예제 #1
0
def askForLoadSave_func(saveId: str):
    '''
    读档处理询问流程
    玩家输入0:进入读取存档询问流程
    玩家输入1:进入删除存档询问流程
    Keyword arguments:
    saveId -- 存档id
    '''
    cmdList = SaveHandleFramePanel.askLoadSavePanel()
    yrn = GameInit.askfor_All(cmdList)
    PyCmd.clr_cmd()
    if yrn == '0':
        return confirmationLoadSave_func(saveId)
    elif yrn == '1':
        confirmationRemoveSave_func(saveId)
    return False
예제 #2
0
def askForOverlaySave_func(saveId:str):
    '''
    存档处理询问流程
    玩家输入0:进入覆盖存档询问流程
    玩家输入1:进入删除存档询问流程
    Keyword arguments:
    saveId -- 存档id
    '''
    cmdList = SaveHandleFramePanel.askForOverlaySavePanel()
    yrn = GameInit.askfor_All(cmdList)
    yrn = str(yrn)
    PyCmd.clr_cmd()
    if yrn == '0':
        confirmationOverlaySave_func(saveId)
    elif yrn == '1':
        confirmationRemoveSave_func(saveId)
예제 #3
0
def mainFrame_func():
    '''
    游戏主页控制流程
    '''
    inputS = []
    flowReturn = MainFramePanel.mainFramePanel()
    inputS = inputS + flowReturn
    characterId = CacheContorl.characterData['characterId']
    characterData = AttrHandle.getAttrData(characterId)
    characterName = characterData['Name']
    ans = GameInit.askfor_All(inputS)
    PyCmd.clr_cmd()
    CacheContorl.oldFlowId = 'main'
    if ans == characterName:
        CacheContorl.nowFlowId = 'see_character_attr'
    else:
        CacheContorl.nowFlowId = mainFrameGotoData[ans]
예제 #4
0
def startInputNamePanel():
    '''
    玩家姓名输入处理面板
    '''
    EraPrint.pline()
    EraPrint.pl(TextLoading.getTextData(TextLoading.messagePath, '3'))
    inputState = 0
    while inputState == 0:
        characterName = GameInit.askfor_str()
        EraPrint.pl(characterName)
        if TextHandle.getTextIndex(characterName) > 10:
            EraPrint.pl(
                TextLoading.getTextData(TextLoading.errorPath,
                                        'inputNameTooLongError'))
        else:
            inputState = 1
            CacheContorl.temporaryCharacter['Name'] = characterName
예제 #5
0
def waitInput(intA: int, intB: int) -> GameInit.askfor_str:
    '''
    等待玩家输入ab之间的一个数
    Keyword arguments:
    intA -- 输入边界A
    intB -- 输入边界B
    '''
    while (True):
        ans = GameInit.askfor_str()
        if ans.isdecimal():
            ans = int(ans)
            if intA <= ans <= intB:
                break
        EraPrint.pl(ans)
        EraPrint.pl(
            TextLoading.getTextData(TextLoading.errorPath, 'inputNullError') +
            '\n')
    return ans
