Ejemplo n.º 1
0
def acknowledgmentAttributeAns(inputList):
    playerId = CacheContorl.playObject['objectId']
    yrn = GameInit.askfor_All(inputList)
    showAttrHandleData = TextLoading.getTextData(TextLoading.cmdId,'seeAttrPanelHandle')
    PyCmd.clr_cmd()
    if yrn in panelList:
        PanelStateHandle.panelStateChange(yrn)
        acknowledgmentAttribute_func()
    elif yrn == '0':
        GameTime.initTime()
        AttrCalculation.setAttrOver(playerId)
        CharacterHandle.initCharacterList()
        SeePlayerAttrPanel.initShowAttrPanelList()
        playerPosition = CacheContorl.playObject['object'][playerId]['Position']
        MapHandle.playerMoveScene('0', playerPosition, playerId)
        import script.Flow.Main as mainframe
        mainframe.mainFrame_func()
    elif yrn == '1':
        CacheContorl.wframeMouse['wFrameRePrint'] = 1
        EraPrint.pnextscreen()
        SeePlayerAttrPanel.initShowAttrPanelList()
        import Design.StartFlow as mainflow
        mainflow.main_func()
    elif yrn in showAttrHandleData:
        index = showAttrHandleData.index(yrn)
        index = str(index)
        CacheContorl.panelState['AttrShowHandlePanel'] = index
        acknowledgmentAttribute_func()
Ejemplo n.º 2
0
def seeScene_func(judge):
    inputS = []
    InScenePanel.seeScenePanel()
    if judge == '0':
        inputS = inputS + InScenePanel.seeScenePlayerListPanel()
    else:
        pass
    sceneId = CacheContorl.playObject['object']['0']['Position']
    scenePlayerNameList = MapHandle.getScenePlayerNameList(sceneId)
    if len(scenePlayerNameList) == 1:
        CacheContorl.playObject['objectId'] = '0'
    else:
        pass
    InScenePanel.seeObjectInfoPanel()
    inSceneCmdList1 = InScenePanel.inSceneButtonPanel()
    inputS = inputS + inSceneCmdList1
    startId1 = len(inSceneCmdList1)
    yrn = GameInit.askfor_All(inputS)
    PyCmd.clr_cmd()
    if yrn in scenePlayerNameList:
        CacheContorl.playObject[
            'objectId'] = MapHandle.getPlayerIdByPlayerName(yrn, sceneId)
        seeScene_func(judge)
    elif yrn == '0':
        import Flow.SeeMap as seemap
        seemap.seeMapFlow()
    elif yrn == '1':
        SeePlayerAttr.seeAttrOnEveryTime_func('InScenePanel')
    elif yrn == '2':
        CacheContorl.playObject['objectId'] = '0'
        SeePlayerAttr.seeAttrOnEveryTime_func('InScenePanel')
Ejemplo n.º 3
0
def seeMovePathPanel():
    inputS = []
    sceneId = CacheContorl.playObject['object']['0']['Position']
    mapId = MapHandle.getMapIdForScene(sceneId)
    mapData = CacheContorl.mapData['MapData'][mapId]
    movePathInfo = TextLoading.getTextData(TextLoading.messageId, '27')
    EraPrint.p(movePathInfo)
    EraPrint.p('\n')
    pathEdge = mapData['PathEdge']
    mapSceneId = str(MapHandle.getMapSceneIdForSceneId(mapId, sceneId))
    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(mapId, 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.messageId, '28')
        EraPrint.p(errorMoveText)
    EraPrint.pline()
    return {'inputS': inputS, 'scenePathList': scenePathList}
Ejemplo n.º 4
0
def seeMapPanel():
    inputS = []
    titleText = TextLoading.getTextData(TextLoading.stageWordId, '78')
    EraPrint.plt(titleText)
    sceneId = CacheContorl.playObject['object']['0']['Position']
    mapId = MapHandle.getMapIdForScene(sceneId)
    inputS = inputS + MapHandle.printMap(mapId)
    return inputS
Ejemplo n.º 5
0
def initPlayerPosition():
    characterListPath = os.path.join(gamepath, 'data', language, 'character')
    characterList = GameData.getPathList(characterListPath)
    for i in range(0, len(characterList)):
        playerIdS = str(i + 1)
        characterDataName = characterList[i]
        characterAttrTemPath = os.path.join(characterListPath, characterDataName, 'AttrTemplate.json')
        characterData = GameData._loadjson(characterAttrTemPath)
        characterInitPosition = characterData['Position']
        characterPosition = CacheContorl.playObject['object'][playerIdS]['Position']
        MapHandle.playerMoveScene(characterPosition, characterInitPosition, playerIdS)
    pass
Ejemplo n.º 6
0
def establishSave(saveId):
    playerData = CacheContorl.playObject
    gameTime = CacheContorl.gameTime
    gameVerson = GameConfig.verson
    scaneData = CacheContorl.sceneData
    MapHandle.initScanePlayerData()
    data = {
        "playerData": playerData,
        "gameTime": gameTime,
        "gameVerson": gameVerson,
        "sceneData": scaneData
    }
    filepath = getSavefilePath(saveId)
    with open(filepath, 'wb') as f:
        pickle.dump(data, f)
