Exemplo n.º 1
0
 def resync(self, firstInit=False, forceResync=False, callback=None):
     if not isClubsEnabled():
         LOG_DEBUG(
             'Clubs is not enabled on this server. Skip profile resync.')
         return
     else:
         clubsMgr = getClientClubsMgr()
         if not forceResync and clubsMgr and not clubsMgr.isRelatedToClubs(
         ):
             LOG_DEBUG(
                 'Account does not related to clubs. Skip profile resync.')
             if firstInit and self.__state.getStateID(
             ) != CLIENT_CLUB_STATE.NO_CLUB:
                 self._changeState(states.NoClubState([], []))
             return
         serverSettings = g_lobbyContext.getServerSettings()
         if serverSettings is not None and serverSettings.roaming.isInRoaming(
         ):
             LOG_NOTE('There is no clubs in the roaming')
             return
         if self._waitForSync & _SYNC_TYPE.ALL:
             LOG_DEBUG('Club profile resync already in progress')
             return
         self._waitForSync |= _SYNC_TYPE.ALL
         self.__sendRequest(club_ctx.GetPrivateProfileCtx(),
                            callback=partial(
                                self.__onAccountProfileReceived,
                                _SYNC_TYPE.ALL, callback))
         return
Exemplo n.º 2
0
 def getSeasonInfo(cls, seasonID):
     clubsMgr = getClientClubsMgr()
     if clubsMgr is not None:
         dossier = clubsMgr.getESportSeasons().get(seasonID)
         if dossier is not None:
             return SeasonInfo(seasonID, 0, 0, dossier)
     return
Exemplo n.º 3
0
 def getSeasonInfo(cls, seasonID):
     clubsMgr = getClientClubsMgr()
     if clubsMgr is not None:
         dossier = clubsMgr.getESportSeasons().get(seasonID)
         if dossier is not None:
             return SeasonInfo(seasonID, 0, 0, dossier)
     return
Exemplo n.º 4
0
 def getSeasons(cls):
     clubsMgr = getClientClubsMgr()
     if clubsMgr is not None:
         return sorted(
             map(lambda (sID, d): SeasonInfo(sID, 0, 0, d),
                 clubsMgr.getESportSeasons().iteritems()))
     else:
         return []
Exemplo n.º 5
0
    def __doUnsubscribe(self):

        def _onUnsubscribed(result):
            if result.isSuccess():
                self._changeState(SUBSCRIPTION_STATE.NOT_SUBSCRIBED)

        if getClientClubsMgr():
            self._request(club_ctx.UnsubscribeCtx(self.__clubDbID), _onUnsubscribed)
            self._changeState(SUBSCRIPTION_STATE.NOT_SUBSCRIBED)
Exemplo n.º 6
0
    def __doUnsubscribe(self):

        def _onUnsubscribed(result):
            if result.isSuccess():
                self._changeState(SUBSCRIPTION_STATE.NOT_SUBSCRIBED)

        if getClientClubsMgr():
            self._request(club_ctx.UnsubscribeCtx(self.__clubDbID), _onUnsubscribed)
            self._changeState(SUBSCRIPTION_STATE.NOT_SUBSCRIBED)
Exemplo n.º 7
0
 def start(self):
     clubsMgr = getClientClubsMgr()
     if clubsMgr is not None:
         clubsMgr.onClientClubsChanged += self.__onClientClubsChanged
         clubsMgr.onClientClubsNotification += self.__onClientClubsNotification
         clubsMgr.onClientClubsUnitInfoChanged += self.__onClientClubsUnitInfoChanged
     g_playerEvents.onCenterIsLongDisconnected += self.__onCenterIsLongDisconnected
     g_clientUpdateManager.addCallbacks({'cache.relatedToClubs': self.__onSpaAttrChanged,
      'cache.cybersportSeasonInProgress': self.__onSeasonStateChanged})
     self._accountProfile.resync(firstInit=True)
     return
Exemplo n.º 8
0
 def start(self):
     clubsMgr = getClientClubsMgr()
     if clubsMgr is not None:
         clubsMgr.onClientClubsChanged += self.__onClientClubsChanged
         clubsMgr.onClientClubsNotification += self.__onClientClubsNotification
         clubsMgr.onClientClubsUnitInfoChanged += self.__onClientClubsUnitInfoChanged
     g_playerEvents.onCenterIsLongDisconnected += self.__onCenterIsLongDisconnected
     g_clientUpdateManager.addCallbacks({'cache.relatedToClubs': self.__onSpaAttrChanged,
      'cache.eSportSeasonState': self.__onSeasonStateChanged})
     self._accountProfile.resync(firstInit=True)
     self._seasonsCache.start()
     self._availabilityCtrl.start()
