Esempio n. 1
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)
Esempio n. 2
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)
Esempio n. 3
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)
Esempio n. 4
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
Esempio n. 5
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