當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。