Example #1
0
 def start(self, clanCache):
     if self.isStarted():
         LOG_WARNING('Fort provider already is ready')
         return
     else:
         self.__initial |= FORT_PROVIDER_INITIAL_FLAGS.STARTED
         self.__clan = weakref.proxy(clanCache)
         self.__listeners = _ClientFortListeners()
         self.__keeper = FortSubscriptionKeeper()
         self.__keeper.onAutoUnsubscribed += self.__onAutoUnsubscribed
         fortMgr = getClientFortMgr()
         if fortMgr:
             fortMgr.onFortResponseReceived += self.__onFortResponseReceived
             fortMgr.onFortUpdateReceived += self.__onFortUpdateReceived
             fortMgr.onFortStateChanged += self.__onFortStateChanged
         else:
             LOG_ERROR('Fort manager is not found')
         g_lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingChanged
         g_playerEvents.onCenterIsLongDisconnected += self.__onCenterIsLongDisconnected
         self.__controller = controls.createInitial()
         self.__controller.init(self.__clan, self.__listeners)
         states.create(self)
         if not g_lobbyContext.getServerSettings().isFortsEnabled() and self.__cachedState is not None:
             if self.__cachedState.getStateID() not in (CLIENT_FORT_STATE.UNSUBSCRIBED, CLIENT_FORT_STATE.DISABLED):
                 SystemMessages.pushI18nMessage(I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDOFF, type=SystemMessages.SM_TYPE.Warning)
                 showFortDisabledDialog()
         return
 def start(self, clanCache):
     if self.isStarted():
         LOG_WARNING('Fort provider already is ready')
         return
     else:
         self.__initial |= FORT_PROVIDER_INITIAL_FLAGS.STARTED
         self.__clan = weakref.proxy(clanCache)
         self.__listeners = _ClientFortListeners()
         self.__keeper = FortSubscriptionKeeper()
         self.__keeper.onAutoUnsubscribed += self.__onAutoUnsubscribed
         fortMgr = getClientFortMgr()
         if fortMgr:
             fortMgr.onFortResponseReceived += self.__onFortResponseReceived
             fortMgr.onFortUpdateReceived += self.__onFortUpdateReceived
             fortMgr.onFortStateChanged += self.__onFortStateChanged
         else:
             LOG_ERROR('Fort manager is not found')
         g_lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingChanged
         g_playerEvents.onCenterIsLongDisconnected += self.__onCenterIsLongDisconnected
         self.__controller = controls.createInitial()
         self.__controller.init(self.__clan, self.__listeners)
         states.create(self)
         if not g_lobbyContext.getServerSettings().isFortsEnabled() and self.__cachedState is not None:
             if self.__cachedState.getStateID() not in (CLIENT_FORT_STATE.UNSUBSCRIBED, CLIENT_FORT_STATE.DISABLED):
                 SystemMessages.pushI18nMessage(I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDOFF, type=SystemMessages.SM_TYPE.Warning)
                 showFortDisabledDialog()
         return
Example #3
0
 def __onServerSettingChanged(self, diff):
     if 'isFortsEnabled' in diff:
         if diff['isFortsEnabled']:
             SystemMessages.pushI18nMessage(I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDON, priority=NotificationPriorityLevel.MEDIUM)
         else:
             SystemMessages.pushI18nMessage(I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDOFF, type=SystemMessages.SM_TYPE.Warning)
             if self.__state.getStateID() != CLIENT_FORT_STATE.UNSUBSCRIBED:
                 showFortDisabledDialog()
         self.resetState()
Example #4
0
 def __onServerSettingChanged(self, diff):
     if 'isFortsEnabled' in diff:
         if diff['isFortsEnabled']:
             SystemMessages.pushI18nMessage(
                 I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDON,
                 priority=NotificationPriorityLevel.MEDIUM)
         else:
             SystemMessages.pushI18nMessage(
                 I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDOFF,
                 type=SystemMessages.SM_TYPE.Warning)
             if self.__state.getStateID() != CLIENT_FORT_STATE.UNSUBSCRIBED:
                 showFortDisabledDialog()
         self.resetState()
Example #5
0
 def __showPopupDlgIfDisabled(self, _):
     showFortDisabledDialog()
 def __showPopupDlgIfDisabled(self, _):
     showFortDisabledDialog()