예제 #1
0
 def ctrl_onPrebattleInited(self):
     self.__requestCtx.stopProcessing(result=True)
     self.__setFunctional(
         CreateFunctionalCtx(_CTRL_TYPE.PREBATTLE,
                             flags=self.__requestCtx.getFlags(),
                             initCtx=self.__requestCtx))
     g_eventDispatcher.updateUI()
예제 #2
0
 def fini(self, clientPrb = None, woEvents = False):
     super(TrainingIntroFunctional, self).fini()
     if self._flags & FUNCTIONAL_FLAG.SWITCH == 0 and not woEvents:
         g_eventDispatcher.loadHangar()
         g_eventDispatcher.removeTrainingFromCarousel()
         g_eventDispatcher.updateUI()
     return FUNCTIONAL_FLAG.UNDEFINED
예제 #3
0
 def init(self, clientPrb = None, ctx = None):
     result = super(CompanyIntroFunctional, self).init()
     self._rosterReq.start(self._onPrbRosterReceived)
     g_eventDispatcher.loadCompany()
     result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_WINDOW)
     g_eventDispatcher.updateUI()
     return result
예제 #4
0
 def __setEntity(self, ctx):
     """
     Set current entity and clear request context.
     Args:
         ctx: set entity context
     
     Returns:
         integer containing initialization result as flags
     """
     created = self.__factories.createEntity(ctx)
     if created is not None:
         if created.getEntityFlags(
         ) & FUNCTIONAL_FLAG.SET_GLOBAL_LISTENERS > 0:
             created.addMutualListeners(self)
         self.__entity = created
         self.__prevEntity = NotSupportedEntity()
         flag = self.__entity.init(ctx=ctx)
         self._invokeListeners('onPrbEntitySwitched')
         ctx.clearFlags()
         ctx.addFlags(flag | created.getFunctionalFlags())
     LOG_DEBUG('Entity have been updated', ctx.getFlagsToStrings())
     ctx.clear()
     currentCtx = self.__requestCtx
     self.__requestCtx = PrbCtrlRequestCtx()
     currentCtx.stopProcessing(result=True)
     g_eventDispatcher.updateUI()
     return ctx.getFlags()
예제 #5
0
 def pe_onKickedFromUnitAssembler(self):
     """
     Listener for unit assembler kick event
     """
     self.__exitFromQueue()
     g_eventDispatcher.updateUI()
     SystemMessages.pushMessage(messages.getUnitKickedReasonMessage('KICKED_FROM_UNIT_ASSEMBLER'), type=SystemMessages.SM_TYPE.Warning)
예제 #6
0
 def selectFight(self, actionName):
     super(BCBattleSelector, self).selectFight(actionName)
     if actionName == 'random':
         from bootcamp.BootcampGarage import g_bootcampGarage
         g_bootcampGarage.removeTutorialBattleMode()
         g_eventDispatcher.updateUI()
         g_bootcampGarage.runCustomAction('callbackOnBattleReady')
예제 #7
0
 def ctrl_onPrebattleInited(self):
     self.__requestCtx.stopProcessing(result=True)
     self.__factories.createFunctional(
         self,
         CreateFunctionalCtx(CTRL_ENTITY_TYPE.PREBATTLE,
                             init={'ctx': self.__requestCtx}))
     g_eventDispatcher.updateUI()
예제 #8
0
 def onKickedFromQueue(self):
     super(EventBattlesQueueFunctional, self).onKickedFromQueue()
     self.__requestCtx.stopProcessing(True)
     g_prbCtrlEvents.onPreQueueFunctionalDestroyed()
     g_eventDispatcher.loadHangar()
     g_eventDispatcher.updateUI()
     SystemMessages.pushMessage(messages.getKickReasonMessage('timeout'), type=SystemMessages.SM_TYPE.Warning)
예제 #9
0
 def onKickedFromQueue(self):
     super(RandomQueueFunctional, self).onKickedFromQueue()
     self.__requestCtx.stopProcessing(True)
     g_prbCtrlEvents.onPreQueueFunctionalDestroyed()
     g_eventDispatcher.loadHangar()
     g_eventDispatcher.updateUI()
     SystemMessages.pushMessage(messages.getKickReasonMessage('timeout'), type=SystemMessages.SM_TYPE.Warning)
