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 seeCharacterWearClothes(characterId:str,changeButton:bool): ''' 查看角色穿戴服装列表面板 Keyword arguments: characterId -- 角色id changeButton -- 将服装列表绘制成按钮的开关 ''' EraPrint.p('\n') characterClothingData = CacheContorl.characterData['character'][characterId]['Clothing'] characterPutOnList = CacheContorl.characterData['character'][characterId]['PutOn'] clothingTextData = {} tagTextIndex = 0 for i in range(len(Clothing.clothingTypeTextList.keys())): clothingType = list(Clothing.clothingTypeTextList.keys())[i] clothingId = characterPutOnList[clothingType] if clothingId == '': clothingTextData[clothingType] = 'None' else: clothingData = characterClothingData[clothingType][clothingId] clothingText = Clothing.clothingTypeTextList[clothingType] + ':' + clothingData['Evaluation'] + clothingData['Tag'] + clothingData['Name'] clothingTextData[clothingText] = {} for tag in Clothing.clothingTagTextList: tagText = Clothing.clothingTagTextList[tag] + str(clothingData[tag]) clothingTextData[clothingText][tagText] = 0 nowTagTextIndex = TextHandle.getTextIndex(tagText) if nowTagTextIndex > tagTextIndex: tagTextIndex = nowTagTextIndex longClothingTextIndex = TextHandle.getTextIndex(max(clothingTextData.keys(),key=TextHandle.getTextIndex)) i = 0 inputS = [] for clothingText in clothingTextData: drawText = '' EraPrint.plittleline() if clothingTextData[clothingText] == 'None': drawText = Clothing.clothingTypeTextList[clothingText] + ':' + TextLoading.getTextData(TextLoading.stageWordPath,'117') else: nowClothingTextIndex = TextHandle.getTextIndex(clothingText) drawText += clothingText + ' ' if nowClothingTextIndex < longClothingTextIndex: drawText += ' ' * (longClothingTextIndex - nowClothingTextIndex) for tagText in clothingTextData[clothingText]: nowTagTextIndex = TextHandle.getTextIndex(tagText) if nowTagTextIndex < tagTextIndex: drawText += ' ' + tagText + ' ' * (tagTextIndex - nowTagTextIndex) else: drawText += ' ' + tagText if changeButton: idInfo = CmdButtonQueue.idIndex(i) cmdText = idInfo + drawText PyCmd.pcmd(cmdText,i,None) else: EraPrint.p(drawText) i += 1 inputS.append(str(i)) EraPrint.p('\n') return inputS
def seeCharacterItemPanel(characterId: int) -> list: ''' 查看角色背包道具列表面板 Keyword arguments: characterId -- 角色Id ''' EraPrint.p(AttrText.getSeeAttrPanelHeadCharacterInfo(characterId)) EraPrint.pline('.') if characterId != '0': EraPrint.pl(TextLoading.getTextData(TextLoading.messagePath, '37')) return [] characterItemData = CacheContorl.characterData['character'][ characterId].Item if len(characterItemData) == 0: EraPrint.pl(TextLoading.getTextData(TextLoading.messagePath, '36')) return [] nowPageId = int(CacheContorl.panelState['SeeCharacterItemListPanel']) nowPageMax = GameConfig.see_character_item_max nowPageStartId = nowPageId * nowPageMax nowPageEndId = nowPageStartId + nowPageMax if nowPageEndId > len(characterItemData.keys()): nowPageEndId = len(characterItemData.keys()) inputS = [] index = 0 for i in range(nowPageStartId, nowPageEndId): itemId = list(characterItemData.keys())[i] itemData = characterItemData[itemId] itemText = itemData['ItemName'] + ' ' + TextLoading.getTextData( TextLoading.stageWordPath, '136') + str(itemData['ItemNum']) if characterId == '0': idInfo = CmdButtonQueue.idIndex(index) cmdText = idInfo + drawText PyCmd.pcmd(cmdText, index, None) else: EraPrint.p(drawText) index += 1 inputS.append(str(index)) EraPrint.p('\n') return inputS
def seeCharacterClothesPanel(characterId: str, clothingType: str, maxPage: int): ''' 用于查看角色服装列表的面板 Keyword arguments: characterId -- 角色id clothingType -- 服装类型 maxPage -- 服装列表最大页数 ''' EraPrint.p('\n') characterClothingData = CacheContorl.characterData['character'][ characterId].Clothing[clothingType] characterPutOnList = CacheContorl.characterData['character'][ characterId].PutOn clothingTextData = {} tagTextIndex = 0 nowPageId = int(CacheContorl.panelState["SeeCharacterClothesPanel"]) nowPageMax = GameConfig.see_character_clothes_max nowPageStartId = nowPageId * nowPageMax nowPageEndId = nowPageStartId + nowPageMax if characterClothingData == {}: EraPrint.p(TextLoading.getTextData(TextLoading.messagePath, '34')) EraPrint.p('\n') return [] if nowPageEndId > len(characterClothingData.keys()): nowPageEndId = len(characterClothingData.keys()) passId = None for i in range(nowPageStartId, nowPageEndId): clothingId = list(characterClothingData.keys())[i] if clothingId == CacheContorl.characterData['character'][ characterId].PutOn[clothingType]: passId = i - nowPageStartId clothingData = characterClothingData[clothingId] clothingText = clothingData['Evaluation'] + clothingData[ 'Tag'] + clothingData['Name'] clothingTextData[clothingText] = {} for tag in Clothing.clothingTagTextList: tagText = Clothing.clothingTagTextList[tag] + str( clothingData[tag]) clothingTextData[clothingText][tagText] = 0 nowTagTextIndex = TextHandle.getTextIndex(tagText) if nowTagTextIndex == nowTagTextIndex: tagTextIndex = nowTagTextIndex longClothingTextIndex = TextHandle.getTextIndex( max(clothingTextData.keys(), key=TextHandle.getTextIndex)) i = 0 inputS = [] for clothingText in clothingTextData: drawText = '' EraPrint.plittleline() nowClothingTextIndex = TextHandle.getTextIndex(clothingText) drawText += clothingText + ' ' if nowClothingTextIndex < longClothingTextIndex: drawText += ' ' * (longClothingTextIndex - nowClothingTextIndex) for tagText in clothingTextData[clothingText]: nowTagTextIndex = TextHandle.getTextIndex(tagText) if nowTagTextIndex < tagTextIndex: drawText += ' ' + tagText + ' ' * (tagTextIndex - nowTagTextIndex) else: drawText += ' ' + tagText if i == passId: drawText += ' ' + TextLoading.getTextData( TextLoading.stageWordPath, '125') idInfo = CmdButtonQueue.idIndex(i) cmdText = idInfo + drawText inputS.append(f'{i}') PyCmd.pcmd(cmdText, i, None) i += 1 EraPrint.p('\n') pageText = '(' + str(nowPageId) + '/' + str(maxPage) + ')' EraPrint.printPageLine(sample='-', string=pageText) EraPrint.p('\n') return inputS
def seeSaveListPanel(pageSaveValue: int, lastSavePageValue: int, autoSave=False) -> list: ''' 查看存档页面面板 Keyword arguments: pageSaveValue -- 单页最大存档显示数量 lastSavePageValue -- 最后一页存档显示数量 autoSave -- 自动存档显示开关 (default False) ''' savePanelPage = int(CacheContorl.panelState['SeeSaveListPanel']) + 1 inputS = [] idTextList = [] idInfoText = TextLoading.getTextData(TextLoading.stageWordPath, '72') textWidth = int(GameConfig.text_width) saveNoneText = TextLoading.getTextData(TextLoading.messagePath, '20') if savePanelPage == int(GameConfig.save_page) + 1: startSaveId = int(pageSaveValue) * (savePanelPage - 1) overSaveId = startSaveId + lastSavePageValue else: overSaveId = int(pageSaveValue) * savePanelPage startSaveId = overSaveId - int(pageSaveValue) for i in range(0, overSaveId - startSaveId): id = CmdButtonQueue.idIndex(i) saveId = startSaveId + i if autoSave == True and SaveHandle.judgeSaveFileExist(saveId) != '1': idText = idInfoText + " " + str(saveId) + ":" idTextList.append(idText) else: idText = id + idInfoText + " " + str(saveId) + ":" idTextList.append(idText) for i in range(0, overSaveId - startSaveId): id = str(i) idText = idTextList[i] EraPrint.plittleline() saveId = SaveHandle.getSavePageSaveId(pageSaveValue, i) if SaveHandle.judgeSaveFileExist(saveId) == '1': saveInfoHead = SaveHandle.loadSaveInfoHead(saveId) gameTimeData = saveInfoHead['gameTime'] gameTimeText = GameTime.getDateText(gameTimeData) characterName = saveInfoHead['characterName'] saveVerson = saveInfoHead['gameVerson'] saveText = characterName + ' ' + gameTimeText + ' ' + saveVerson idTextIndex = int(TextHandle.getTextIndex(idText)) fixIdWidth = textWidth - idTextIndex saveAlign = TextHandle.align(saveText, 'center', textWidth=fixIdWidth) idText = idText + saveAlign PyCmd.pcmd(idText, id, None) EraPrint.p('\n') inputS.append(id) else: idTextIndex = int(TextHandle.getTextIndex(idText)) fixIdWidth = textWidth - idTextIndex saveNoneAlign = TextHandle.align(saveNoneText, 'center', textWidth=fixIdWidth) idText = idText + saveNoneAlign if autoSave == True: EraPrint.p(idText) EraPrint.p('\n') else: PyCmd.pcmd(idText, id, None) inputS.append(id) EraPrint.p('\n') if autoSave == True: autoInfoText = TextLoading.getTextData(TextLoading.stageWordPath, "73") i = pageSaveValue id = CmdButtonQueue.idIndex(i) EraPrint.plittleline() if SaveHandle.judgeSaveFileExist('auto') == '1': saveInfoHead = SaveHandle.loadSaveInfoHead('auto') gameTimeData = saveInfoHead['gameTime'] gameTimeText = GameTime.getDateText(gameTimeData) characterName = saveInfoHead['characterName'] saveVerson = saveInfoHead['gameVerson'] saveText = characterName + ' ' + gameTimeText + ' ' + saveVerson idText = id + autoInfoText idTextIndex = int(TextHandle.getTextIndex(idText)) fixIdWidth = textWidth - idTextIndex saveTextAlign = TextHandle.align(saveText, 'center', textWidth=fixIdWidth) idText = idText + saveTextAlign PyCmd.pcmd(idText, id, None) inputS.append(id) EraPrint.p('\n') else: idTextIndex = int(TextHandle.getTextIndex(autoInfoText)) fixIdWidth = textWidth - idTextIndex saveNoneAlign = TextHandle.align(saveNoneText, 'center', textWidth=fixIdWidth) idText = autoInfoText + saveNoneAlign EraPrint.p(idText) EraPrint.p('\n') return inputS