Exemplo n.º 1
0
def save_func(return_func=None):
    game.clr_cmd()
    if return_func == None:
        return_func = script.mainflow.main_func
    game.pline()
    game.pl('游戏存储目录:' + game.savedir)
    game.pl()

    def savehere(save_file_name):
        game.pl('save: ' + save_file_path)
        game.save(save_file_name)
        save_func(return_func)

    for i in range(0, 11):
        save_file_name = 'save' + str(i)
        save_file_path = game.savedir + '\\' + save_file_name + '.save'

        # 此处修改显示信息
        if os.path.exists(save_file_path):
            file_str = '[{:0>2}]'.format(i) + "  " + save_file_path
        else:
            file_str = '[{:0>2}]'.format(i) + "  ----"
        game.pcmd(file_str, i, savehere, arg=(save_file_name, ))
        game.pl()
    game.pl()
    game.pcmd('[99] 返回', 99, return_func)
    game.askfor_order()
Exemplo n.º 2
0
def main_func():
    game.clr_cmd()
    game.pl()
    game.pline()
    game.pl('主神名称:' + game.data['主神名称'])
    import script.play_cfg
    script.play_cfg.display_traget()
    game.pline('--')

    import script.play
    game.pcmd('[101]  开始试炼', 101, script.play.init_play)
    game.p('    ')
    import script.play_cfg
    game.pcmd('[102]  试炼设置', 102, script.play_cfg.play_config)
    game.pl()
    import script.people
    game.pcmd('[103]  人物管理', 103, script.people.people_manager)
    game.p('    ')
    import script.group
    game.pcmd('[104]  队伍管理', 104, script.group.group_manager)
    game.p('    ')
    import script.world
    game.pcmd('[105]  世界管理', 105, script.world.world_manager)
    game.pl()
    game.pcmd('[111]  保存游戏', 111, lib.save_func, arg=(main_func, ))
    game.p('    ')
    game.pcmd('[112]  读取游戏', 112, lib.load_func, arg=(main_func, main_func))
Exemplo n.º 3
0
def main_play():
    global tgroup, tworld, tscene
    game.clr_cmd()
    game.pline()
    string = game.align('剧情进度:', 14) + lib.value_bar(tworld.当前进度,
                                                     tworld.data['剧情容量'])
    string += game.align('下一剧情:' + tscene.名称, 30, 'right')
    game.pl(string)
    for p in tgroup.所有人物:
        prefix = p.姓名 + '|体力:'
        prefix = game.align(prefix, 14)
        game.pl(prefix + lib.value_bar(p.当前体力, p.体力上限))

    string = '----------------------------------' + '设置剧情 ' + ': ' + tscene.名称 + ' --------------------------------'
    game.pl(string, style='title')
    game.call_event('设置剧情_' + tscene.名称, arg=(tscene.data, ))
    string = '---------------------------------------------------------------------------------------'
    game.pl(string, style='title')

    def begin_scene():
        global tscene
        game.call_event('进行剧情_' + tworld.当前剧情['名称'],
                        arg=(tgroup, tworld, tscene))
        tworld.下一剧情()
        if tworld.当前进度 <= tworld.data['剧情容量']:
            tscene = Target_scene(tworld.当前剧情)
        main_play()

    if tworld.当前进度 <= tworld.data['剧情容量']:
        game.pcmd('[100] 开始剧情', 100, begin_scene)
    else:
        game.p('[100] 开始剧情', style='grey')
    game.pl()
    game.pcmd('[999] 结束试炼', 999, main_func)