예제 #10
0
 def init(self, clientPrb=None, ctx=None):
     result = super(TrainingIntroFunctional, self).init()
     g_eventDispatcher.loadTrainingList()
     result = FUNCTIONAL_INIT_RESULT.addIfNot(
         result, FUNCTIONAL_INIT_RESULT.LOAD_PAGE)
     g_eventDispatcher.updateUI()
     return result
예제 #11
0
파일: historical.py 프로젝트: webiumsk/WoT
 def onDequeued(self, *args):
     super(HistoricalQueueFunctional, self).onDequeued(*args)
     self.__requestCtx.stopProcessing(True)
     g_eventDispatcher.loadHangar()
     g_eventDispatcher.updateUI()
     self.showGUI()
     self.__checkAvailability()
예제 #12
0
 def onDequeued(self, *args):
     super(HistoricalQueueFunctional, self).onDequeued(*args)
     self.__requestCtx.stopProcessing(True)
     g_eventDispatcher.loadHangar()
     g_eventDispatcher.updateUI()
     self.showGUI()
     self.__checkAvailability()
예제 #13
0
 def __setEntity(self, ctx):
     created = self.__factories.createEntity(ctx)
     if created is not None:
         if created.getEntityFlags(
         ) & FUNCTIONAL_FLAG.SET_GLOBAL_LISTENERS > 0:
             created.addMutualListeners(self)
         if self.__entity is not None and not isinstance(
                 self.__entity, NotSupportedEntity):
             _logger.info(
                 "__setEntity() new entity '%r' was created, previous entity '%r' was stopped",
                 created, self.__entity)
             self.__entity.fini()
         self.__entity = created
         if self.__prevEntity is not None and self.__prevEntity.isActive():
             self.__prevEntity.fini()
         self.__prevEntity = NotSupportedEntity()
         flag = self.__entity.init(ctx=ctx)
         self.notifyPrbEntitySwitched()
         ctx.clearFlags()
         ctx.addFlags(flag | created.getFunctionalFlags())
     LOG_DEBUG('Entity have been updated', ctx.getFlagsToStrings())
     ctx.clear()
     currentCtx = self.__requestCtx
     self.__requestCtx = PrbCtrlRequestCtx()
     currentCtx.stopProcessing(result=True)
     g_eventDispatcher.updateUI()
     return ctx.getFlags()
예제 #14
0
파일: historical.py 프로젝트: webiumsk/WoT
 def onKickedFromArena(self, *args):
     super(HistoricalQueueFunctional, self).onKickedFromQueue(*args)
     self.__requestCtx.stopProcessing(True)
     g_eventDispatcher.loadHangar()
     g_eventDispatcher.updateUI()
     SystemMessages.pushMessage(messages.getKickReasonMessage('timeout'), type=SystemMessages.SM_TYPE.Warning)
     self.__checkAvailability()
예제 #15
0
 def prb_onPlayerStateChanged(self, pID, roster):
     super(EventSquadFunctional, self).prb_onPlayerStateChanged(pID, roster)
     if self.__doTeamReady:
         self.__doTeamReady = False
         self.__setTeamReady()
     g_eventDispatcher.updateUI()
     g_eventDispatcher.setEventSquadTeamReadyInCarousel(self.getPrbType(), self.__isTeamRead())
예제 #16
0
 def fini(self, clientPrb=None, woEvents=False):
     super(TrainingIntroFunctional, self).fini()
     if self._flags & FUNCTIONAL_FLAG.SWITCH == 0 and not woEvents:
         g_eventDispatcher.loadHangar()
         g_eventDispatcher.removeTrainingFromCarousel()
         g_eventDispatcher.updateUI()
     return FUNCTIONAL_FLAG.UNDEFINED
