示例#1
0
 def _stopListening(self):
     """
     Unsubscribe from player events.
     """
     g_eventsCache.companies.onCompanyStateChanged -= self.onCompanyStateChanged
     g_playerEvents.onPrebattleJoined -= self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure -= self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft -= self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle -= self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure -= self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena -= self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged -= self.pe_onPrebattleAutoInvitesChanged
     game_control.g_instance.captcha.onCaptchaInputCanceled -= self.captcha_onCaptchaInputCanceled
     game_control.g_instance.gameSession.onTimeTillBan -= self.gs_onTillBanNotification
     game_control.g_instance.rentals.onRentChangeNotify -= self.rc_onRentChange
     game_control.g_instance.igr.onIgrTypeChanged -= self.igr_onRoomChange
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined -= self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft -= self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored -= self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     unitBrowser = getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived -= self.unitBrowser_onErrorReceived
     fortMgr = getClientFortMgr()
     if fortMgr:
         fortMgr.onFortResponseReceived -= self.fortMgr_onFortResponseReceived
         fortMgr.onFortStateChanged -= self.forMgr_onFortStateChanged
     g_prbCtrlEvents.clear()
示例#2
0
 def _stopListening(self):
     """
     Unsubscribe from player events.
     """
     g_playerEvents.onEnqueuedRandom -= self.pe_onEnqueuedRandom
     g_playerEvents.onDequeuedRandom -= self.pe_onDequeuedRandom
     g_playerEvents.onEnqueueRandomFailure -= self.pe_onEnqueueRandomFailure
     g_playerEvents.onKickedFromRandomQueue -= self.pe_onKickedFromRandomQueue
     g_playerEvents.onPrebattleJoined -= self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure -= self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft -= self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle -= self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure -= self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena -= self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged -= self.pe_onPrebattleAutoInvitesChanged
     game_control.g_instance.gameSession.onTimeTillBan -= self.gs_onTillBanNotification
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined -= self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft -= self.unitMgr_onUnitLeft
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     unitBrowser = getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived -= self.unitBrowser_onErrorReceived
     g_prbCtrlEvents.clear()
示例#3
0
 def init(self):
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived += self.unitMgr_onUnitResponseReceived
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
示例#4
0
 def _startListening(self):
     """
     Subscribes to player events.
     """
     g_playerEvents.onEnqueuedRandom += self.pe_onEnqueuedRandom
     g_playerEvents.onDequeuedRandom += self.pe_onDequeuedRandom
     g_playerEvents.onEnqueueRandomFailure += self.pe_onEnqueueRandomFailure
     g_playerEvents.onKickedFromRandomQueue += self.pe_onKickedFromRandomQueue
     g_playerEvents.onPrebattleJoined += self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure += self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft += self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle += self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure += self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena += self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged += self.pe_onPrebattleAutoInvitesChanged
     gameSession = game_control.g_instance.gameSession
     if gameSession.lastBanMsg is not None:
         self.gs_onTillBanNotification(*gameSession.lastBanMsg)
     gameSession.onTimeTillBan += self.gs_onTillBanNotification
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft += self.unitMgr_onUnitLeft
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
     unitBrowser = getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived += self.unitBrowser_onErrorReceived
     else:
         LOG_ERROR('Unit browser is not defined')
     g_prbCtrlEvents.onPrebattleInited += self.ctrl_onPrebattleInited
     g_prbCtrlEvents.onUnitIntroModeJoined += self.ctrl_onUnitIntroModeJoined
     g_prbCtrlEvents.onUnitIntroModeLeft += self.ctrl_onUnitIntroModeLeft
     return
示例#5
0
    def createFunctional(self, dispatcher, ctx):
        unitMrg = prb_control.getClientUnitMgr()
        if unitMrg.id and unitMrg.unitIdx:
            unit = prb_control.getUnit(unitMrg.unitIdx, safe=True)
            prbType = PREBATTLE_TYPE.UNIT
            if unit.isSortie():
                prbType = PREBATTLE_TYPE.SORTIE
            elif unit.isFortBattle():
                prbType = PREBATTLE_TYPE.FORT_BATTLE
            if unit:
                unitFunctional = UnitFunctional(prbType, DynamicRosterSettings(unit))
                for listener in dispatcher._globalListeners:
                    unitFunctional.addListener(listener())

            else:
                LOG_ERROR('Unit is not found in unit manager', unitMrg.unitIdx, unitMrg.units)
                unitMrg.leave()
                unitFunctional = NoUnitFunctional()
        else:
            prbType = ctx.getPrbType()
            if prbType:
                unitFunctional = IntroFunctional(prbType, ctx.getCreateParams().get('modeFlags', UNIT_MODE_FLAGS.UNDEFINED), SupportedRosterSettings.last(prbType))
                for listener in dispatcher._globalListeners:
                    unitFunctional.addListener(listener())

            else:
                unitFunctional = NoUnitFunctional()
        return unitFunctional
