Пример #1
0
 def __init__(self, clubDbID, subscriptionType, clubsCtrl = None):
     super(_Subscription, self).__init__()
     self.__clubDbID = clubDbID
     self.__subscriptionType = subscriptionType
     self.__club = None
     self.__state = SUBSCRIPTION_STATE.NOT_SUBSCRIBED
     self.__lastRequestTime = -1
     if clubsCtrl is not None:
         self.__clubsCtrl = weakref.proxy(clubsCtrl)
     else:
         self.__clubsCtrl = None
     self.addNotificator(PeriodicNotifier(lambda : _SET - 10.0, BoundMethodWeakref(self._onSubscriptionUpdate), (_SET,)))
     self.__comparators = [SimpleTypeComparator('name', 'onClubNameChanged', 'getUserName'),
      SimpleTypeComparator('description', 'onClubDescriptionChanged', 'getUserDescription'),
      SimpleTypeComparator('owner', 'onClubOwnerChanged', 'getOwnerDbID'),
      SimpleTypeComparator('state', 'onClubStateChanged', 'getState'),
      SimpleTypeComparator('ladder', 'onClubLadderInfoChanged', 'getLadderInfo'),
      SimpleTypeComparator('members', 'onClubMembersChanged', 'getMembers'),
      SimpleTypeComparator('membersExtras', 'onClubMembersChanged', 'getMembers'),
      SimpleTypeComparator('invites', 'onClubInvitesChanged', 'getInvites'),
      SimpleTypeComparator('applicants', 'onClubApplicantsChanged', 'getApplicants'),
      SimpleTypeComparator('restrictions', 'onClubRestrictionsChanged', 'getRestrictions'),
      SimpleTypeComparator('minWinRate', 'onClubApplicantsRequirementsChanged', 'getApplicantsRequirements'),
      SimpleTypeComparator('minBattleCount', 'onClubApplicantsRequirementsChanged', 'getApplicantsRequirements'),
      SimpleTypeComparator('shortDescription', 'onClubApplicantsRequirementsChanged', 'getApplicantsRequirements')]
     return
Пример #2
0
 def start(self):
     if not self.isPlaying():
         SOUND_DEBUG('Start playing sound event', self._soundEventID,
                     self._params)
         _MC.g_musicController.play(self._soundEventID, self._params)
         if self._checkFinish:
             self.addNotificators(
                 PeriodicNotifier(
                     BoundMethodWeakref(self._getNotificationDelta),
                     BoundMethodWeakref(self._onCheckAmbientNotification),
                     (PLAYING_SOUND_CHECK_PERIOD, )))
             self.startNotification()
             self.onStarted()
     else:
         SOUND_DEBUG('Sound is already playing', self._soundEventID,
                     self._params)
 def _onRegisterFlashComponent(self, viewPy, alias):
     super(StrongholdBattlesListView,
           self)._onRegisterFlashComponent(viewPy, alias)
     if alias == VIEW_ALIAS.BROWSER:
         viewPy.init(
             self.__browserId,
             createStrongholdsWebHandlers(onBrowserOpen=BoundMethodWeakref(
                 self.addChildBrowserAlias)))
         self.__browserCreated = True
Пример #4
0
 def __init__(self):
     super(NYScreenViewBase, self).__init__()
     self._slots = []
     self._tabID = None
     self.__changeResCallbackID = None
     self.__scrollUpdateTimer = EachFrameTickTimer(
         BoundMethodWeakref(self.doScrollUpdate))
     self.__isActive = False
     self.__interfaceScale = 1.0
     return
Пример #5
0
 def init(self, isPremium):
     if self.__space is None:
         self.__space = ClientHangarSpace(BoundMethodWeakref(self._changeDone))
     self.statsCollector.noteHangarLoadingState(HANGAR_LOADING_STATE.START_LOADING_SPACE)
     self.__videoCameraController.init()
     self.__spaceDestroyedDuringLoad = False
     if not self.__spaceInited:
         LOG_DEBUG('HangarSpace::init')
         Waiting.show('loadHangarSpace', overlapsUI=False)
         self.__inited = True
         self.__isSpacePremium = isPremium
         self.__igrSpaceType = self.igrCtrl.getRoomType()
         self.__space.create(isPremium, self.__spaceDone)
         if self.__lastUpdatedVehicle is not None:
             self.startToUpdateVehicle(self.__lastUpdatedVehicle)
         self.gameSession.onPremiumNotify += self.onPremiumChanged
         g_keyEventHandlers.add(self.__handleKeyEvent)
         g_eventBus.addListener(events.LobbySimpleEvent.NOTIFY_CURSOR_OVER_3DSCENE, self.__onNotifyCursorOver3dScene)
     return
