def tryingToRun(self, runCtx): settings = TUTORIAL_SETTINGS.getSettings(runCtx.settings) if not settings.enabled: return else: runCtx.cache = TutorialCache.TutorialCache(BigWorld.player().name, settings.space) reqs = TUTORIAL_SETTINGS.factory(settings.reqs, init=(weakref.proxy(self), runCtx)) if reqs.isEnabled(): if self.__tutorial is None or self.__tutorial._settings.id != settings.id: self.__tutorial = Tutorial(settings) if self.__tutorial._descriptor is None: LOG_ERROR( 'Tutorial descriptor is not valid. Tutorial is not available.' ) return if self.__dispatcher is not None: self.__dispatcher.stop() self.__dispatcher = None self.__dispatcher = TUTORIAL_SETTINGS.factory( settings.dispatcher) self.__dispatcher.start(runCtx) self.__tutorial.setDispatcher(weakref.proxy(self.__dispatcher)) reqs.process() return
def run(self, ctx): self._cache = ctx.cache if self._cache is None: LOG_ERROR('Cache is not init.') return else: self._bonuses = self._ctrlFactory.createBonuses(ctx.bonusCompleted) self._sound = self._ctrlFactory.createSoundPlayer() if not self._tutorialStopped: LOG_ERROR('Tutorial is already running.') return self._gui = TUTORIAL_SETTINGS.factory(self._settings.gui) self._gui.onGUILoaded += self.__onGUILoaded if not self._gui.init(): self._gui.onGUILoaded -= self.__onGUILoaded LOG_ERROR('GUI can not init. Tutorial is stopping.') return LOG_DEBUG('Start training', ctx) self._tutorialStopped = False proxy = weakref.proxy(self) setTutorialProxy(proxy) if self.__resolveInitialChapter(ctx): self._gui.setPlayerXPLevel(self._cache.getPlayerXPLevel()) self._gui.setTrainingRunMode() self._gui.loadConfig(self._descriptor.getGuiFilePath()) self._gui.onMouseClicked += self.__onMouseClicked self._gui.onPageChanging += self.__onPageChanging self.__tryRunFirstState(INITIAL_FLAG.CHAPTER_RESOLVED) return
def run(self, ctx): self._cache = ctx.cache if self._cache is None: LOG_ERROR('Cache is not init.') return else: self._bonuses = self._ctrlFactory.createBonuses(ctx.bonusCompleted) self._sound = self._ctrlFactory.createSoundPlayer() if not self._tutorialStopped: LOG_ERROR('Tutorial is already running.') return self._gui = TUTORIAL_SETTINGS.factory(self._settings.gui) self._gui.onGUILoaded += self.__onGUILoaded if not self._gui.init(): self._gui.onGUILoaded -= self.__onGUILoaded LOG_ERROR('GUI can not init. Tutorial is stopping.') return LOG_DEBUG('Start training', ctx) self._tutorialStopped = False proxy = weakref.proxy(self) setTutorialProxy(proxy) if self.__resolveInitialChapter(): self._gui.setPlayerXPLevel(self._cache.getPlayerXPLevel()) self._gui.setTrainingRunMode() self._gui.loadConfig(self._descriptor.getGuiFilePath()) self._gui.onMouseClicked += self.__onMouseClicked self._gui.onPageChanging += self.__onPageChanging self.__tryRunFirstState(INITIAL_FLAG.CHAPTER_RESOLVED) return
def tryingToRun(self, runCtx): settings = TUTORIAL_SETTINGS.getSettings(runCtx.settings) if not settings.enabled: return runCtx.cache = TutorialCache.TutorialCache(BigWorld.player().name, settings.space) reqs = TUTORIAL_SETTINGS.factory(settings.reqs, init=(weakref.proxy(self), runCtx)) if reqs.isEnabled(): if self.__tutorial is None or self.__tutorial._settings.id != settings.id: self.__tutorial = Tutorial(settings) if self.__tutorial._descriptor is None: LOG_ERROR('Tutorial descriptor is not valid. Tutorial is not available.') return if self.__dispatcher is not None: self.__dispatcher.stop() self.__dispatcher = None self.__dispatcher = TUTORIAL_SETTINGS.factory(settings.dispatcher) self.__dispatcher.start(runCtx) self.__tutorial.setDispatcher(weakref.proxy(self.__dispatcher)) reqs.process()
def __init__(self, settings): super(Tutorial, self).__init__() self._cache = None self.__callbackID = None self._currentChapter = None self._currentState = None self._settings = settings self._ctrlFactory = TUTORIAL_SETTINGS.factory(settings.ctrl) self._descriptor = doc_loader.loadDescriptorData(settings.descriptorPath, settings.exParsers) self._data = None self._tutorialStopped = True self._nextChapter = False self._nextScene = None self._funcScene = None self._funcInfo = None self._flags = None self._vars = None self._effectsQueue = [] self._gui = None self._bonuses = None self._sound = None self._initialized = 0
def __init__(self, settings): super(Tutorial, self).__init__() self._cache = None self.__callbackID = None self._currentChapter = None self._currentState = None self._settings = settings self._ctrlFactory = TUTORIAL_SETTINGS.factory(settings.ctrl) self._descriptor = doc_loader.loadDescriptorData( settings.descriptorPath, settings.exParsers) self._data = None self._tutorialStopped = True self._nextChapter = False self._nextScene = None self._funcScene = None self._funcInfo = None self._flags = None self._vars = None self._effectsQueue = [] self._gui = None self._bonuses = None self._sound = None self._initialized = 0 return