示例#6
0
 def _startListening(self):
     """
     Subscribes to player events.
     """
     g_playerEvents.onEnqueuedRandom += self.pe_onEnqueuedRandom
     g_playerEvents.onDequeuedRandom += self.pe_onDequeuedRandom
     g_playerEvents.onEnqueueRandomFailure += self.pe_onEnqueueRandomFailure
     g_playerEvents.onKickedFromRandomQueue += self.pe_onKickedFromRandomQueue
     g_playerEvents.onPrebattleJoined += self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure += self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft += self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle += self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure += self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena += self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged += self.pe_onPrebattleAutoInvitesChanged
     gameSession = game_control.g_instance.gameSession
     if gameSession.lastBanMsg is not None:
         self.gs_onTillBanNotification(*gameSession.lastBanMsg)
     gameSession.onTimeTillBan += self.gs_onTillBanNotification
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft += self.unitMgr_onUnitLeft
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
     unitBrowser = getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived += self.unitBrowser_onErrorReceived
     else:
         LOG_ERROR('Unit browser is not defined')
     g_prbCtrlEvents.onPrebattleInited += self.ctrl_onPrebattleInited
     g_prbCtrlEvents.onUnitIntroModeJoined += self.ctrl_onUnitIntroModeJoined
     g_prbCtrlEvents.onUnitIntroModeLeft += self.ctrl_onUnitIntroModeLeft
     return
示例#7
0
    def createFunctional(self, dispatcher, ctx):
        unitMrg = prb_control.getClientUnitMgr()
        if unitMrg.id and unitMrg.unitIdx:
            unit = prb_control.getUnit(unitMrg.unitIdx, safe=True)
            if unit:
                unitFunctional = UnitFunctional(unit.getPrebattleType(),
                                                DynamicRosterSettings(unit))
                for listener in dispatcher._globalListeners:
                    unitFunctional.addListener(listener())

            else:
                LOG_ERROR('Unit is not found in unit manager', unitMrg.unitIdx,
                          unitMrg.units)
                unitMrg.leave()
                unitFunctional = NoUnitFunctional()
        else:
            prbType = ctx.getPrbType()
            if prbType:
                unitFunctional = IntroFunctional(
                    prbType,
                    ctx.getCreateParams().get('modeFlags',
                                              UNIT_MODE_FLAGS.UNDEFINED),
                    SupportedRosterSettings.last(prbType))
                for listener in dispatcher._globalListeners:
                    unitFunctional.addListener(listener())

            else:
                unitFunctional = NoUnitFunctional()
        return unitFunctional
示例#8
0
 def _stopListening(self):
     """
     Unsubscribe from player events.
     """
     g_playerEvents.onEnqueuedRandom -= self.pe_onEnqueuedRandom
     g_playerEvents.onDequeuedRandom -= self.pe_onDequeuedRandom
     g_playerEvents.onEnqueueRandomFailure -= self.pe_onEnqueueRandomFailure
     g_playerEvents.onKickedFromRandomQueue -= self.pe_onKickedFromRandomQueue
     g_playerEvents.onPrebattleJoined -= self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure -= self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft -= self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle -= self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure -= self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena -= self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged -= self.pe_onPrebattleAutoInvitesChanged
     game_control.g_instance.gameSession.onTimeTillBan -= self.gs_onTillBanNotification
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined -= self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft -= self.unitMgr_onUnitLeft
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     unitBrowser = getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived -= self.unitBrowser_onErrorReceived
     g_prbCtrlEvents.clear()
示例#9
0
 def doRawRequest(self, methodName, *args, **kwargs):
     unitMgr = prb_control.getClientUnitMgr()
     method = getattr(unitMgr, methodName)
     if callable(method):
         method(*args, **kwargs)
     else:
         LOG_ERROR('Name of method is invalid', methodName)
