示例#1
0
文件: play.py 项目: sakuracandy/pyera
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)
示例#2
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))
示例#3
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()
示例#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()
示例#5
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))
示例#6
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)
示例#7
0
文件: group.py 项目: Mahayu/pyera
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()
示例#8
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()
示例#9
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()
示例#10
0
文件: play_cfg.py 项目: Mahayu/pyera
def change_target_group():
    def change_group(group):
        game.data['试炼设置']['试炼队伍'] = group
        game.pl('试炼队伍已改为:' + group['队伍名称'])
        play_config()

    game.clr_cmd()
    game.pl('请选择试炼队伍:')
    script.group.display_group_list(change_group)
    game.pcmd('[001] 取消', 1, play_config)
    game.askfor_order()
示例#11
0
文件: play_cfg.py 项目: Mahayu/pyera
def change_target_world():
    def change_world(world):
        game.data['试炼设置']['试炼世界'] = world
        game.pl('试炼世界已改为:' + world['世界名称'])
        play_config()

    game.clr_cmd()
    game.pl('请选择试炼世界:')
    script.world.display_world_list(change_world)
    game.pcmd('[001] 取消', 1, play_config)
    game.askfor_order()
示例#12
0
文件: play_cfg.py 项目: Mahayu/pyera
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()
示例#13
0
def create_world():
    game.clr_cmd()
    string = '----------------------------------' + '可选世界' + '---------------------------------------------'
    game.pl(string, style='title')
    string = game.align('创造编号', 15) + game.align('世界类型', 15) + game.align('剧情容量', 15) + game.align('构建点数', 15)
    game.pl(string)

    numid = 0
    for w in game.data['世界']:
        id = '[{:0>3}]'.format(numid)
        string = game.align(id, 15) + game.align(w['世界名称'], 15) + game.align(w['剧情容量'], 15) + game.align(w['构建点数'], 15)
        game.pcmd(string + '\n', numid, _create_world, arg=(numid,))
        numid += 1
    game.askfor_order()
示例#14
0
文件: group.py 项目: Mahayu/pyera
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()
示例#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)
示例#16
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)
示例#17
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()