Exemplo n.º 1
0
def seeMapFlow():
    '''
    地图查看流程
    '''
    while (True):
        PyCmd.clr_cmd()
        inputS = []
        mapCmd = SeeMapPanel.seeMapPanel()
        startId1 = len(mapCmd)
        inputS = inputS + mapCmd
        movePathCmdData = SeeMapPanel.seeMovePathPanel()
        movePathCmd = movePathCmdData['inputS']
        movePathList = movePathCmdData['scenePathList']
        showSceneNameListCmd = SeeMapPanel.showSceneNameListPanel()
        seeMapCmd = SeeMapPanel.backScenePanel(startId1)
        inputS = inputS + seeMapCmd + movePathCmd + [showSceneNameListCmd]
        yrn = FlowHandle.askfor_All(inputS)
        backButton = str(startId1)
        nowPosition = CacheContorl.characterData['character'][0].Position
        nowPositionMap = MapHandle.getMapForPath(nowPosition)
        upMapButton = 'Null'
        downMapButton = 'Null'
        if nowPositionMap != [] and CacheContorl.nowMap != []:
            upMapButton = str(int(startId1) + 1)
        if nowPositionMap != CacheContorl.nowMap:
            if upMapButton == 'Null':
                downMapButton = str(int(startId1) + 1)
            else:
                downMapButton = str(int(startId1) + 2)
        nowMap = CacheContorl.nowMap.copy()
        if yrn in mapCmd:
            nowTargetPath = MapHandle.getScenePathForMapSceneId(nowMap, yrn)
            CharacterMove.ownCharcterMove(nowTargetPath)
            break
        elif yrn == backButton:
            CacheContorl.nowMap = []
            CacheContorl.nowFlowId = 'in_scene'
            break
        elif yrn in movePathCmd:
            moveListId = movePathCmd.index(yrn)
            moveId = movePathList[moveListId]
            nowTargetPath = MapHandle.getScenePathForMapSceneId(nowMap, moveId)
            CharacterMove.ownCharcterMove(nowTargetPath)
            break
        elif upMapButton != 'Null' and yrn == upMapButton:
            upMapPath = MapHandle.getMapForPath(nowMap)
            CacheContorl.nowMap = upMapPath
        elif downMapButton != 'Null' and yrn == downMapButton:
            characterPosition = CacheContorl.characterData['character'][
                0].Position
            downMapSceneId = MapHandle.getMapSceneIdForScenePath(
                CacheContorl.nowMap, characterPosition)
            nowMap.append(downMapSceneId)
            CacheContorl.nowMap = nowMap
        elif yrn == showSceneNameListCmd:
            PanelStateHandle.panelStateChange(showSceneNameListCmd)
Exemplo n.º 2
0
def differenceMapMove(characterId, targetScene):
    nowPosition = CacheContorl.characterData['character'][characterId][
        'Position']
    isAffiliation = MapHandle.judgeSceneIsAffiliation(nowPosition, targetScene)
    nowTruePosition = MapHandle.getScenePathForTrue(nowPosition)
    if isAffiliation == '0':
        nowTrueAffiliation = MapHandle.judgeSceneIsAffiliation(
            nowTruePosition, targetScene)
        if nowTrueAffiliation == '0':
            nowTrueMap = MapHandle.getMapForPath(nowTruePosition)
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
                nowTrueMap, nowPosition)
            return identicalMapMove(characterId, nowTrueMap, nowMapSceneId,
                                    '0')
        elif nowTrueAffiliation == '1':
            nowMap = MapHandle.getMapForPath(targetScene)
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
                nowMap, nowPosition)
            return identicalMapMove(characterId, nowMap, nowMapSceneId, '0')
    elif isAffiliation == '1':
        nowMap = MapHandle.getMapForPath(nowPosition)
        nowTargetMapSceneId = MapHandle.getMapSceneIdForScenePath(
            nowMap, targetScene)
        return identicalMapMove(characterId, nowMap, '0', nowTargetMapSceneId)
    else:
        nowTrueMap = MapHandle.getMapForPath(nowTruePosition)
        if nowTrueMap == []:
            nowTargetMapSceneId = MapHandle.getMapSceneIdForScenePath(
                [], targetScene)
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
                [], nowTruePosition)
            return identicalMapMove(characterId, [], nowMapSceneId,
                                    nowTargetMapSceneId)
        else:
            relationMapList = MapHandle.getRelationMapListForScenePath(
                nowTruePosition)
            nowSceneRealMap = relationMapList[-1]
            commonMap = MapHandle.getCommonMapForScenePath(
                nowTruePosition, targetScene)
            realMapInMap = MapHandle.getMapForPath(nowSceneRealMap)
            targetMapSceneId = MapHandle.getMapSceneIdForScenePath(
                commonMap, targetScene)
            if nowSceneRealMap == commonMap:
                nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
                    commonMap, nowTruePosition)
            elif realMapInMap == commonMap:
                nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
                    commonMap, nowSceneRealMap)
            identicalMapMove(characterId, commonMap, nowMapSceneId,
                             targetMapSceneId)
