def acknowledgmentAttributeAns(inputList): characterId = CacheContorl.characterData['characterId'] yrn = GameInit.askfor_All(inputList) showAttrHandleData = TextLoading.getTextData(TextLoading.cmdPath, 'seeAttrPanelHandle') PyCmd.clr_cmd() if yrn in panelList: PanelStateHandle.panelStateChange(yrn) acknowledgmentAttribute_func() elif yrn == '0': GameTime.initTime() AttrCalculation.setAttrOver(characterId) CharacterHandle.initCharacterList() SeeCharacterAttrPanel.initShowAttrPanelList() characterPosition = CacheContorl.characterData['character'][ characterId]['Position'] MapHandle.characterMoveScene(['0'], characterPosition, characterId) from script.Flow import Main Main.mainFrame_func() elif yrn == '1': CacheContorl.wframeMouse['wFrameRePrint'] = 1 EraPrint.pnextscreen() SeeCharacterAttrPanel.initShowAttrPanelList() from script.Design import StartFlow StartFlow.main_func() elif yrn in showAttrHandleData: index = showAttrHandleData.index(yrn) index = str(index) CacheContorl.panelState['AttrShowHandlePanel'] = index acknowledgmentAttribute_func()
def acknowledgmentAttribute_func(): ''' 创建角色时用于查看角色属性的流程 ''' while (True): characterId = CacheContorl.characterData['characterId'] CharacterHandle.initCharacterList() inputS = [] seeAttrInEveryTime_func() flowReturn = SeeCharacterAttrPanel.inputAttrOverPanel() inputS = flowReturn + inputS characterId = CacheContorl.characterData['characterId'] yrn = GameInit.askfor_All(inputS) showAttrHandleData = TextLoading.getTextData(TextLoading.cmdPath, 'seeAttrPanelHandle') PyCmd.clr_cmd() if yrn in panelList: PanelStateHandle.panelStateChange(yrn) elif yrn == '0': GameStartFlow.initGameStart() break elif yrn == '1': CacheContorl.wframeMouse['wFrameRePrint'] = 1 EraPrint.pnextscreen() CacheContorl.nowFlowId = 'title_frame' break elif yrn in showAttrHandleData: CacheContorl.panelState['AttrShowHandlePanel'] = str( showAttrHandleData.index(yrn))
def initGameStart(): ''' 用于结束角色创建正式开始游戏的初始化流程 ''' CharacterHandle.initCharacterDormitory() CharacterHandle.initCharacterPosition() Course.initPhaseCourseHour() Interest.initCharacterInterest() Course.initCharacterKnowledge() Course.initClassTeacher() Course.initClassTimeTable() characterPosition = CacheContorl.characterData['character'][0].Position MapHandle.characterMoveScene(['0'],characterPosition,0) CacheContorl.nowFlowId = 'main'
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 inputLoadSave(saveId:str): ''' 载入存档存档id对应数据,覆盖当前游戏内存 Keyword arguments: saveId -- 存档id ''' saveData = loadSave(saveId) CacheContorl.characterData = saveData['1'] CacheContorl.characterData['characterId'] = '0' CacheContorl.gameTime = saveData['2'] CacheContorl.sceneData = saveData['3'] CacheContorl.mapData = saveData['4'] CacheContorl.npcTemData = saveData['5'] CacheContorl.randomNpcList = saveData['6'] CacheContorl.occupationCharacterData = saveData['7'] CharacterHandle.initCharacterPosition()
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 initGameStart(): ''' 用于结束角色创建正式开始游戏的初始化流程 ''' GameTime.initTime() AttrCalculation.setAttrOver('0') Course.initPhaseCourseHour() CharacterHandle.initCharacterList() Interest.initCharacterInterest() Course.initCharacterKnowledge() Course.initClassTeacher() Course.initClassTimeTable() SeeCharacterAttrPanel.initShowAttrPanelList() characterPosition = CacheContorl.characterData['character']['0'][ 'Position'] MapHandle.characterMoveScene(['0'], characterPosition, '0') CacheContorl.nowFlowId = 'main'
def initCharacterBehavior(): ''' 角色行为树总控制 ''' npcList = CharacterHandle.getCharacterIdList() npcList.remove('0') for npc in npcList: characterOccupationJudge(npc)
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 inputLoadSave(saveId: str): ''' 载入存档存档id对应数据,覆盖当前游戏内存 Keyword arguments: saveId -- 存档id ''' saveData = loadSave(saveId) CacheContorl.characterData = saveData['1'] CacheContorl.characterData['characterId'] = 0 CacheContorl.gameTime = saveData['2'] CacheContorl.sceneData = saveData['3'] CacheContorl.mapData = saveData['4'] CacheContorl.npcTemData = saveData['5'] CacheContorl.randomNpcList = saveData['6'] CacheContorl.occupationCharacterData = saveData['7'] CacheContorl.TotalBodyFatByage = saveData['8'] CacheContorl.AverageBodyFatByage = saveData['9'] CacheContorl.TotalNumberOfPeopleOfAllAges = saveData['10'] CacheContorl.TotalHeightByage = saveData['11'] CacheContorl.AverageHeightByage = saveData['12'] CharacterHandle.initCharacterPosition()
def initGameStart(): ''' 用于结束角色创建正式开始游戏的初始化流程 ''' GameTime.initTime() AttrCalculation.setAttrOver('0') Course.initPhaseCourseHour() CharacterHandle.initCharacterList() characterSuit = Clothing.creatorSuit( 'Uniform', CacheContorl.characterData['character']['0']['Sex']) for clothing in characterSuit: CacheContorl.characterData['character']['0']['Clothing'][clothing][ uuid.uuid1()] = characterSuit[clothing] Clothing.characterPutOnClothing('0') Interest.initCharacterInterest() Course.initCharacterKnowledge() Course.initClassTeacher() Course.initClassTimeTable() SeeCharacterAttrPanel.initShowAttrPanelList() characterPosition = CacheContorl.characterData['character']['0'][ 'Position'] MapHandle.characterMoveScene(['0'], characterPosition, '0') CacheContorl.nowFlowId = 'main'
def seeCharacterList_func(oldPanel): maxPage = getCharacterListPageMax() inputS = [] seeCharacterListPanelInput = SeeCharacterListPanel.seeCharacterListPanel( maxPage) startId = len(seeCharacterListPanelInput) inputS = inputS + seeCharacterListPanelInput askForSeeCharacterListPanelInput = SeeCharacterListPanel.askForSeeCharacterListPanel( startId) inputS = inputS + askForSeeCharacterListPanelInput yrn = GameInit.askfor_All(inputS) yrn = str(yrn) characterIdList = CharacterHandle.getCharacterIdList() pageId = int(CacheContorl.panelState['SeeCharacterListPanel']) if yrn == str(startId): if pageId == 0: CacheContorl.panelState['SeeCharacterListPanel'] = str(maxPage) seeCharacterList_func(oldPanel) else: pageId = str(pageId - 1) CacheContorl.panelState['SeeCharacterListPanel'] = pageId seeCharacterList_func(oldPanel) elif yrn == str(startId + 1): if oldPanel == 'MainFramePanel': import script.Flow.Main as mainframe CacheContorl.characterData['characterId'] = '0' CacheContorl.panelState['SeeCharacterListPanel'] = '0' mainframe.mainFrame_func() else: pass elif yrn == str(startId + 2): if pageId == maxPage: CacheContorl.panelState['SeeCharacterListPanel'] = '0' seeCharacterList_func(oldPanel) else: pageId = str(pageId + 1) CacheContorl.panelState['SeeCharacterListPanel'] = pageId seeCharacterList_func(oldPanel) elif yrn in characterIdList: yrn = str(int(yrn) + characterPageShow * pageId) CacheContorl.characterData['characterId'] = yrn from script.Flow import SeeCharacterAttr SeeCharacterAttr.seeAttrOnEveryTime_func('SeeCharacterListPanel', oldPanel)
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)
def initCharacterBehavior(self): npcList = CharacterHandle.getCharacterIdList() npcList.remove('0') for npc in npcList: self.characterOccupationJudge(npc)