예제 #17
0
    def unitBrowser_onErrorReceived(self, errorCode, errorStr):
        self.__isInSearch = False
        self.__lastErrorCode = errorCode
        if errorCode != UNIT_ERROR.OK:
            for listener in self.__entity.getListenersIterator():
                listener.onUnitBrowserErrorReceived(errorCode)

        g_eventDispatcher.updateUI()
예제 #18
0
 def ec_onCompanyStateChanged(self, state):
     """
     Events cache companies state subscriber. Updates UI on changed.
     Args:
         state: is companies currently enabled
     """
     if not self.__entity.hasLockedState():
         g_eventDispatcher.updateUI()
예제 #19
0
 def pe_onPrebattleAutoInvitesChanged(self):
     if GUI_SETTINGS.specPrebatlesVisible:
         isHidden = areSpecBattlesHidden()
         if isHidden:
             g_eventDispatcher.removeSpecBattlesFromCarousel()
         else:
             g_eventDispatcher.addSpecBattlesToCarousel()
     g_eventDispatcher.updateUI()
예제 #20
0
 def fini(self, clientPrb = None, woEvents = False):
     super(EventSquadFunctional, self).fini(clientPrb=clientPrb, woEvents=woEvents)
     if not woEvents:
         g_eventDispatcher.unloadEventSquad()
     else:
         g_eventDispatcher.removeEventSquadFromCarousel()
     g_eventDispatcher.updateUI()
     g_eventBus.removeListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
예제 #21
0
 def onKickedFromQueue(self, *args):
     super(HistoricalQueueFunctional, self).onKickedFromQueue(*args)
     self.__requestCtx.stopProcessing(True)
     g_eventDispatcher.loadHangar()
     g_eventDispatcher.updateUI()
     SystemMessages.pushMessage(messages.getKickReasonMessage('timeout'),
                                type=SystemMessages.SM_TYPE.Warning)
     self.__checkAvailability()
예제 #22
0
 def pe_onPrebattleAutoInvitesChanged(self):
     if GUI_SETTINGS.specPrebatlesVisible:
         isHidden = prb_getters.areSpecBattlesHidden()
         if isHidden:
             g_eventDispatcher.removeSpecBattlesFromCarousel()
         else:
             g_eventDispatcher.addSpecBattlesToCarousel()
     g_eventDispatcher.updateUI()
예제 #23
0
 def prb_onTeamStatesReceived(self):
     super(EventSquadFunctional, self).prb_onTeamStatesReceived()
     g_eventDispatcher.updateUI()
     if self.getPlayerInfo().isReady() or self.isCreator():
         if self.getTeamState(team=1).isInQueue():
             g_eventDispatcher.loadBattleQueue()
         else:
             g_eventDispatcher.loadHangar()
예제 #24
0
 def __update(self, status):
     isPrimeTime = status == PrimeTimeStatus.AVAILABLE
     isConfigured = status != PrimeTimeStatus.NOT_SET
     if isPrimeTime != self.__isPrimeTime or isConfigured != self.__isConfigured:
         self.__isPrimeTime = isPrimeTime
         self.__isConfigured = isConfigured
         self.__show(status)
         g_eventDispatcher.updateUI()
예제 #25
0
 def fini(self, clientPrb = None, woEvents = False):
     super(CompanyIntroFunctional, self).fini()
     if self._exit != FUNCTIONAL_EXIT.PREBATTLE:
         if not woEvents:
             g_eventDispatcher.unloadCompany()
         else:
             g_eventDispatcher.removeCompanyFromCarousel()
         g_eventDispatcher.updateUI()
예제 #26
0
 def init(self, clientPrb=None, ctx=None):
     result = super(CompanyIntroFunctional, self).init()
     self._rosterReq.start(self._onPrbRosterReceived)
     g_eventDispatcher.loadCompany()
     result = FUNCTIONAL_FLAG.addIfNot(result, FUNCTIONAL_FLAG.LOAD_WINDOW)
     g_eventDispatcher.updateUI()
     g_eventsCache.companies.onCompanyStateChanged += self.onCompanyStateChanged
     return result