示例#10
0
 def fini(self):
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived -= self.unitMgr_onUnitResponseReceived
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     self.__requests.clear()
     self.__functional = None
示例#11
0
 def fini(self):
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived -= self.unitMgr_onUnitResponseReceived
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     self.__requests.clear()
     self.__functional = None
示例#12
0
 def init(self):
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitResponseReceived += self.unitMgr_onUnitResponseReceived
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
示例#13
0
 def _stopListening(self):
     """
     Unsubscribe from player events.
     """
     g_eventsCache.companies.onCompanyStateChanged -= self.onCompanyStateChanged
     g_playerEvents.onPrebattleJoined -= self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure -= self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft -= self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle -= self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure -= self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena -= self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged -= self.pe_onPrebattleAutoInvitesChanged
     game_control.g_instance.captcha.onCaptchaInputCanceled -= self.captcha_onCaptchaInputCanceled
     game_control.g_instance.gameSession.onTimeTillBan -= self.gs_onTillBanNotification
     game_control.g_instance.rentals.onRentChangeNotify -= self.rc_onRentChange
     game_control.g_instance.igr.onIgrTypeChanged -= self.igr_onRoomChange
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined -= self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft -= self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored -= self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived
     unitBrowser = getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived -= self.unitBrowser_onErrorReceived
     fortMgr = getClientFortMgr()
     if fortMgr:
         fortMgr.onFortResponseReceived -= self.fortMgr_onFortResponseReceived
         fortMgr.onFortStateChanged -= self.forMgr_onFortStateChanged
     g_prbCtrlEvents.clear()
示例#14
0
 def doRawRequest(self, methodName, *args, **kwargs):
     unitMgr = prb_control.getClientUnitMgr()
     method = getattr(unitMgr, methodName)
     if callable(method):
         method(*args, **kwargs)
     else:
         LOG_ERROR('Name of method is invalid', methodName)
示例#15
0
 def _unsubscribe(self):
     g_playerEvents.onEnqueuedRandom -= self.__pe_onEnqueued
     g_playerEvents.onDequeuedRandom -= self.__pe_onDequeued
     g_playerEvents.onKickedFromRandomQueue -= self.__pe_onKickedFromQueue
     g_playerEvents.onPrebattleJoined -= self.__pe_onPrebattleJoined
     g_playerEvents.onPrebattleLeft -= self.__pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle -= self.__pe_onKickedFromPrebattle
     connectionManager.onDisconnected -= self.__cm_onDisconnected
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined -= self.__cum_onUnitJoined
         unitMgr.onUnitLeft -= self.__cum_onUnitLeft
示例#16
0
 def _unsubscribe(self):
     g_playerEvents.onEnqueuedRandom -= self.__pe_onEnqueued
     g_playerEvents.onDequeuedRandom -= self.__pe_onDequeued
     g_playerEvents.onKickedFromRandomQueue -= self.__pe_onKickedFromQueue
     g_playerEvents.onPrebattleJoined -= self.__pe_onPrebattleJoined
     g_playerEvents.onPrebattleLeft -= self.__pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle -= self.__pe_onKickedFromPrebattle
     connectionManager.onDisconnected -= self.__cm_onDisconnected
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined -= self.__cum_onUnitJoined
         unitMgr.onUnitLeft -= self.__cum_onUnitLeft
示例#17
0
 def _sendRequest(self, ctx, methodName, chain, *args, **kwargs):
     unitMgr = prb_control.getClientUnitMgr()
     result = False
     method = getattr(unitMgr, methodName)
     if callable(method):
         requestID = method(*args, **kwargs)
         if requestID > 0:
             self.__requests[requestID] = (ctx, chain)
             result = True
         else:
             LOG_ERROR('Request ID can not be null')
     else:
         LOG_ERROR('Name of method is invalid', methodName)
     return result
示例#18
0
 def _sendRequest(self, ctx, methodName, chain, *args, **kwargs):
     unitMgr = prb_control.getClientUnitMgr()
     result = False
     method = getattr(unitMgr, methodName)
     if callable(method):
         requestID = method(*args, **kwargs)
         if requestID > 0:
             self.__requests[requestID] = (ctx, chain)
             result = True
         else:
             LOG_ERROR('Request ID can not be null')
     else:
         LOG_ERROR('Name of method is invalid', methodName)
     return result