Exemplo n.º 3
0
def getInScene_func():
    '''
    用于进入场景界面的流程
    '''
    PyCmd.clr_cmd()
    scenePath = CacheContorl.characterData['character'][0].Position
    scenePathStr = MapHandle.getMapSystemPathStrForList(scenePath)
    MapHandle.sortSceneCharacterId(scenePathStr)
    CacheContorl.nowMap = MapHandle.getMapForPath(scenePath)
    sceneData = CacheContorl.sceneData[scenePathStr].copy()
    sceneCharacterList = sceneData['SceneCharacterData']
    if 0 not in sceneCharacterList:
        characterIdList = [0]
        sceneCharacterList = sceneCharacterList + characterIdList
        CacheContorl.sceneData[scenePathStr][
            'SceneCharacterData'] = sceneCharacterList
    if len(sceneCharacterList
           ) > 1 and CacheContorl.characterData['characterId'] == 0:
        nowNameList = MapHandle.getSceneCharacterNameList(scenePathStr)
        nowNameList.remove(CacheContorl.characterData['character'][0].Name)
        CacheContorl.characterData[
            'characterId'] = MapHandle.getCharacterIdByCharacterName(
                nowNameList[0], scenePathStr)
        if CacheContorl.oldCharacterId != 0:
            CacheContorl.characterData[
                'characterId'] = CacheContorl.oldCharacterId
            CacheContorl.oldCharacterId = 0
    if len(sceneCharacterList) > 1:
        seeScene_func(True)
    else:
        seeScene_func(False)
Exemplo n.º 4
0
def seeScene_func(judge):
    inputS = []
    InScenePanel.seeScenePanel()
    if judge == '0':
        inputS = inputS + InScenePanel.seeSceneCharacterListPanel()
    InScenePanel.changeSceneCharacterListPanel()
    scenePath = CacheContorl.characterData['character']['0']['Position']
    sceneCharacterNameList = MapHandle.getSceneCharacterNameList(scenePath)
    if len(sceneCharacterNameList) == 1:
        CacheContorl.characterData['characterId'] = '0'
    InScenePanel.seeCharacterInfoPanel()
    inSceneCmdList1 = InScenePanel.inSceneButtonPanel()
    inputS = inputS + inSceneCmdList1
    startId1 = len(inSceneCmdList1)
    yrn = GameInit.askfor_All(inputS)
    PyCmd.clr_cmd()
    if yrn in sceneCharacterNameList:
        CacheContorl.characterData[
            'characterId'] = MapHandle.getCharacterIdByCharacterName(
                yrn, scenePath)
        seeScene_func(judge)
    elif yrn == '0':
        from script.Flow import SeeMap
        nowMap = MapHandle.getMapForPath(
            CacheContorl.characterData['character']['0']['Position'])
        CacheContorl.nowMap = nowMap
        SeeMap.seeMapFlow()
    elif yrn == '1':
        SeeCharacterAttr.seeAttrOnEveryTime_func('InScenePanel')
    elif yrn == '2':
        CacheContorl.characterData['characterId'] = '0'
        SeeCharacterAttr.seeAttrOnEveryTime_func('InScenePanel')
