Exemple #1
0
 def clear(self):
     LOG_DEBUG('_DirectionIndicatorCtrl.clear', hex(id(self)))
     if self.__indicator is not None:
         self.__indicator.remove()
     self.__indicator = None
     from account_helpers.settings_core.SettingsCore import g_settingsCore
     g_settingsCore.onSettingsChanged -= self.__as_onSettingsChanged
     return
Exemple #2
0
 def clear(self):
     LOG_DEBUG('_StaticWorldMarker2D.clear', self.__handle)
     vm = self.__vmRef()
     if vm is not None:
         vm.destroyStaticMarker(self.__handle)
     self.__vmRef = None
     self.__handle = -1
     return
Exemple #3
0
 def isOn(self, stateFlag):
     result = True
     if result:
         self._count += 1
         LOG_DEBUG('Player shot damage', self._count)
         if self._count < self._maxCount:
             result = False
     return result and stateFlag
Exemple #4
0
 def _setFlagValue(self, flagID, value):
     if flagID is None:
         return
     else:
         flags = self._tutorial.getFlags()
         isActive = flags.isActiveFlag(flagID)
         if value:
             if not isActive:
                 flags.activateFlag(flagID)
                 LOG_DEBUG('invalidateFlags from _setFlagValue', flagID,
                           value)
                 self._tutorial.invalidateFlags()
         elif isActive:
             flags.deactivateFlag(flagID)
             LOG_DEBUG('invalidateFlags from _setFlagValue', flagID, value)
             self._tutorial.invalidateFlags()
         return
Exemple #5
0
def getCtx():
    instance = loader.g_loader.tutorial
    ctx = None
    if instance is not None and not instance._tutorialStopped:
        ctx = OffBattleClientCtx.fetch(instance._cache)
    else:
        LOG_DEBUG('Tutorial is not running.')
    return ctx
Exemple #6
0
 def triggerEffect(self):
     data = self.getTarget()
     if _MarkersStorage.hasMarker(data.getID()):
         LOG_DEBUG('Markers is showing', data.getID())
         return
     marker = self.__makeEffect(data)
     if marker is not None:
         _MarkersStorage.addMarker(data.getID(), marker)
Exemple #7
0
 def fetch(cls, *args):
     player = BigWorld.player()
     if player is None or not hasattr(player, 'clientCtx'):
         LOG_DEBUG('Avatar.clientCtx not found', player)
         result = cls._makeDefault()
     else:
         result = cls.makeCtx(player.clientCtx)
     return result
 def __onItemLost(self, itemID):
     if self._funcScene is not None:
         self._funcScene.removeItemFromScene(itemID)
     if self._funcChapterCtx is not None:
         self._funcChapterCtx.onItemLost(itemID)
     LOG_DEBUG('invalidateFlags from __onItemLost', itemID)
     self.invalidateFlags()
     return
Exemple #9
0
 def clear(self):
     LOG_DEBUG('_VehicleMarker.clear', self.__vehicleID)
     if self.__dIndicator is not None:
         self.__dIndicator.clear()
     self.__dIndicator = None
     self.__vehicleID = -1
     self.__minimapRef = None
     self.__period = -1
Exemple #10
0
 def clear(self):
     LOG_DEBUG('_StaticWorldMarker2D.clear', self.__objectID)
     markers2D = self.__markers2D()
     if markers2D is not None and self.__objectID:
         markers2D.delStaticObject(self.__objectID)
     self.__objectID = ''
     self.__markers2D = lambda : None
     return
Exemple #11
0
 def clear(self):
     LOG_DEBUG('_StaticMinimapMarker2D.clear', self.__markerID)
     minimap = self.__minimap()
     if minimap is not None and self.__markerID:
         minimap.delTarget(self.__markerID)
     self.__markerID = ''
     self.__minimap = None
     return