Exemplo n.º 4
0
def load_func(return_func=None):
    game.clr_cmd()
    if return_func == None:
        return_func = script.mainflow.main_func
    game.pl('读取游戏:' + game.savedir)
    game.pline()

    def loadhere(load_file_name):
        game.pl('load: ' + load_file_name)
        game.load(load_file_name)
        script.mainflow.main_func()

    def loadnodata(load_file_name):
        game.pl(load_file_name + ": 没有数据")
        game.askfor_order(print_order=False)

    for i in range(0, 11):
        load_file_name = 'save' + str(i)
        load_file_path = game.savedir + '\\' + load_file_name + '.save'

        # 此处修改显示信息
        if os.path.exists(load_file_path):
            file_str = '[{:0>2}]'.format(i) + "  " + load_file_path
            game.pcmd(file_str, i, loadhere, arg=(load_file_name, ))
        else:
            file_str = '[{:0>2}]'.format(i) + "  ----"
            game.pcmd(file_str, i, loadnodata, arg=(load_file_name, ))
        game.pl()
    game.pl()
    game.pcmd('[99] 返回', 99, return_func)
    game.askfor_order()
Exemplo n.º 5
0
def load_func(return_func, next_func):
    game.clr_cmd()
    game.pl('读取游戏:' + game.savedir)
    game.pline()

    def loadhere(load_file_name):
        game.pl('load: ' + load_file_name)
        game.load(load_file_name)
        next_func()

    def loadnodata(load_file_name):
        game.pl(load_file_name + ": 没有数据")

    for i in range(0, 11):
        load_file_name = 'save' + str(i)
        load_file_path = game.savedir + '\\' + load_file_name + '.save'

        # 此处修改显示信息
        if os.path.exists(load_file_path):
            file_str = '[{:0>2}]'.format(i) + "  " + load_file_path
            game.pcmd(file_str, i, loadhere, arg=(load_file_name, ))
        else:
            file_str = '[{:0>2}]'.format(i) + "  ----"
            game.pcmd(file_str, i, loadnodata, arg=(load_file_name, ))
        game.pl()
    game.pl()
    game.pcmd('[99] 返回', 99, return_func)
Exemplo n.º 6
0
def people_manager():
    game.clr_cmd()
    game.pline()
    dispaly_people_list(askfor_order_atend=False)
    game.pcmd('[001]  召唤人物', 1, summon_people)
    game.pl()
    game.pcmd('[099]  退出管理', 99, script.mainflow.main_func)
    game.askfor_order()
Exemplo n.º 7
0
def world_manager():
    game.clr_cmd()
    game.pline()
    display_world_list()
    game.pcmd('[001]  创造世界', 1, create_world)
    game.pl()
    game.pcmd('[099]  退出管理', 99, main_func)
    game.askfor_order()
Exemplo n.º 8
0
def group_manager():
    game.clr_cmd()
    game.pline()
    display_group_list()
    game.pcmd('[001]  新建队伍', 1, create_group)
    game.pl()
    game.pcmd('[099]  退出管理', 99, main_func)
    game.askfor_order()
Exemplo n.º 9
0
def open_func():
    game.pl('pyera贪吃蛇游戏加载中')
    map_size = game.data['map']['map_size']
    game.pl('地图大小设置为 ' + str(map_size))
    game.pline()

    game.pcmd('[001]  读取游戏', 1, lib.load_func, arg=(open_func, main_func))
    game.pl()
    game.pcmd('[002]  开始游戏', 2, newgame_func)
Exemplo n.º 10
0
def play_config():
    game.clr_cmd()
    game.pline()
    display_traget()
    game.pline('--')

    game.pcmd('[001]  改变试炼队伍', 1, change_target_group)
    game.p('    ')
    game.pcmd('[002]  改变试炼世界', 2, change_target_world)
    game.pl()
    game.pcmd('[099]  退出管理', 99, main_func)
    game.askfor_order()
