def seeCharacterListPanel(maxPage): titleText = TextLoading.getTextData(TextLoading.stageWordPath,'74') EraPrint.plt(titleText) inputS = [] pageId = int(CacheContorl.panelState['SeeCharacterListPanel']) pageShow = int(GameConfig.characterlist_show) maxPage = int(maxPage) characterMax = CharacterHandle.getCharacterIndexMax() if pageId == maxPage: showPageStart = pageShow * pageId showPageOver = showPageStart + (characterMax + 1 - showPageStart) else: showPageOver = pageShow * (pageId + 1) showPageStart = showPageOver - pageShow for i in range(showPageStart,showPageOver): characterId = str(i) cmdId = i - showPageStart cmdIdText = CmdButtonQueue.idIndex(cmdId) cmdText = AttrText.getCharacterAbbreviationsInfo(characterId) cmdIdTextIndex = TextHandle.getTextIndex(cmdIdText) windowWidth = int(GameConfig.text_width) textWidth = windowWidth - cmdIdTextIndex cmdText = TextHandle.align(cmdText,'center',textWidth=textWidth) cmdText = cmdIdText + ' ' + cmdText cmdId = str(cmdId) EraPrint.plittleline() PyCmd.pcmd(cmdText, cmdId, None) inputS.append(cmdId) EraPrint.p('\n') pageText = '(' + str(pageId) + '/' + str(maxPage) + ')' EraPrint.printPageLine(sample = '-',string = pageText) EraPrint.p('\n') return inputS
def changeSceneCharacterListPanel(): nameListMax = int(GameConfig.in_scene_see_player_max) nowPage = int(CacheContorl.panelState['SeeSceneCharacterListPanel']) characterMax = CharacterHandle.getCharacterIndexMax() pageMax = math.floor(characterMax / nameListMax) pageText = '(' + str(nowPage) + '/' + str(pageMax) + ')' EraPrint.printPageLine(sample = '-',string = pageText)
def getCharacterListPageMax(): characterMax = CharacterHandle.getCharacterIndexMax() if characterMax - characterPageShow < 0: return 0 elif characterMax % characterPageShow == 0: return characterMax / characterPageShow - 1 else: return int(characterMax / characterPageShow)
def jumpCharacterListPagePanel() -> str: ''' 角色列表页面跳转控制面板 ''' messageText = TextLoading.getTextData(TextLoading.messagePath, '32') nameListMax = int(GameConfig.in_scene_see_player_max) characterMax = CharacterHandle.getCharacterIndexMax() pageMax = math.floor(characterMax / nameListMax) EraPrint.p('\n' + messageText + '(0-' + str(pageMax) + ')') ans = InputQueue.waitInput(0, pageMax) EraPrint.p(ans) return ans
def seeScene_func(judge: bool): ''' 用于查看当前场景界面的流程 Keyword argument: judge -- 判断是否绘制角色列表界面的开关 ''' while (True): inputS = [] InScenePanel.seeScenePanel() scenePath = CacheContorl.characterData['character']['0']['Position'] scenePathStr = MapHandle.getMapSystemPathStrForList(scenePath) sceneCharacterNameList = MapHandle.getSceneCharacterNameList( scenePathStr) nameListMax = int(GameConfig.in_scene_see_player_max) changePageJudge = False if len(sceneCharacterNameList) == 1: CacheContorl.characterData['characterId'] = '0' inSceneCmdList1 = [] if judge: if CacheContorl.panelState['SeeSceneCharacterListPage'] == '0': inputS = inputS + InScenePanel.seeSceneCharacterListPanel() if len(sceneCharacterNameList) > nameListMax: inSceneCmdList1 = InScenePanel.changeSceneCharacterListPanel( ) changePageJudge = True inputS.append('SeeSceneCharacterListPage') startId1 = len(inSceneCmdList1) InScenePanel.seeCharacterInfoPanel() inSceneCmdList2 = InScenePanel.inSceneButtonPanel(startId1) if changePageJudge: inputS += inSceneCmdList1 + inSceneCmdList2 else: inputS += inSceneCmdList2 yrn = GameInit.askfor_All(inputS) PyCmd.clr_cmd() nowPage = int(CacheContorl.panelState['SeeSceneCharacterListPanel']) characterMax = CharacterHandle.getCharacterIndexMax() - 1 pageMax = math.floor(characterMax / nameListMax) if yrn in sceneCharacterNameList: CacheContorl.characterData[ 'characterId'] = MapHandle.getCharacterIdByCharacterName( yrn, scenePathStr) elif judge and yrn not in inSceneCmdList2 and yrn != 'SeeSceneCharacterListPage' and changePageJudge: if yrn == inSceneCmdList1[0]: CacheContorl.panelState['SeeSceneCharacterListPanel'] = 0 elif yrn == inSceneCmdList1[1]: if int(nowPage) == 0: CacheContorl.panelState[ 'SeeSceneCharacterListPanel'] = pageMax else: CacheContorl.panelState[ 'SeeSceneCharacterListPanel'] = int(nowPage) - 1 elif yrn == inSceneCmdList1[2]: CacheContorl.panelState[ 'SeeSceneCharacterListPanel'] = InScenePanel.jumpCharacterListPagePanel( ) elif yrn == inSceneCmdList1[3]: if int(nowPage) == pageMax: CacheContorl.panelState['SeeSceneCharacterListPanel'] = 0 else: CacheContorl.panelState[ 'SeeSceneCharacterListPanel'] = int(nowPage) + 1 elif yrn == inSceneCmdList1[4]: CacheContorl.panelState['SeeSceneCharacterListPanel'] = pageMax elif yrn == inSceneCmdList2[0]: CacheContorl.nowFlowId = 'see_map' nowMap = MapHandle.getMapForPath( CacheContorl.characterData['character']['0']['Position']) CacheContorl.nowMap = nowMap break elif yrn in [inSceneCmdList2[1], inSceneCmdList2[2]]: if yrn == inSceneCmdList2[2]: CacheContorl.oldCharacterId = CacheContorl.characterData[ 'characterId'] CacheContorl.characterData['characterId'] = '0' CacheContorl.nowFlowId = 'see_character_attr' CacheContorl.oldFlowId = 'in_scene' break elif yrn == 'SeeSceneCharacterListPage': PanelStateHandle.panelStateChange(yrn)