Exemple #12
0
 def stop(self, effectID=None):
     if effectID is not None and effectID != self._greetingID:
         LOG_DEBUG('Greeting is not added', effectID)
         return
     else:
         if self._component is not None:
             self._component.as_hideGreetingS(effectID)
         return
Exemple #13
0
 def leave(self):
     LOG_DEBUG('Leave scene', self._scene.getID())
     if self._mustBeUpdated:
         self._gui.release()
         self._mustBeUpdated = False
     self._actions.clear()
     self._itemsOnScene.clear()
     self._pending = []
Exemple #14
0
 def __init__(self, scene):
     super(FunctionalScene, self).__init__()
     LOG_DEBUG('New functional scene', scene.getID())
     self.__scene = scene
     self.__actions = {}
     self.__dynamicItems = {}
     self.__dynamicItemsOnScene = []
     self._sceneToBeUpdated = True
     self._gui.lock()
Exemple #15
0
def stopCurrentEffect():
    instance = loader.g_loader.tutorial
    if instance and not instance._tutorialStopped:
        if isinstance(instance._currentState, TutorialStateRunEffects
                      ) and instance._currentState._current is not None:
            instance._currentState._current.stop()
    else:
        LOG_DEBUG('Tutorial is not running.')
    return
 def triggerEffect(self):
     targetID = self._effect.getTargetID()
     flags = self._tutorial.getFlags()
     if flags.isActiveFlag(targetID):
         flags.deactivateFlag(targetID)
         LOG_DEBUG('invalidateFlags from FunctionalDeactivateEffect',
                   targetID)
         self._tutorial.invalidateFlags()
     return True
Exemple #17
0
def join(short = None):
    instance = loader.g_loader.tutorial
    if instance is None or instance._tutorialStopped:
        from tutorial.TutorialCache import TutorialCache
        cache = TutorialCache(BigWorld.player().name, TUTORIAL_SETTINGS.BATTLE.space)
        cache.setRefused(False).write()
        if short is not None:
            if short not in _chapters.keys():
                LOG_DEBUG('Chapter not found. Available shot names of chapters are', _chapters.keys())
                return
            chapter, flags = _chapters[short]
            cache.update(chapter, flags)
        else:
            cache.clear()
        BigWorld.player().enqueueTutorial()
    else:
        LOG_DEBUG('Tutorial is running.')
    return
Exemple #18
0
 def _store(self):
     record = self.makeRecord()
     player = BigWorld.player()
     if player is None or not hasattr(player, 'storeClientCtx'):
         LOG_DEBUG('Avatar.storeClientCtx not found', player)
         return False
     else:
         player.storeClientCtx(record)
         return True
Exemple #19
0
 def getSceneID(self):
     sceneID = None
     container = self.app.containerManager.getContainer(ViewTypes.LOBBY_SUB)
     if container is not None:
         pyView = container.getView()
         if pyView is not None:
             sceneID = self.config.getSceneID(pyView.settings.alias)
     LOG_DEBUG('GUI.getSceneID', sceneID)
     return sceneID
 def isConditionOk(self, condition):
     shownHints = self.__settingsCore.serverSettings.getOnceOnlyHintsSettings(
     )
     isHintShown = shownHints.get(condition.getID(), None)
     if isHintShown is None:
         LOG_DEBUG('invalid hintID in condition: ', condition.getID())
         return False
     else:
         return False if isHintShown != condition.isShown() else True
Exemple #21
0
 def _updateScene(self):
     LOG_DEBUG('Update scene.')
     effects = filter(self.__areAllConditionsOk, self._scene.getEffects())
     if self._pending:
         effects.extend(self._pending)
         self._pending = []
     if effects:
         self._tutorial.storeEffectsInQueue(effects)
     self._isUpdatedOnce = True
     self._gui.release()