예제 #6
0
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)
예제 #7
0
def loadSave_func(oldPanel):
    inputS = []
    savePage = savePageIndex()
    showSaveValue = savePage[0]
    lastSavePageValue = savePage[1]
    SaveHandleFramePanel.loadSaveInfoHeadPanel()
    flowReturn = SaveHandleFramePanel.seeSaveListPanel(showSaveValue,
                                                       lastSavePageValue, True)
    inputS = inputS + flowReturn
    startId = len(inputS)
    flowReturn = SaveHandleFramePanel.askForChangeSavePagePanel(startId)
    inputS = inputS + flowReturn
    yrn = GameInit.askfor_Int(inputS)
    PyCmd.clr_cmd()
    if yrn == str(startId):
        savePanelPage = int(CacheContorl.panelState['SeeSaveListPanel'])
        if savePanelPage == 0:
            CacheContorl.panelState[
                'SeeSaveListPanel'] = CacheContorl.maxSavePage
        else:
            CacheContorl.panelState['SeeSaveListPanel'] = savePanelPage - 1
        loadSave_func(oldPanel)
    elif yrn == str(startId + 1):
        if oldPanel == 'MainFlowPanel':
            CacheContorl.wframeMouse['wFrameRePrint'] = 1
            CacheContorl.panelState['SeeSaveListPanel'] = 0
            import script.Design.StartFlow as mainflow
            mainflow.main_func()
        elif oldPanel == 'MainFramePanel':
            CacheContorl.panelState['SeeSaveListPanel'] = 0
            import script.Flow.Main as mainframe
            mainframe.mainFrame_func()
            pass
    elif yrn == str(startId + 2):
        savePanelPage = int(CacheContorl.panelState['SeeSaveListPanel'])
        if savePanelPage == CacheContorl.maxSavePage:
            CacheContorl.panelState['SeeSaveListPanel'] = 0
        else:
            CacheContorl.panelState['SeeSaveListPanel'] = savePanelPage + 1
        loadSave_func(oldPanel)
    else:
        ansReturn = int(yrn)
        saveId = SaveHandle.getSavePageSaveId(showSaveValue, ansReturn)
        askForLoadSave_func(oldPanel, saveId)
예제 #8
0
def establishSave_func(oldPanel):
    inputS = []
    savePage = savePageIndex()
    showSaveValue = savePage[0]
    lastSavePageValue = savePage[1]
    SaveHandleFramePanel.establishSaveInfoHeadPanel()
    flowReturn = SaveHandleFramePanel.seeSaveListPanel(showSaveValue,
                                                       lastSavePageValue)
    inputS = inputS + flowReturn
    startId = len(inputS)
    flowReturn = SaveHandleFramePanel.askForChangeSavePagePanel(startId)
    inputS = inputS + flowReturn
    yrn = GameInit.askfor_Int(inputS)
    PyCmd.clr_cmd()
    if yrn == str(startId):
        savePanelPage = int(CacheContorl.panelState['SeeSaveListPanel'])
        if savePanelPage == 0:
            CacheContorl.panelState[
                'SeeSaveListPanel'] = CacheContorl.maxSavePage
        else:
            CacheContorl.panelState['SeeSaveListPanel'] = savePanelPage - 1
        establishSave_func(oldPanel)
    elif yrn == str(startId + 1):
        if oldPanel == 'MainFramePanel':
            CacheContorl.panelState['SeeSaveListPanel'] = 0
            import script.Flow.Main as mainframe
            mainframe.mainFrame_func()
        else:
            pass
    elif yrn == str(startId + 2):
        savePanelPage = int(CacheContorl.panelState['SeeSaveListPanel'])
        if savePanelPage == CacheContorl.maxSavePage:
            CacheContorl.panelState['SeeSaveListPanel'] = 0
        else:
            CacheContorl.panelState['SeeSaveListPanel'] = savePanelPage + 1
        establishSave_func(oldPanel)
    else:
        ansReturn = int(yrn)
        saveId = SaveHandle.getSavePageSaveId(showSaveValue, ansReturn)
        if SaveHandle.judgeSaveFileExist(saveId) == '1':
            askForOverlaySave_func(oldPanel, saveId)
        else:
            SaveHandle.establishSave(saveId)
            establishSave_func(oldPanel)
