def mainFramePanel(): cmdList = [] characterId = CacheContorl.characterData['characterId'] characterData = AttrHandle.getAttrData(characterId) titleText = TextLoading.getTextData(TextLoading.stageWordPath, '64') EraPrint.plt(titleText) dateText = GameTime.getDateText() EraPrint.p(dateText) EraPrint.p(' ') weekDateText = GameTime.getWeekDayText() EraPrint.p(weekDateText) EraPrint.p(' ') characterName = characterData['Name'] PyCmd.pcmd(characterName,characterName,None) cmdList.append(characterName) EraPrint.p(' ') goldText = AttrText.getGoldText(characterId) EraPrint.p(goldText) EraPrint.p('\n') AttrPrint.printHpAndMpBar(characterId) mainMenuText = TextLoading.getTextData(TextLoading.stageWordPath,'68') EraPrint.sontitleprint(mainMenuText) EraPrint.p('\n') askForMainMenu = CmdButtonQueue.optionint(CmdButtonQueue.mainmenu, 4, 'left', askfor=False, cmdSize='center') cmdList = cmdList + askForMainMenu systemMenuText = TextLoading.getTextData(TextLoading.stageWordPath,'69') EraPrint.sontitleprint(systemMenuText) EraPrint.p('\n') systemMenuStartId = len(askForMainMenu) askForSystemMenu = CmdButtonQueue.optionint(CmdButtonQueue.systemmenu, 4, 'left', askfor=False, cmdSize='center', startId=systemMenuStartId) cmdList = cmdList + askForSystemMenu return cmdList
def inputName_func(): ''' 请求玩家输入姓名流程 输入0:进入请求玩家输入昵称流程(玩家姓名为默认或输入姓名流程结果) 输入1:进入输入姓名流程 输入2:返回标题菜单 ''' GameTime.initTime() CacheContorl.characterData['characterId'] = 0 CacheContorl.characterData['character'][0] = Character.Character() flowReturn = 0 while 1: flowReturn = CreatorCharacterPanel.inputNamePanel() if flowReturn == 0: PyCmd.clr_cmd() break elif flowReturn == 1: PyCmd.clr_cmd() CreatorCharacterPanel.startInputNamePanel() PyCmd.clr_cmd() else: break if flowReturn == 0: inputNickName_func() else: EraPrint.pnextscreen() CacheContorl.nowFlowId = 'title_frame'
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 getChest(chestTem: str, birthday: dict): ''' 按罩杯模板生成人物最终罩杯,并按人物年龄计算当前罩杯 Keyword arguments: chestTem -- 罩杯模板 age -- 角色年龄 ''' targetChest = getRandNpcChest(chestTem) overAge = random.randint(14, 18) overYear = birthday['year'] + overAge endDate = GameTime.getRandDayForYear(overYear).timetuple() nowDate = CacheContorl.gameTime.copy() nowDate = GameTime.gameTimeToDatetime(nowDate) startDate = GameTime.gameTimeToDatetime(birthday) endDay = GameTime.countDayForDateToDate(startDate, endDate) nowDay = GameTime.countDayForDateToDate(startDate, nowDate) subChest = targetChest / endDay nowChest = subChest * nowDay if nowChest > subChest: nowChest = targetChest return { "TargetChest": targetChest, "NowChest": nowChest, "SubChest": subChest }
def identicalMapMove(characterId, nowMap, nowMapSceneId, targetMapSceneId): movePath = MapHandle.getPathfinding(nowMap, nowMapSceneId, targetMapSceneId) if movePath != 'End' and movePath != 'Null': nowTargetSceneId = movePath['Path'][1] nowNeedTime = movePath['Time'][1] nowCharacterPosition = MapHandle.getScenePathForMapSceneId( nowMap, nowMapSceneId) nowTargetPosition = MapHandle.getScenePathForMapSceneId( nowMap, nowTargetSceneId) MapHandle.characterMoveScene(nowCharacterPosition, nowTargetPosition, characterId) GameTime.subTimeNow(nowNeedTime) return movePath
def seeScenePanel(): ''' 当前场景信息面板 ''' titleText = TextLoading.getTextData(TextLoading.stageWordPath, '75') EraPrint.plt(titleText) timeText = GameTime.getDateText() EraPrint.p(timeText) EraPrint.p(' ') scenePath = CacheContorl.characterData['character']['0']['Position'] scenePathStr = MapHandle.getMapSystemPathStrForList(scenePath) sceneData = CacheContorl.sceneData[scenePathStr].copy() sceneName = sceneData['SceneName'] sceneInfoHead = TextLoading.getTextData(TextLoading.stageWordPath, '76') sceneInfo = sceneInfoHead + sceneName EraPrint.p(sceneInfo) panelState = CacheContorl.panelState['SeeSceneCharacterListPage'] switch = panelStateOnText if panelState == '0': switch = panelStateOffText sceneCharacterList = sceneData['SceneCharacterData'] if len(sceneCharacterList) > 1: EraPrint.p(' ') PyCmd.pcmd(switch, 'SeeSceneCharacterListPage') EraPrint.plittleline()
def seeScenePanel(): ''' 当前场景信息面板 ''' titleText = TextLoading.getTextData(TextLoading.stageWordPath, '75') EraPrint.plt(titleText) timeText = GameTime.getDateText() EraPrint.p(timeText) EraPrint.p(' ') scenePath = CacheContorl.characterData['character'][0].Position scenePathStr = MapHandle.getMapSystemPathStrForList(scenePath) mapList = MapHandle.getMapHierarchyListForScenePath(scenePath, []) mapPathText = '' mapList.reverse() for nowMap in mapList: nowMapMapSystemStr = MapHandle.getMapSystemPathStrForList(nowMap) mapName = CacheContorl.mapData[nowMapMapSystemStr]['MapName'] mapPathText += mapName + '-' sceneData = CacheContorl.sceneData[scenePathStr].copy() sceneName = mapPathText + sceneData['SceneName'] sceneInfoHead = TextLoading.getTextData(TextLoading.stageWordPath, '76') sceneInfo = sceneInfoHead + sceneName EraPrint.p(sceneInfo) panelState = CacheContorl.panelState['SeeSceneCharacterListPage'] switch = panelStateOnText if panelState == '0': switch = panelStateOffText sceneCharacterList = sceneData['SceneCharacterData'] if len(sceneCharacterList) > 1: EraPrint.p(' ') PyCmd.pcmd(switch, 'SeeSceneCharacterListPage') EraPrint.plittleline()
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 identicalMapMove(characterId:str,nowMap:list,nowMapSceneId:str,targetMapSceneId:str) -> 'MoveEnd:str_Null,str_End,list': ''' 角色在相同地图层级内移动 Keyword arguments: characterId -- 角色id nowMap -- 当前地图路径 nowMapSceneId -- 当前角色所在场景(当前地图层级下的相对坐标) targetMapSceneId -- 寻路目标场景(当前地图层级下的相对坐标) ''' nowMapStr = MapHandle.getMapSystemPathStrForList(nowMap) movePath = MapHandle.getPathfinding(nowMapStr,nowMapSceneId,targetMapSceneId) if movePath != 'End' and movePath != 'Null': nowTargetSceneId = movePath['Path'][0] nowNeedTime = movePath['Time'][0] nowCharacterPosition = MapHandle.getScenePathForMapSceneId(nowMap,nowMapSceneId) nowTargetPosition = MapHandle.getScenePathForMapSceneId(nowMap,nowTargetSceneId) MapHandle.characterMoveScene(nowCharacterPosition,nowTargetPosition,characterId) GameTime.subTimeNow(nowNeedTime) return movePath
def seeScenePanel(): titleText = TextLoading.getTextData(TextLoading.stageWordPath,'75') EraPrint.plt(titleText) timeText = GameTime.getDateText() EraPrint.p(timeText) EraPrint.p(' ') scenePath = CacheContorl.characterData['character']['0']['Position'] scenePathStr = MapHandle.getMapSystemPathStrForList(scenePath) sceneData = CacheContorl.sceneData[scenePathStr].copy() sceneName = sceneData['SceneName'] sceneInfoHead = TextLoading.getTextData(TextLoading.stageWordPath, '76') sceneInfo = sceneInfoHead + sceneName EraPrint.p(sceneInfo) EraPrint.plittleline()
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 getRandNpcBirthDay(age: int): ''' 随机生成npc生日 Keyword arguments: age -- 年龄 ''' nowYear = int(CacheContorl.gameTime['year']) nowMonth = int(CacheContorl.gameTime['month']) nowDay = int(CacheContorl.gameTime['day']) birthYear = nowYear - age date = GameTime.getRandDayForYear(birthYear) birthday = {"year": date.year, "month": date.month, "day": date.day} if nowMonth < birthday['month'] or (nowMonth == birthday['month'] and nowDay < birthday['day']): birthday['year'] -= 1 return birthday
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
def arderBehavior(characterId): nowWeekDay = GameTime.getWeekDate() if nowWeekDay in range(1, 5): nowTimeSlice = GameTime.getNowTimeSlice() else: pass
def arderBehavior(self, objectId, objectData, characterData): nowWeekDay = GameTime.getWeekDate() if nowWeekDay in range(1, 5): nowTimeSlice = GameTime.getNowTimeSlice() else: pass
def gameUpdateFlow(): ''' 游戏流程刷新 ''' GameTime.initSchoolCourseTimeStatus() CharacterBehavior.initCharacterBehavior()