Exemplo n.º 5
0
def seeMapFlow():
    PyCmd.clr_cmd()
    inputS = []
    mapCmd = SeeMapPanel.seeMapPanel()
    startId1 = len(mapCmd)
    inputS = inputS + mapCmd
    movePathCmdData = SeeMapPanel.seeMovePathPanel()
    movePathCmd = movePathCmdData['inputS']
    movePathList = movePathCmdData['scenePathList']
    seeMapCmd = SeeMapPanel.backScenePanel(startId1)
    inputS = inputS + seeMapCmd + movePathCmd
    yrn = FlowHandle.askfor_All(inputS)
    backButton = str(startId1)
    nowPosition = CacheContorl.characterData['character']['0']['Position']
    nowPositionMap = MapHandle.getMapForPath(nowPosition)
    upMapButton = 'Null'
    downMapButton = 'Null'
    if nowPositionMap != [] and CacheContorl.nowMap != []:
        upMapButton = str(int(startId1) + 1)
    if nowPositionMap != CacheContorl.nowMap:
        if upMapButton == 'Null':
            downMapButton = str(int(startId1) + 1)
        else:
            downMapButton = str(int(startId1) + 2)
    nowMap = CacheContorl.nowMap
    if yrn in mapCmd:
        nowTargetPath = MapHandle.getScenePathForMapSceneId(nowMap,yrn)
        CharacterMove.ownCharcterMove(nowTargetPath)
    elif yrn == backButton:
        CacheContorl.nowMap = []
        import script.Flow.InScene as inscene
        inscene.getInScene_func()
    elif yrn in movePathCmd:
        moveListId = movePathCmd.index(yrn)
        moveId = movePathList[moveListId]
        nowTargetPath = MapHandle.getScenePathForMapSceneId(nowMap,moveId)
        CharacterMove.ownCharcterMove(nowTargetPath)
    elif upMapButton != 'Null' and yrn == upMapButton:
        upMapPath = MapHandle.getMapForPath(nowMap)
        CacheContorl.nowMap = upMapPath
        seeMapFlow()
    elif downMapButton != 'Null' and yrn == downMapButton:
        characterPosition = CacheContorl.characterData['character']['0']['Position']
        downMapSceneId = MapHandle.getMapSceneIdForScenePath(CacheContorl.nowMap,characterPosition)
        downMapPath = nowMap.append(downMapSceneId)
        CacheContorl.nowMap = downMapPath
        seeMapFlow()
Exemplo n.º 6
0
def differenceMapMove(characterId:str,targetScene:list) -> 'MoveEnd:str_Null,str_End,list':
    '''
    角色跨地图层级移动
    Keyword arguments:
    characterId -- 角色id
    targetScene -- 寻路目标场景(在地图系统下的绝对坐标)
    '''
    nowPosition = CacheContorl.characterData['character'][characterId].Position
    isAffiliation = MapHandle.judgeSceneIsAffiliation(nowPosition,targetScene)
    nowTruePosition = MapHandle.getScenePathForTrue(nowPosition)
    mapDoorData = MapHandle.getMapDoorDataForScenePath(MapHandle.getMapSystemPathStrForList(nowTruePosition))
    doorScene = '0'
    nowTrueMap = MapHandle.getMapForPath(nowTruePosition)
    nowTrueMapMapSystemStr = MapHandle.getMapSystemPathStrForList(nowTrueMap)
    if isAffiliation == 'subordinate':
        nowTrueAffiliation = MapHandle.judgeSceneIsAffiliation(nowTruePosition,targetScene)
        if nowTrueAffiliation == 'subordinate':
            if mapDoorData != {}:
                doorScene = mapDoorData[nowTrueMapMapSystemStr]['Door']
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath(nowTrueMap,nowPosition)
            return identicalMapMove(characterId,nowTrueMap,nowMapSceneId,doorScene)
        elif nowTrueAffiliation == 'superior':
            nowMap = MapHandle.getMapForPath(targetScene)
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath(nowMap,nowPosition)
            return identicalMapMove(characterId,nowMap,nowMapSceneId,doorScene)
    else:
        if nowTrueMap == []:
            nowTargetMapSceneId = MapHandle.getMapSceneIdForScenePath([],targetScene)
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath([],nowTruePosition)
            return identicalMapMove(characterId,[],nowMapSceneId,nowTargetMapSceneId)
        else:
            relationMapList = MapHandle.getRelationMapListForScenePath(nowTruePosition)
            nowSceneRealMap = relationMapList[-1]
            commonMap = MapHandle.getCommonMapForScenePath(nowTruePosition,targetScene)
            realMapInMap = MapHandle.getMapForPath(nowSceneRealMap)
            targetMapSceneId = MapHandle.getMapSceneIdForScenePath(commonMap,targetScene)
            if nowSceneRealMap == commonMap:
                nowMapSceneId = MapHandle.getMapSceneIdForScenePath(commonMap,nowTruePosition)
            elif realMapInMap == commonMap:
                nowMapSceneId = MapHandle.getMapSceneIdForScenePath(commonMap,nowSceneRealMap)
            else:
                nowMapSceneId =MapHandle.getMapSceneIdForScenePath(nowTrueMap,nowTruePosition)
                targetMapSceneId = '0'
            return identicalMapMove(characterId,commonMap,nowMapSceneId,targetMapSceneId)