예제 #9
0
def optionstr(cmdList,
              cmdColumn=1,
              cmdSize='left',
              lastLine=False,
              askfor=True,
              cmdListData=None):
    if cmdListData == None:
        cmdListData = TextLoading.getTextData(TextLoading.cmdPath,
                                              cmdList).copy()
    else:
        pass
    inputS = []
    textWidth = GameConfig.text_width
    if lastLine == True:
        if len(cmdListData) - 1 < cmdColumn:
            cmdColumn = len(cmdListData) - 1
    else:
        if len(cmdListData) < cmdColumn:
            cmdColumn = len(cmdListData)
    cmdIndex = int(textWidth / cmdColumn)
    for i in range(0, len(cmdListData)):
        cmdTextBak = Dictionaries.handleText(cmdListData[i])
        cmdText = '[' + cmdTextBak + ']'
        if i == 0:
            cmdSizePrint(cmdText, cmdTextBak, None, cmdIndex, cmdSize)
            inputS.append(cmdListData[i])
        elif i / cmdColumn >= 1 and i % cmdColumn == 0:
            EraPrint.p('\n')
            cmdSizePrint(cmdText, cmdTextBak, None, cmdIndex, cmdSize)
            inputS.append(cmdTextBak)
        elif i == len(cmdListData) - 1 and lastLine == True:
            EraPrint.p('\n')
            cmdSizePrint(cmdText, cmdTextBak, None, cmdIndex, cmdSize)
            inputS.append(cmdTextBak)
        else:
            cmdSizePrint(cmdText, cmdTextBak, None, cmdIndex, cmdSize)
            inputS.append(cmdTextBak)
    EraPrint.p('\n')
    if askfor == True:
        ans = GameInit.askfor_All(inputS)
        return ans
    else:
        return inputS
예제 #10
0
파일: Main.py 프로젝트: homer12/dieloli
def mainFrame_func():
    '''
    游戏主页控制流程
    '''
    inputS = []
    flowReturn = MainFramePanel.mainFramePanel()
    inputS = inputS + flowReturn
    characterId = CacheContorl.characterData['characterId']
    characterData = CacheContorl.characterData['character'][characterId]
    characterName = characterData.Name
    ans = GameInit.askfor_All(inputS)
    PyCmd.clr_cmd()
    CacheContorl.oldFlowId = 'main'
    if ans == characterName:
        CacheContorl.nowFlowId = 'see_character_attr'
    else:
        if ans == '0':
            Clothing.initCharacterClothingPutOn()
        CacheContorl.nowFlowId = mainFrameGotoData[ans]
예제 #11
0
def seeCharacterList_func():
    '''
    用于查看角色列表的流程
    '''
    while (True):
        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 = CacheContorl.characterData['character'].keys()
        pageId = int(CacheContorl.panelState['SeeCharacterListPanel'])
        if yrn == str(startId):
            if pageId == 0:
                CacheContorl.panelState['SeeCharacterListPanel'] = str(maxPage)
            else:
                pageId = str(pageId - 1)
                CacheContorl.panelState['SeeCharacterListPanel'] = pageId
        elif yrn == str(startId + 1):
            CacheContorl.characterData['characterId'] = 0
            CacheContorl.panelState['SeeCharacterListPanel'] = '0'
            CacheContorl.nowFlowId = CacheContorl.oldFlowId
            break
        elif yrn == str(startId + 2):
            if pageId == maxPage:
                CacheContorl.panelState['SeeCharacterListPanel'] = '0'
            else:
                pageId = str(pageId + 1)
                CacheContorl.panelState['SeeCharacterListPanel'] = pageId
        elif int(yrn) + characterPageShow * pageId in characterIdList:
            yrn = int(yrn) + characterPageShow * pageId
            CacheContorl.characterData['characterId'] = yrn
            CacheContorl.nowFlowId = 'see_character_attr'
            CacheContorl.tooOldFlowId = CacheContorl.oldFlowId
            CacheContorl.oldFlowId = 'see_character_list'
            break