Пример #6
0
 def __init__(self, unitEntity):
     super(ActionButtonStateVO, self).__init__()
     self._playerInfo = unitEntity.getPlayerInfo()
     result = unitEntity.canPlayerDoAction()
     self.__unitIsValid, self.__restrictionType = result.isValid, result.restriction
     self.__validationCtx = result.ctx
     self.__isEnabled = self._isEnabled(self.__unitIsValid,
                                        self.__restrictionType)
     self.__stats = unitEntity.getStats()
     self.__flags = unitEntity.getFlags()
     self.__settings = unitEntity.getRosterSettings()
     self.__canTakeSlot = not self._playerInfo.isLegionary()
     self.__INVALID_UNIT_MESSAGES = {
         UNIT_RESTRICTION.UNDEFINED: ('', {}),
         UNIT_RESTRICTION.UNIT_IS_FULL:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_UNITISFULL, {}),
         UNIT_RESTRICTION.UNIT_IS_LOCKED:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_UNITISLOCKED, {}),
         UNIT_RESTRICTION.VEHICLE_NOT_SELECTED:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLENOTSELECTED, {}),
         UNIT_RESTRICTION.VEHICLE_NOT_VALID:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLENOTVALID, {}),
         UNIT_RESTRICTION.VEHICLE_BROKEN:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLEINNOTREADY_BROKEN, {}),
         UNIT_RESTRICTION.VEHICLE_CREW_NOT_FULL:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLEINNOTREADY_CREWNOTFULL, {}),
         UNIT_RESTRICTION.VEHICLE_RENT_IS_OVER:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLEINNOTREADY_RENTISOVER, {}),
         UNIT_RESTRICTION.VEHICLE_IS_IN_BATTLE:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLEINNOTREADY_ISINBATTLE, {}),
         UNIT_RESTRICTION.MIN_SLOTS:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_MINSLOTS, {}),
         UNIT_RESTRICTION.NOT_READY_IN_SLOTS:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_WAITING, {}),
         UNIT_RESTRICTION.MIN_TOTAL_LEVEL:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_LEVEL, self.__validationCtx),
         UNIT_RESTRICTION.MAX_TOTAL_LEVEL:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_LEVEL, self.__validationCtx),
         UNIT_RESTRICTION.INVALID_TOTAL_LEVEL:
         ActionButtonStateVO.getInvalidVehicleLevelsMessage(
             self.__validationCtx),
         UNIT_RESTRICTION.IS_IN_IDLE:
         BoundMethodWeakref(self._getIdleStateStr),
         UNIT_RESTRICTION.IS_IN_ARENA:
         BoundMethodWeakref(self._getArenaStateStr),
         UNIT_RESTRICTION.NEED_PLAYERS_SEARCH: ('', {}),
         UNIT_RESTRICTION.ZERO_TOTAL_LEVEL: ('', {}),
         UNIT_RESTRICTION.IS_IN_PRE_ARENA:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_WAITCOMMANDER, {}),
         UNIT_RESTRICTION.NOT_IN_SLOT:
         BoundMethodWeakref(self._notInSlotMessage),
         UNIT_RESTRICTION.VEHICLE_NOT_VALID_FOR_EVENT:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLENOTVALID, {}),
         UNIT_RESTRICTION.CURFEW: (CYBERSPORT.WINDOW_UNIT_MESSAGE_CURFEW,
                                   {}),
         UNIT_RESTRICTION.VEHICLE_WRONG_MODE:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLEINNOTREADY_WRONGMODE, {}),
         UNIT_RESTRICTION.FALLOUT_NOT_ENOUGH_PLAYERS: ('', {}),
         UNIT_RESTRICTION.FALLOUT_VEHICLE_LEVEL_REQUIRED:
         BoundMethodWeakref(self._getFalloutVehLevelStr),
         UNIT_RESTRICTION.FALLOUT_VEHICLE_MIN:
         BoundMethodWeakref(self._getFalloutVehMinStr),
         UNIT_RESTRICTION.FALLOUT_VEHICLE_MAX: ('', {}),
         UNIT_RESTRICTION.FALLOUT_VEHICLE_BROKEN:
         BoundMethodWeakref(self._getFalloutVehBrokenStr),
         UNIT_RESTRICTION.FORT_DISABLED:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_FORTIFICATIONNOTAVAILABLE, {}),
         UNIT_RESTRICTION.VEHICLE_INVALID_LEVEL:
         (self.__getNotAvailableIcon() + i18n.makeString(
             MESSENGER.DIALOGS_SQUAD_MESSAGE_INVALIDVEHICLELEVEL), {}),
         UNIT_RESTRICTION.SPG_IS_FORBIDDEN:
         (self.__getNotAvailableIcon() +
          i18n.makeString(MESSENGER.DIALOGS_SQUAD_MESSAGE_SPGFORBIDDEN),
          {}),
         UNIT_RESTRICTION.SPG_IS_FULL:
         (self.__getNotAvailableIcon() +
          i18n.makeString(MESSENGER.DIALOGS_SQUAD_MESSAGE_SPGFULL), {}),
         UNIT_RESTRICTION.ROTATION_GROUP_LOCKED:
         BoundMethodWeakref(self._rotationGroupBlockMessage),
         UNIT_RESTRICTION.UNIT_MAINTENANCE:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_MAINTENANCE, {}),
         UNIT_RESTRICTION.UNIT_INACTIVE_PERIPHERY_UNDEF:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_INACTIVEPERIPHERY, {}),
         UNIT_RESTRICTION.UNIT_INACTIVE_PERIPHERY_SORTIE:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_INACTIVEPERIPHERYSORTIE, {}),
         UNIT_RESTRICTION.UNIT_INACTIVE_PERIPHERY_BATTLE:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_INACTIVEPERIPHERYBATTLE, {}),
         UNIT_RESTRICTION.UNIT_WAITINGFORDATA:
         (TOOLTIPS.STRONGHOLDS_TIMER_WAITINGFORDATA, {})
     }
     self.__WARNING_UNIT_MESSAGES = {
         UNIT_RESTRICTION.XP_PENALTY_VEHICLE_LEVELS:
         (MESSENGER.DIALOGS_SQUAD_MESSAGE_VEHICLES_DIFFERENTLEVELS, {})
     }
     stateKey, stateCtx = self.__getState()
     self['stateString'] = self.__stateTextStyleFormatter(
         i18n.makeString(stateKey, **stateCtx))
     self['label'] = self._getLabel()
     self['isEnabled'] = self.__isEnabled
     self['isReady'] = self._playerInfo.isReady
     self['toolTipData'] = self.__toolTipData