예제 #27
0
 def unit_onUnitRosterChanged(self):
     rosterSettings = self._createRosterSettings()
     if rosterSettings != self.getRosterSettings():
         self._rosterSettings = rosterSettings
         self.invalidateVehicleStates()
         self._vehiclesWatcher.validate()
     self._invokeListeners('onUnitRosterChanged')
     g_eventDispatcher.updateUI()
예제 #28
0
 def init(self, clientPrb = None, ctx = None):
     result = super(CompanyIntroFunctional, self).init()
     self._rosterReq.start(self._onPrbRosterReceived)
     g_eventDispatcher.loadCompany()
     result = FUNCTIONAL_FLAG.addIfNot(result, FUNCTIONAL_FLAG.LOAD_WINDOW)
     g_eventDispatcher.updateUI()
     g_eventsCache.companies.onCompanyStateChanged += self.onCompanyStateChanged
     return result
예제 #29
0
 def init(self, clientPrb = None, ctx = None):
     result = super(BattleSessionFunctional, self).init(clientPrb=clientPrb)
     g_eventDispatcher.loadHangar()
     g_eventDispatcher.loadBattleSessionWindow(self.getEntityType())
     result = FUNCTIONAL_FLAG.addIfNot(result, FUNCTIONAL_FLAG.LOAD_WINDOW)
     result = FUNCTIONAL_FLAG.addIfNot(result, FUNCTIONAL_FLAG.LOAD_PAGE)
     g_eventBus.addListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
     g_eventDispatcher.updateUI()
     return result
예제 #30
0
 def fini(self, clientPrb=None, woEvents=False):
     super(CompanyIntroFunctional, self).fini()
     if self._exit != FUNCTIONAL_EXIT.PREBATTLE:
         if not woEvents:
             g_eventDispatcher.unloadCompany()
         else:
             g_eventDispatcher.removeCompanyFromCarousel()
         g_eventDispatcher.updateUI()
     g_eventsCache.companies.onCompanyStateChanged -= self.onCompanyStateChanged
예제 #31
0
 def __update(self, status):
     if not self.rankedController.isAvailable():
         self._entity.leave(LeavePreQueueCtx(waitingID='prebattle/leave'))
         return
     isPrimeTime = status == PRIME_TIME_STATUS.AVAILABLE
     if isPrimeTime != self.__isPrimeTime:
         self.__isPrimeTime = isPrimeTime
         self.__show()
         g_eventDispatcher.updateUI()
예제 #32
0
 def prb_onTeamStatesReceived(self):
     super(CompanyFunctional, self).prb_onTeamStatesReceived()
     g_eventDispatcher.updateUI()
     playerInfo = self.getPlayerInfo()
     if playerInfo.isReady() or self.isCreator():
         if self.getTeamState(team=1).isInQueue() and playerInfo.roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1:
             g_eventDispatcher.loadBattleQueue()
         else:
             g_eventDispatcher.loadHangar()
예제 #33
0
 def fini(self, clientPrb = None, woEvents = False):
     prbType = self.getPrbType()
     super(BattleSessionFunctional, self).fini(clientPrb=clientPrb, woEvents=woEvents)
     if not woEvents:
         g_eventDispatcher.unloadBattleSessionWindow(prbType)
     else:
         g_eventDispatcher.removeSpecBattleFromCarousel(prbType)
     g_eventDispatcher.updateUI()
     g_eventBus.removeListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
예제 #34
0
 def init(self, clientPrb = None, ctx = None):
     result = super(BattleSessionFunctional, self).init(clientPrb=clientPrb)
     g_eventDispatcher.loadHangar()
     g_eventDispatcher.loadBattleSessionWindow(self.getEntityType())
     result = FUNCTIONAL_FLAG.addIfNot(result, FUNCTIONAL_FLAG.LOAD_WINDOW)
     result = FUNCTIONAL_FLAG.addIfNot(result, FUNCTIONAL_FLAG.LOAD_PAGE)
     g_eventBus.addListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
     g_eventDispatcher.updateUI()
     return result