Ejemplo n.º 7
0
def seeAttrOnEveryTime_func(oldPanel,tooOldFlow = None):
    objectId = CacheContorl.playObject['objectId']
    if oldPanel == 'InScenePanel':
        sceneId = CacheContorl.playObject['object']['0']['Position']
        objectIdList = MapHandle.getScenePlayerIdList(sceneId)
    else:
        objectIdList = ValueHandle.dictKeysToList(CacheContorl.playObject['object'])
    objectIdIndex = objectIdList.index(objectId)
    inputS = []
    seeAttrList = seeAttrInEveryTime_func()
    inputS = inputS + seeAttrList
    askSeeAttr = SeePlayerAttrPanel.askForSeeAttr()
    inputS = inputS + askSeeAttr
    yrn = GameInit.askfor_All(inputS)
    PyCmd.clr_cmd()
    showAttrHandleData = TextLoading.getTextData(TextLoading.cmdId, 'seeAttrPanelHandle')
    objectMax = objectIdList[len(objectIdList) - 1]
    if yrn in showAttrHandleData:
        index = showAttrHandleData.index(yrn)
        index = str(index)
        CacheContorl.panelState['AttrShowHandlePanel'] = index
        seeAttrOnEveryTime_func(oldPanel,tooOldFlow)
    elif yrn in panelList:
        PanelStateHandle.panelStateChange(yrn)
        seeAttrOnEveryTime_func(oldPanel,tooOldFlow)
    elif yrn == '0':
        if objectIdIndex == 0:
            CacheContorl.playObject['objectId'] = objectMax
            seeAttrOnEveryTime_func(oldPanel,tooOldFlow)
        else:
            playerId = objectIdList[objectIdIndex - 1]
            CacheContorl.playObject['objectId'] = playerId
            seeAttrOnEveryTime_func(oldPanel,tooOldFlow)
    elif yrn == '1':
        if oldPanel == 'MainFramePanel':
            import Flow.Main as mainframe
            SeePlayerAttrPanel.initShowAttrPanelList()
            CacheContorl.playObject['objectId'] = '0'
            mainframe.mainFrame_func()
        elif oldPanel == 'SeePlayerListPanel':
            SeePlayerAttrPanel.initShowAttrPanelList()
            import Flow.SeePlayerList as seeplayerlist
            seeplayerlist.seePlayerList_func(tooOldFlow)
        elif oldPanel == 'InScenePanel':
            SeePlayerAttrPanel.initShowAttrPanelList()
            import Flow.InScene as inscene
            CacheContorl.playObject['objectId'] = '0'
            inscene.getInScene_func()
    elif yrn == '2':
        if objectId == objectMax:
            objectId = objectIdList[0]
            CacheContorl.playObject['objectId'] = objectId
            seeAttrOnEveryTime_func(oldPanel,tooOldFlow)
        else:
            objectId = objectIdList[objectIdIndex  + 1]
            CacheContorl.playObject['objectId'] = objectId
            seeAttrOnEveryTime_func(oldPanel,tooOldFlow)
    pass
Ejemplo n.º 8
0
def init(main_flow):
    global def_style
    IoInit.clear_screen()
    IoInit.clearorder()
    FlowHandle.cmd_clear()
    # 载入数据库数据
    GameData.init()
    # 事件载入
    Event.load_event_file()
    # 载入按键监听
    KeyListionEvent.onWFrameListion()
    # 设置背景颜色
    IoInit.set_background(GameData.gamedata()['core_cfg']['background_color'])
    # 初始化字体
    IoInit.init_style()
    # 初始化地图数据
    MapHandle.initSceneData()
    MapHandle.initMapData()

    FlowHandle.reset_func = reset

    global _main_flow
    _main_flow = main_flow

    _have_run = False

    def run_main_flow():
        nonlocal _have_run
        while True:
            if _have_run == False:
                main_flow()
                _have_run = True
            askfor_order()
            FlowHandle.call_default_flow()
            if FlowHandle.exit_flag == True:
                break

    run_main_flow()
Ejemplo n.º 9
0
def playerMove(targetScene):
    playerPosition = CacheContorl.playObject['object']['0']['Position']
    intPlayerPosition = int(playerPosition)
    intTargetScene = int(targetScene)
    if intPlayerPosition == intTargetScene:
        InScene.getInScene_func()
    else:
        mapId = MapHandle.getMapIdForScene(playerPosition)
        nowSceneId = MapHandle.getMapSceneIdForSceneId(mapId, playerPosition)
        pathData = MapHandle.getPathfinding(mapId, nowSceneId, targetScene)
        if pathData == 'End':
            InScene.getInScene_func()
        else:
            targetScenePosition = MapHandle.getSceneIdForMapSceneId(
                mapId, targetScene)
            timeList = pathData['Time']
            MapHandle.playerMoveScene(playerPosition, targetScenePosition, '0')
            GameTime.setSubMinute(timeList[1])
            playerMove(targetScene)