Пример #7
0
 def __init__(self, unitEntity):
     super(ActionButtonStateVO, self).__init__()
     self._playerInfo = unitEntity.getPlayerInfo()
     result = unitEntity.canPlayerDoAction()
     self.__unitIsValid, self.__restrictionType = result.isValid, result.restriction
     self.__validationCtx = result.ctx
     self.__isEnabled = self._isEnabled(self.__unitIsValid,
                                        self.__restrictionType)
     self.__stats = unitEntity.getStats()
     self.__flags = unitEntity.getFlags()
     self.__settings = unitEntity.getRosterSettings()
     self.__canTakeSlot = not self._playerInfo.isLegionary()
     self.__INVALID_UNIT_MESSAGES = {
         UNIT_RESTRICTION.UNDEFINED: ('', {}),
         UNIT_RESTRICTION.UNIT_IS_FULL:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_UNITISFULL, {}),
         UNIT_RESTRICTION.UNIT_IS_LOCKED:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_UNITISLOCKED, {}),
         UNIT_RESTRICTION.VEHICLE_NOT_SELECTED:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLENOTSELECTED, {}),
         UNIT_RESTRICTION.VEHICLE_NOT_VALID:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLENOTVALID, {}),
         UNIT_RESTRICTION.VEHICLE_BROKEN:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLEINNOTREADY_BROKEN, {}),
         UNIT_RESTRICTION.VEHICLE_CREW_NOT_FULL:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLEINNOTREADY_CREWNOTFULL, {}),
         UNIT_RESTRICTION.VEHICLE_RENT_IS_OVER:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLEINNOTREADY_RENTISOVER, {}),
         UNIT_RESTRICTION.VEHICLE_IS_IN_BATTLE:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLEINNOTREADY_ISINBATTLE, {}),
         UNIT_RESTRICTION.MIN_SLOTS:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_MINSLOTS, {}),
         UNIT_RESTRICTION.NOT_READY_IN_SLOTS:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_WAITING, {}),
         UNIT_RESTRICTION.MIN_TOTAL_LEVEL:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_LEVEL, self.__validationCtx),
         UNIT_RESTRICTION.MAX_TOTAL_LEVEL:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_LEVEL, self.__validationCtx),
         UNIT_RESTRICTION.INVALID_TOTAL_LEVEL:
         ActionButtonStateVO.getInvalidVehicleLevelsMessage(
             self.__validationCtx),
         UNIT_RESTRICTION.IS_IN_IDLE:
         BoundMethodWeakref(self._getIdleStateStr),
         UNIT_RESTRICTION.IS_IN_ARENA:
         BoundMethodWeakref(self._getArenaStateStr),
         UNIT_RESTRICTION.NEED_PLAYERS_SEARCH: ('', {}),
         UNIT_RESTRICTION.ZERO_TOTAL_LEVEL: ('', {}),
         UNIT_RESTRICTION.IS_IN_PRE_ARENA:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_WAITCOMMANDER, {}),
         UNIT_RESTRICTION.NOT_IN_SLOT:
         BoundMethodWeakref(self._notInSlotMessage),
         UNIT_RESTRICTION.VEHICLE_NOT_VALID_FOR_EVENT:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLENOTVALIDFOREVENT, {}),
         UNIT_RESTRICTION.CURFEW: (CYBERSPORT.WINDOW_UNIT_MESSAGE_CURFEW,
                                   {}),
         UNIT_RESTRICTION.VEHICLE_WRONG_MODE:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLEINNOTREADY_WRONGMODE, {}),
         UNIT_RESTRICTION.UNIT_WRONG_DATA:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_VEHICLEINNOTREADY_WRONGUNITDATA,
          {}),
         UNIT_RESTRICTION.FORT_DISABLED:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_FORTIFICATIONNOTAVAILABLE, {}),
         UNIT_RESTRICTION.VEHICLE_INVALID_LEVEL:
         (self.__getNotAvailableIcon() +
          i18n.makeString(PLATOON.MEMBERS_FOOTER_INVALIDVEHICLELEVEL), {}),
         UNIT_RESTRICTION.SPG_IS_FORBIDDEN:
         (self.__getNotAvailableIcon() +
          i18n.makeString(PLATOON.MEMBERS_FOOTER_SPGFORBIDDEN), {}),
         UNIT_RESTRICTION.SPG_IS_FULL:
         (self.__getNotAvailableIcon() +
          i18n.makeString(PLATOON.MEMBERS_FOOTER_SPGFULL), {}),
         UNIT_RESTRICTION.ROTATION_GROUP_LOCKED:
         BoundMethodWeakref(self._rotationGroupBlockMessage),
         UNIT_RESTRICTION.UNIT_MAINTENANCE:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_MAINTENANCE, {}),
         UNIT_RESTRICTION.UNIT_INACTIVE_PERIPHERY_UNDEF:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_INACTIVEPERIPHERY, {}),
         UNIT_RESTRICTION.UNIT_INACTIVE_PERIPHERY_SORTIE:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_INACTIVEPERIPHERYSORTIE, {}),
         UNIT_RESTRICTION.UNIT_INACTIVE_PERIPHERY_BATTLE:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_INACTIVEPERIPHERYBATTLE, {}),
         UNIT_RESTRICTION.UNIT_WAITINGFORDATA:
         (TOOLTIPS.STRONGHOLDS_TIMER_WAITINGFORDATA, {}),
         UNIT_RESTRICTION.UNIT_MIN_CLAN_MEMBERS:
         BoundMethodWeakref(self._clanMembersNotEnoughMessage),
         UNIT_RESTRICTION.UNIT_IS_IN_PLAYERS_MATCHING:
         (CYBERSPORT.WINDOW_UNIT_MESSAGE_IN_PLAYERS_MATCHING, {}),
         UNIT_RESTRICTION.UNIT_NOT_FULL: ('', {}),
         UNIT_RESTRICTION.UNSUITABLE_VEHICLE:
         (self.__getNotAvailableIcon() +
          backport.text(R.strings.system_messages.prebattle.vehicleInvalid.
                        vehicleNotSupported()), {}),
         UNIT_RESTRICTION.VEHICLE_TOO_HEAVY: (backport.text(
             R.strings.cyberSport.window.unit.message.vehicleInNotReady.
             tooHeavy()), {})
     }
     self.__WARNING_UNIT_MESSAGES = {
         UNIT_RESTRICTION.XP_PENALTY_VEHICLE_LEVELS:
         (PLATOON.MEMBERS_FOOTER_VEHICLES_DIFFERENTLEVELS, {})
     }
     self.__NEUTRAL_UNIT_MESSAGES = {
         UNIT_RESTRICTION.UNIT_WILL_SEARCH_PLAYERS:
         (FORTIFICATIONS.UNIT_WINDOW_WILLSEARCHPLAYERS, {})
     }
     stateKey, stateCtx = self.__getState()
     self['stateString'] = self.__stateTextStyleFormatter(
         i18n.makeString(stateKey, **stateCtx))
     self['label'] = self._getLabel()
     self['isEnabled'] = self.__isEnabled
     self['isReady'] = self._playerInfo.isReady
     self['toolTipData'] = self.__toolTipData