예제 #35
0
 def fini(self, clientPrb = None, woEvents = False):
     super(CompanyIntroFunctional, self).fini()
     if self._flags & FUNCTIONAL_FLAG.SWITCH == 0:
         if not woEvents:
             g_eventDispatcher.unloadCompany()
         else:
             g_eventDispatcher.removeCompanyFromCarousel()
         g_eventDispatcher.updateUI()
     g_eventsCache.companies.onCompanyStateChanged -= self.onCompanyStateChanged
예제 #36
0
 def fini(self, clientPrb = None, woEvents = False):
     prbType = self.getEntityType()
     super(BattleSessionFunctional, self).fini(clientPrb=clientPrb, woEvents=woEvents)
     if not woEvents:
         g_eventDispatcher.unloadBattleSessionWindow(prbType)
     else:
         g_eventDispatcher.removeSpecBattleFromCarousel(prbType)
     g_eventDispatcher.updateUI()
     g_eventBus.removeListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
     return FUNCTIONAL_FLAG.UNDEFINED
예제 #37
0
 def prb_onTeamStatesReceived(self):
     super(CompanyFunctional, self).prb_onTeamStatesReceived()
     g_eventDispatcher.updateUI()
     playerInfo = self.getPlayerInfo()
     if playerInfo.isReady() or self.isCreator():
         if self.getTeamState(team=1).isInQueue(
         ) and playerInfo.roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1:
             g_eventDispatcher.loadBattleQueue()
         else:
             g_eventDispatcher.loadHangar()
예제 #38
0
 def unitMgr_onUnitLeft(self, unitMgrID, unitIdx):
     unitFunctional = self.getFunctional(CTRL_ENTITY_TYPE.UNIT)
     prbType = 0
     update = True
     if unitFunctional and unitFunctional.getExit() == FUNCTIONAL_EXIT.INTRO_UNIT:
         prbType = unitFunctional.getPrbType()
         update = False
     self._changeUnitFunctional(prbType=prbType)
     if update:
         g_eventDispatcher.updateUI()
 def __onPrimeTimeUpdated(self, status):
     if not self.__checkEpicIsEnabled():
         return
     isPrimeTime = status == PrimeTimeStatus.AVAILABLE
     time = time_utils.getCurrentLocalServerTimestamp()
     isCycle = self.__epicController.getCurrentSeason().hasActiveCycle(time)
     if isPrimeTime != self.__isPrimeTime or isCycle != self.__isCycle:
         self.__isPrimeTime = isPrimeTime
         self.__isCycle = isCycle
         g_eventDispatcher.updateUI()
예제 #40
0
 def ctrl_onPreQueueFunctionalCreated(self, queueType, doAction = False, action = None):
     self.__factories.createFunctional(self, CreateFunctionalCtx(CTRL_ENTITY_TYPE.PREQUEUE, create={'queueType': queueType}))
     g_prbCtrlEvents.onPreQueueFunctionalChanged()
     if action and doAction:
         preQueueFunctional = self.getFunctional(CTRL_ENTITY_TYPE.PREQUEUE)
         if preQueueFunctional:
             preQueueFunctional.doAction(action, dispatcher=self)
         else:
             LOG_ERROR('PreQueue functional is not found')
     g_eventDispatcher.updateUI()
예제 #41
0
 def unitMgr_onUnitLeft(self, unitMgrID, unitIdx):
     unitFunctional = self.getFunctional(CTRL_ENTITY_TYPE.UNIT)
     prbType = 0
     update = True
     if unitFunctional and unitFunctional.getExit(
     ) == FUNCTIONAL_EXIT.INTRO_UNIT:
         prbType = unitFunctional.getPrbType()
         update = False
     self._changeUnitFunctional(prbType=prbType)
     if update:
         g_eventDispatcher.updateUI()
예제 #42
0
    def pe_onEnqueuedUnitAssembler(self):
        self.__isInSearch = True
        self.__startSearchTime = BigWorld.time()
        g_eventDispatcher.setUnitProgressInCarousel(
            self.__entity.getEntityType(), True)
        for listener in self.__entity.getListenersIterator():
            listener.onUnitAutoSearchStarted(0)
        else:
            g_eventDispatcher.showUnitWindow(self.__entity.getEntityType())

        g_eventDispatcher.updateUI()
