def _update(self, state): if state.isInSpecialPrebattle(): self._isSelected = True self._isDisabled = state.hasLockedState else: self._isSelected = False self._isDisabled = areSpecBattlesHidden()
def pe_onPrebattleAutoInvitesChanged(self): if GUI_SETTINGS.specPrebatlesVisible: isHidden = areSpecBattlesHidden() if isHidden: events_dispatcher.removeSpecBattlesFromCarousel() else: events_dispatcher.addSpecBattlesToCarousel() events_dispatcher.updateUI()
def pe_onPrebattleAutoInvitesChanged(self): if GUI_SETTINGS.specPrebatlesVisible: isHidden = areSpecBattlesHidden() if isHidden: g_eventDispatcher.removeSpecBattlesFromCarousel() else: g_eventDispatcher.addSpecBattlesToCarousel() g_eventDispatcher.updateUI()
def start(self, ctx): g_eventDispatcher.init(self) self.__requestCtx = PrbCtrlRequestCtx() result = self.__factories.start(self, CreateFunctionalCtx(CTRL_ENTITY_TYPE.UNKNOWN, create={'queueType': ctx.getQueueType(), 'settings': ctx.prbSettings})) self._startListening() functional.initDevFunctional() if result & FUNCTIONAL_INIT_RESULT.LOAD_PAGE == 0: BigWorld.callback(0.001, lambda : g_eventDispatcher.loadHangar()) g_eventDispatcher.updateUI() if GUI_SETTINGS.specPrebatlesVisible and not areSpecBattlesHidden(): g_eventDispatcher.addSpecBattlesToCarousel()
def start(self, ctx): self.__requestCtx = context._PrbRequestCtx() self.__prbFunctional = functional.createPrbFunctional(self) self.__prbFunctional.init() self.__unitFunctional = functional.createUnitFunctional(self) self.__unitFunctional.init() self.__queueFunctional = functional.createQueueFunctional(isInRandomQueue=ctx.isInRandomQueue) self._startListening() functional.initDevFunctional() if not self.__prbFunctional.hasGUIPage() and not self.__prbFunctional.isGUIProcessed(): self.__queueFunctional.onChanged() events_dispatcher.updateUI() events_dispatcher.addCompaniesToCarousel() if GUI_SETTINGS.specPrebatlesVisible and not areSpecBattlesHidden(): events_dispatcher.addSpecBattlesToCarousel()
def start(self, ctx): g_eventDispatcher.init(self) self.__requestCtx = PrbCtrlRequestCtx() result = self.__factories.start( self, CreateFunctionalCtx(CTRL_ENTITY_TYPE.UNKNOWN, create={ 'queueType': ctx.getQueueType(), 'settings': ctx.prbSettings })) self._startListening() functional.initDevFunctional() if result & FUNCTIONAL_INIT_RESULT.LOAD_PAGE == 0: BigWorld.callback(0.001, lambda: g_eventDispatcher.loadHangar()) g_eventDispatcher.updateUI() if GUI_SETTINGS.specPrebatlesVisible and not areSpecBattlesHidden(): g_eventDispatcher.addSpecBattlesToCarousel()
def start(self, ctx): self.__requestCtx = context._PrbRequestCtx() self.__prbFunctional = functional.createPrbFunctional(self) self.__prbFunctional.init() self.__unitFunctional = functional.createUnitFunctional(self) self.__unitFunctional.init() self.__queueFunctional = functional.createQueueFunctional( isInRandomQueue=ctx.isInRandomQueue) self._startListening() functional.initDevFunctional() if not self.__prbFunctional.hasGUIPage( ) and not self.__prbFunctional.isGUIProcessed(): self.__queueFunctional.onChanged() events_dispatcher.updateUI() events_dispatcher.addCompaniesToCarousel() if GUI_SETTINGS.specPrebatlesVisible and not areSpecBattlesHidden(): events_dispatcher.addSpecBattlesToCarousel()
def update(self): prbDispatcher = g_prbLoader.getDispatcher() if not prbDispatcher: return else: prbFunctional = prbDispatcher.getPrbFunctional() hasModalEntity, prbType = prbDispatcher.getFunctionalState() inPrebattle = prbType is not 0 isTraining = prbType is PREBATTLE_TYPE.TRAINING disableHint = None disabled = False if self.__isActionsLocked: disabled = True else: canDo, restriction = prbDispatcher.canPlayerDoAction() if not canDo: disabled = True disableHint = getActionDisabledTooltip(restriction, functional=prbFunctional) self.__disableFightButton(disabled, disableHint) label = MENU.HEADERBUTTONS_BATTLE isCreator = prbFunctional.isCreator() if not isTraining and not isCreator: playerInfo = prbFunctional.getPlayerInfo() if inPrebattle and playerInfo is not None: if playerInfo.isReady(): label = MENU.HEADERBUTTONS_NOTREADY else: label = MENU.HEADERBUTTONS_READY if prbDispatcher.getUnitFunctional().hasEntity(): menu = MENU.HEADERBUTTONS_BATTLE_MENU_UNIT else: menu = self.__menuLabels.get(prbType, MENU.HEADERBUTTONS_BATTLE_MENU_STANDART) fightTypes = list() if self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE: fightTypes.append({'label': MENU.HEADERBUTTONS_BATTLE_TYPES_STANDART, 'data': PREBATTLE_ACTION_NAME.LEAVE_RANDOM_QUEUE, 'disabled': True, 'tooltip': TOOLTIPS.BATTLETYPES_STANDART, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_STANDARTLEAVE_DESCR), 'icon': PREBATTLE_ACTION_NAME.LEAVE_RANDOM_QUEUE, 'active': True}) else: fightTypes.append({'label': MENU.HEADERBUTTONS_BATTLE_TYPES_STANDART, 'data': PREBATTLE_ACTION_NAME.JOIN_RANDOM_QUEUE, 'disabled': disabled or hasModalEntity, 'tooltip': TOOLTIPS.BATTLETYPES_STANDART, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_STANDART_DESCR), 'icon': PREBATTLE_ACTION_NAME.JOIN_RANDOM_QUEUE, 'active': False}) if prbType is PREBATTLE_TYPE.SQUAD: fightTypes.append({'label': '#menu:headerButtons/battle/types/squadLeave%s' % ('Owner' if isCreator else ''), 'data': PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE, 'disabled': self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE, 'tooltip': TOOLTIPS.BATTLETYPES_SQUADLEAVE, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_SQUADLEAVE_DESCR), 'icon': PREBATTLE_ACTION_NAME.SQUAD, 'active': True}) else: fightTypes.append({'label': MENU.HEADERBUTTONS_BATTLE_TYPES_SQUAD, 'data': PREBATTLE_ACTION_NAME.SQUAD, 'disabled': disabled or hasModalEntity, 'tooltip': TOOLTIPS.BATTLETYPES_SQUAD, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_SQUAD_DESCR), 'icon': PREBATTLE_ACTION_NAME.SQUAD, 'active': False}) units = AccountSettings.getSettings('unitWindow') if prbType is PREBATTLE_TYPE.UNIT: fightTypes.append({'label': MENU.HEADERBUTTONS_BATTLE_TYPES_UNITLEAVE, 'data': PREBATTLE_ACTION_NAME.UNIT_LEAVE, 'disabled': False, 'tooltip': TOOLTIPS.BATTLETYPES_LEAVEUNIT, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVEUNIT_DESCR), 'icon': PREBATTLE_ACTION_NAME.UNIT, 'active': True, 'isUnitOpened': units['isOpened']}) else: fightTypes.append({'label': MENU.HEADERBUTTONS_BATTLE_TYPES_UNIT, 'data': PREBATTLE_ACTION_NAME.UNIT, 'disabled': disabled or inPrebattle, 'tooltip': TOOLTIPS.BATTLETYPES_UNIT, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_UNIT_DESCR), 'icon': PREBATTLE_ACTION_NAME.UNIT, 'active': False, 'isUnitOpened': units['isOpened']}) if prbType is PREBATTLE_TYPE.COMPANY: fightTypes.append({'label': '#menu:headerButtons/battle/types/companyLeave%s' % ('Owner' if isCreator else ''), 'data': PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE, 'disabled': self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE, 'tooltip': TOOLTIPS.BATTLETYPES_LEAVECOMPANY, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVECOMPANY_DESCR), 'icon': PREBATTLE_ACTION_NAME.COMPANY_LIST, 'active': True}) else: fightTypes.append({'label': MENU.HEADERBUTTONS_BATTLE_TYPES_COMPANY, 'data': PREBATTLE_ACTION_NAME.COMPANY_LIST, 'disabled': disabled or hasModalEntity, 'tooltip': TOOLTIPS.BATTLETYPES_COMPANY, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_COMPANY_DESCR), 'icon': PREBATTLE_ACTION_NAME.COMPANY_LIST, 'active': False}) if GUI_SETTINGS.specPrebatlesVisible: if prbType in [PREBATTLE_TYPE.CLAN, PREBATTLE_TYPE.TOURNAMENT]: fightTypes.append({'label': MENU.HEADERBUTTONS_BATTLE_TYPES_SPECLEAVE, 'data': PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE, 'disabled': False, 'tooltip': TOOLTIPS.BATTLETYPES_LEAVESPEC, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVESPEC_DESCR), 'icon': PREBATTLE_ACTION_NAME.SPEC_BATTLE_LIST, 'active': True}) else: fightTypes.append({'label': MENU.HEADERBUTTONS_BATTLE_TYPES_SPEC, 'data': PREBATTLE_ACTION_NAME.SPEC_BATTLE_LIST, 'disabled': disabled or hasModalEntity or areSpecBattlesHidden(), 'tooltip': TOOLTIPS.BATTLETYPES_SPEC, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_SPEC_DESCR), 'icon': PREBATTLE_ACTION_NAME.SPEC_BATTLE_LIST, 'active': False}) if isTraining: fightTypes.append({'label': '#menu:headerButtons/battle/types/trainingLeave%s' % ('Owner' if isCreator else ''), 'data': PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE, 'disabled': False, 'tooltip': TOOLTIPS.BATTLETYPES_LEAVETRAINING, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVETRAINING_DESCR), 'icon': PREBATTLE_ACTION_NAME.TRAINING_LIST, 'active': True}) elif self.__currentLockedView == VIEW_ALIAS.LOBBY_TRAININGS: menu = MENU.HEADERBUTTONS_BATTLE_MENU_TRAINING fightTypes.append({'label': '#menu:headerButtons/battle/types/trainingLeave', 'data': PREBATTLE_ACTION_NAME.LEAVE_TRAINING_LIST, 'disabled': False, 'tooltip': TOOLTIPS.BATTLETYPES_LEAVETRAINING, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVETRAINING_DESCR), 'icon': PREBATTLE_ACTION_NAME.TRAINING_LIST, 'active': True}) else: fightTypes.append({'label': MENU.HEADERBUTTONS_BATTLE_TYPES_TRAINING, 'data': PREBATTLE_ACTION_NAME.TRAINING_LIST, 'disabled': disabled or hasModalEntity, 'tooltip': TOOLTIPS.BATTLETYPES_TRAINING, 'description': i18n.makeString(MENU.HEADERBUTTONS_BATTLE_TYPES_TRAINING_DESCR), 'icon': PREBATTLE_ACTION_NAME.TRAINING_LIST, 'active': False}) disableDropDown = self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE self.__onFightButtonSet(label, menu, fightTypes, disableDropDown) self.fireEvent(events.LobbySimpleEvent(events.LobbySimpleEvent.UPDATE_TANK_PARAMS), scope=EVENT_BUS_SCOPE.LOBBY) return
def update(self): prbDispatcher = g_prbLoader.getDispatcher() if not prbDispatcher: return else: prbFunctional = prbDispatcher.getPrbFunctional() hasModalEntity, prbType = prbDispatcher.getFunctionalState() inPrebattle = prbType is not 0 isTraining = prbType is PREBATTLE_TYPE.TRAINING disableHint = None disabled = False if self.__isActionsLocked: disabled = True else: canDo, restriction = prbDispatcher.canPlayerDoAction() if not canDo: disabled = True disableHint = getActionDisabledTooltip( restriction, functional=prbFunctional) self.__disableFightButton(disabled, disableHint) label = MENU.HEADERBUTTONS_BATTLE isCreator = prbFunctional.isCreator() if not isTraining and not isCreator: playerInfo = prbFunctional.getPlayerInfo() if inPrebattle and playerInfo is not None: if playerInfo.isReady(): label = MENU.HEADERBUTTONS_NOTREADY else: label = MENU.HEADERBUTTONS_READY if prbDispatcher.getUnitFunctional().hasEntity(): menu = MENU.HEADERBUTTONS_BATTLE_MENU_UNIT else: menu = self.__menuLabels.get( prbType, MENU.HEADERBUTTONS_BATTLE_MENU_STANDART) fightTypes = list() if self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE: fightTypes.append({ 'label': MENU.HEADERBUTTONS_BATTLE_TYPES_STANDART, 'data': PREBATTLE_ACTION_NAME.LEAVE_RANDOM_QUEUE, 'disabled': True, 'tooltip': TOOLTIPS.BATTLETYPES_STANDART, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_STANDARTLEAVE_DESCR), 'icon': PREBATTLE_ACTION_NAME.LEAVE_RANDOM_QUEUE, 'active': True }) else: fightTypes.append({ 'label': MENU.HEADERBUTTONS_BATTLE_TYPES_STANDART, 'data': PREBATTLE_ACTION_NAME.JOIN_RANDOM_QUEUE, 'disabled': disabled or hasModalEntity, 'tooltip': TOOLTIPS.BATTLETYPES_STANDART, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_STANDART_DESCR), 'icon': PREBATTLE_ACTION_NAME.JOIN_RANDOM_QUEUE, 'active': False }) if prbType is PREBATTLE_TYPE.SQUAD: fightTypes.append({ 'label': '#menu:headerButtons/battle/types/squadLeave%s' % ('Owner' if isCreator else ''), 'data': PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE, 'disabled': self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE, 'tooltip': TOOLTIPS.BATTLETYPES_SQUADLEAVE, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_SQUADLEAVE_DESCR), 'icon': PREBATTLE_ACTION_NAME.SQUAD, 'active': True }) else: fightTypes.append({ 'label': MENU.HEADERBUTTONS_BATTLE_TYPES_SQUAD, 'data': PREBATTLE_ACTION_NAME.SQUAD, 'disabled': disabled or hasModalEntity, 'tooltip': TOOLTIPS.BATTLETYPES_SQUAD, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_SQUAD_DESCR), 'icon': PREBATTLE_ACTION_NAME.SQUAD, 'active': False }) units = AccountSettings.getSettings('unitWindow') if prbType is PREBATTLE_TYPE.UNIT: fightTypes.append({ 'label': MENU.HEADERBUTTONS_BATTLE_TYPES_UNITLEAVE, 'data': PREBATTLE_ACTION_NAME.UNIT_LEAVE, 'disabled': False, 'tooltip': TOOLTIPS.BATTLETYPES_LEAVEUNIT, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVEUNIT_DESCR), 'icon': PREBATTLE_ACTION_NAME.UNIT, 'active': True, 'isUnitOpened': units['isOpened'] }) else: fightTypes.append({ 'label': MENU.HEADERBUTTONS_BATTLE_TYPES_UNIT, 'data': PREBATTLE_ACTION_NAME.UNIT, 'disabled': disabled or inPrebattle, 'tooltip': TOOLTIPS.BATTLETYPES_UNIT, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_UNIT_DESCR), 'icon': PREBATTLE_ACTION_NAME.UNIT, 'active': False, 'isUnitOpened': units['isOpened'] }) if prbType is PREBATTLE_TYPE.COMPANY: fightTypes.append({ 'label': '#menu:headerButtons/battle/types/companyLeave%s' % ('Owner' if isCreator else ''), 'data': PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE, 'disabled': self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE, 'tooltip': TOOLTIPS.BATTLETYPES_LEAVECOMPANY, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVECOMPANY_DESCR), 'icon': PREBATTLE_ACTION_NAME.COMPANY_LIST, 'active': True }) else: fightTypes.append({ 'label': MENU.HEADERBUTTONS_BATTLE_TYPES_COMPANY, 'data': PREBATTLE_ACTION_NAME.COMPANY_LIST, 'disabled': disabled or hasModalEntity, 'tooltip': TOOLTIPS.BATTLETYPES_COMPANY, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_COMPANY_DESCR), 'icon': PREBATTLE_ACTION_NAME.COMPANY_LIST, 'active': False }) if GUI_SETTINGS.specPrebatlesVisible: if prbType in [PREBATTLE_TYPE.CLAN, PREBATTLE_TYPE.TOURNAMENT]: fightTypes.append({ 'label': MENU.HEADERBUTTONS_BATTLE_TYPES_SPECLEAVE, 'data': PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE, 'disabled': False, 'tooltip': TOOLTIPS.BATTLETYPES_LEAVESPEC, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVESPEC_DESCR), 'icon': PREBATTLE_ACTION_NAME.SPEC_BATTLE_LIST, 'active': True }) else: fightTypes.append({ 'label': MENU.HEADERBUTTONS_BATTLE_TYPES_SPEC, 'data': PREBATTLE_ACTION_NAME.SPEC_BATTLE_LIST, 'disabled': disabled or hasModalEntity or areSpecBattlesHidden(), 'tooltip': TOOLTIPS.BATTLETYPES_SPEC, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_SPEC_DESCR), 'icon': PREBATTLE_ACTION_NAME.SPEC_BATTLE_LIST, 'active': False }) if isTraining: fightTypes.append({ 'label': '#menu:headerButtons/battle/types/trainingLeave%s' % ('Owner' if isCreator else ''), 'data': PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE, 'disabled': False, 'tooltip': TOOLTIPS.BATTLETYPES_LEAVETRAINING, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVETRAINING_DESCR), 'icon': PREBATTLE_ACTION_NAME.TRAINING_LIST, 'active': True }) elif self.__currentLockedView == VIEW_ALIAS.LOBBY_TRAININGS: menu = MENU.HEADERBUTTONS_BATTLE_MENU_TRAINING fightTypes.append({ 'label': '#menu:headerButtons/battle/types/trainingLeave', 'data': PREBATTLE_ACTION_NAME.LEAVE_TRAINING_LIST, 'disabled': False, 'tooltip': TOOLTIPS.BATTLETYPES_LEAVETRAINING, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVETRAINING_DESCR), 'icon': PREBATTLE_ACTION_NAME.TRAINING_LIST, 'active': True }) else: fightTypes.append({ 'label': MENU.HEADERBUTTONS_BATTLE_TYPES_TRAINING, 'data': PREBATTLE_ACTION_NAME.TRAINING_LIST, 'disabled': disabled or hasModalEntity, 'tooltip': TOOLTIPS.BATTLETYPES_TRAINING, 'description': i18n.makeString( MENU.HEADERBUTTONS_BATTLE_TYPES_TRAINING_DESCR), 'icon': PREBATTLE_ACTION_NAME.TRAINING_LIST, 'active': False }) disableDropDown = self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE self.__onFightButtonSet(label, menu, fightTypes, disableDropDown) self.fireEvent(events.LobbySimpleEvent( events.LobbySimpleEvent.UPDATE_TANK_PARAMS), scope=EVENT_BUS_SCOPE.LOBBY) return