示例#19
0
 def _subscribe(self):
     g_playerEvents.onEnqueuedRandom += self.__pe_onEnqueued
     g_playerEvents.onDequeuedRandom += self.__pe_onDequeued
     g_playerEvents.onKickedFromRandomQueue += self.__pe_onKickedFromQueue
     g_playerEvents.onPrebattleJoined += self.__pe_onPrebattleJoined
     g_playerEvents.onPrebattleLeft += self.__pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle += self.__pe_onKickedFromPrebattle
     connectionManager.onDisconnected += self.__cm_onDisconnected
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.__cum_onUnitJoined
         unitMgr.onUnitLeft += self.__cum_onUnitLeft
     else:
         LOG_ERROR('Unit manager is not defined')
示例#20
0
 def _subscribe(self):
     g_playerEvents.onEnqueuedRandom += self.__pe_onEnqueued
     g_playerEvents.onDequeuedRandom += self.__pe_onDequeued
     g_playerEvents.onKickedFromRandomQueue += self.__pe_onKickedFromQueue
     g_playerEvents.onPrebattleJoined += self.__pe_onPrebattleJoined
     g_playerEvents.onPrebattleLeft += self.__pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle += self.__pe_onKickedFromPrebattle
     connectionManager.onDisconnected += self.__cm_onDisconnected
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.__cum_onUnitJoined
         unitMgr.onUnitLeft += self.__cum_onUnitLeft
     else:
         LOG_ERROR('Unit manager is not defined')
示例#21
0
 def _startListening(self):
     """
     Subscribes to player events.
     """
     g_playerEvents.onPrebattleJoined += self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure += self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft += self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle += self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure += self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena += self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged += self.pe_onPrebattleAutoInvitesChanged
     gameSession = game_control.g_instance.gameSession
     captchaCtrl = game_control.g_instance.captcha
     rentCtr = game_control.g_instance.rentals
     igrCtr = game_control.g_instance.igr
     if gameSession.lastBanMsg is not None:
         self.gs_onTillBanNotification(*gameSession.lastBanMsg)
     gameSession.onTimeTillBan += self.gs_onTillBanNotification
     rentCtr.onRentChangeNotify += self.rc_onRentChange
     captchaCtrl.onCaptchaInputCanceled += self.captcha_onCaptchaInputCanceled
     igrCtr.onIgrTypeChanged += self.igr_onRoomChange
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft += self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored += self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
     unitBrowser = getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived += self.unitBrowser_onErrorReceived
     else:
         LOG_ERROR('Unit browser is not defined')
     fortMgr = getClientFortMgr()
     if fortMgr:
         fortMgr.onFortStateChanged += self.forMgr_onFortStateChanged
         fortMgr.onFortResponseReceived += self.fortMgr_onFortResponseReceived
     else:
         LOG_ERROR('Fort manager is not defined')
     g_prbCtrlEvents.onPrebattleIntroModeJoined += self.ctrl_onPrebattleIntroModeJoined
     g_prbCtrlEvents.onPrebattleIntroModeLeft += self.ctrl_onPrebattleIntroModeLeft
     g_prbCtrlEvents.onPrebattleInited += self.ctrl_onPrebattleInited
     g_prbCtrlEvents.onUnitIntroModeJoined += self.ctrl_onUnitIntroModeJoined
     g_prbCtrlEvents.onUnitIntroModeLeft += self.ctrl_onUnitIntroModeLeft
     g_prbCtrlEvents.onPreQueueFunctionalCreated += self.ctrl_onPreQueueFunctionalCreated
     g_prbCtrlEvents.onPreQueueFunctionalDestroyed += self.ctrl_onPreQueueFunctionalDestroyed
     g_eventsCache.companies.onCompanyStateChanged += self.onCompanyStateChanged
     return