Exemplo n.º 7
0
def getInScene_func():
    PyCmd.clr_cmd()
    scenePath = CacheContorl.characterData['character']['0']['Position']
    MapHandle.sortSceneCharacterId(scenePath)
    CacheContorl.nowMap = MapHandle.getMapForPath(scenePath)
    scenePathStr = MapHandle.getMapSystemPathStrForList(scenePath)
    sceneData = CacheContorl.sceneData[scenePathStr].copy()
    sceneCharacterList = sceneData['SceneCharacterData']
    if '0' not in sceneCharacterList:
        characterIdList = ['0']
        sceneCharacterList = sceneCharacterList + characterIdList
        CacheContorl.sceneData[scenePathStr][
            'SceneCharacterData'] = sceneCharacterList
    if len(sceneCharacterList) > 1:
        CacheContorl.characterData['characterId'] = sceneCharacterList[0]
        seeScene_func('0')
    else:
        seeScene_func('1')
Exemplo n.º 8
0
def backScenePanel(startId):
    seeMapCmd = []
    nowPosition = CacheContorl.characterData['character']['0']['Position']
    nowMap = MapHandle.getMapForPath(nowPosition)
    cmdData = TextLoading.getTextData(TextLoading.cmdPath,
                                      CmdButtonQueue.seemap)
    seeMapCmd.append(cmdData[0])
    if nowMap != [] and CacheContorl.nowMap != []:
        seeMapCmd.append(cmdData[1])
    if nowMap != CacheContorl.nowMap:
        seeMapCmd.append(cmdData[2])
    mapCmdList = CmdButtonQueue.optionint(cmdList=None,
                                          cmdListData=seeMapCmd,
                                          cmdColumn=3,
                                          askfor=False,
                                          cmdSize='center',
                                          startId=startId)
    return mapCmdList
Exemplo n.º 9
0
def backScenePanel(startId: str) -> list:
    '''
    查看场景页面基础命令绘制面板
    Keyword arguments:
    startId -- 面板命令起始id
    '''
    seeMapCmd = []
    nowPosition = CacheContorl.characterData['character'][0].Position
    nowMap = MapHandle.getMapForPath(nowPosition)
    cmdData = TextLoading.getTextData(TextLoading.cmdPath,
                                      CmdButtonQueue.seemap)
    seeMapCmd.append(cmdData[0])
    if nowMap != [] and CacheContorl.nowMap != []:
        seeMapCmd.append(cmdData[1])
    if nowMap != CacheContorl.nowMap:
        seeMapCmd.append(cmdData[2])
    mapCmdList = CmdButtonQueue.optionint(cmdList=None,
                                          cmdListData=seeMapCmd,
                                          cmdColumn=3,
                                          askfor=False,
                                          cmdSize='center',
                                          startId=startId)
    return mapCmdList
Exemplo n.º 10
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