예제 #43
0
    def init(self, clientPrb=None, ctx=None):
        result = super(TrainingFunctional, self).init(clientPrb=clientPrb)
        add = g_eventBus.addListener
        for event in self.__loadEvents:
            add(event, self.__handleViewLoad, scope=EVENT_BUS_SCOPE.LOBBY)

        self.__enterTrainingRoom()
        result |= FUNCTIONAL_FLAG.LOAD_WINDOW
        result |= FUNCTIONAL_FLAG.LOAD_PAGE
        g_eventDispatcher.updateUI()
        return result
예제 #44
0
 def start(self):
     g_eventDispatcher.init(self)
     result = self.__setFunctional(CreateFunctionalCtx())
     self.__requestCtx = PrbCtrlRequestCtx()
     self.__startListening()
     functional.initDevFunctional()
     if result & FUNCTIONAL_FLAG.LOAD_PAGE == 0:
         BigWorld.callback(0.001, lambda: g_eventDispatcher.loadHangar())
     g_eventDispatcher.updateUI()
     if GUI_SETTINGS.specPrebatlesVisible and not prb_getters.areSpecBattlesHidden():
         g_eventDispatcher.addSpecBattlesToCarousel()
예제 #45
0
 def unitMgr_onUnitLeft(self, unitMgrID, unitIdx):
     flags = self.__requestCtx.getFlags()
     flags |= FUNCTIONAL_FLAG.LEAVE_ENTITY
     prbType = 0
     if flags & FUNCTIONAL_FLAG.SWITCH > 0:
         unitFunctional = self.getFunctional(_CTRL_TYPE.UNIT)
         if unitFunctional is not None:
             prbType = unitFunctional.getEntityType()
     self.__changeUnitFunctional(flags=flags, prbType=prbType)
     g_eventDispatcher.updateUI()
     return
 def _update(self, status):
     if not self._controller.isAvailable():
         self._doLeave()
         return
     isPrimeTime = status == PrimeTimeStatus.AVAILABLE
     isConfigured = status != PrimeTimeStatus.NOT_SET
     if isPrimeTime != self.__isPrimeTime or isConfigured != self.__isConfigured:
         self.__isPrimeTime = isPrimeTime
         self.__isConfigured = isConfigured
         self.__show()
         g_eventDispatcher.updateUI()
예제 #47
0
    def init(self, clientPrb = None, ctx = None):
        result = super(TrainingFunctional, self).init(clientPrb=clientPrb)
        add = g_eventBus.addListener
        for event in self.__loadEvents:
            add(event, self.__handleViewLoad, scope=EVENT_BUS_SCOPE.LOBBY)

        self.__enterTrainingRoom()
        result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_WINDOW)
        result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_PAGE)
        g_eventDispatcher.updateUI()
        return result
예제 #48
0
 def fini(self, clientPrb = None, woEvents = False):
     super(CompanyFunctional, self).fini(clientPrb=clientPrb, woEvents=woEvents)
     if self._exit != FUNCTIONAL_EXIT.INTRO_PREBATTLE:
         if not woEvents:
             g_eventDispatcher.unloadCompany()
         else:
             g_eventDispatcher.removeCompanyFromCarousel()
         g_eventDispatcher.updateUI()
     else:
         g_eventDispatcher.requestToDestroyPrbChannel(PREBATTLE_TYPE.COMPANY)
     g_eventBus.removeListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
예제 #49
0
 def unitMgr_onUnitLeft(self, unitMgrID, unitIdx):
     flags = self.__requestCtx.getFlags()
     flags |= FUNCTIONAL_FLAG.LEAVE_ENTITY
     prbType = 0
     if flags & FUNCTIONAL_FLAG.SWITCH > 0:
         unitFunctional = self.getFunctional(_CTRL_TYPE.UNIT)
         if unitFunctional is not None:
             prbType = unitFunctional.getEntityType()
     self.__changeUnitFunctional(flags=flags, prbType=prbType)
     g_eventDispatcher.updateUI()
     return
