def dispaly_people_list(func=None, askfor_order_atend=True): def display_people_here(people): display_people(people) game.plwait() people_manager() if func == None: func = display_people_here string = '----------------------------------' + '人物列表' + '---------------------------------------------' game.pl(string, style='title') string = game.align('ID', 4) + game.align('姓名', 15) + game.align('体力上限', 8) + '/ ' + \ game.align('物资补给', 8) + '/ ' + game.align('神秘能源', 8) game.pl(string) for stu in game.data['人物列表']: string = game.align('[' + str(stu['ID']) + ']', 4) + game.align(stu['姓名'], 15) + \ game.align(stu['属性']['体力上限'], 8, just='right') + '/ ' + \ game.align(stu['属性']['物资补给'], 8, just='right') + '/ ' + \ game.align(stu['属性']['神秘能源'], 8, just='right') + '\n' game.pcmd(string, stu['ID'], func, arg=(stu, )) string = '---------------------------------------------------------------------------------------' game.pl(string, style='title') if askfor_order_atend == True: game.askfor_order()
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)
def display_group_list(func=None): if func == None: func = group_control string = '----------------------------------' + '队伍列表' + '---------------------------------------------' game.pl(string, style='title') string = game.align('队伍编号', 15) + game.align('队伍名称', 15) + game.align( '队伍队员', 15) game.pl(string) def display_memebr_of_groups(agroup): string = '' for i in range(0, 6): if agroup['队伍队员'][i] != {}: string = string + agroup['队伍队员'][i]['姓名'] + '|' if string == '': string = '暂无队员' return string numid = 101 for g in game.data['队伍列表']: id = '[{:0>3}]'.format(numid) string = game.align(id, 15) + game.align( g['队伍名称'], 15) + display_memebr_of_groups(g) game.pcmd(string + '\n', numid, func, arg=(g, )) numid += 1 string = '---------------------------------------------------------------------------------------' game.pl(string, style='title')
def display_traget(): target_group = game.data['试炼设置']['试炼队伍'] target_world = game.data['试炼设置']['试炼世界'] string = '试炼队伍:' if target_group == None: string = string + game.align('未设定', 12) else: string = string + game.align( target_group['队伍名称'] + '(编号:{})'.format(target_group['ID']), 30) string = string + '试炼世界:' if target_world == None: string = string + game.align('未设定', 12) else: string = string + target_world['世界名称'] + '(编号:{})'.format( target_world['ID']) game.pl(string)
def display_world_list(func=None): string = '----------------------------------' + '现有世界' + '---------------------------------------------' game.pl(string, style='title') string = game.align('ID', 4) + game.align('世界类型', 15) + game.align('剧情容量', 15) + game.align('构建点数', 15) game.pl(string) for w in game.data['世界列表']: string = game.align(w['ID'], 4) + game.align(w['世界名称'], 15) \ + game.align(w['剧情容量'], 15) + game.align(w['构建点数'], 15) if func == None: func = display_world # game.pl(string) game.pcmd(string + '\n', w['ID'], func, arg=(w,)) string = '---------------------------------------------------------------------------------------' game.pl(string, style='title')
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()
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()
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)
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)