当前位置: 首页>>代码示例>>Python>>正文


Python context.GlobalStorage类代码示例

本文整理汇总了Python中tutorial.control.context.GlobalStorage的典型用法代码示例。如果您正苦于以下问题:Python GlobalStorage类的具体用法?Python GlobalStorage怎么用?Python GlobalStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GlobalStorage类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: stop

 def stop(self, finished = False, reason = TUTORIAL_STOP_REASON.DEFAULT):
     if self._tutorialStopped:
         return
     else:
         if self.__callbackID is not None:
             BigWorld.cancelCallback(self.__callbackID)
             self.__callbackID = None
         if self._funcScene is not None:
             self._funcScene.leave()
         if self._data is not None:
             self._data.clear()
         GlobalStorage.clearFlags()
         if self._sound is not None:
             self._sound.stop()
         self._sound = None
         if self._gui is not None:
             self._gui.fini(isItemsRevert=self._descriptor.isItemsRevertIfStop(reason))
         self._gui = None
         if finished:
             self._cache.setFinished(True).write()
         else:
             self._cache.update(self._currentChapter, self._flags.getDict() if self._flags else None)
         self._cache = None
         g_tutorialWeaver.clear()
         clearTutorialProxy()
         self.removeEffectsInQueue()
         self._nextChapter = False
         self._tutorialStopped = True
         self._initialized = 0
         return
开发者ID:webiumsk,项目名称:WoT,代码行数:30,代码来源:__init__.py

示例2: run

 def run(self, dispatcher, ctx):
     self._cache = ctx.cache
     if self._cache is None:
         LOG_ERROR('Cache is not init.')
         return False
     else:
         self._bonuses = self._ctrlFactory.createBonuses(ctx.bonusCompleted)
         self._sound = self._ctrlFactory.createSoundPlayer()
         GlobalStorage.setFlags(ctx.globalFlags)
         if not self._stopped:
             LOG_ERROR('Tutorial is already running.')
             return False
         self._gui = createTutorialElement(self._settings.gui)
         self._gui.setDispatcher(dispatcher)
         self._gui.onGUILoaded += self.__onGUILoaded
         if not self._gui.init():
             self._gui.onGUILoaded -= self.__onGUILoaded
             self._gui.setDispatcher(None)
             LOG_ERROR('GUI can not init. Tutorial is stopping.')
             return False
         LOG_DEBUG('Start training', ctx)
         self._stopped = False
         proxy = weakref.proxy(self)
         setTutorialProxy(proxy)
         if self.__resolveInitialChapter(ctx):
             self._gui.loadConfig(self._descriptor.getGuiFilePath())
             self._gui.onGUIInput += self.__onGUIInput
             self._gui.onPageChanging += self.__onPageChanging
             self._gui.onItemFound += self.__onItemFound
             self._gui.onItemLost += self.__onItemLost
             self.__tryRunFirstState(INITIAL_FLAG.CHAPTER_RESOLVED)
         self.onStarted()
         return True
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:33,代码来源:__init__.py

示例3: run

 def run(self, settingsID, state = None):
     """
     Try to run tutorial.
     
     :param settingsID: string containing settings ID of required tutorial.
     :param state: dict(
                     reloadIfRun : bool - just reload tutorial if it's running,
                     afterBattle : bool - tutorial should load scenario that is played
                             when player left battle,
                     initialChapter : str - name of initial chapter,
                     restoreIfRun: bool - current tutorial will be started again
                             if required tutorial stop.
                     globalFlags : dict(GLOBAL_FLAG.* : bool,)
             )
     :return: True if tutorial has started, otherwise - False.
     """
     settings = self.__settings.getSettings(settingsID)
     if settings is None:
         LOG_ERROR('Can not find settings', settingsID)
         return False
     else:
         if state is None:
             state = {}
         reloadIfRun = state.pop('reloadIfRun', False)
         restoreIfRun = state.pop('restoreIfRun', False)
         isStopForced = state.pop('isStopForced', False)
         if self.__tutorial is not None and not self.__tutorial.isStopped():
             isCurrent = self.__tutorial.getID() == settings.id
             if reloadIfRun and isCurrent:
                 if isStopForced:
                     self.__doStop()
                 else:
                     GlobalStorage.setFlags(state.get('globalFlags', {}))
                     self.__tutorial.invalidateFlags()
                     return True
             elif restoreIfRun and not isCurrent:
                 self.__restoreID = self.__tutorial.getID()
                 self.__doStop()
             else:
                 LOG_ERROR('Tutorial already is running', self.__tutorial.getID())
                 return False
         if self.__dispatcher is None:
             self.__setDispatcher(settings.dispatcher)
         cache = _cache.TutorialCache(BigWorld.player().name)
         cache.read()
         state.setdefault('isAfterBattle', self.__afterBattle)
         state.setdefault('restart', True)
         result = self.__doRun(settings, RunCtx(cache, **state), byRequest=True)
         if not result:
             self.__restoreID = None
         return result
开发者ID:webiumsk,项目名称:WOT0.10.0,代码行数:51,代码来源:loader.py

示例4: __init__

 def __init__(self, **kwargs):
     super(RunCtx, self).__init__()
     self.cache = None
     self.restart = kwargs.get('restart', False)
     self.isInRandomQueue = kwargs.get('isInRandomQueue', False)
     self.isInPrebattle = kwargs.get('prebattleID', 0L) > 0L
     self.isInTutorialQueue = GlobalStorage(GLOBAL_FLAG.IN_QUEUE, kwargs.get('isInTutorialQueue', False))
     self.settings = kwargs.get('settings', TUTORIAL_SETTINGS.DEFAULT_SETTINGS)
     self.bonusCompleted = kwargs.get('bonusCompleted', 0)
     return
