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
Exemple #2
0
def gameMainPanel():
    EraPrint.pline()
    EraPrint.pl(TextHandle.align(GameConfig.game_name, 'center'))
    EraPrint.pl(TextHandle.align(GameConfig.author, 'right'))
    EraPrint.pl(TextHandle.align(GameConfig.verson, 'right'))
    EraPrint.pl(TextHandle.align(GameConfig.verson_time, 'right'))
    EraPrint.p('\n')
    EraPrint.pline()
    EraPrint.lcp(1 / 3, TextLoading.getTextData(TextLoading.messagePath, '2'))
    time.sleep(1)
    EraPrint.p('\n')
    EraPrint.pline()
    time.sleep(1)
    PyCmd.focusCmd()
    menuInt = CmdButtonQueue.optionint(CmdButtonQueue.logomenu)
    return menuInt
Exemple #3
0
def printMap(mapPath: list) -> list:
    '''
    按地图路径绘制地图
    Ketword arguments:
    mapPath -- 地图路径
    '''
    mapPathStr = getMapSystemPathStrForList(mapPath)
    mapDraw = getMapDrawForMapPath(mapPathStr)
    characterPosition = CacheContorl.characterData['character']['0'][
        'Position']
    characterNowSceneId = getSceneIdInMapForScenePathOnMapPath(
        characterPosition, mapPath)
    inputS = []
    mapYList = mapDraw['Draw']
    mapXCmdListData = mapDraw['Cmd']
    mapXCmdIdListData = mapDraw['CmdId']
    for mapXListId in range(len(mapYList)):
        mapXList = mapYList[mapXListId]
        nowCmdList = mapXCmdListData[mapXListId]
        nowCmdIdList = mapXCmdIdListData[mapXListId]
        cmdListStr = ''.join(nowCmdList)
        EraPrint.p(TextHandle.align(mapXList + cmdListStr, 'center', True),
                   richTextJudge=False)
        i = 0
        while i in range(len(mapXList)):
            if nowCmdIdList != []:
                while i == nowCmdIdList[0]:
                    if nowCmdList[0] == characterNowSceneId:
                        EraPrint.p(nowCmdList[0],
                                   'nowmap',
                                   richTextJudge=False)
                        inputS.append(None)
                    else:
                        PyCmd.pcmd(nowCmdList[0], nowCmdList[0], None)
                        inputS.append(nowCmdList[0])
                    nowCmdList = nowCmdList[1:]
                    nowCmdIdList = nowCmdIdList[1:]
                    if nowCmdList == []:
                        break
                if nowCmdIdList != []:
                    EraPrint.p(mapXList[i:nowCmdIdList[0]])
                    i = nowCmdIdList[0]
                else:
                    EraPrint.p(mapXList[i:])
                    i = len(mapXList)
            else:
                EraPrint.p(mapXList[i:])
                i = len(mapXList)
        EraPrint.p('\n')
    return inputS
Exemple #4
0
def lcp(sleepTime:float,string='',style='standard'):
    '''
    将多行文本以居中的对齐方式进行逐字绘制
    Keyword arguments:
    sleepTime -- 逐字的间隔时间
    string -- 需要逐字绘制的文本
    style -- 文本的默认样式
    '''
    textWait = CacheContorl.textWait
    if textWait != 0:
        time.sleep(textWait)
    CacheContorl.wframeMouse['wFrameLineState'] = 1
    string = str(string)
    stringlist = string.split('\n')
    width = GameConfig.text_width
    styleNameList = GameConfig.getFontDataList()
    stringCenterList = ''
    for i in range(0, len(styleNameList)):
        styleTextHead = '<' + styleNameList[i] + '>'
        styleTextTail = '</' + styleNameList[i] + '>'
        if styleTextHead in string:
            stringCenter = string.replace(styleTextHead, '')
            stringCenter = stringCenter.replace(styleTextTail, '')
            stringCenterList = stringCenter.split('\n')
        else:
            stringCenterList = stringlist
    for i in range(0,len(stringlist)):
        widthI = int(width) / 2
        countIndex = TextHandle.getTextIndex(stringCenterList[i])
        countI = int(countIndex) / 2
        if CacheContorl.wframeMouse['wFrameRePrint'] == 1:
            p('\n')
            p(' ' * int((widthI - countI)))
            p(stringlist[i])
        else:
            p(' ' * int((widthI - countI)))
            pobo(sleepTime, stringlist[i])
            p('\n')
            if CacheContorl.wframeMouse['wFrameLinesUp'] == 1:
                indexIUp = i + 1
                CacheContorl.wframeMouse['wFrameLinesUp'] = 2
                for indexIUp in range(indexIUp, len(stringlist)):
                    pl(TextHandle.align(stringlist[indexIUp], 'center'), style)
                CacheContorl.wframeMouse['wFrameLineState'] = 2
                break
    CacheContorl.wframeMouse['wFrameRePrint'] = 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