예제 #12
0
def establishSave_func():
    '''
    绘制保存存档界面流程
    '''
    while (True):
        inputS = []
        savePage = savePageIndex()
        showSaveValue = savePage[0]
        lastSavePageValue = savePage[1]
        SaveHandleFramePanel.establishSaveInfoHeadPanel()
        flowReturn = SaveHandleFramePanel.seeSaveListPanel(
            showSaveValue, lastSavePageValue)
        inputS = inputS + flowReturn
        startId = len(inputS)
        flowReturn = SaveHandleFramePanel.askForChangeSavePagePanel(startId)
        inputS = inputS + flowReturn
        yrn = GameInit.askfor_Int(inputS)
        PyCmd.clr_cmd()
        if yrn == str(startId):
            savePanelPage = int(CacheContorl.panelState['SeeSaveListPanel'])
            if savePanelPage == 0:
                CacheContorl.panelState[
                    'SeeSaveListPanel'] = CacheContorl.maxSavePage
            else:
                CacheContorl.panelState['SeeSaveListPanel'] = savePanelPage - 1
        elif yrn == str(startId + 1):
            CacheContorl.panelState['SeeSaveListPanel'] = 0
            CacheContorl.nowFlowId = CacheContorl.oldFlowId
            break
        elif yrn == str(startId + 2):
            savePanelPage = int(CacheContorl.panelState['SeeSaveListPanel'])
            if savePanelPage == CacheContorl.maxSavePage:
                CacheContorl.panelState['SeeSaveListPanel'] = 0
            else:
                CacheContorl.panelState['SeeSaveListPanel'] = savePanelPage + 1
        else:
            ansReturn = int(yrn)
            saveId = SaveHandle.getSavePageSaveId(showSaveValue, ansReturn)
            if SaveHandle.judgeSaveFileExist(saveId) == '1':
                askForOverlaySave_func(saveId)
            else:
                SaveHandle.establishSave(saveId)
예제 #13
0
def enterCharacterNature_func():
    '''
    请求玩家确认性格流程
    '''
    CacheContorl.characterData['character'][0].initAttr()
    while 1:
        PyCmd.clr_cmd()
        CreatorCharacterPanel.enterCharacterNatureHead()
        inputS = SeeNaturePanel.seeCharacterNatureChangePanel(0)
        inputS += CreatorCharacterPanel.enterCharacterNatureEnd()
        yrn = GameInit.askfor_All(inputS)
        if yrn in CacheContorl.characterData['character'][0].Nature:
            if CacheContorl.characterData['character'][0].Nature[yrn] < 50:
                CacheContorl.characterData['character'][0].Nature[yrn] = random.uniform(50,100)
            else:
                CacheContorl.characterData['character'][0].Nature[yrn] = random.uniform(0,50)
        elif int(yrn) == 0:
            CacheContorl.characterData['character'][0].initAttr()
            CacheContorl.nowFlowId = 'acknowledgment_attribute'
            break
        elif int(yrn) == 1:
            CacheContorl.characterData['character'][0].Nature = Nature.getRandomNature()
예제 #14
0
def gameStart():
    from script.Design import StartFlow
    from script.Core import GameInit
    GameInit.run(StartFlow.open_func)