Пример #8
0
 def __init__(self):
     self.__started = False
     self.__lessonId = 0
     self.__checkpoint = ''
     self.__account = None
     self.__lobbyAssistant = None
     self.__bootcampGarageActions = BootcampGarageActions()
     self.__prevHint = None
     self.__nextHint = None
     self.__hardcodeHint = None
     self.__secondVehicleNode = None
     self.__moduleNode = None
     self.isLessonSuspended = False
     self.__callbacks = {
         'onBattleReady':
         BoundMethodWeakref(self.onBattleReady),
         'onBootcampFinished':
         BoundMethodWeakref(self.finishBootcamp),
         'setTutorialBattleMode':
         BoundMethodWeakref(self.setTutorialBattleMode),
         'clear':
         BoundMethodWeakref(self.clear),
         'showFinalVideo':
         BoundMethodWeakref(self.showFinalVideo),
         'disableResearchButton':
         BoundMethodWeakref(self.disableResearchButton),
         'enableResearchButton':
         BoundMethodWeakref(self.enableResearchButton),
         'disableVehiclePreviewBuyButton':
         BoundMethodWeakref(self.disableVehiclePreviewBuyButton),
         'enableVehiclePreviewBuyButton':
         BoundMethodWeakref(self.enableVehiclePreviewBuyButton)
     }
     self.__hintsLoaded = False
     self.__hangarLoaded = False
     self.__tutorialModePointCut = None
     self._actions = {
         ACTION_TYPE.INIT: BoundMethodWeakref(self.initAction),
         ACTION_TYPE.CALLBACK: BoundMethodWeakref(self.callbackAction),
         ACTION_TYPE.SHOW_MESSAGE: BoundMethodWeakref(self.showMessage),
         ACTION_TYPE.SHOW_ELEMENT: BoundMethodWeakref(self.showElement),
         ACTION_TYPE.HIGHLIGHT_BUTTON:
         BoundMethodWeakref(self.highlightButton),
         ACTION_TYPE.CONDITIONAL: BoundMethodWeakref(self.conditionalAction)
     }
     self.__showActionsHistory = []
     self.__deferredAliases = []
     return
 def registerSettingHandler(self, setting, handler):
     if setting in self.__settingHandlers:
         return False
     self.__settingHandlers[setting] = BoundMethodWeakref(handler)
     return True