Exemplo n.º 11
0
def display_people(people):
    def print_title(title):
        string = '□' + title + '□' + '-------------------------------------------------------------------------------'
        game.pl(string, style='title')

    def print_numattr(node, attrs, display_room, pre_fix=' '):
        string = ''
        for attr in attrs:
            temp = attr + ':' + pre_fix + str(node[attr]) + '  '
            string += game.align(temp, display_room)
        game.pl(string)

    def print_talent(node, attrs, pre_fix=' '):
        for attr in attrs:
            temp_value = ['[' + iter_var + ']' for iter_var in node[attr]]
            temp = attr + ':' + pre_fix + ''.join(temp_value)
            game.pl(temp)

    game.pline()
    game.pl('姓名:' + people['姓名'])

    print_title('属性')
    attrs = ["体力上限", "物资补给", "神秘能源", "认同程度", "因果点数", "因果碎片"]
    print_numattr(people['属性'], attrs, 15)

    print_title('经验')
    attrs = ["近战经验", "远战经验", "科技经验", "神秘经验"]
    print_numattr(people['经验'], attrs, 15)

    print_title('能力')
    attrs = ['见闻', '社交', '科技', '神秘']
    print_numattr(people['能力'], attrs, 15)
    attrs = ['近战', '远战', '基因锁']
    print_numattr(people['能力'], attrs, 15)

    print_title('刻印')
    attrs = people['刻印'].keys()
    print_numattr(people['刻印'], attrs, 15, ' LV')

    print_title('素质')
    attrs = ['性征', '性格', '倾向', '技能', '体质', '天赋']
    print_talent(people['素质'], attrs)

    print_title('背景')
    attrs = ['职业']
    print_talent(people['背景'], attrs)

    print_title('装备')
    attrs = ['装备一', '装备二']
    print_numattr(people['装备'], attrs, 30)
    attrs = ['装备三', '装备四']
    print_numattr(people['装备'], attrs, 30)
Exemplo n.º 12
0
def newgame_func():
    game.pl()
    game.pline()
    game.pl('请输入主神名称:')
    name = game.askfor_str()
    game.data['主神名称'] = name
    game.pl('主神名称为:' + str(name))
    game.pl('是否接受?')
    ans = lib.yes_or_no()
    if ans == True:
        main_func()
    if ans == False:
        newgame_func()
Exemplo n.º 13
0
def group_control(g):
    import script.people
    game.clr_cmd()
    game.pline()
    string = '----------------------------------' + '队伍配置' + '---------------------------------------------'
    game.pl(string, style='title')
    string = '队伍名称:  ' + g['队伍名称']
    game.pl(string)
    for i in range(0, 6):

        def add_people_here(people, i=i):
            clean_people(people)
            add_people_to_group(g, people, i)
            group_control(g)

        def cancel_people_here(i=i):
            g['队伍队员'][i] = {}
            group_control(g)

        num_cmd = (i + 1) * 10

        game.pcmd('[0' + str(i + 1) + '1]设置',
                  num_cmd + 1,
                  script.people.dispaly_people_list,
                  arg=add_people_here)
        game.p('   ')
        game.pcmd('[0' + str(i + 1) + '2]清空', num_cmd + 2, cancel_people_here)
        string = '     队员 ' + str(i + 1) + ':  '
        if g['队伍队员'][i] == {}:
            string += '无'
        else:
            string += g['队伍队员'][i]['姓名']
        game.p(string + '\n')
    string = '---------------------------------------------------------------------------------------'
    game.pl(string, style='title')

    def add_people(people):
        clean_people(people)
        add_people_to_group(g, people)
        group_control(g)

    game.pcmd('[001]  添加队员',
              1,
              script.people.dispaly_people_list,
              arg=add_people)
    game.pl()
    game.pcmd('[099]  返回列表', 99, group_manager)
    game.askfor_order()
Exemplo n.º 14
0
def open_func(*args):
    game.pline()
    game.pl('pyera 启动中,准备游戏')
    game.def_style('notice', foreground='#DCE441')
    game.def_style('title', foreground='#E1FFFF')
    if not '人物列表' in game.data:
        game.data['人物列表'] = []
    if not '世界列表' in game.data:
        game.data['世界列表'] = []
    if not '队伍列表' in game.data:
        game.data['队伍列表'] = []
    import script.play_cfg
    script.play_cfg.init()
    game.pl(f'pyera 启动中,准备完成')
    test()
    open_menu()
