Esempio n. 1
0
def seeMovePathPanel():
    inputS = []
    nowScene = CacheContorl.characterData['character']['0']['Position']
    nowMap = CacheContorl.nowMap
    nowMapStr = MapHandle.getMapSystemPathStrForList(nowMap)
    mapData = CacheContorl.mapData[nowMapStr]
    movePathInfo = TextLoading.getTextData(TextLoading.messagePath, '27')
    EraPrint.p(movePathInfo)
    EraPrint.p('\n')
    pathEdge = mapData['PathEdge']
    mapSceneId = str(MapHandle.getMapSceneIdForScenePath(nowMap, nowScene))
    scenePath = pathEdge[mapSceneId]
    scenePathList = ValueHandle.dictKeysToList(scenePath)
    try:
        scenePathList.remove(mapSceneId)
    except ValueError:
        pass
    if len(scenePathList) > 0:
        sceneCmd = []
        for scene in scenePathList:
            loadSceneData = MapHandle.getSceneDataForMap(nowMap, scene)
            sceneName = loadSceneData['SceneName']
            sceneCmd.append(sceneName)
        yrn = CmdButtonQueue.optionstr(cmdList=None,
                                       cmdListData=sceneCmd,
                                       cmdColumn=4,
                                       askfor=False,
                                       cmdSize='center')
        inputS = inputS + yrn
    else:
        errorMoveText = TextLoading.getTextData(TextLoading.messagePath, '28')
        EraPrint.p(errorMoveText)
    EraPrint.pline()
    return {'inputS': inputS, 'scenePathList': scenePathList}
Esempio n. 2
0
def characterMove(characterId, targetScene):
    characterId = str(characterId)
    nowPosition = CacheContorl.characterData['character'][characterId][
        'Position']
    sceneHierarchy = MapHandle.judgeSceneAffiliation(nowPosition, targetScene)
    if sceneHierarchy == '0':
        mapPath = MapHandle.getCommonMapForScenePath(nowPosition, targetScene)
        nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
            mapPath, nowPosition)
        targetMapSceneId = MapHandle.getMapSceneIdForScenePath(
            mapPath, targetScene)
        moveEnd = identicalMapMove(characterId, mapPath, nowMapSceneId,
                                   targetMapSceneId)
    else:
        moveEnd = differenceMapMove(characterId, targetScene)
    return moveEnd
Esempio n. 3
0
def characterMove(characterId:str,targetScene:list) -> 'MoveEnd:str_Null,str_End,list':
    '''
    通用角色移动控制
    Keyword arguments:
    characterId -- 角色id
    targetScene -- 寻路目标场景(在地图系统下的绝对坐标)
    '''
    nowPosition = CacheContorl.characterData['character'][characterId].Position
    sceneHierarchy = MapHandle.judgeSceneAffiliation(nowPosition,targetScene)
    if sceneHierarchy == 'common':
        mapPath = MapHandle.getCommonMapForScenePath(nowPosition,targetScene)
        nowMapSceneId = MapHandle.getMapSceneIdForScenePath(mapPath,nowPosition)
        targetMapSceneId = MapHandle.getMapSceneIdForScenePath(mapPath,targetScene)
        moveEnd = identicalMapMove(characterId,mapPath,nowMapSceneId,targetMapSceneId)
    else:
        moveEnd = differenceMapMove(characterId,targetScene)
    return moveEnd
Esempio n. 4
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)
Esempio n. 5
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)
Esempio n. 6
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()
Esempio n. 7
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)
Esempio n. 8
0
def seeMovePathPanel() -> dict:
    '''
    当前场景可直接通往的移动路径绘制面板
    '''
    inputS = []
    nowScene = CacheContorl.characterData['character'][0].Position
    nowMap = CacheContorl.nowMap
    nowMapStr = MapHandle.getMapSystemPathStrForList(nowMap)
    mapData = CacheContorl.mapData[nowMapStr]
    movePathInfo = TextLoading.getTextData(TextLoading.messagePath, '27')
    EraPrint.p(movePathInfo)
    EraPrint.p('\n')
    pathEdge = mapData['PathEdge']
    mapSceneId = str(MapHandle.getMapSceneIdForScenePath(nowMap, nowScene))
    scenePath = pathEdge[mapSceneId]
    scenePathList = list(scenePath.keys())
    if mapSceneId in scenePathList:
        remove(mapSceneId)
    if len(scenePathList) > 0:
        sceneCmd = []
        for scene in scenePathList:
            nowMapStr = MapHandle.getMapSystemPathStrForList(nowMap)
            loadSceneData = MapHandle.getSceneDataForMap(nowMapStr, scene)
            sceneName = loadSceneData['SceneName']
            sceneCmd.append(sceneName)
        yrn = CmdButtonQueue.optionstr(cmdList=None,
                                       cmdListData=sceneCmd,
                                       cmdColumn=4,
                                       askfor=False,
                                       cmdSize='center')
        inputS = inputS + yrn
    else:
        errorMoveText = TextLoading.getTextData(TextLoading.messagePath, '28')
        EraPrint.p(errorMoveText)
    EraPrint.pline()
    return {'inputS': inputS, 'scenePathList': scenePathList}