예제 #15
0
def optionstr(cmdList: str,
              cmdColumn=1,
              cmdSize='left',
              lastLine=False,
              askfor=True,
              cmdListData=None,
              nullCmd='',
              returnData=None) -> list:
    '''
    绘制无id的文本命令列表
    例:
    [长寿的青蛙]
    Keyword arguments:
    cmdList -- 命令列表id,当cmdListData为None时,根据此id调用cmdList内的命令数据
    cmdColumn -- 每行命令列数 (default 1)
    cmdSize -- 命令文本在当前列的对齐方式(left/center/right) (default 'left')
    lastLine -- 最后一个命令换行绘制 (default False)
    cmdListData -- 命令列表数据 (default None)
    nullCmd -- 在列表中按纯文本绘制,并不加入监听列表的命令文本
    returnData -- 命令返回数据 (default None)
    '''
    if cmdListData == None:
        cmdListData = TextLoading.getTextData(TextLoading.cmdPath,
                                              cmdList).copy()
    inputS = []
    textWidth = GameConfig.text_width
    if lastLine == True:
        if len(cmdListData) - 1 < cmdColumn:
            cmdColumn = len(cmdListData) - 1
    else:
        if len(cmdListData) < cmdColumn:
            cmdColumn = len(cmdListData)
    cmdIndex = int(textWidth / cmdColumn)
    nowNullCmd = nullCmd
    for i in range(0, len(cmdListData)):
        nowNullCmd = True
        if returnData == None:
            if nullCmd == cmdListData[i]:
                nowNullCmd = False
            cmdTextBak = Dictionaries.handleText(cmdListData[i])
            cmdText = '[' + cmdTextBak + ']'
        else:
            if nullCmd == returnData[i]:
                nowNullCmd = False
            cmdTextBak = returnData[i]
            cmdText = '[' + cmdListData[i] + ']'
        if i == 0:
            cmdSizePrint(cmdText,
                         cmdTextBak,
                         None,
                         cmdIndex,
                         cmdSize,
                         noNullCmd=nowNullCmd)
            if nowNullCmd:
                inputS.append(cmdListData[i])
        elif i / cmdColumn >= 1 and i % cmdColumn == 0:
            EraPrint.p('\n')
            cmdSizePrint(cmdText,
                         cmdTextBak,
                         None,
                         cmdIndex,
                         cmdSize,
                         noNullCmd=nowNullCmd)
            if nowNullCmd:
                inputS.append(cmdTextBak)
        elif i == len(cmdListData) - 1 and lastLine == True:
            EraPrint.p('\n')
            cmdSizePrint(cmdText,
                         cmdTextBak,
                         None,
                         cmdIndex,
                         cmdSize,
                         noNullCmd=nowNullCmd)
            if nowNullCmd:
                inputS.append(cmdTextBak)
        else:
            cmdSizePrint(cmdText,
                         cmdTextBak,
                         None,
                         cmdIndex,
                         cmdSize,
                         noNullCmd=nowNullCmd)
            if nowNullCmd:
                inputS.append(cmdTextBak)
    EraPrint.p('\n')
    if askfor == True:
        ans = GameInit.askfor_All(inputS)
        return ans
    else:
        return inputS
예제 #16
0
def optionint(cmdList,
              cmdColumn=1,
              idSize='left',
              idSwitch=True,
              askfor=True,
              cmdSize='left',
              startId='0',
              cmdListData=None,
              lastLine=False):
    if cmdListData == None:
        cmdListData = TextLoading.getTextData(TextLoading.cmdPath,
                                              cmdList).copy()
    inputI = []
    textWidth = GameConfig.text_width
    if lastLine == True:
        if len(cmdListData) < cmdColumn:
            cmdColumn = len(cmdListData)
    else:
        if len(cmdListData) + 1 < cmdColumn:
            cmdColumn = len(cmdListData)
    cmdIndex = int(textWidth / cmdColumn)
    if len(cmdListData) + 1 < cmdColumn:
        cmdColumn = len(cmdListData) + 1
    for i in range(0, len(cmdListData)):
        cmdText = Dictionaries.handleText(cmdListData[i])
        startId = int(startId)
        returnId = i + startId
        if idSwitch == True:
            id = idIndex(returnId)
        else:
            id = ''
        cmdTextAndId = id + cmdText
        cmdTextAndIdIndex = TextHandle.getTextIndex(cmdTextAndId)
        if cmdTextAndIdIndex < cmdIndex:
            if idSize == 'right':
                cmdTextAndId = cmdText + id
            elif idSize == 'left':
                cmdTextAndId = id + cmdText
            if i == 0:
                cmdTextAndId = cmdTextAndId.rstrip()
                cmdSizePrint(cmdTextAndId, returnId, None, cmdIndex, cmdSize)
                inputI.append(str(returnId))
            elif i / cmdColumn >= 1 and i % cmdColumn == 0:
                EraPrint.p('\n')
                cmdTextAndId = cmdTextAndId.rstrip()
                cmdSizePrint(cmdTextAndId, returnId, None, cmdIndex, cmdSize)
                inputI.append(str(returnId))
            elif i == len(cmdListData) and lastLine == True:
                EraPrint.p('\n')
                cmdTextAndId = cmdTextAndId.rstrip()
                cmdSizePrint(cmdTextAndId, returnId, None, cmdIndex, cmdSize)
                inputI.append(str(returnId))
            else:
                cmdTextAndId = cmdTextAndId.rstrip()
                cmdSizePrint(cmdTextAndId, returnId, None, cmdIndex, cmdSize)
                inputI.append(str(returnId))
        else:
            pass
    EraPrint.p('\n')
    if askfor == True:
        ans = int(GameInit.askfor_Int(inputI))
        return ans
    else:
        return inputI