Exemplo n.º 15
0
def open_menu():
    # game.pline()
    # game.pcmd('[001]  开始游戏', 1, newgame_func)
    # game.pl()
    # game.pcmd('[002]  读取游戏', 2, saveload.load_func, arg=(open_menu,))
    # game.askfor_order()
    game.clr_cmd()
    game.pline()
    game.pcmd('[001]  开始游戏', 1)
    game.pl()
    game.pcmd('[002]  读取游戏', 2)

    @game.set_deal_cmd_func_deco
    def deal_func(order):
        if order == 1:
            newgame_func()
        if order == 2:
            lib.load_func(open_menu, main_func)
Exemplo n.º 16
0
def main_func():
    # 新界面准备
    game.clr_cmd()
    game.pline()

    # 画图
    draw_map()

    def create_func(direction_name):
        def func():
            global direction
            direction = direction_name
            next_step()

        return func

    # 状态显示
    game.pline('--')
    game.pl('分数:')

    # 绘制命令按钮
    game.pline('--')
    game.pcmd('[1] 左  ', 1, create_func('zuo'))
    game.pcmd('[2] 上  ', 2, create_func('shang'))
    game.pcmd('[3] 右  ', 3, create_func('you'))
    game.pl()
    game.p('        ')
    game.pcmd('[4] 下  ', 4, create_func('xia'))
    game.pl('\n')
    game.pcmd('[5] 存储游戏  ', 5, lib.save_func, arg=main_func)
    game.pcmd('[6] 读取游戏  ', 6, lib.load_func, arg=(main_func, main_func))
Exemplo n.º 17
0
def display_world(w):
    game.clr_cmd()
    game.pline()
    game.set_default_flow(display_world, arg=(w,))
    string = '----------------------------------' + '设置世界' + '---------------------------------------------'
    game.pl(string, style='title')
    string = game.align('ID', 4) + game.align('世界类型', 15) + game.align('剧情容量', 15) + game.align('构建点数', 15)
    game.pl(string)
    string = game.align(w['ID'], 4) + game.align(w['世界名称'], 15) \
             + game.align(w['剧情容量'], 15) + game.align(w['构建点数'], 15)
    game.pl(string)
    game.pl('------------------------------------')
    game.call_event('设置世界_' + w['世界名称'], arg=(w,))

    for scene_num in range(0, w['剧情容量']):
        s = w['剧情列表'][scene_num]
        string = '----------------------------------' + '设置剧情 ' + str(scene_num) + ' :' + s[
            '名称'] + ' --------------------------------'
        game.pl(string, style='title')
        game.call_event('设置剧情_' + s['名称'], arg=(s,))

    string = '---------------------------------------------------------------------------------------'
    game.pl(string, style='title')
    game.pcmd('[099]  退出管理', 99, world_manager)
Exemplo n.º 18
0
def main_play():
    global tgroup, tworld, tscene
    game.clr_cmd()
    game.pline()
    string = '剧情容量:' + lib.value_bar(tworld.当前进度, tworld.data['剧情容量'])
    string += game.align('  下一剧情:' + tscene.名称, 40, 'right')
    game.pl(string)
    for p in tgroup.peoplelist:
        prefix = '人物体力(' + p.姓名 + '):'
        prefix = game.align(prefix, 20)
        game.pl(prefix + lib.value_bar(p.当前体力, p.体力上限))
    game.pline('--', 'notice')

    def begin_scene():
        game.call_event('进行剧情_' + tworld.当前剧情['名称'],
                        arg=(tgroup, tworld, tscene))
        main_play()

    game.pcmd('[100] 开始剧情', 100, begin_scene)
    game.pl()
    game.pcmd('[101] 调整剧情', 101, lambda: "break")
    game.pl()
    game.pcmd('[999] 结束试炼', 999, main_func)
    game.askfor_order()