Exemplo n.º 9
0
 def start(self):
     clubsMgr = getClientClubsMgr()
     if clubsMgr is not None:
         clubsMgr.onClientClubsChanged += self.__onClientClubsChanged
         clubsMgr.onClientClubsNotification += self.__onClientClubsNotification
         clubsMgr.onClientClubsUnitInfoChanged += self.__onClientClubsUnitInfoChanged
     g_playerEvents.onCenterIsLongDisconnected += self.__onCenterIsLongDisconnected
     g_clientUpdateManager.addCallbacks({'cache.relatedToClubs': self.__onSpaAttrChanged,
      'cache.eSportSeasonState': self.__onSeasonStateChanged})
     self._accountProfile.resync(firstInit=True, callback=lambda : self._seasonsCache.start())
     self._availabilityCtrl.start()
     return
Exemplo n.º 10
0
 def resync(self, firstInit = False, forceResync = False):
     if not isClubsEnabled():
         LOG_DEBUG('Clubs is not enabled on this server. Skip profile resync.')
         return
     clubsMgr = getClientClubsMgr()
     if not forceResync and clubsMgr and not clubsMgr.isRelatedToClubs():
         LOG_DEBUG('Account does not related to clubs. Skip profile resync.')
         if firstInit and self.__state.getStateID() != CLIENT_CLUB_STATE.NO_CLUB:
             self._changeState(states.NoClubState([], []))
         return
     if g_gameCtrl.roaming.isInRoaming():
         LOG_NOTE('There is no clubs in the roaming')
         return
     if self._waitForSync & _SYNC_TYPE.ALL:
         LOG_DEBUG('Club profile resync already in progress')
         return
     self._waitForSync |= _SYNC_TYPE.ALL
     self.__sendRequest(club_ctx.GetPrivateProfileCtx(), callback=partial(self.__onAccountProfileReceived, _SYNC_TYPE.ALL))
Exemplo n.º 11
0
    def stop(self, isDisconnected = False):
        if isDisconnected:
            self.__isAppsNotifyShown = False
            clearInvitesIDs()
        g_clientUpdateManager.removeObjectCallbacks(self)
        g_playerEvents.onCenterIsLongDisconnected -= self.__onCenterIsLongDisconnected
        clubsMgr = getClientClubsMgr()
        if clubsMgr is not None:
            clubsMgr.onClientClubsNotification -= self.__onClientClubsNotification
            clubsMgr.onClientClubsChanged -= self.__onClientClubsChanged
            clubsMgr.onClientClubsUnitInfoChanged -= self.__onClientClubsUnitInfoChanged
        self._accountProfile.stop()
        self._requestsCtrl.stopProcessing()
        for s in self.__subscriptions.itervalues():
            s.stop()

        self.__subscriptions.clear()
        return
Exemplo n.º 12
0
    def stop(self, isDisconnected = False):
        self._seasonsCache.stop()
        if isDisconnected:
            self.__isAppsNotifyShown = False
            clearInvitesIDs()
        g_clientUpdateManager.removeObjectCallbacks(self)
        g_playerEvents.onCenterIsLongDisconnected -= self.__onCenterIsLongDisconnected
        clubsMgr = getClientClubsMgr()
        if clubsMgr is not None:
            clubsMgr.onClientClubsNotification -= self.__onClientClubsNotification
            clubsMgr.onClientClubsChanged -= self.__onClientClubsChanged
            clubsMgr.onClientClubsUnitInfoChanged -= self.__onClientClubsUnitInfoChanged
        self._accountProfile.stop()
        self._requestsCtrl.stopProcessing()
        for s in self.__subscriptions.itervalues():
            s.stop()

        self.__subscriptions.clear()
        self._availabilityCtrl.stop()
Exemplo n.º 13
0
 def getSender(self):
     return self._sender or getClientClubsMgr()
Exemplo n.º 14
0
 def getSender(self):
     return getClientClubsMgr()
Exemplo n.º 15
0
 def getSeasonState(cls):
     clubsMgr = getClientClubsMgr()
     if clubsMgr is not None:
         return SeasonState(clubsMgr.getESportSeasonState())
     else:
         return SeasonState(CLUBS_SEASON_STATE.INACTIVE)
Exemplo n.º 16
0
 def getSeasons(cls):
     clubsMgr = getClientClubsMgr()
     if clubsMgr is not None:
         return sorted(map(lambda (sID, d): SeasonInfo(sID, 0, 0, d), clubsMgr.getESportSeasons().iteritems()))
     else:
         return []
Exemplo n.º 17
0
 def getSender(self):
     return getClientClubsMgr()
Exemplo n.º 18
0
 def getSender(self):
     return self._sender or getClientClubsMgr()
Exemplo n.º 19
0
 def getSeasonState(cls):
     clubsMgr = getClientClubsMgr()
     if clubsMgr is not None:
         return SeasonState(clubsMgr.getESportSeasonState())
     return SeasonState(CLUBS_SEASON_STATE.INACTIVE)