예제 #50
0
 def __onOverrideBattleSelectorHint(self, _=None):
     enableOverride = self.app.tutorialManager.lastBattleSelectorHintOverride == 'bootcamp'
     isOverrideEnabled = self.__battleSelectorHintPointcutIndex is not None
     if enableOverride != isOverrideEnabled:
         if enableOverride:
             self.__battleSelectorHintPointcutIndex = g_bootcamp.addPointcut(PointcutBattleSelectorHintText)
         else:
             g_bootcamp.removePointcut(self.__battleSelectorHintPointcutIndex)
             self.__battleSelectorHintPointcutIndex = None
         g_eventDispatcher.updateUI()
     return
예제 #51
0
 def start(self):
     g_eventDispatcher.init(self)
     result = self.__setFunctional(CreateFunctionalCtx())
     self.__requestCtx = PrbCtrlRequestCtx()
     self.__startListening()
     functional.initDevFunctional()
     if result & FUNCTIONAL_FLAG.LOAD_PAGE == 0:
         BigWorld.callback(0.001, lambda: g_eventDispatcher.loadHangar())
     g_eventDispatcher.updateUI()
     if GUI_SETTINGS.specPrebatlesVisible and not prb_getters.areSpecBattlesHidden(
     ):
         g_eventDispatcher.addSpecBattlesToCarousel()
예제 #52
0
 def start(self, ctx):
     g_eventDispatcher.init(self)
     self.__requestCtx = PrbCtrlRequestCtx()
     result = self.__factories.start(self, CreateFunctionalCtx(CTRL_ENTITY_TYPE.UNKNOWN, create={'queueType': ctx.getQueueType(),
      'settings': ctx.prbSettings}))
     self._startListening()
     functional.initDevFunctional()
     if result & FUNCTIONAL_INIT_RESULT.LOAD_PAGE == 0:
         BigWorld.callback(0.001, lambda : g_eventDispatcher.loadHangar())
     g_eventDispatcher.updateUI()
     if GUI_SETTINGS.specPrebatlesVisible and not areSpecBattlesHidden():
         g_eventDispatcher.addSpecBattlesToCarousel()
예제 #53
0
 def unitMgr_onUnitErrorReceived(self, requestID, unitMgrID, unitIdx, errorCode, errorString):
     unitFunctional = self.getFunctional(CTRL_ENTITY_TYPE.UNIT)
     if unitFunctional:
         unitFunctional.setLastError(errorCode)
     else:
         LOG_ERROR('Unit functional is not found')
     if errorCode not in IGNORED_UNIT_MGR_ERRORS:
         msgType, msgBody = messages.getUnitMessage(errorCode, errorString)
         SystemMessages.pushMessage(msgBody, type=msgType)
         if errorCode in RETURN_INTRO_UNIT_MGR_ERRORS and unitFunctional:
             unitFunctional.setExit(FUNCTIONAL_EXIT.INTRO_UNIT)
         self.__requestCtx.stopProcessing(result=False)
         g_eventDispatcher.updateUI()
예제 #54
0
 def fini(self, clientPrb = None, woEvents = False):
     super(CompanyFunctional, self).fini(clientPrb=clientPrb, woEvents=woEvents)
     if self._flags & FUNCTIONAL_FLAG.SWITCH == 0:
         if not woEvents:
             g_eventDispatcher.unloadCompany()
         else:
             g_eventDispatcher.removeCompanyFromCarousel()
         g_eventDispatcher.updateUI()
     else:
         g_eventDispatcher.requestToDestroyPrbChannel(PREBATTLE_TYPE.COMPANY)
     g_eventBus.removeListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
     g_eventsCache.companies.onCompanyStateChanged -= self.onCompanyStateChanged
     return FUNCTIONAL_FLAG.UNDEFINED
예제 #55
0
 def init(self, clientPrb = None, ctx = None):
     result = super(CompanyFunctional, self).init(clientPrb=clientPrb)
     playerInfo = self.getPlayerInfo()
     if self.getTeamState(team=1).isInQueue() and playerInfo.isReady() and playerInfo.roster == PREBATTLE_ROSTER.ASSIGNED_IN_TEAM1:
         g_eventDispatcher.loadBattleQueue()
     else:
         g_eventDispatcher.loadHangar()
     g_eventDispatcher.loadCompany()
     result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_WINDOW)
     result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_PAGE)
     g_eventBus.addListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
     g_eventDispatcher.updateUI()
     return result
