def init(self): super(EpicBattleMetaGameController, self).init() self.__urlMacros = URLMacros() self.addNotificator(SimpleNotifier(self.getTimer, self.__timerUpdate)) self.addNotificator(PeriodicNotifier(self.getTimer, self.__timerTick)) self.__eventEndedNotifier = SimpleNotifier(self.getEventTimeLeft, self.__onEventEnded) self.addNotificator(self.__eventEndedNotifier)
def __init__(self, battlePassController): super(BattlePassVideoProvider, self).__init__() self.__battlePassController = weakref.proxy(battlePassController) self.__eventsManager = EventManager() self.__videosConfig = {} self.__unlockVideoNotifier = SimpleNotifier( self.__getTimeToNotifyUnlockVideo, self.__onNotifyUnlockVideo) self.__requestVideoNotifier = SimpleNotifier( self.__getTimeToNotifyFailedRequest, self.__onMakeRepeatRequest) self.__isStarted = False self.__failedRequestCount = 0 self.__webController = None self.onVideosConfigUpdated = Event(self.__eventsManager) return
def init(self): super(BattleRoyaleController, self).init() self.__voControl = BRVoiceOverController() self.__voControl.init() self.__urlMacros = URLMacros() self.addNotificator(SimpleNotifier(self.getTimer, self.__timerUpdate)) self.addNotificator(PeriodicNotifier(self.getTimer, self.__timerTick))
def _populate(self): super(SwitchPeripheryWindow, self)._populate() self._serversDP = ServersDataProvider() self._serversDP.setFlashObject(self.as_getServersDPS()) self.as_setImageS(RES_ICONS.MAPS_ICONS_WINDOWS_SWITCH_PERIPHERY_WINDOW_BG, 0) self.as_setWindowTitleS(_ms(DIALOGS.SWITCHPERIPHERYWINDOW_WINDOWTITLE)) currentServer = self.connectionMgr.serverUserName self.as_setTextS(_ms(self.__ctx.getHeader()), _ms(self.__ctx.getDescription(), server=text_styles.error(currentServer))) self.addNotificator(SimpleNotifier(self.__ctx.getUpdateTime, self.__onServersUpdate)) self.startNotification() self._updateServersList() if not constants.IS_CHINA: if GUI_SETTINGS.csisRequestRate == REQUEST_RATE.ALWAYS: g_preDefinedHosts.startCSISUpdate() g_preDefinedHosts.onCsisQueryStart += self.__onServersUpdate g_preDefinedHosts.onCsisQueryComplete += self.__onServersUpdate g_preDefinedHosts.onPingPerformed += self.__onServersUpdate self.as_setButtonsS([{'label': _ms(DIALOGS.SWITCHPERIPHERYWINDOW_BTNSWITCH), 'btnLinkage': BUTTON_LINKAGES.BUTTON_NORMAL, 'action': self._SWITCH_BTN_ACTION, 'isFocused': True, 'tooltip': ''}, {'label': _ms(DIALOGS.SWITCHPERIPHERYWINDOW_BTNCANCEL), 'btnLinkage': BUTTON_LINKAGES.BUTTON_BLACK, 'action': self._CLOSE_BTN_ACTION, 'isFocused': False, 'tooltip': ''}], TEXT_ALIGN.RIGHT, self._BTN_WIDTH)
def __init__(self): self.__eventsManager = EventManager() self.onEventUpdated = Event(self.__eventsManager) self.onSettingsChanged = Event(self.__eventsManager) self.onNumberRequesterUpdated = Event(self.__eventsManager) self.__notifier = SimpleNotifier(self.__getTimeLeft, self.__onEventStateChange) self.__serialNumberRequester = ResourceWellNumberRequester(isSerial=True) self.__regularNumberRequester = ResourceWellNumberRequester(isSerial=False)
def __init__(self, battlePassController): super(BattlePassVotingRequester, self).__init__() self.__battlePassController = weakref.proxy(battlePassController) self.__eventsManager = EventManager() self.__requestNotifier = SimpleNotifier( self.__getTimeToNotifyFailedRequest, self.__requestVotingData) self.__isStarted = False self.__isAvailableService = True self.__cache = {} self.onVotingResultsUpdated = Event(self.__eventsManager)
def __init__(self): self.__oldPoints = 0 self.__oldLevel = 0 self.__currentMode = None self.__eventsManager = EventManager() self.__seasonChangeNotifier = SimpleNotifier(self.__getTimeToNotifySeasonChanged, self.__onNotifySeasonChanged) self.__extraChapterNotifier = SimpleNotifier(self.__getTimeToExtraChapterExpired, self.__onNotifyExtraChapterExpired) self.onPointsUpdated = Event(self.__eventsManager) self.onLevelUp = Event(self.__eventsManager) self.onBattlePassIsBought = Event(self.__eventsManager) self.onSelectTokenUpdated = Event(self.__eventsManager) self.onSeasonStateChanged = Event(self.__eventsManager) self.onExtraChapterExpired = Event(self.__eventsManager) self.onBattlePassSettingsChange = Event(self.__eventsManager) self.onFinalRewardStateChange = Event(self.__eventsManager) self.onOffersUpdated = Event(self.__eventsManager) self.onRewardSelectChange = Event(self.__eventsManager) self.onChapterChanged = Event(self.__eventsManager) self.__rewardLogic = None return
def __init__(self, eventSettings, clearCallback): super(GiftEventBaseKeeper, self).__init__(eventSettings) self._msgHandlers.update({GiftMessageType.INCOME: self._processIncomeMessage, GiftMessageType.OUTCOME: self._processOutcomeMessage}) self.__clearCallback = clearCallback self.__sendLimit = _DEFAULT_SEND_LIMIT self.__incomeRelations = defaultdict(int) self.__outcomeRelations = defaultdict(int) self.__expireTime = self.__expireDelta = None self.__currentTimeInterval = _ENDLESS_INTERVAL self.addNotificator(SimpleNotifier(self.getClearingDelta, self.__updateExpiredRelations)) return
def _onLoading(self, *args, **kwargs): super(BattlePassProgressionsView, self)._onLoading() self.__notifier = Notifiable() self.__notifier.addNotificator( PeriodicNotifier(self.__battlePass.getSeasonTimeLeft, self.__updateTimer)) self.__notifier.addNotificator( SimpleNotifier(self.__battlePass.getFinalOfferTimeLeft, self.__updateTimer)) self.__notifier.startNotification() self.__updateProgressData() self.__updateBuyButtonState()
def __init__(self): self.__oldPoints = 0 self.__oldLevel = 0 self.__oldVoteOption = 0 self.__badge = None self.__currentMode = None self.__eventsManager = EventManager() self.__seasonChangeNotifier = SimpleNotifier( self.__getTimeToNotifySeasonChange, self.__onNotifySeasonChange) self.__purchaseUnlockNotifier = SimpleNotifier( self.__getTimeToNotifyPurchaseUnlock, self.__onNotifyUnlock) self.onPointsUpdated = Event(self.__eventsManager) self.onLevelUp = Event(self.__eventsManager) self.onVoted = Event(self.__eventsManager) self.onBattlePassIsBought = Event(self.__eventsManager) self.onSeasonStateChange = Event(self.__eventsManager) self.onUnlimitedPurchaseUnlocked = Event(self.__eventsManager) self.onBattlePassSettingsChange = Event(self.__eventsManager) self.onFinalRewardStateChange = Event(self.__eventsManager) self.__votingRequester = BattlePassVotingRequester(self) self.__finalRewardStateMachine = FinalRewardStateMachine(self) return
def __onConfigChanged(self, diff): config = diff[BATTLE_PASS_CONFIG_NAME] self.__seasonChangeNotifier.startNotification() chapters = config.get('season', {}).get('chapters', {}) if any((self.isExtraChapter(chapterID) for chapterID in chapters)): self.__extraChapterNotifier.stopNotification() self.__extraChapterNotifier = SimpleNotifier(self.__getTimeToExtraChapterExpired, self.__onNotifyExtraChapterExpired) self.__extraChapterNotifier.startNotification() else: self.__extraChapterNotifier.stopNotification() newMode = None oldMode = self.__currentMode if 'mode' in config: newMode = config['mode'] self.__currentMode = newMode self.onBattlePassSettingsChange(newMode, oldMode) return
def init(self): self.addNotificators( PeriodicNotifier(self.__getClosestPremiumNotification, self.__notifyPremiumTime), SimpleNotifier(self.__getClosestSessionTimeNotification, self.__notifyClient), PeriodicNotifier(self.__getClosestNewDayNotification, self.__notifyNewDay)) self.__sessionStartedAt = -1 self.__banCallback = None self.__lastBanMsg = None self.__curfewBlockTime = None self.__curfewUnblockTime = None self.__doNotifyInStart = False self.__battles = 0 self.__lastNotifyTime = None LOG_DEBUG('GameSessionController::init') return
def _populate(self): super(PrimeTimeViewBase, self)._populate() self.__serversDP = self._getAllServersDP() self.__serversDP.setFlashObject(self.as_getServersDPS()) self.__updateList() self.__updateData() self._getController().onUpdated += self.__onControllerUpdated if not constants.IS_CHINA: if GUI_SETTINGS.csisRequestRate == REQUEST_RATE.ALWAYS: g_preDefinedHosts.startCSISUpdate() g_preDefinedHosts.onCsisQueryStart += self.__onServersUpdate g_preDefinedHosts.onCsisQueryComplete += self.__onServersUpdate g_preDefinedHosts.onPingPerformed += self.__onServersUpdate self.addNotificators( PeriodicNotifier(self.__getPeriodUpdateTime, self.__onPeriodUpdate), SimpleNotifier(self.__getSimpleUpdateTime, self.__onSimpleUpdate)) self.startNotification()
def _onLoading(self, *args, **kwargs): super(BattlePassProgressionsView, self)._onLoading() self.__addListeners() self.__notifier = Notifiable() self.__notifier.addNotificator( PeriodicNotifier(self.__battlePassController.getSeasonTimeLeft, self.__updateTimer)) self.__notifier.addNotificator( PeriodicNotifier( self.__battlePassController.getSellAnyLevelsUnlockTimeLeft, self.__updateTimer)) self.__notifier.addNotificator( SimpleNotifier(self.__battlePassController.getFinalOfferTimeLeft, self.__updateTimer)) self.__notifier.startNotification() self.__updateProgressData() self.__updateBuyButtonState() self.__updateExtrasAndVotingButtons()
def __init__(self): self.__oldPoints = 0 self.__oldLevel = 0 self.__currentMode = None self.__eventsManager = EventManager() self.__seasonChangeNotifier = SimpleNotifier( self.__getTimeToNotifySeasonChange, self.__onNotifySeasonChange) self.onPointsUpdated = Event(self.__eventsManager) self.onLevelUp = Event(self.__eventsManager) self.onBattlePassIsBought = Event(self.__eventsManager) self.onSeasonStateChange = Event(self.__eventsManager) self.onBattlePassSettingsChange = Event(self.__eventsManager) self.onFinalRewardStateChange = Event(self.__eventsManager) self.onDeviceSelectChange = Event(self.__eventsManager) self.onOffersUpdated = Event(self.__eventsManager) self.onRewardSelectChange = Event(self.__eventsManager) self.__nonSelectedOldTrophyDeviceNotifier = NonSelectedOldTrophyDeviceNotifier( self) self.__rewardLogic = None return
def __handleNotifications(self, notifications): newEntries = {} for item in notifications: if item.eventType == _HANGAR_ENTRY_POINTS: notificationEntries = json.loads(item.data) for entryData in notificationEntries: entryId = entryData.get('id') entry = self.__entries.get(entryId) if not (entry and entry.data == entryData): entry = _EntryPointData(entryData) if entry.getIsValidData() and not entry.getIsExpiredDate(): newEntries[entryId] = entry if not newEntries == self.__entries: self.__entries = newEntries self.clearNotification() self.addNotificator( SimpleNotifier(self.__getCooldownForUpdate, self.__onUpdateNotify)) self.startNotification() self.__updateEntries()
def __update(self): actions = self.__eventsCache.getActions() eventState = self.__getEventParams(actions, _EVENT_STATE_NAME) try: dateFinishDT = datetime.strptime(eventState.strip(), FORMAT_DATE) self.__dateFinish = calendar.timegm(dateFinishDT.timetuple()) except (AttributeError, TypeError): self.__updateEvent(False) self.__dateFinish = None return currtime = time_utils.getServerUTCTime() eventState = self.__dateFinish > currtime self.__updateEvent(eventState) self.__clearNotifier() if eventState: self.__notifier = SimpleNotifier(self.__getTimeDelta, self.__update) self.__notifier.startNotification() else: self.__dateFinish = None return
def _onLoading(self, *args, **kwargs): super(ProgressionView, self)._onLoading(*args, **kwargs) self.__resourceWell.startNumberRequesters() self.__notifier = SimpleNotifier(self.__getReminderTimeLeft, self.__updateEventTime) self.__updateModel() ResourceWellMainScreenLogger().onViewOpened(getProgressionState())
def init(self): super(EpicBattleMetaGameController, self).init() self.addNotificator(SimpleNotifier(self.__getTimer, self.__timerUpdate))
def init(self): super(FunRandomController, self).init() self.addNotificator( SimpleNotifier(self.getTimer, self.__gameModeStatusUpdate)) self.addNotificator( TimerNotifier(self.getTimer, self.__gameModeStatusTick))
def init(self): super(EventBattlesController, self).init() self.addNotificator(SimpleNotifier(self.__getTimer, self.__timerUpdate))
def startControl(self): self.addNotificators(SimpleNotifier(self.__getClosestSessionTimeNotification, self.__onBanNotifyHandler)) self.startNotification()
def init(self): super(BattleRoyaleController, self).init() self.__voControl = BRVoiceOverController() self.__voControl.init() self.addNotificator(SimpleNotifier(self.getTimer, self.__timerUpdate))