Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
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