예제 #56
0
 def unitMgr_onUnitErrorReceived(self, requestID, unitMgrID, unitIdx, errorCode, errorString):
     unitFunctional = self.getFunctional(_CTRL_TYPE.UNIT)
     if unitFunctional is not None:
         unitFunctional.setLastError(errorCode)
         if errorCode in RETURN_INTRO_UNIT_MGR_ERRORS and unitFunctional.canSwitchToIntro():
             self.__requestCtx.addFlags(FUNCTIONAL_FLAG.SWITCH)
     else:
         LOG_ERROR('Unit functional is not found')
     if errorCode not in IGNORED_UNIT_MGR_ERRORS:
         msgType, msgBody = messages.getUnitMessage(errorCode, errorString)
         SystemMessages.pushMessage(msgBody, type=msgType)
         self.__requestCtx.stopProcessing(result=False)
         g_eventDispatcher.updateUI()
     return
예제 #57
0
    def fini(self, clientPrb = None, woEvents = False):
        super(TrainingFunctional, self).fini(clientPrb=clientPrb, woEvents=woEvents)
        remove = g_eventBus.removeListener
        for event in self.__loadEvents:
            remove(event, self.__handleViewLoad, scope=EVENT_BUS_SCOPE.LOBBY)

        if not woEvents:
            if self._exit == FUNCTIONAL_EXIT.INTRO_PREBATTLE:
                g_eventDispatcher.loadTrainingList()
            else:
                g_eventDispatcher.loadHangar()
                g_eventDispatcher.removeTrainingFromCarousel(False)
                g_eventDispatcher.updateUI()
        g_eventDispatcher.requestToDestroyPrbChannel(PREBATTLE_TYPE.TRAINING)
예제 #58
0
    def fini(self, clientPrb = None, woEvents = False):
        super(TrainingFunctional, self).fini(clientPrb=clientPrb, woEvents=woEvents)
        remove = g_eventBus.removeListener
        for event in self.__loadEvents:
            remove(event, self.__handleViewLoad, scope=EVENT_BUS_SCOPE.LOBBY)

        if not woEvents:
            if self._flags & FUNCTIONAL_FLAG.SWITCH > 0:
                g_eventDispatcher.loadTrainingList()
            else:
                g_eventDispatcher.loadHangar()
                g_eventDispatcher.removeTrainingFromCarousel(False)
                g_eventDispatcher.updateUI()
            self.storage.suspend()
        g_eventDispatcher.requestToDestroyPrbChannel(PREBATTLE_TYPE.TRAINING)
        return FUNCTIONAL_FLAG.UNDEFINED
예제 #59
0
 def init(self, clientPrb = None, ctx = None):
     result = super(EventSquadFunctional, self).init(clientPrb=clientPrb)
     (isCreationCtx, accountsToInvite,) = (False, [])
     if ctx is not None:
         isCreationCtx = ctx.getRequestType() is REQUEST_TYPE.CREATE
         if isCreationCtx:
             accountsToInvite = ctx.getAccountsToInvite()
     if self.getPlayerInfo().isReady() and self.getTeamState(team=1).isInQueue():
         g_eventDispatcher.loadBattleQueue()
     else:
         g_eventDispatcher.loadHangar()
     g_eventDispatcher.loadEventSquad(isInvitesOpen=isCreationCtx and not accountsToInvite, isReady=self.__isTeamRead())
     g_eventBus.addListener(ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
     result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_WINDOW)
     result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_PAGE)
     g_eventDispatcher.updateUI()
     if accountsToInvite:
         self.request(SendInvitesCtx(accountsToInvite, ''))
     return result
예제 #60
0
 def prb_onPlayerRosterChanged(self, pID, prevRoster, roster, actorID):
     super(BattleSessionFunctional, self).prb_onPlayerRosterChanged(pID, prevRoster, roster, actorID)
     g_eventDispatcher.updateUI()