Exemple #22
0
 def __init__(self, scene):
     super(FunctionalScene, self).__init__()
     LOG_DEBUG('New functional scene', scene.getID())
     self._scene = scene
     self._actions = chapter.ActionsHolder()
     self._itemsOnScene = set()
     self._pending = []
     self._mustBeUpdated = True
     self._isUpdatedOnce = False
     self._gui.lock()
 def __onViewLoaded(self, pyEntity, _):
     if pyEntity.layer == WindowLayer.SUB_VIEW:
         pageName = pyEntity.alias
         sceneID = self.config.getSceneID(pageName)
         LOG_DEBUG('GUI.onPageReady', sceneID)
         if sceneID is not None:
             self.onPageReady(sceneID)
     self.onViewLoaded(pyEntity.alias)
     pyEntity.onDispose += self.__onViewDisposed
     return
 def getSceneID(self):
     sceneID = None
     container = self.app.containerManager.getContainer(
         WindowLayer.SUB_VIEW)
     if container is not None:
         pyView = container.getView()
         if pyView is not None:
             sceneID = self.config.getSceneID(pyView.alias)
     LOG_DEBUG('GUI.getSceneID', sceneID)
     return sceneID
Exemple #25
0
 def __onViewLoaded(self, pyEntity, _):
     if pyEntity.settings.type is ViewTypes.LOBBY_SUB:
         pageName = pyEntity.settings.alias
         sceneID = self.config.getSceneID(pageName)
         LOG_DEBUG('GUI.onPageReady', sceneID)
         if sceneID is not None:
             self.onPageReady(sceneID)
     self.onViewLoaded(pyEntity.settings.alias)
     pyEntity.onDispose += self.__onViewDisposed
     return
Exemple #26
0
    def leave(self):
        LOG_DEBUG('Leave scene', self._scene.getID())
        for itemID in list(self._itemsOnScene):
            self.removeItemFromScene(itemID)

        if self._mustBeUpdated:
            self._gui.release()
            self._mustBeUpdated = False
        self._actions.clear()
        self._itemsOnScene.clear()
        self._pending = []
Exemple #27
0
 def request(self, chapterID = None):
     chapter = self.getChapter(chapterID=chapterID)
     if chapter is None:
         LOG_ERROR('Chapter not found', chapterID)
         return
     elif not chapter.hasBonus():
         LOG_ERROR('Chapter has not bonus', chapter.getID())
         return
     else:
         bonusID = chapter.getBonusID()
         mask = 1 << bonusID
         localCtx = BattleClientCtx.fetch().addMask(mask)
         if chapter.isBonusReceived(self._completed):
             LOG_DEBUG('Bonus already received', chapter.getID(), self._completed)
             self._isReceived = True
             return
         LOG_DEBUG('Received bonus', bonusID)
         self._completed |= mask
         self._gui.setTrainingProgress(self._descriptor.getProgress(localCtx.completed))
         return
 def stop(self, effectID=None):
     if effectID is not None and effectID != self._hintID:
         LOG_DEBUG('Hint is not added', effectID)
         return
     if self._itemID is None:
         return
     layout = self._getTutorialLayout()
     if layout is not None:
         layout.closeInteractiveHint(self._itemID)
     self._hintID = None
     self._itemID = None
Exemple #29
0
    def unload(self, isItemsRevert = True):
        if self._loader is None:
            return False
        result = True
        try:
            self._loader.unloadTutorial(isItemsRevert)
            LOG_DEBUG('UILoader.unload:', self._swf)
        except AttributeError:
            result = False

        return result
Exemple #30
0
 def __requestRequiredData(self):
     localCtx = BattleClientCtx.fetch()
     if localCtx.startedAt == 0.0:
         localCtx.setStartedAt(time.time())
     if localCtx.accCompleted < 0:
         player = BigWorld.player()
         if player is None or not hasattr(player, 'requestAccountStats'):
             LOG_DEBUG('Stats method not found', player)
             return
         LOG_REQUEST('Avatar.requestAccountStats')
         player.requestAccountStats(['tutorialsCompleted'], self.__onReceiveAccountStats)