예제 #17
0
def optionint(cmdList: list,
              cmdColumn=1,
              idSize='left',
              idSwitch=True,
              askfor=True,
              cmdSize='left',
              startId=0,
              cmdListData=None,
              lastLine=False) -> list:
    '''
    批量绘制带id命令列表
    例:
    [000]开始游戏
    Keyword arguments:
    cmdList -- 命令列表id,当cmdListData为None时,根据此id调用cmdList内的命令数据
    cmdColumn -- 每行命令列数 (default 1)
    idSize -- id文本位置(left/center/right) (default 'left')
    idSwitch -- id显示开关 (default True)
    askfor -- 绘制完成时等待玩家输入的开关 (default True)
    cmdSize -- 命令文本在当前列的对齐方式(left/center/right) (default 'left')
    startId -- 命令列表的起始id (default 0)
    cmdListData -- 命令列表数据 (default None)
    lastLine -- 最后一个命令换行绘制 (default False)
    '''
    if cmdListData == None:
        cmdListData = TextLoading.getTextData(TextLoading.cmdPath,
                                              cmdList).copy()
    inputI = []
    textWidth = GameConfig.text_width
    if lastLine == True:
        if len(cmdListData) < cmdColumn:
            cmdColumn = len(cmdListData)
    else:
        if len(cmdListData) + 1 < cmdColumn:
            cmdColumn = len(cmdListData)
    cmdIndex = int(textWidth / cmdColumn)
    if len(cmdListData) + 1 < cmdColumn:
        cmdColumn = len(cmdListData) + 1
    for i in range(0, len(cmdListData)):
        cmdText = Dictionaries.handleText(cmdListData[i])
        returnId = i + startId
        if idSwitch == True:
            id = idIndex(returnId)
        else:
            id = ''
        cmdTextAndId = id + cmdText
        cmdTextAndIdIndex = TextHandle.getTextIndex(cmdTextAndId)
        if cmdTextAndIdIndex < cmdIndex:
            if idSize == 'right':
                cmdTextAndId = cmdText + id
            elif idSize == 'left':
                cmdTextAndId = id + cmdText
            if i == 0:
                cmdTextAndId = cmdTextAndId.rstrip()
                cmdSizePrint(cmdTextAndId, returnId, None, cmdIndex, cmdSize)
                inputI.append(str(returnId))
            elif i / cmdColumn >= 1 and i % cmdColumn == 0:
                EraPrint.p('\n')
                cmdTextAndId = cmdTextAndId.rstrip()
                cmdSizePrint(cmdTextAndId, returnId, None, cmdIndex, cmdSize)
                inputI.append(str(returnId))
            elif i == len(cmdListData) and lastLine == True:
                EraPrint.p('\n')
                cmdTextAndId = cmdTextAndId.rstrip()
                cmdSizePrint(cmdTextAndId, returnId, None, cmdIndex, cmdSize)
                inputI.append(str(returnId))
            else:
                cmdTextAndId = cmdTextAndId.rstrip()
                cmdSizePrint(cmdTextAndId, returnId, None, cmdIndex, cmdSize)
                inputI.append(str(returnId))
    EraPrint.p('\n')
    if askfor == True:
        ans = int(GameInit.askfor_Int(inputI))
        return ans
    else:
        return inputI
