예제 #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.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()
예제 #2
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.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()
예제 #3
0
 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()
예제 #4
0
 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)
예제 #5
0
 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
예제 #6
0
 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
예제 #7
0
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)
예제 #8
0
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)
예제 #9
0
 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)
예제 #10
0
 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
예제 #11
0
 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())
예제 #12
0
 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
예제 #13
0
 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
예제 #14
0
 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())
예제 #15
0
 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
예제 #16
0
 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
예제 #17
0
 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
예제 #18
0
 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
예제 #19
0
 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
예제 #20
0
 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
예제 #21
0
 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
예제 #22
0
 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
예제 #23
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 = 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
예제 #24
0
 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
예제 #25
0
 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
예제 #26
0
 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
예제 #27
0
 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')
예제 #28
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
     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
예제 #29
0
 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
예제 #30
0
 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')
예제 #31
0
 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')
예제 #32
0
 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')
예제 #33
0
 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