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.gameSession.onTimeTillBan -= self.gs_onTillBanNotification game_control.g_instance.rentals.onRentChangeNotify -= self.rc_onRentChange game_control.g_instance.igr.onIgrTypeChanged -= self.igr_onRoomChange unitMgr = prb_getters.getClientUnitMgr() if unitMgr: unitMgr.onUnitJoined -= self.unitMgr_onUnitJoined unitMgr.onUnitLeft -= self.unitMgr_onUnitLeft unitMgr.onUnitRestored -= self.unitMgr_onUnitRestored unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived unitBrowser = prb_getters.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()
def __stopListening(self): """ Unsubscribe from player and system 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.onArenaCreated -= self.pe_onArenaCreated g_playerEvents.onArenaJoinFailure -= self.pe_onArenaJoinFailure g_playerEvents.onKickedFromArena -= self.pe_onKickedFromArena g_playerEvents.onPrebattleAutoInvitesChanged -= self.pe_onPrebattleAutoInvitesChanged g_playerEvents.onPrebattleInvitationsError -= self.pe_onPrebattleInviteError self.gameSession.onTimeTillBan -= self.gs_onTillBanNotification self.rentals.onRentChangeNotify -= self.rc_onRentChange self.igrCtrl.onIgrTypeChanged -= self.igr_onRoomChange unitMgr = prb_getters.getClientUnitMgr() if unitMgr: unitMgr.onUnitJoined -= self.unitMgr_onUnitJoined unitMgr.onUnitLeft -= self.unitMgr_onUnitLeft unitMgr.onUnitRestored -= self.unitMgr_onUnitRestored unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived unitBrowser = prb_getters.getClientUnitBrowser() if unitBrowser: unitBrowser.onErrorReceived -= self.unitBrowser_onErrorReceived g_prbCtrlEvents.clear()
def __stopListening(self): 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.onArenaCreated -= self.pe_onArenaCreated g_playerEvents.onArenaJoinFailure -= self.pe_onArenaJoinFailure g_playerEvents.onKickedFromArena -= self.pe_onKickedFromArena g_playerEvents.onPrebattleAutoInvitesChanged -= self.pe_onPrebattleAutoInvitesChanged g_playerEvents.onPrebattleInvitationsError -= self.pe_onPrebattleInviteError g_playerEvents.onUpdateSpecBattlesWindow -= self.pe_onPrebattleAutoInvitesChanged self.gameSession.onTimeTillBan -= self.gs_onTillBanNotification self.rentals.onRentChangeNotify -= self.rc_onRentChange self.igrCtrl.onIgrTypeChanged -= self.igr_onRoomChange unitMgr = prb_getters.getClientUnitMgr() if unitMgr: unitMgr.onUnitJoined -= self.unitMgr_onUnitJoined unitMgr.onUnitLeft -= self.unitMgr_onUnitLeft unitMgr.onUnitRestored -= self.unitMgr_onUnitRestored unitMgr.onUnitErrorReceived -= self.unitMgr_onUnitErrorReceived unitMgr.onUnitNotifyReceived -= self.unitMgr_onUnitNotifyReceived unitBrowser = prb_getters.getClientUnitBrowser() if unitBrowser: unitBrowser.onErrorReceived -= self.unitBrowser_onErrorReceived g_prbCtrlEvents.clear() g_eventBus.removeListener(events.PrbActionEvent.SELECT, self.__onDoSelectAction, scope=EVENT_BUS_SCOPE.LOBBY) g_eventBus.removeListener(events.PrbActionEvent.LEAVE, self.__onDoLeaveAction, scope=EVENT_BUS_SCOPE.LOBBY)
def init(self): browser = prb_getters.getClientUnitBrowser() if browser: browser.onSearchSuccessReceived += self.unitBrowser_onSearchSuccessReceived browser.onErrorReceived += self.unitBrowser_onErrorReceived else: LOG_ERROR('Unit browser is not defined') g_playerEvents.onDequeuedUnitAssembler += self.pe_onDequeuedUnitAssembler g_playerEvents.onKickedFromUnitAssembler += self.pe_onKickedFromUnitAssembler g_playerEvents.onEnqueuedUnitAssembler += self.pe_onEnqueuedUnitAssembler
def _getUnitFromBrowser(unitIdx): unitBrowser = prb_getters.getClientUnitBrowser() if unitBrowser: results = unitBrowser.results else: results = {} if unitIdx in results: unit = results[unitIdx]['unit'] else: unit = None return (unitIdx, unit)
def _getUnit(self, unitMgrID=None): unitBrowser = prb_getters.getClientUnitBrowser() if unitBrowser: results = unitBrowser.results else: results = {} if unitMgrID in results: unit = results[unitMgrID]['unit'] else: unit = None return (unitMgrID, unit)
def decline(self): if not self.__hasResult: LOG_ERROR('First, sends request for search.') return False browser = prb_getters.getClientUnitBrowser() if browser: self.__lastErrorCode = UNIT_ERROR.OK browser.declineSearch() return True LOG_ERROR('Unit browser is not defined') return False
def initEvents(self, listener): if self.__hasResult: browser = prb_getters.getClientUnitBrowser() if browser: acceptDelta = self.getAcceptDelta(browser._acceptDeadlineUTC) if acceptDelta > 0: LOG_DEBUG('onUnitAutoSearchSuccess', acceptDelta) listener.onUnitAutoSearchSuccess(acceptDelta) elif self.__isInSearch: g_eventDispatcher.setUnitProgressInCarousel(self.__functional.getEntityType(), True) listener.onUnitAutoSearchStarted(self.getTimeLeftInSearch())
def unsubscribe(self): self.__handlers.clear() browser = prb_getters.getClientUnitBrowser() if browser: if self.__isSubscribed: browser.unsubscribe() browser.onResultsReceived -= self.__unitBrowser_onUnitsListReceived browser.onResultsUpdated -= self.__unitBrowser_onUnitsListUpdated self.__isSubscribed = False self.__selectedID = None return
def stop(self): if not self.__isInSearch: LOG_DEBUG('Auto search did not start. Exits form search forced.') self.__exitFromQueue() return True browser = prb_getters.getClientUnitBrowser() if browser: self.__lastErrorCode = UNIT_ERROR.OK browser.stopSearch() else: LOG_ERROR('Unit browser is not defined') return False
def initEvents(self, listener): if self.__hasResult: browser = prb_getters.getClientUnitBrowser() if browser: acceptDelta = self.getAcceptDelta(browser._acceptDeadlineUTC) if acceptDelta > 0: LOG_DEBUG('onUnitAutoSearchSuccess', acceptDelta) listener.onUnitAutoSearchSuccess(acceptDelta) elif self.__isInSearch: g_eventDispatcher.setUnitProgressInCarousel( self.__functional.getEntityType(), True) listener.onUnitAutoSearchStarted(self.getTimeLeftInSearch())
def unsubscribe(self): self.__handlers.clear() browser = prb_getters.getClientUnitBrowser() if browser: if self.__isSubscribed: browser.unsubscribe() browser.onResultsReceived -= self.__unitBrowser_onUnitsListReceived browser.onResultsUpdated -= self.__unitBrowser_onUnitsListUpdated self.__isSubscribed = False self.__selectedID = None self.__pageNum = 0 return
def fini(self): browser = prb_getters.getClientUnitBrowser() if browser: browser.onSearchSuccessReceived -= self.unitBrowser_onSearchSuccessReceived browser.onErrorReceived -= self.unitBrowser_onErrorReceived g_playerEvents.onDequeuedUnitAssembler -= self.pe_onDequeuedUnitAssembler g_playerEvents.onKickedFromUnitAssembler -= self.pe_onKickedFromUnitAssembler g_playerEvents.onEnqueuedUnitAssembler -= self.pe_onEnqueuedUnitAssembler if self.__isInSearch: self.stop() self.__functional = None return
def decline(self): if not self.__hasResult: LOG_ERROR('First, sends request for search.') return False else: browser = prb_getters.getClientUnitBrowser() if browser: self.__lastErrorCode = UNIT_ERROR.OK browser.declineSearch() return True LOG_ERROR('Unit browser is not defined') return False
def start(self, callback): self.__cache.clear() if callback is not None and callable(callback): self.__callback = callback else: LOG_ERROR('Callback is None or is not callable') return if self.__cooldown.isInProcess(REQUEST_TYPE.UNITS_LIST): self.__cooldown.fireEvent(REQUEST_TYPE.UNITS_LIST) browser = prb_getters.getClientUnitBrowser() if browser: self.__unitBrowser_onUnitsListReceived(browser.results) return
def accept(self): """ Accepts the auto search result """ if not self.__hasResult: LOG_ERROR('First, sends request for search.') return False browser = prb_getters.getClientUnitBrowser() if browser: self.__lastErrorCode = UNIT_ERROR.OK browser.acceptSearch() return True LOG_ERROR('Unit browser is not defined') return False
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 = prb_getters.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 = prb_getters.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
def start(self, vTypeDescrs = None): if self.__isInSearch: LOG_ERROR('Auto search already started.') return False else: browser = prb_getters.getClientUnitBrowser() if browser: if vTypeDescrs is not None: self.__vTypeDescrs = vTypeDescrs self.__lastErrorCode = UNIT_ERROR.OK browser.startSearch(vehTypes=self.__vTypeDescrs) return True LOG_ERROR('Unit browser is not defined') return False return
def start(self, vTypeDescrs=None): if self.__isInSearch: LOG_ERROR('Auto search already started.') return False else: browser = prb_getters.getClientUnitBrowser() if browser: if vTypeDescrs is not None: self.__vTypeDescrs = vTypeDescrs self.__lastErrorCode = UNIT_ERROR.OK browser.startSearch(vehTypes=self.__vTypeDescrs) return True LOG_ERROR('Unit browser is not defined') return False return
def fini(self): """ Finalization of requester. Unsubscription from browser events. """ browser = prb_getters.getClientUnitBrowser() if browser: browser.onSearchSuccessReceived -= self.unitBrowser_onSearchSuccessReceived browser.onErrorReceived -= self.unitBrowser_onErrorReceived g_playerEvents.onDequeuedUnitAssembler -= self.pe_onDequeuedUnitAssembler g_playerEvents.onKickedFromUnitAssembler -= self.pe_onKickedFromUnitAssembler g_playerEvents.onEnqueuedUnitAssembler -= self.pe_onEnqueuedUnitAssembler if self.__isInSearch: self.stop() self.__entity = None return
def subscribe(self, unitTypeFlags): if self.__isSubscribed: return self.__isSubscribed = True browser = prb_getters.getClientUnitBrowser() if browser: self.__cooldown.process(REQUEST_TYPE.UNITS_LIST) self.__handlers = {REQUEST_TYPE.UNITS_RECENTER: self.__recenter, REQUEST_TYPE.UNITS_REFRESH: self.__refresh, REQUEST_TYPE.UNITS_NAV_LEFT: self.__navLeft, REQUEST_TYPE.UNITS_NAV_RIGHT: self.__navRight} browser.subscribe(unitTypeFlags=unitTypeFlags) browser.onResultsReceived += self.__unitBrowser_onUnitsListReceived browser.onResultsUpdated += self.__unitBrowser_onUnitsListUpdated else: LOG_ERROR('Unit browser is not defined')
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 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 igrCtr.onIgrTypeChanged += self.igr_onRoomChange unitMgr = prb_getters.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 = prb_getters.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
def __startListening(self): 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.onArenaCreated += self.pe_onArenaCreated g_playerEvents.onArenaJoinFailure += self.pe_onArenaJoinFailure g_playerEvents.onKickedFromArena += self.pe_onKickedFromArena g_playerEvents.onPrebattleAutoInvitesChanged += self.pe_onPrebattleAutoInvitesChanged g_playerEvents.onPrebattleInvitationsError += self.pe_onPrebattleInviteError g_playerEvents.onUpdateSpecBattlesWindow += self.pe_onPrebattleAutoInvitesChanged if self.gameSession.lastBanMsg is not None: self.gs_onTillBanNotification(*self.gameSession.lastBanMsg) self.gameSession.onTimeTillBan += self.gs_onTillBanNotification self.rentals.onRentChangeNotify += self.rc_onRentChange self.igrCtrl.onIgrTypeChanged += self.igr_onRoomChange unitMgr = prb_getters.getClientUnitMgr() if unitMgr: unitMgr.onUnitJoined += self.unitMgr_onUnitJoined unitMgr.onUnitLeft += self.unitMgr_onUnitLeft unitMgr.onUnitRestored += self.unitMgr_onUnitRestored unitMgr.onUnitErrorReceived += self.unitMgr_onUnitErrorReceived unitMgr.onUnitNotifyReceived += self.unitMgr_onUnitNotifyReceived else: LOG_ERROR('Unit manager is not defined') unitBrowser = prb_getters.getClientUnitBrowser() if unitBrowser: unitBrowser.onErrorReceived += self.unitBrowser_onErrorReceived else: LOG_ERROR('Unit browser is not defined') g_prbCtrlEvents.onLegacyIntroModeJoined += self.ctrl_onLegacyIntroModeJoined g_prbCtrlEvents.onLegacyIntroModeLeft += self.ctrl_onLegacyIntroModeLeft g_prbCtrlEvents.onLegacyInited += self.ctrl_onLegacyInited g_prbCtrlEvents.onUnitIntroModeJoined += self.ctrl_onUnitIntroModeJoined g_prbCtrlEvents.onUnitIntroModeLeft += self.ctrl_onUnitIntroModeLeft g_prbCtrlEvents.onUnitBrowserModeLeft += self.ctrl_onUnitBrowserModeLeft g_prbCtrlEvents.onPreQueueJoined += self.ctrl_onPreQueueJoined g_prbCtrlEvents.onPreQueueJoinFailure += self.ctrl_onPreQueueJoinFailure g_prbCtrlEvents.onPreQueueLeft += self.ctrl_onPreQueueLeft g_eventBus.addListener(events.PrbActionEvent.SELECT, self.__onDoSelectAction, scope=EVENT_BUS_SCOPE.LOBBY) g_eventBus.addListener(events.PrbActionEvent.LEAVE, self.__onDoLeaveAction, scope=EVENT_BUS_SCOPE.LOBBY) return
def subscribe(self, unitTypeFlags): if self.__isSubscribed: return self.__isSubscribed = True browser = prb_getters.getClientUnitBrowser() if browser: self.__cooldown.process(REQUEST_TYPE.UNITS_LIST) self.__handlers = { REQUEST_TYPE.UNITS_RECENTER: self.__recenter, REQUEST_TYPE.UNITS_REFRESH: self.__refresh, REQUEST_TYPE.UNITS_NAV_LEFT: self.__navLeft, REQUEST_TYPE.UNITS_NAV_RIGHT: self.__navRight } browser.subscribe(unitTypeFlags=unitTypeFlags) browser.onResultsReceived += self.__unitBrowser_onUnitsListReceived browser.onResultsUpdated += self.__unitBrowser_onUnitsListUpdated else: LOG_ERROR('Unit browser is not defined')
def request(self, **kwargs): if self.__cooldown.validate(REQUEST_TYPE.UNITS_LIST): return LOG_DEBUG('Request list of units', kwargs) self.__cooldown.process(REQUEST_TYPE.UNITS_LIST) self.__cache.clear() browser = prb_getters.getClientUnitBrowser() if browser: if 'req' in kwargs: req = kwargs['req'] if req in self.__handlers: if self.__handlers[req](browser, **kwargs): Waiting.show('prebattle/auto_search') else: LOG_ERROR('Request is not supported', kwargs) else: LOG_ERROR('Request is not found', self.__handlers.keys(), kwargs) else: LOG_ERROR('Unit browser is not defined')
def __startListening(self): """ Subscribes to player and system 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.onArenaCreated += self.pe_onArenaCreated g_playerEvents.onArenaJoinFailure += self.pe_onArenaJoinFailure g_playerEvents.onKickedFromArena += self.pe_onKickedFromArena g_playerEvents.onPrebattleAutoInvitesChanged += self.pe_onPrebattleAutoInvitesChanged g_playerEvents.onPrebattleInvitationsError += self.pe_onPrebattleInviteError if self.gameSession.lastBanMsg is not None: self.gs_onTillBanNotification(*self.gameSession.lastBanMsg) self.gameSession.onTimeTillBan += self.gs_onTillBanNotification self.rentals.onRentChangeNotify += self.rc_onRentChange self.igrCtrl.onIgrTypeChanged += self.igr_onRoomChange unitMgr = prb_getters.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 = prb_getters.getClientUnitBrowser() if unitBrowser: unitBrowser.onErrorReceived += self.unitBrowser_onErrorReceived else: LOG_ERROR('Unit browser is not defined') g_prbCtrlEvents.onLegacyIntroModeJoined += self.ctrl_onLegacyIntroModeJoined g_prbCtrlEvents.onLegacyIntroModeLeft += self.ctrl_onLegacyIntroModeLeft g_prbCtrlEvents.onLegacyInited += self.ctrl_onLegacyInited g_prbCtrlEvents.onUnitIntroModeJoined += self.ctrl_onUnitIntroModeJoined g_prbCtrlEvents.onUnitIntroModeLeft += self.ctrl_onUnitIntroModeLeft g_prbCtrlEvents.onUnitBrowserModeLeft += self.ctrl_onUnitBrowserModeLeft g_prbCtrlEvents.onPreQueueJoined += self.ctrl_onPreQueueJoined g_prbCtrlEvents.onPreQueueJoinFailure += self.ctrl_onPreQueueJoinFailure g_prbCtrlEvents.onPreQueueLeft += self.ctrl_onPreQueueLeft return