예제 #18
0
def seeAttrOnEveryTime_func():
    '''
    通用用于查看角色属性的流程
    '''
    while (True):
        characterId = CacheContorl.characterData['characterId']
        if CacheContorl.oldFlowId == 'in_scene':
            nowScene = CacheContorl.characterData['character'][0].Position
            nowSceneStr = MapHandle.getMapSystemPathStrForList(nowScene)
            characterIdList = MapHandle.getSceneCharacterIdList(nowSceneStr)
        else:
            characterIdList = list(
                CacheContorl.characterData['character'].keys())
        characterIdIndex = characterIdList.index(characterId)
        inputS = []
        seeAttrInEveryTime_func()
        askSeeAttr = SeeCharacterAttrPanel.askForSeeAttr()
        inputS += askSeeAttr
        inputs1 = SeeCharacterAttrPanel.askForSeeAttrCmd()
        inputS += inputs1
        yrn = GameInit.askfor_All(inputS)
        PyCmd.clr_cmd()
        showAttrHandleData = TextLoading.getTextData(TextLoading.cmdPath,
                                                     'seeAttrPanelHandle')
        characterMax = characterIdList[len(characterIdList) - 1]
        if yrn in showAttrHandleData:
            CacheContorl.panelState['AttrShowHandlePanel'] = yrn
        elif yrn == '0':
            if characterIdIndex == 0:
                CacheContorl.characterData['characterId'] = characterMax
            else:
                characterId = characterIdList[characterIdIndex - 1]
                CacheContorl.characterData['characterId'] = characterId
        elif yrn == '1':
            if CacheContorl.oldFlowId == 'main':
                CacheContorl.characterData['characterId'] = 0
            elif CacheContorl.oldFlowId == 'see_character_list':
                characterListShow = int(GameConfig.characterlist_show)
                nowPageId = characterIdIndex / characterListShow
                CacheContorl.panelState['SeeCharacterListPanel'] = nowPageId
            elif CacheContorl.oldFlowId == 'in_scene':
                scenePath = CacheContorl.characterData['character'][0].Position
                scenePathStr = MapHandle.getMapSystemPathStrForList(scenePath)
                nameList = MapHandle.getSceneCharacterNameList(
                    scenePathStr, True)
                nowCharacterName = CacheContorl.characterData['character'][
                    CacheContorl.characterData['characterId']].Name
                try:
                    nowCharacterIndex = nameList.index(nowCharacterName)
                except ValueError:
                    nowCharacterIndex = 0
                nameListMax = int(GameConfig.in_scene_see_player_max)
                nowSceneCharacterListPage = math.floor(nowCharacterIndex /
                                                       nameListMax)
                CacheContorl.panelState[
                    'SeeSceneCharacterListPanel'] = nowSceneCharacterListPage
            CacheContorl.panelState['AttrShowHandlePanel'] = 'MainAttr'
            CacheContorl.nowFlowId = CacheContorl.oldFlowId
            CacheContorl.oldFlowId = CacheContorl.tooOldFlowId
            break
        elif yrn == '2':
            if characterId == characterMax:
                characterId = characterIdList[0]
                CacheContorl.characterData['characterId'] = characterId
            else:
                characterId = characterIdList[characterIdIndex + 1]
                CacheContorl.characterData['characterId'] = characterId
예제 #19
0
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()
        SeeCharacterAttrPanel.seeCharacterHPAndMPInSence(
            CacheContorl.characterData['characterId'])
        SeeCharacterAttrPanel.seeCharacterStatusPanel(
            CacheContorl.characterData['characterId'])
        instructHead = InstructPanel.seeInstructHeadPanel()
        inSceneCmdList2 = InScenePanel.inSceneButtonPanel(startId1)
        if changePageJudge:
            inputS += inSceneCmdList1 + instructHead + inSceneCmdList2
        else:
            inputS += instructHead + inSceneCmdList2
        yrn = GameInit.askfor_All(inputS)
        PyCmd.clr_cmd()
        nowPage = int(CacheContorl.panelState['SeeSceneCharacterListPanel'])
        characterMax = len(CacheContorl.characterData['character']) - 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)
        elif yrn in instructHead:
            if CacheContorl.instructFilter[yrn] == 1:
                CacheContorl.instructFilter[yrn] = 0
            else:
                CacheContorl.instructFilter[yrn] = 1