Esempio 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
Esempio 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
Esempio 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
Esempio 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 []
Esempio 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)
Esempio 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)
Esempio 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
Esempio 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()
Esempio 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
Esempio 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))
Esempio 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
Esempio 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()
Esempio n. 13
0
 def getSender(self):
     return self._sender or getClientClubsMgr()
Esempio n. 14
0
 def getSender(self):
     return getClientClubsMgr()
Esempio n. 15
0
 def getSeasonState(cls):
     clubsMgr = getClientClubsMgr()
     if clubsMgr is not None:
         return SeasonState(clubsMgr.getESportSeasonState())
     else:
         return SeasonState(CLUBS_SEASON_STATE.INACTIVE)
Esempio 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 []
Esempio n. 17
0
 def getSender(self):
     return getClientClubsMgr()
Esempio n. 18
0
 def getSender(self):
     return self._sender or getClientClubsMgr()
Esempio n. 19
0
 def getSeasonState(cls):
     clubsMgr = getClientClubsMgr()
     if clubsMgr is not None:
         return SeasonState(clubsMgr.getESportSeasonState())
     return SeasonState(CLUBS_SEASON_STATE.INACTIVE)