示例#22
0
 def _startListening(self):
     """
     Subscribes to player events.
     """
     g_playerEvents.onPrebattleJoined += self.pe_onPrebattleJoined
     g_playerEvents.onPrebattleJoinFailure += self.pe_onPrebattleJoinFailure
     g_playerEvents.onPrebattleLeft += self.pe_onPrebattleLeft
     g_playerEvents.onKickedFromPrebattle += self.pe_onKickedFromPrebattle
     g_playerEvents.onArenaJoinFailure += self.pe_onArenaJoinFailure
     g_playerEvents.onKickedFromArena += self.pe_onKickedFromArena
     g_playerEvents.onPrebattleAutoInvitesChanged += self.pe_onPrebattleAutoInvitesChanged
     gameSession = game_control.g_instance.gameSession
     captchaCtrl = game_control.g_instance.captcha
     rentCtr = game_control.g_instance.rentals
     igrCtr = game_control.g_instance.igr
     if gameSession.lastBanMsg is not None:
         self.gs_onTillBanNotification(*gameSession.lastBanMsg)
     gameSession.onTimeTillBan += self.gs_onTillBanNotification
     rentCtr.onRentChangeNotify += self.rc_onRentChange
     captchaCtrl.onCaptchaInputCanceled += self.captcha_onCaptchaInputCanceled
     igrCtr.onIgrTypeChanged += self.igr_onRoomChange
     unitMgr = getClientUnitMgr()
     if unitMgr:
         unitMgr.onUnitJoined += self.unitMgr_onUnitJoined
         unitMgr.onUnitLeft += self.unitMgr_onUnitLeft
         unitMgr.onUnitRestored += self.unitMgr_onUnitRestored
         unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived
     else:
         LOG_ERROR('Unit manager is not defined')
     unitBrowser = getClientUnitBrowser()
     if unitBrowser:
         unitBrowser.onErrorReceived += self.unitBrowser_onErrorReceived
     else:
         LOG_ERROR('Unit browser is not defined')
     fortMgr = getClientFortMgr()
     if fortMgr:
         fortMgr.onFortStateChanged += self.forMgr_onFortStateChanged
         fortMgr.onFortResponseReceived += self.fortMgr_onFortResponseReceived
     else:
         LOG_ERROR('Fort manager is not defined')
     g_prbCtrlEvents.onPrebattleIntroModeJoined += self.ctrl_onPrebattleIntroModeJoined
     g_prbCtrlEvents.onPrebattleIntroModeLeft += self.ctrl_onPrebattleIntroModeLeft
     g_prbCtrlEvents.onPrebattleInited += self.ctrl_onPrebattleInited
     g_prbCtrlEvents.onUnitIntroModeJoined += self.ctrl_onUnitIntroModeJoined
     g_prbCtrlEvents.onUnitIntroModeLeft += self.ctrl_onUnitIntroModeLeft
     g_prbCtrlEvents.onPreQueueFunctionalCreated += self.ctrl_onPreQueueFunctionalCreated
     g_prbCtrlEvents.onPreQueueFunctionalDestroyed += self.ctrl_onPreQueueFunctionalDestroyed
     g_eventsCache.companies.onCompanyStateChanged += self.onCompanyStateChanged
示例#23
0
def createUnitFunctional(dispatcher):
    unitMrg = prb_control.getClientUnitMgr()
    if unitMrg.id and unitMrg.unitIdx:
        if unitMrg.unitIdx in unitMrg.units:
            unitFunctional = UnitFunctional()
            for listener in dispatcher._globalListeners:
                unitFunctional.addListener(listener())

        else:
            LOG_ERROR('Unit not found in unit manager', unitMrg.unitIdx, unitMrg.units)
            unitMrg.leave()
            unitFunctional = NoUnitFunctional()
    else:
        func = dispatcher.getUnitFunctional()
        if func and func.getExit() == FUNCTIONAL_EXIT.INTRO_UNIT:
            unitFunctional = IntroFunctional()
            for listener in dispatcher._globalListeners:
                unitFunctional.addListener(listener())

        else:
            unitFunctional = NoUnitFunctional()
    return unitFunctional
示例#24
0
def createUnitFunctional(dispatcher):
    unitMrg = prb_control.getClientUnitMgr()
    if unitMrg.id and unitMrg.unitIdx:
        if unitMrg.unitIdx in unitMrg.units:
            unitFunctional = UnitFunctional()
            for listener in dispatcher._globalListeners:
                unitFunctional.addListener(listener())

        else:
            LOG_ERROR("Unit not found in unit manager", unitMrg.unitIdx, unitMrg.units)
            unitMrg.leave()
            unitFunctional = NoUnitFunctional()
    else:
        func = dispatcher.getUnitFunctional()
        if func and func.getExit() == FUNCTIONAL_EXIT.INTRO_UNIT:
            unitFunctional = IntroFunctional()
            for listener in dispatcher._globalListeners:
                unitFunctional.addListener(listener())

        else:
            unitFunctional = NoUnitFunctional()
    return unitFunctional