开发者ID:19colt87,项目名称:WOTDecompiled,代码行数:10,代码来源:loader.py

示例5: getImagePaths

 def getImagePaths(self, varSummary):
     path = varSummary.get(self._pathRef)
     originPath = []
     altPath = []
     if path and len(path):
         originPath.append(path)
         altPath.append(path)
     else:
         return (self._image, self._image)
     default = varSummary.get(self._defaultRef)
     if default and len(default):
         from tutorial.control.context import GLOBAL_VAR, GlobalStorage
         vehTypeName = GlobalStorage(GLOBAL_VAR.PLAYER_VEHICLE_NAME, default).value()
         if vehTypeName and default != vehTypeName:
             originPath.append(vehTypeName.replace(':', '_'))
     originPath.append(self._image)
     altPath.append(self._image)
     if originPath != altPath:
         result = ('/'.join(originPath), '/'.join(altPath))
     else:
         result = ('/'.join(originPath), '')
     return result
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:22,代码来源:chapter.py

示例6: __init__

 def __init__(self, **kwargs):
     super(RunCtx, self).__init__()
     self.cache = None
     self.isFirstStart = False
     self.databaseID = kwargs.get('databaseID', 0L)
     self.restart = kwargs.get('restart', False)
     self.isInRandomQueue = kwargs.get('isInRandomQueue', False)
     self.isInPrebattle = isInPrebattle()
     self.isInTutorialQueue = GlobalStorage(GLOBAL_FLAG.IN_QUEUE, kwargs.get('isInTutorialQueue', False))
     self.isInHistoricalQueue = kwargs.get('isInHistoricalQueue', False)
     self.isInEventBattlesQueue = kwargs.get('isInEventBattles', False)
     self.settings = kwargs.get('settings', TUTORIAL_SETTINGS.DEFAULT_SETTINGS)
     self.bonusCompleted = kwargs.get('bonusCompleted', 0)
开发者ID:wotmods,项目名称:WOTDecompiled,代码行数:13,代码来源:loader.py

示例7: stop

 def stop(self, finished = False):
     """
     Stops the process of training.
     :param finished: if it equals True than training completed.
     """
     if self._stopped:
         return
     else:
         if self.__callbackID is not None:
             BigWorld.cancelCallback(self.__callbackID)
             self.__callbackID = None
         if self._funcScene is not None:
             self._funcScene.leave()
         if self._data is not None:
             self._data.clear()
         GlobalStorage.clearFlags()
         if self._sound is not None:
             self._sound.stop()
         self._sound = None
         if self._gui is not None:
             self._gui.fini()
         self._gui = None
         if finished:
             self._cache.setFinished(True).write()
         else:
             self._cache.update(self._currentChapter, self._flags.getDict() if self._flags else None)
         self._cache = None
         g_tutorialWeaver.clear()
         clearTutorialProxy()
         self.removeEffectsInQueue()
         self._nextChapter = False
         self._stopped = True
         self._initialized = 0
         self._triggeredEffects.clear()
         self.onStopped()
         return
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:36,代码来源:__init__.py

示例8: prepare

 def prepare(self, ctx):
     clientCtx = BattleClientCtx.fetch()
     ctx.bonusCompleted = clientCtx.completed
     GlobalStorage.clearVars()
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:4,代码来源:context.py

示例9: RunCtx

class RunCtx(object):
    __slots__ = ['cache',
     'isFirstStart',
     'databaseID',
     'afterBattle',
     'restart',
     'isInRandomQueue',
     'isInPrebattle',
     'isInTutorialQueue',
     'settings',
     'bonusCompleted',
     'isInHistoricalQueue',
     'isInEventBattlesQueue']

    def __init__(self, **kwargs):
        super(RunCtx, self).__init__()
        self.cache = None
        self.isFirstStart = False
        self.databaseID = kwargs.get('databaseID', 0L)
        self.restart = kwargs.get('restart', False)
        self.isInRandomQueue = kwargs.get('isInRandomQueue', False)
        self.isInPrebattle = isInPrebattle()
        self.isInTutorialQueue = GlobalStorage(GLOBAL_FLAG.IN_QUEUE, kwargs.get('isInTutorialQueue', False))
        self.isInHistoricalQueue = kwargs.get('isInHistoricalQueue', False)
        self.isInEventBattlesQueue = kwargs.get('isInEventBattles', False)
        self.settings = kwargs.get('settings', TUTORIAL_SETTINGS.DEFAULT_SETTINGS)
        self.bonusCompleted = kwargs.get('bonusCompleted', 0)
        return

    def __repr__(self):
        return 'RunCtx(settings = {0:>s}, bonuses = {1:n}, cache = {2!r:s},  inPrb = {3!r:s}, inQueue = {4!r:s})'.format(self.settings, self.bonusCompleted, self.cache, self.isInPrebattle, self.isInTutorialQueue.value())
开发者ID:webiumsk,项目名称:WoT,代码行数:31,代码来源:loader.py

示例10: triggerEffect

 def triggerEffect(self):
     GlobalStorage.setValue(self._effect.getTargetID(), False)
开发者ID:krzcho,项目名称:WOTDecompiled,代码行数:2,代码来源:functional.py

示例11: process

 def process(self):
     loader, ctx = self._flush()
     clientCtx = BattleClientCtx.fetch()
     ctx.bonusCompleted = clientCtx.completed
     GlobalStorage.clearVars()
     loader._doRun(ctx)
开发者ID:wotmods,项目名称:WOTDecompiled,代码行数:6,代码来源:context.py


注:本文中的tutorial.control.context.GlobalStorage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。