# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client/gui/Scaleform/daapi/view/lobby/techtree/sound_constants.py
from gui.Scaleform.framework.entities.View import CommonSoundSpaceSettings
from shared_utils import CONST_CONTAINER


class Sounds(CONST_CONTAINER):
    COMMON_SOUND_SPACE = 'techtree'
    STATE_PLACE = 'STATE_hangar_place'
    STATE_PLACE_TECHTREE = 'STATE_hangar_place_research'
    AMBIENT = 'researches_ambience'
    MUSIC = 'researches_music'
    RESET = 'researches_music_reset'
    BLUEPRINT_VIEW_ON_SOUND_ID = 'gui_blueprint_view_switch_on'
    BLUEPRINT_VIEW_OFF_SOUND_ID = 'gui_blueprint_view_switch_off'
    BLUEPRINT_VIEW_PLUS_SOUND_ID = 'gui_blueprint_view_switch_on_plus'
    TOP_OF_THE_TREE_ANIMATION_ON_SOUND_ID = 'researches_top_of_the_tree_start'
    TOP_OF_THE_TREE_ANIMATION_OFF_SOUND_ID = 'researches_top_of_the_tree_stop'
    TOP_OF_THE_TREE_ANIMATION_STOP_ANIMATION = 'researches_top_of_the_tree_stop_animation'


TECHTREE_SOUND_SPACE = CommonSoundSpaceSettings(
    name=Sounds.COMMON_SOUND_SPACE,
    entranceStates={Sounds.STATE_PLACE: Sounds.STATE_PLACE_TECHTREE},
    exitStates={},
    persistentSounds=(Sounds.MUSIC, Sounds.AMBIENT),
    stoppableSounds=(),
    priorities=(),
    autoStart=True,
    exitEvent=Sounds.RESET)
Ejemplo n.º 2
0
    CHAIN_NAV_CLICK = 'pm_type_select_animation'
    REGION_CLICK = 'tabb'
    FREE_AWARD_LIST_SPENT = 'pm_reward_list_spend'
    AWARD_WINDOW = 'pm_standard_greeting'
    AWARD_LIST_AWARD_WINDOW = 'pm_special_greeting'
    WOMAN_AWARD_WINDOW = 'pm_special_greeting_woman'
    TANK_AWARD_WINDOW = 'pm_special_greeting_tank'
    RTCP_OVERLAY = 'RTPC_ext_greeting_overlay'
    ONE_AWARD_LIST_RECEIVED = 'pm_greeting_order_form'
    ONE_AWARD_LIST_RECEIVED_CONFIRM = 'pm_greeting_order_form_confirm'
    FOUR_AWARD_LISTS_RECEIVED = 'pm_conversion_order_form'
    FOUR_AWARD_LISTS_RECEIVED_CONFIRM = 'pm_conversion_order_form_confirm'
    RTCP_MISSION_BRANCH = {PM_BRANCH.REGULAR: 'RTPC_ext_mission_zoom_green',
     PM_BRANCH.PERSONAL_MISSION_2: 'RTPC_ext_mission_zoom_blue'}
    BRANCH_DEFAULT = 0
    BRANCH_SELECTED = 100
    MIN_MISSIONS_ZOOM = 0
    MAX_MISSIONS_ZOOM = 100


_SOUNDS_PRIORITIES = (SOUNDS.AWARD_WINDOW, SOUNDS.WOMAN_AWARD_WINDOW, SOUNDS.TANK_AWARD_WINDOW)
PERSONAL_MISSIONS_SOUND_SPACE = CommonSoundSpaceSettings(SOUNDS.COMMON_SOUND_SPACE, {SOUNDS.STATE_PLACE: SOUNDS.STATE_PLACE_MISSIONS}, {SOUNDS.STATE_PLACE: SOUNDS.STATE_PLACE_GARAGE}, (SOUNDS.MUSIC, SOUNDS.AMBIENT), (), _SOUNDS_PRIORITIES, True, '', '')
PERSONAL_MISSIONS_SILENT_SOUND_SPACE = CommonSoundSpaceSettings(SOUNDS.COMMON_SOUND_SPACE, {}, {}, (), (), _SOUNDS_PRIORITIES, False, '', '')

class PM_TUTOR_FIELDS(CONST_CONTAINER):
    GREETING_SCREEN_SHOWN = 'pm_greeting_screen_shown'
    FIRST_ENTRY_AWARDS_SHOWN = 'pm_first_entry_awards_shown'
    INITIAL_FAL_COUNT = 'pm_initial_free_award_lists_count'
    ONE_FAL_SHOWN = 'pm_first_free_award_list_shown'
    FOUR_FAL_SHOWN = 'pm_four_free_award_lists_shown'
# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client/gui/Scaleform/daapi/view/lobby/storage/sound_constants.py
from gui.Scaleform.framework.entities.View import CommonSoundSpaceSettings
from shared_utils import CONST_CONTAINER


class SOUNDS(CONST_CONTAINER):
    COMMON_SOUND_SPACE = 'warehouse'
    STATE_PLACE = 'STATE_hangar_place'
    STATE_PLACE_STORAGE = 'STATE_hangar_place_warehouse'
    ENTER = 'warehouse_enter'
    EXIT = 'warehouse_exit'


STORAGE_SOUND_SPACE = CommonSoundSpaceSettings(
    name=SOUNDS.COMMON_SOUND_SPACE,
    entranceStates={SOUNDS.STATE_PLACE: SOUNDS.STATE_PLACE_STORAGE},
    exitStates={},
    persistentSounds=(),
    stoppableSounds=(),
    priorities=(),
    autoStart=True,
    enterEvent=SOUNDS.ENTER,
    exitEvent=SOUNDS.EXIT)
Ejemplo n.º 4
0
class TokenRecruitWindow(QuestRecruitWindowMeta):
    eventsCache = dependency.descriptor(IEventsCache)
    itemsCache = dependency.descriptor(IItemsCache)
    __SOUND_SETTINGS = CommonSoundSpaceSettings(
        name='hangar',
        entranceStates={
            SOUNDS.STATE_PLACE: SOUNDS.STATE_PLACE_GARAGE,
            STATE_HANGAR_FILTERED: '{}_off'.format(STATE_HANGAR_FILTERED)
        },
        exitStates={},
        persistentSounds=(),
        stoppableSounds=(),
        priorities=(),
        autoStart=True,
        enterEvent=SOUNDS.WOMAN_AWARD_WINDOW,
        exitEvent='')
    _COMMON_SOUND_SPACE = __SOUND_SETTINGS

    def __init__(self, ctx=None):
        super(TokenRecruitWindow, self).__init__()
        self.__currentSelectedNationID = None
        self.__tokenName = ctx['tokenName']
        self.__tokenData = ctx['tokenData']
        return

    def onWindowClose(self):
        self.destroy()

    @decorators.process('updating')
    def onApply(self, data):
        yield self.__recruitTankman(int(data.nation), int(data.vehicle),
                                    data.tankmanRole, self.__tokenName,
                                    self.__tokenData)
        self.onWindowClose()

    def _onRegisterFlashComponent(self, viewPy, alias):
        super(TokenRecruitWindow,
              self)._onRegisterFlashComponent(viewPy, alias)
        if alias == VIEW_ALIAS.RECRUIT_PARAMS:
            viewPy.setPredefinedTankman(
                packPredefinedTmanParams(
                    roles=self.__tokenData.getRoles(),
                    nationsParam=self.__tokenData.getNations()))
            viewPy.onDataChange += self.__paramsChangeHandler
            viewPy.init()

    def _onUnregisterFlashComponent(self, viewPy, alias):
        super(TokenRecruitWindow,
              self)._onUnregisterFlashComponent(viewPy, alias)
        if alias == VIEW_ALIAS.RECRUIT_PARAMS:
            viewPy.onDataChange -= self.__paramsChangeHandler

    def __paramsChangeHandler(self, selectedNationID, selectedVehClass,
                              selectedVehicle, selectedTmanRole):
        selectedNationID = int(selectedNationID)
        nationName = nations.NAMES[selectedNationID]
        if self.__currentSelectedNationID != selectedNationID:
            faceIcon = self.__tokenData.getBigIcon()
            bgImage = self.__getBgImage(self.__tokenData.getSourceID())
            self.as_setInitDataS({
                'windowTitle':
                _ms(DIALOGS.RECRUITWINDOW_TITLE),
                'applyButtonLabel':
                _ms(DIALOGS.RECRUITWINDOW_SUBMIT),
                'cancelButtonLabel':
                _ms(DIALOGS.RECRUITWINDOW_CANCEL),
                'name':
                self.__tokenData.getFullUserNameByNation(selectedNationID),
                'nation':
                nationName,
                'rank':
                Tankman.getRankUserName(selectedNationID,
                                        self.__tokenData.getRankID()),
                'backAnimationData':
                None if bgImage else self.__getBackAnimationData(faceIcon),
                'bgImage':
                bgImage,
                'tankmanIcon':
                faceIcon
            })
        self.__currentSelectedNationID = selectedNationID
        return

    @staticmethod
    def __getBackAnimationData(faceIcon):
        return {
            'image':
            faceIcon,
            'animationPath':
            AWARDWINDOW_CONSTANTS.EXPLOSION_BACK_ANIMATION_PATH,
            'animationLinkage':
            AWARDWINDOW_CONSTANTS.EXPLOSION_BACK_ANIMATION_LINKAGE
        }

    @staticmethod
    def __getBgImage(eventName):
        bg = None
        if eventName is not None:
            bg = RES_ICONS.getRecruitWindowBg(eventName=eventName)
        return bg if bg is not None else ''

    @async
    @process
    def __recruitTankman(self, nationID, vehTypeID, role, tokenName, tokenData,
                         callback):
        recruiter = TankmanTokenRecruit(nationID=int(nationID),
                                        vehTypeID=int(vehTypeID),
                                        role=role,
                                        tokenName=tokenName,
                                        tokenData=tokenData)
        _, msg, msgType, _ = yield recruiter.request()
        if msg:
            SystemMessages.pushMessage(msg, type=msgType)
        callback(None)
        return
Ejemplo n.º 5
0
    MAIN_PAGE_SPACE_NAME = 'battle_royale_main_page'
    MAIN_PAGE_STATE = 'STATE_gamemode_progress_page'
    MAIN_PAGE_STATE_ON = 'STATE_gamemode_progress_page_on'
    MAIN_PAGE_STATE_OFF = 'STATE_gamemode_progress_page_off'
    VEHILCE_INFO_SPACE_NAME = 'battle_royale_vehicle_info'
    VEHILCE_INFO_STATE = 'STATE_hangar_filtered'
    VEHILCE_INFO_STATE_ON = 'STATE_hangar_filtered_on'
    VEHILCE_INFO_STATE_OFF = 'STATE_hangar_filtered_off'


BATTLE_ROYALE_PAGE_SOUND_SPACE = CommonSoundSpaceSettings(
    name=Sounds.MAIN_PAGE_SPACE_NAME,
    entranceStates={Sounds.MAIN_PAGE_STATE: Sounds.MAIN_PAGE_STATE_ON},
    exitStates={
        Sounds.MAIN_PAGE_STATE: Sounds.MAIN_PAGE_STATE_OFF,
        Sounds.OVERLAY_HANGAR_GENERAL: Sounds.OVERLAY_HANGAR_GENERAL_OFF
    },
    persistentSounds=(),
    stoppableSounds=(),
    priorities=(),
    autoStart=True)
BATTLE_ROYALE_OVERLAY_SOUND_SPACE = CommonSoundSpaceSettings(
    name=Sounds.OVERLAY_SPACE_NAME,
    entranceStates={
        Sounds.OVERLAY_HANGAR_GENERAL: Sounds.OVERLAY_HANGAR_GENERAL_ON
    },
    exitStates={
        Sounds.OVERLAY_HANGAR_GENERAL: Sounds.OVERLAY_HANGAR_GENERAL_OFF
    },
    persistentSounds=(),
    stoppableSounds=(),
Ejemplo n.º 6
0
    RESEARCH_SOUND_SPACE = 'research_preview'
    STATE_PLACE = 'STATE_hangar_place'
    STATE_PLACE_RESEARCH_PREVIEW = 'STATE_hangar_place_researches_preview'
    PREVIEW_SOUND_SPACE = 'research_preview'
    SUBVIEW_HANGAR_GENERAL = 'STATE_subview_hangar_general'
    SUBVIEW_HANGAR_GENERAL_ON = 'STATE_subview_hangar_general_on'
    SUBVIEW_HANGAR_GENERAL_OFF = 'STATE_subview_hangar_general_off'
    HANGAR_PLACE_STATE = 'STATE_hangar_place'
    HANGAR_PLACE_GARAGE = 'STATE_hangar_place_garage'


RESEARCH_PREVIEW_SOUND_SPACE = CommonSoundSpaceSettings(
    name=Sounds.RESEARCH_SOUND_SPACE,
    entranceStates={Sounds.STATE_PLACE: Sounds.STATE_PLACE_RESEARCH_PREVIEW},
    exitStates={},
    persistentSounds=(),
    stoppableSounds=(),
    priorities=(),
    autoStart=True,
    enterEvent='',
    exitEvent='')
STYLE_PREVIEW_SOUND_SPACE = CommonSoundSpaceSettings(
    name=Sounds.PREVIEW_SOUND_SPACE,
    entranceStates={
        Sounds.SUBVIEW_HANGAR_GENERAL: Sounds.SUBVIEW_HANGAR_GENERAL_ON,
        Sounds.HANGAR_PLACE_STATE: Sounds.HANGAR_PLACE_GARAGE
    },
    exitStates={
        Sounds.SUBVIEW_HANGAR_GENERAL: Sounds.SUBVIEW_HANGAR_GENERAL_OFF
    },
    persistentSounds=(),
    stoppableSounds=(),
Ejemplo n.º 7
0
# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client/gui/Scaleform/daapi/view/lobby/trainings/sound_constants.py
from gui.Scaleform.framework.entities.View import CommonSoundSpaceSettings
from shared_utils import CONST_CONTAINER


class Sounds(CONST_CONTAINER):
    COMMON_SOUND_SPACE = 'trainings'
    STATE_PLACE = 'STATE_hangar_place'
    STATE_PLACE_GARAGE = 'STATE_hangar_place_garage'


TRAININGS_SOUND_SPACE = CommonSoundSpaceSettings(
    name=Sounds.COMMON_SOUND_SPACE,
    entranceStates={Sounds.STATE_PLACE: Sounds.STATE_PLACE_GARAGE},
    exitStates={},
    persistentSounds=(),
    stoppableSounds=(),
    priorities=(),
    autoStart=True)
Ejemplo n.º 8
0
# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client/gui/Scaleform/daapi/view/lobby/hangar/sound_constants.py
from gui.Scaleform.framework.entities.View import CommonSoundSpaceSettings
from gui.sounds.filters import States, StatesGroup
FIELD_POST_SOUND_SETTINGS = CommonSoundSpaceSettings(
    name='field_post',
    entranceStates={
        'STATE_hangar_place': 'STATE_hangar_place_garage',
        StatesGroup.HANGAR_FILTERED: States.HANGAR_FILTERED_ON
    },
    exitStates={},
    persistentSounds=(),
    stoppableSounds=(),
    priorities=(),
    autoStart=True,
    enterEvent='',
    exitEvent='')
BROWSER_VIEW_SOUND_SPACES = {
    FIELD_POST_SOUND_SETTINGS.name: FIELD_POST_SOUND_SETTINGS
}
# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client/gui/Scaleform/daapi/view/lobby/customization/sound_constants.py
from gui.Scaleform.framework.entities.View import CommonSoundSpaceSettings
from shared_utils import CONST_CONTAINER

class SOUNDS(CONST_CONTAINER):
    COMMON_SOUND_SPACE = 'c11n'
    STATE_PLACE = 'STATE_hangar_place'
    STATE_PLACE_GARAGE = 'STATE_hangar_place_garage'
    STATE_PLACE_C11N = 'STATE_hangar_place_customization'
    ENTER = 'cust_mode_entering'
    EXIT = 'cust_mode_exiting'
    SEASON_SELECT = 'cust_camtype_{}'
    SEASON_SELECT_SUMMER = 'cust_camtype_summer'
    SEASON_SELECT_DESERT = 'cust_camtype_desert'
    SEASON_SELECT_WINTER = 'cust_camtype_winter'
    TAB_SWITCH = 'cust_tab_switch'
    SELECT = 'cust_select'
    REMOVE = 'cust_select_remove'
    CHOOSE = 'cust_tankmodule_choose'
    HOVER = 'cust_tankmodule_mouseover'
    PICK = 'cust_color_take'
    RELEASE = 'cust_color_release'
    APPLY = 'cust_color_apply'


C11N_SOUND_SPACE = CommonSoundSpaceSettings(name=SOUNDS.COMMON_SOUND_SPACE, entranceStates={SOUNDS.STATE_PLACE: SOUNDS.STATE_PLACE_C11N}, exitStates={}, persistentSounds=(), stoppableSounds=(), priorities=(), autoStart=True)
# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client/gui/Scaleform/daapi/view/lobby/store/browser/sound_constants.py
from gui.Scaleform.framework.entities.View import CommonSoundSpaceSettings
from shared_utils import CONST_CONTAINER

class SOUNDS(CONST_CONTAINER):
    COMMON_SOUND_SPACE = 'shop'
    VEHICLE_PREVIEW_SOUND_SPACE = 'shopVehiclePreview'
    STATE_PLACE = 'STATE_hangar_place'
    STATE_PLACE_SHOP = 'STATE_hangar_place_shop'
    STATE_PLACE_VEHICLE_PREVIEW = 'STATE_hangar_place_shop_preview'
    ENTER = 'shop_enter'
    EXIT = 'shop_exit'


SHOP_SOUND_SPACE = CommonSoundSpaceSettings(name=SOUNDS.COMMON_SOUND_SPACE, entranceStates={SOUNDS.STATE_PLACE: SOUNDS.STATE_PLACE_SHOP}, exitStates={}, persistentSounds=(), stoppableSounds=(), priorities=(), autoStart=True, enterEvent=SOUNDS.ENTER, exitEvent=SOUNDS.EXIT)
SHOP_PREVIEW_SOUND_SPACE = CommonSoundSpaceSettings(name=SOUNDS.VEHICLE_PREVIEW_SOUND_SPACE, entranceStates={SOUNDS.STATE_PLACE: SOUNDS.STATE_PLACE_VEHICLE_PREVIEW}, exitStates={}, persistentSounds=(), stoppableSounds=(), priorities=(), autoStart=True, enterEvent='', exitEvent='', parentSpace=SOUNDS.COMMON_SOUND_SPACE)
Ejemplo n.º 11
0
class Hangar(LobbySelectableView, HangarMeta, IGlobalListener):
    _SOUND_STATE_PLACE = 'STATE_hangar_place'
    _SOUND_STATE_PLACE_GARAGE = 'STATE_hangar_place_garage'
    _ENABLED_GF_HINTS = frozenset([TutorialHintConsts.AMMUNITION_PANEL_HINT_MC,
     TutorialHintConsts.BOOTCAMP_PANEL_EQUIPMENT_MC,
     TutorialHintConsts.BOOTCAMP_PANEL_OPT_DEVICE_MC,
     TutorialHintConsts.HANGAR_PANEL_OPT_DEVICE_MC,
     TutorialHintConsts.HANGAR_PANEL_SHELLS_MC])
    __background_alpha__ = 0.0
    __SOUND_SETTINGS = CommonSoundSpaceSettings(name='hangar', entranceStates={_SOUND_STATE_PLACE: _SOUND_STATE_PLACE_GARAGE,
     StatesGroup.HANGAR_FILTERED: States.HANGAR_FILTERED_OFF}, exitStates={}, persistentSounds=(), stoppableSounds=(), priorities=(), autoStart=True, enterEvent='', exitEvent='')
    rankedController = dependency.descriptor(IRankedBattlesController)
    epicController = dependency.descriptor(IEpicBattleMetaGameController)
    battlePassController = dependency.descriptor(IBattlePassController)
    battleRoyaleController = dependency.descriptor(IBattleRoyaleController)
    itemsCache = dependency.descriptor(IItemsCache)
    igrCtrl = dependency.descriptor(IIGRController)
    lobbyContext = dependency.descriptor(ILobbyContext)
    statsCollector = dependency.descriptor(IStatisticsCollector)
    gui = dependency.descriptor(IGuiLoader)
    _settingsCore = dependency.descriptor(ISettingsCore)
    hangarSpace = dependency.descriptor(IHangarSpace)
    _promoController = dependency.descriptor(IPromoController)
    _connectionMgr = dependency.descriptor(IConnectionManager)
    _offersBannerController = dependency.descriptor(IOffersBannerController)
    _countdownController = dependency.descriptor(ITenYearsCountdownController)
    _lowTierController = dependency.descriptor(ILowTierRewardsController)
    _hangarLoadingController = dependency.descriptor(IHangarLoadingController)
    _COMMON_SOUND_SPACE = __SOUND_SETTINGS

    def __init__(self, _=None):
        LobbySelectableView.__init__(self, 0)
        self.__currentCarouselAlias = None
        self.__isSpaceReadyForC11n = False
        self.__isVehicleReadyForC11n = False
        self.__isVehicleCameraReadyForC11n = False
        self.__urlMacros = URLMacros()
        self.__teaser = None
        self.__seniorityAwardsIsActive = False
        return

    def onEscape(self):
        dialogsContainer = self.app.containerManager.getContainer(ViewTypes.TOP_WINDOW)
        if not dialogsContainer.getView(criteria={POP_UP_CRITERIA.VIEW_ALIAS: VIEW_ALIAS.LOBBY_MENU}):
            self.fireEvent(events.LoadViewEvent(VIEW_ALIAS.LOBBY_MENU), scope=EVENT_BUS_SCOPE.LOBBY)

    def onCloseBtnClick(self):
        self.battleRoyaleController.selectRandomBattle()

    def hideTeaser(self):
        self.__teaser.stop(byUser=True)
        self.__teaser = None
        return

    def onTeaserClick(self):
        self._promoController.showLastTeaserPromo()

    def showHelpLayout(self):
        containerManager = self.app.containerManager
        topSubViewContainer = containerManager.getContainer(ViewTypes.LOBBY_TOP_SUB)
        dialogsContainer = containerManager.getContainer(ViewTypes.TOP_WINDOW)
        windowsContainer = containerManager.getContainer(ViewTypes.WINDOW)
        browserWindowContainer = containerManager.getContainer(ViewTypes.BROWSER)
        overlayContainer = containerManager.getContainer(ViewTypes.OVERLAY)
        unboundWindows = self.gui.windowsManager.findWindows(predicateNotEmptyWindow)
        if not dialogsContainer.getViewCount() and not windowsContainer.getViewCount() and not browserWindowContainer.getViewCount() and not overlayContainer.getViewCount() and not unboundWindows and not topSubViewContainer.getViewCount():
            containerManager.onViewAddedToContainer += self.__onViewAddedToContainer
            self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.SHOW_HELPLAYOUT), scope=EVENT_BUS_SCOPE.LOBBY)
            self.as_showHelpLayoutS()

    def closeHelpLayout(self):
        self.app.containerManager.onViewAddedToContainer -= self.__onViewAddedToContainer
        self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.CLOSE_HELPLAYOUT), scope=EVENT_BUS_SCOPE.LOBBY)
        self.as_closeHelpLayoutS()

    def _populate(self):
        LobbySelectableView._populate(self)
        self.__isSpaceReadyForC11n = self.hangarSpace.spaceInited
        self.__isVehicleReadyForC11n = self.hangarSpace.isModelLoaded
        self.__checkVehicleCameraState()
        g_currentVehicle.onChanged += self.__onCurrentVehicleChanged
        self.hangarSpace.onVehicleChangeStarted += self.__onVehicleLoading
        self.hangarSpace.onVehicleChanged += self.__onVehicleLoaded
        self.hangarSpace.onSpaceRefresh += self.__onSpaceRefresh
        self.hangarSpace.onSpaceCreate += self.__onSpaceCreate
        self.igrCtrl.onIgrTypeChanged += self.__onIgrTypeChanged
        self.itemsCache.onSyncCompleted += self.onCacheResync
        self.rankedController.onUpdated += self.onRankedUpdate
        self.rankedController.onGameModeStatusTick += self.__updateAlertMessage
        self.battleRoyaleController.onUpdated += self.__updateBattleRoyaleComponents
        self.epicController.onUpdated += self.__onEpicSkillsUpdate
        self.epicController.onPrimeTimeStatusUpdated += self.__onEpicSkillsUpdate
        self._promoController.onNewTeaserReceived += self.__onTeaserReceived
        self.hangarSpace.setVehicleSelectable(True)
        g_prbCtrlEvents.onVehicleClientStateChanged += self.__onVehicleClientStateChanged
        g_clientUpdateManager.addCallbacks({'inventory': self.__updateAlertMessage})
        self.lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingChanged
        self._settingsCore.onSettingsChanged += self.__onSettingsChanged
        self.battlePassController.onSeasonStateChange += self.__switchCarousels
        self._countdownController.onEventStateChanged += self.__updateTenYearsCountdownEntryPointVisibility
        self._countdownController.onEventBlockChanged += self.__updateTenYearsCountdownEntryPointVisibility
        self._countdownController.onBlocksDataValidityChanged += self.__updateTenYearsCountdownEntryPointVisibility
        self._hangarLoadingController.onHangarLoadedAfterLogin += self.__onHangarLoadedAfterLogin
        self.startGlobalListening()
        g_eventBus.addListener(AmmunitionSetupViewEvent.HINT_ZONE_ADD, self.__onHintZoneAdded, EVENT_BUS_SCOPE.LOBBY)
        g_eventBus.addListener(AmmunitionSetupViewEvent.HINT_ZONE_HIDE, self.__onHintZoneHide, EVENT_BUS_SCOPE.LOBBY)
        self.__updateAll()
        self.addListener(LobbySimpleEvent.WAITING_SHOWN, self.__onWaitingShown, EVENT_BUS_SCOPE.LOBBY)
        self.addListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE, self.__handleFightButtonUpdated, scope=EVENT_BUS_SCOPE.LOBBY)
        self.addListener(CameraRelatedEvents.CAMERA_ENTITY_UPDATED, self.__handleSelectedEntityUpdated)
        self.statsCollector.noteHangarLoadingState(HANGAR_LOADING_STATE.HANGAR_UI_READY, showSummaryNow=True)
        lobbyContext = dependency.instance(ILobbyContext)
        isCrewBooksEnabled = lobbyContext.getServerSettings().isCrewBooksEnabled()
        getTutorialGlobalStorage().setValue(GLOBAL_FLAG.CREW_BOOKS_ENABLED, isCrewBooksEnabled)
        self.as_setNotificationEnabledS(crewBooksViewedCache().haveNewCrewBooks())
        self.__updateSenorityEntryPoint()
        self.__updateTenYearsCountdownEntryPointVisibility()
        self._offersBannerController.showBanners()

    def _dispose(self):
        self.removeListener(LobbySimpleEvent.WAITING_SHOWN, self.__onWaitingShown, EVENT_BUS_SCOPE.LOBBY)
        self.removeListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE, self.__handleFightButtonUpdated, scope=EVENT_BUS_SCOPE.LOBBY)
        self.removeListener(CameraRelatedEvents.CAMERA_ENTITY_UPDATED, self.__handleSelectedEntityUpdated)
        self.itemsCache.onSyncCompleted -= self.onCacheResync
        g_currentVehicle.onChanged -= self.__onCurrentVehicleChanged
        self.hangarSpace.onVehicleChangeStarted -= self.__onVehicleLoading
        self.hangarSpace.onVehicleChanged -= self.__onVehicleLoaded
        self.hangarSpace.onSpaceRefresh -= self.__onSpaceRefresh
        self.hangarSpace.onSpaceCreate -= self.__onSpaceCreate
        self.igrCtrl.onIgrTypeChanged -= self.__onIgrTypeChanged
        self.rankedController.onUpdated -= self.onRankedUpdate
        self.rankedController.onGameModeStatusTick -= self.__updateAlertMessage
        self.battleRoyaleController.onUpdated -= self.__updateBattleRoyaleComponents
        self.epicController.onUpdated -= self.__onEpicSkillsUpdate
        self.epicController.onPrimeTimeStatusUpdated -= self.__onEpicSkillsUpdate
        self._promoController.onNewTeaserReceived -= self.__onTeaserReceived
        if self.__teaser is not None:
            self.__teaser.stop()
            self.__teaser = None
        self.hangarSpace.setVehicleSelectable(False)
        g_prbCtrlEvents.onVehicleClientStateChanged -= self.__onVehicleClientStateChanged
        g_clientUpdateManager.removeObjectCallbacks(self)
        self._settingsCore.onSettingsChanged -= self.__onSettingsChanged
        self.lobbyContext.getServerSettings().onServerSettingsChange -= self.__onServerSettingChanged
        self.battlePassController.onSeasonStateChange -= self.__switchCarousels
        self._countdownController.onEventStateChanged -= self.__updateTenYearsCountdownEntryPointVisibility
        self._countdownController.onEventBlockChanged -= self.__updateTenYearsCountdownEntryPointVisibility
        self._countdownController.onBlocksDataValidityChanged -= self.__updateTenYearsCountdownEntryPointVisibility
        self._hangarLoadingController.onHangarLoadedAfterLogin -= self.__onHangarLoadedAfterLogin
        self.closeHelpLayout()
        self.stopGlobalListening()
        g_eventBus.removeListener(AmmunitionSetupViewEvent.HINT_ZONE_ADD, self.__onHintZoneAdded, EVENT_BUS_SCOPE.LOBBY)
        g_eventBus.removeListener(AmmunitionSetupViewEvent.HINT_ZONE_HIDE, self.__onHintZoneHide, EVENT_BUS_SCOPE.LOBBY)
        self._offersBannerController.hideBanners()
        LobbySelectableView._dispose(self)
        return

    def _updateBattleRoyaleMode(self):
        self.as_toggleBattleRoyaleS(g_currentVehicle.isOnlyForBattleRoyaleBattles())

    def __updateSenorityEntryPoint(self):
        curStatus = self.__seniorityAwardsIsActive
        hasBoxes = getSeniorityAwardsBoxesCount() > 0
        config = self.lobbyContext.getServerSettings().getSeniorityAwardsConfig()
        seniorityAwardsWidgetVisibility = config.hangarWidgetIsVisible()
        self.__seniorityAwardsIsActive = config.isEnabled and hasBoxes and seniorityAwardsWidgetVisibility
        if curStatus != self.__seniorityAwardsIsActive:
            self.__seniorityAwardsIsActive = hasBoxes and self.__seniorityAwardsIsActive
            self.as_updateSeniorityAwardsEntryPointS(self.__seniorityAwardsIsActive)

    def __onViewAddedToContainer(self, _, pyEntity):
        self.closeHelpLayout()

    def __switchCarousels(self, force=False):
        prevCarouselAlias = self.__currentCarouselAlias
        linkage = HANGAR_ALIASES.TANK_CAROUSEL_UI
        newCarouselAlias = HANGAR_ALIASES.TANK_CAROUSEL
        if self.prbDispatcher is not None:
            if self.battlePassController.isVisible() and self.battlePassController.isValidBattleType(self.prbDispatcher.getEntity()):
                newCarouselAlias = HANGAR_ALIASES.BATTLEPASS_TANK_CAROUSEL
            elif self.prbDispatcher.getFunctionalState().isInPreQueue(QUEUE_TYPE.RANKED):
                newCarouselAlias = HANGAR_ALIASES.RANKED_TANK_CAROUSEL
            elif self.prbDispatcher.getFunctionalState().isInPreQueue(QUEUE_TYPE.EPIC) or self.prbDispatcher.getFunctionalState().isInUnit(PREBATTLE_TYPE.EPIC):
                newCarouselAlias = HANGAR_ALIASES.EPICBATTLE_TANK_CAROUSEL
            elif self.battleRoyaleController.isBattleRoyaleMode():
                newCarouselAlias = HANGAR_ALIASES.ROYALE_TANK_CAROUSEL
        if prevCarouselAlias != newCarouselAlias or force:
            self.as_setCarouselS(linkage, newCarouselAlias)
            self.__currentCarouselAlias = newCarouselAlias
        return

    def __updateAmmoPanel(self):
        if self.ammoPanel:
            self.ammoPanel.update()

    def __updateParams(self):
        if self.paramsPanel:
            self.paramsPanel.update()

    def __updateVehicleInResearchPanel(self):
        if self.researchPanel is not None:
            self.researchPanel.onCurrentVehicleChanged()
        return

    def __updateNavigationInResearchPanel(self):
        if self.prbDispatcher is not None and self.researchPanel is not None:
            self.researchPanel.setNavigationEnabled(not self.prbDispatcher.getFunctionalState().isNavigationDisabled())
        return

    def __updateHeader(self):
        if self.prbDispatcher is not None:
            if self.prbDispatcher.getFunctionalState().isInPreQueue(QUEUE_TYPE.EPIC) or self.prbDispatcher.getFunctionalState().isInUnit(PREBATTLE_TYPE.EPIC) or self.battleRoyaleController.isBattleRoyaleMode():
                if not self.epicWidget:
                    self.as_setHeaderTypeS(HANGAR_ALIASES.EPIC_WIDGET)
            elif not self.headerComponent:
                self.as_setDefaultHeaderS()
        return

    def __updateHeaderComponent(self):
        if self.headerComponent is not None:
            self.headerComponent.update()
        return

    def __updateRankedHeaderComponent(self):
        if self.headerComponent is not None:
            self.headerComponent.updateRankedHeader()
        return

    def __updateHeaderEpicWidget(self):
        if self.epicWidget is not None:
            self.epicWidget.update()
        return

    def __updateCrew(self):
        if self.crewPanel is not None:
            self.crewPanel.updateTankmen()
        return

    def __updateAlertMessage(self, *_):
        if self.prbDispatcher is not None:
            if self.prbDispatcher.getFunctionalState().isInPreQueue(QUEUE_TYPE.RANKED):
                self.__updateRankedAlertMsg()
                return
        self.as_setAlertMessageBlockVisibleS(False)
        return

    def __updateRankedAlertMsg(self):
        status, _, _ = self.rankedController.getPrimeTimeStatus()
        hasSuitVehs = self.rankedController.hasSuitableVehicles()
        isBlockedStatus = status in (PrimeTimeStatus.NOT_AVAILABLE, PrimeTimeStatus.NOT_SET, PrimeTimeStatus.FROZEN)
        buttonCallback = showRankedPrimeTimeWindow if hasSuitVehs else g_eventDispatcher.loadRankedUnreachable
        data = ranked_helpers.getAlertStatusVO()
        self.__updateAlertBlock(buttonCallback, data, isBlockedStatus or not hasSuitVehs)

    def __updateAlertBlock(self, callback, data, visible):
        self.as_setAlertMessageBlockVisibleS(visible)
        if visible and self.alertMessage is not None:
            self.alertMessage.update(data._asdict(), onBtnClickCallback=callback)
        return

    def __updateTenYearsCountdownEntryPointVisibility(self):
        isVisible = self._countdownController.isEventInProgress() and self._countdownController.isBlocksDataValid()
        self.as_updateEventEntryPointS(HANGAR_ALIASES.TEN_YEARS_COUNTDOWN_ENTRY_POINT_INJECT, isVisible)

    def __onWaitingShown(self, _):
        self.closeHelpLayout()

    def __handleFightButtonUpdated(self, _):
        self.__updateNavigationInResearchPanel()

    def __handleSelectedEntityUpdated(self, event):
        ctx = event.ctx
        if ctx['state'] != CameraMovementStates.FROM_OBJECT:
            entity = BigWorld.entities.get(ctx['entityId'], None)
            if isinstance(entity, HeroTank):
                descriptor = entity.typeDescriptor
                if descriptor:
                    shared_events.showHeroTankPreview(descriptor.type.compactDescr)
        self.__checkVehicleCameraState()
        self.__updateState()
        return

    def __onTeaserReceived(self, teaserData, showCallback, closeCallback):
        if self.__teaser is None:
            self.__teaser = TeaserViewer(self, showCallback, closeCallback)
        self.__teaser.show(teaserData, self._promoController.getPromoCount())
        return

    def _highlight3DEntityAndShowTT(self, entity):
        itemId = entity.selectionId
        if itemId:
            self.as_show3DSceneTooltipS(TOOLTIPS_CONSTANTS.ENVIRONMENT, [itemId])

    def _fade3DEntityAndHideTT(self, entity):
        self.as_hide3DSceneTooltipS()

    def _onRegisterFlashComponent(self, viewPy, alias):
        super(Hangar, self)._onRegisterFlashComponent(viewPy, alias)
        if alias == HANGAR_ALIASES.AMMUNITION_PANEL_INJECT:
            event = viewPy.getOnPanelSectionSelected()
            event += self.__onOptDeviceClick

    def _onUnregisterFlashComponent(self, viewPy, alias):
        super(Hangar, self)._onUnregisterFlashComponent(viewPy, alias)
        if alias == HANGAR_ALIASES.AMMUNITION_PANEL_INJECT and viewPy.getInjectView():
            event = viewPy.getOnPanelSectionSelected()
            event -= self.__onOptDeviceClick

    @property
    def ammoPanel(self):
        return self.getComponent(HANGAR_ALIASES.AMMUNITION_PANEL)

    @property
    def paramsPanel(self):
        return self.getComponent(HANGAR_ALIASES.VEHICLE_PARAMETERS)

    @property
    def crewPanel(self):
        return self.getComponent(HANGAR_ALIASES.CREW)

    @property
    def researchPanel(self):
        return self.getComponent(HANGAR_ALIASES.RESEARCH_PANEL)

    @property
    def headerComponent(self):
        return self.getComponent(HANGAR_ALIASES.HEADER)

    @property
    def alertMessage(self):
        return self.getComponent(HANGAR_ALIASES.ALERT_MESSAGE_BLOCK)

    @property
    def epicWidget(self):
        return self.getComponent(HANGAR_ALIASES.EPIC_WIDGET)

    def onCacheResync(self, reason, diff):
        if diff is not None and GUI_ITEM_TYPE.CREW_BOOKS in diff:
            self.as_setNotificationEnabledS(crewBooksViewedCache().haveNewCrewBooks())
        if reason == CACHE_SYNC_REASON.SHOP_RESYNC:
            self.__updateAll()
            return
        else:
            if diff is not None and GUI_ITEM_TYPE.VEHICLE in diff and g_currentVehicle.isPresent():
                if g_currentVehicle.item.invID in diff[GUI_ITEM_TYPE.VEHICLE]:
                    self.__updateAmmoPanel()
            self.__updateSenorityEntryPoint()
            return

    def onPlayerStateChanged(self, entity, roster, accountInfo):
        if accountInfo.isCurrentPlayer():
            self.__updateState()
            self.__updateAmmoPanel()

    def onUnitPlayerStateChanged(self, pInfo):
        if pInfo.isCurrentPlayer():
            self.__onEntityChanged()

    def onUnitPlayersListChanged(self):
        self.__updateHeader()
        self.__updateHeaderComponent()
        self.__updateHeaderEpicWidget()

    def onPrbEntitySwitched(self):
        self.__onEntityChanged()

    def onEnqueued(self, queueType, *args):
        self.__onEntityChanged()

    def onDequeued(self, queueType, *args):
        self.__onEntityChanged()

    def onRankedUpdate(self):
        self.__updateHeader()
        self.__updateHeaderComponent()
        self.__updateRankedHeaderComponent()

    def __updateBattleRoyaleComponents(self):
        self.__updateHeader()
        self.__updateHeaderComponent()

    def __onEpicSkillsUpdate(self, *_):
        self.__updateHeader()
        self.__updateHeaderComponent()
        self.__updateHeaderEpicWidget()
        self.__updateAmmoPanel()

    def __updateAll(self):
        Waiting.show('updateVehicle')
        self.__switchCarousels()
        self.__updateState()
        self.__updateAmmoPanel()
        self.__updateParams()
        self.__updateVehicleInResearchPanel()
        self.__updateNavigationInResearchPanel()
        self.__updateHeader()
        self.__updateHeaderComponent()
        self.__updateRankedHeaderComponent()
        self.__updateHeaderEpicWidget()
        self.__updateCrew()
        self.__updateAlertMessage()
        self.__updateBattleRoyaleComponents()
        self._updateBattleRoyaleMode()
        Waiting.hide('updateVehicle')

    def __onCurrentVehicleChanged(self):
        Waiting.show('updateVehicle')
        self.__updateState()
        self.__updateAmmoPanel()
        self.__updateParams()
        self.__updateVehicleInResearchPanel()
        self.__updateHeader()
        self.__updateHeaderComponent()
        self.__updateHeaderEpicWidget()
        self.__updateCrew()
        self.as_setNotificationEnabledS(crewBooksViewedCache().haveNewCrewBooks())
        self._updateBattleRoyaleMode()
        Waiting.hide('updateVehicle')

    def __onSpaceRefresh(self):
        self.__isSpaceReadyForC11n = False
        self.__updateState()

    def __onSpaceCreate(self):
        self.__isSpaceReadyForC11n = True
        self.__updateState()

    def __onVehicleLoading(self):
        self.__isVehicleReadyForC11n = False
        self.__updateState()

    def __onVehicleLoaded(self):
        self.__isVehicleReadyForC11n = True
        self.__checkVehicleCameraState()
        self.__updateState()

    def __onIgrTypeChanged(self, *args):
        self.__updateVehicleInResearchPanel()
        self.__updateHeader()
        self.__updateHeaderComponent()
        self.__updateHeaderEpicWidget()
        self.__updateParams()

    def __updateState(self):
        state = g_currentVehicle.getViewState()
        self.as_setCrewEnabledS(state.isCrewOpsEnabled())
        isBattleRoyaleMode = self.battleRoyaleController.isBattleRoyaleMode()
        isC11nEnabled = self.lobbyContext.getServerSettings().isCustomizationEnabled() and state.isCustomizationEnabled() and not state.isOnlyForEventBattles() and self.__isSpaceReadyForC11n and self.__isVehicleReadyForC11n and self.__isVehicleCameraReadyForC11n and not isBattleRoyaleMode
        if isC11nEnabled:
            customizationTooltip = makeTooltip(_ms(backport.text(R.strings.tooltips.hangar.tuning.header())), _ms(backport.text(R.strings.tooltips.hangar.tuning.body())))
        else:
            customizationTooltip = makeTooltip(_ms(backport.text(R.strings.tooltips.hangar.tuning.disabled.header())), _ms(backport.text(R.strings.tooltips.hangar.tuning.disabled.body())))
        changeNationVisibility = g_currentVehicle.isPresent() and g_currentVehicle.item.hasNationGroup
        isNationChangeAvailable = g_currentVehicle.isPresent() and g_currentVehicle.item.isNationChangeAvailable
        if changeNationVisibility:
            if isNationChangeAvailable:
                changeNationTooltipHeader = R.strings.tooltips.hangar.nationChange.header()
                changeNationTooltipBody = R.strings.tooltips.hangar.nationChange.body()
            else:
                changeNationTooltipHeader = R.strings.tooltips.hangar.nationChange.disabled.header()
                if g_currentVehicle.item.isBroken:
                    changeNationTooltipBody = R.strings.tooltips.hangar.nationChange.disabled.body.destroyed()
                elif g_currentVehicle.item.isInBattle:
                    changeNationTooltipBody = R.strings.tooltips.hangar.nationChange.disabled.body.inBattle()
                elif g_currentVehicle.item.isInUnit:
                    changeNationTooltipBody = R.strings.tooltips.hangar.nationChange.disabled.body.inSquad()
                else:
                    changeNationTooltipBody = ''
            if changeNationTooltipBody == '':
                changeNationTooltip = makeTooltip(_ms(backport.text(changeNationTooltipHeader)), '')
            else:
                changeNationTooltip = makeTooltip(_ms(backport.text(changeNationTooltipHeader)), _ms(backport.text(changeNationTooltipBody)))
        else:
            changeNationTooltip = ''
        changeNationIsNew = not AccountSettings.getSettings(NATION_CHANGE_VIEWED)
        isMaintenanceEnabled = state.isMaintenanceEnabled()
        isEquipmentEnabled = g_currentVehicle.isPresent() and not g_currentVehicle.isEquipmentLocked()
        if isMaintenanceEnabled and isEquipmentEnabled:
            maintenanceTooltip = TOOLTIPS.HANGAR_MAINTENANCE
        else:
            maintenanceTooltip = TOOLTIPS.HANGAR_MAINTENANCE_DISABLED
        self.as_setupAmmunitionPanelS({'maintenanceEnabled': isMaintenanceEnabled,
         'maintenanceTooltip': maintenanceTooltip,
         'customizationEnabled': isC11nEnabled,
         'customizationTooltip': customizationTooltip,
         'changeNationVisible': changeNationVisibility,
         'changeNationEnable': isNationChangeAvailable,
         'changeNationTooltip': changeNationTooltip,
         'changeNationIsNew': changeNationIsNew})
        self.as_setControlsVisibleS(state.isUIShown())

    def __onEntityChanged(self):
        self.__updateState()
        self.__updateAmmoPanel()
        self.__updateAlertMessage()
        self.__updateNavigationInResearchPanel()
        self.__updateHeader()
        self.__updateHeaderComponent()
        self.__updateRankedHeaderComponent()
        self.__updateHeaderEpicWidget()
        self.__switchCarousels()
        self.__updateBattleRoyaleComponents()

    def __isSpecialMode(self):
        return self.prbDispatcher is not None and self.prbDispatcher.getFunctionalState().isInUnit() or self.prbDispatcher.getFunctionalState().isInPreQueue(QUEUE_TYPE.RANKED) or self.prbDispatcher.getFunctionalState().isInPreQueue(QUEUE_TYPE.EPIC)

    def __onVehicleClientStateChanged(self, _):
        self.__updateAmmoPanel()

    def __onServerSettingChanged(self, diff):
        if 'isRegularQuestEnabled' in diff:
            self.__updateHeader()
            self.__updateHeaderComponent()
            self.__updateHeaderEpicWidget()
        if 'isCustomizationEnabled' in diff:
            self.__updateState()
        if {SENIORITY_AWARDS_CONFIG, IS_LOOT_BOXES_ENABLED}.intersection(diff):
            self.__updateSenorityEntryPoint()
        if BATTLE_PASS_CONFIG_NAME in diff:
            self.__switchCarousels()
        if Configs.BATTLE_ROYALE_CONFIG.value in diff:
            self.__updateBattleRoyaleComponents()
            self.__updateState()
            self.__switchCarousels(force=True)

    def __onSettingsChanged(self, diff):
        if SETTINGS_SECTIONS.UI_STORAGE in diff:
            if self.ammoPanel:
                self.ammoPanel.update()

    def __checkVehicleCameraState(self):
        vehicleEntity = self.hangarSpace.getVehicleEntity()
        if vehicleEntity is None:
            return
        else:
            self.__isVehicleCameraReadyForC11n = vehicleEntity.state == CameraMovementStates.ON_OBJECT
            return

    def __onHangarLoadedAfterLogin(self):
        isEnabled = self._countdownController.isEnabled()
        isBlocksDataValid = self._countdownController.isBlocksDataValid()
        currentBlockNumber = self._countdownController.getCurrentBlockNumber()
        callbackLowTierRewardsOverlay = None
        if self._lowTierController.isEnabled() and self._lowTierController.isRewardReady():
            callbackLowTierRewardsOverlay = showLowTierRewardsOverlay
        if isEnabled and isBlocksDataValid and not isOnBoardingCurrentBlockVisited(currentBlockNumber):
            setOnBoardingLastVisitedBlock(currentBlockNumber)
            showTenYearsCountdownOnBoarding(currentBlockNumber, self._countdownController.isCurrentBlockActive(), self._countdownController.getMonths(), self._countdownController.getBlocksCount(), callbackLowTierRewardsOverlay)
        elif callbackLowTierRewardsOverlay:
            callbackLowTierRewardsOverlay()
        return

    def __onOptDeviceClick(self, **kwargs):
        self.as_showSwitchToAmmunitionS()
        showAmmunitionSetupView(**kwargs)

    def __onHintZoneAdded(self, event):
        ctx = event.ctx
        if ctx.get('hintName') in self._ENABLED_GF_HINTS:
            self.as_createHintAreaInComponentS(TutorialHintConsts.HANGAR_AMMUNITION_PANEL_COMPONENT, ctx.get('hintName'), ctx.get('posX'), ctx.get('posY'), ctx.get('width'), ctx.get('height'))

    def __onHintZoneHide(self, event):
        ctx = event.ctx
        if ctx.get('hintName') in self._ENABLED_GF_HINTS:
            self.as_removeHintAreaS(ctx.get('hintName'))
# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client/gui/Scaleform/daapi/view/lobby/profile/sound_constants.py
from gui.Scaleform.framework.entities.View import CommonSoundSpaceSettings
from shared_utils import CONST_CONTAINER


class SOUNDS(CONST_CONTAINER):
    COMMON_SOUND_SPACE = 'achievements'
    STATE_PLACE = 'STATE_hangar_place'
    STATE_PLACE_GARAGE = 'STATE_hangar_place_garage'
    STATE_PLACE_ACHIEVEMENTS = 'STATE_hangar_place_achievements'


ACHIEVEMENTS_SOUND_SPACE = CommonSoundSpaceSettings(
    name=SOUNDS.COMMON_SOUND_SPACE,
    entranceStates={SOUNDS.STATE_PLACE: SOUNDS.STATE_PLACE_ACHIEVEMENTS},
    exitStates={SOUNDS.STATE_PLACE: SOUNDS.STATE_PLACE_GARAGE},
    persistentSounds=(),
    stoppableSounds=(),
    priorities=(),
    autoStart=True,
    enterEvent='',
    exitEvent='')
Ejemplo n.º 13
0
class BCVideoPage(BCOutroVideoPageMeta):
    _DEFAULT_MASTER_VOLUME = 1.0
    _ACCESSIBILITY_MINTIME = 0.1
    _HANGAR_OVERLAY_STATE = 'STATE_video_overlay'
    __SOUND_SETTINGS = CommonSoundSpaceSettings(
        name='hangar_video',
        entranceStates={
            _HANGAR_OVERLAY_STATE: '{}_on'.format(_HANGAR_OVERLAY_STATE)
        },
        exitStates={
            _HANGAR_OVERLAY_STATE: '{}_off'.format(_HANGAR_OVERLAY_STATE)
        },
        persistentSounds=(),
        stoppableSounds=(),
        priorities=(),
        autoStart=True,
        enterEvent='',
        exitEvent='')
    _COMMON_SOUND_SPACE = __SOUND_SETTINGS

    def __init__(self, settings):
        super(BCVideoPage, self).__init__(settings)
        self._message = {}
        self._keypoints = []
        self.__accessible = True
        self.__soundDelayer = None
        self.__pauseDelayerID = None
        return

    def stopVideo(self):
        if not self.__showVideo():
            self._onFinish()

    def handleError(self, data):
        self.stopVideo()

    def videoFinished(self):
        self.stopVideo()

    def _populate(self):
        super(BCVideoPage, self)._populate()
        movies = [
            '/'.join((SCALEFORM_SWF_PATH_V3, m['video-path']))
            for m in self.content['messages']
        ]
        ScaleformFileLoader.enableStreaming(movies)
        self.stopVideo()
        self.__accessible = Windowing.isWindowAccessible()
        Windowing.addWindowAccessibilitynHandler(self._onAccessibilityChanged)

    def _dispose(self):
        Windowing.removeWindowAccessibilityHandler(
            self._onAccessibilityChanged)
        ScaleformFileLoader.disableStreaming()
        super(BCVideoPage, self)._dispose()

    def _onAccessibilityChanged(self, isAccessible):
        if self.__accessible == isAccessible:
            return
        else:
            self.__accessible = isAccessible
            if isAccessible:
                if self.__pauseDelayerID is not None:
                    BigWorld.cancelCallback(self.__pauseDelayerID)
                    self.__pauseDelayerID = None
                    return
                self.__onResume()
            else:
                self.__pauseDelayerID = BigWorld.callback(
                    self._ACCESSIBILITY_MINTIME, self.__onPause)
            return

    def __showVideo(self):
        if self.content['messages']:
            self._message = self.content['messages'].pop(0)
            movie = self._message['video-path']
            self.soundManager.playInstantSound(self._message['event-start'])
            self.as_playVideoS({
                'source':
                movie,
                'volume':
                self._DEFAULT_MASTER_VOLUME *
                SoundGroups.g_instance.getMasterVolume()
            })
            if self.content['voiceovers']:
                self._keypoints = [
                    (float(point['keypoint'])
                     if 'keypoint' in point and point['keypoint'] else 0.0)
                    for point in self.content['voiceovers']
                    if point['voiceover']
                ]
                self.__addKeyPoint(0.0)
            return True
        return False

    @subtitleDecorator
    def playNotification(self, delay):
        self.__soundDelayer = None
        self.__addKeyPoint(delay)
        return

    def __addKeyPoint(self, delay):
        if self._keypoints:
            delayTime = self._keypoints.pop(0)
            self.__soundDelayer = _CallbackDelayer(delayTime + delay,
                                                   self.playNotification)
            self.__soundDelayer.startCallback()

    def __onPause(self):
        self.soundManager.playInstantSound(self._message['event-pause'])
        self.as_pausePlaybackS()
        self.__pauseDelayerID = None
        if self.__soundDelayer is not None:
            self.__soundDelayer.stopCallback()
        return

    def __onResume(self):
        self.soundManager.playInstantSound(self._message['event-resume'])
        self.as_resumePlaybackS()
        if self.__soundDelayer is not None:
            self.__soundDelayer.startCallback()
        return

    def _onFinish(self):
        self.soundManager.playInstantSound(self._message['event-stop'])
        if self.__pauseDelayerID is not None:
            BigWorld.cancelCallback(self.__pauseDelayerID)
            self.__pauseDelayerID = None
        if self.__soundDelayer is not None:
            self.__soundDelayer.cancelCallback()
            self.__soundDelayer = None
        self._onDestroy()
        return

    def _onDestroy(self):
        self.destroy()
Ejemplo n.º 14
0
class Hangar(LobbySelectableView, HangarMeta, IGlobalListener):
    __background_alpha__ = 0.0
    __SOUND_SETTINGS = CommonSoundSpaceSettings(
        name='hangar',
        entranceStates={
            customizationSounds.STATE_PLACE:
            customizationSounds.STATE_PLACE_GARAGE,
            STATE_HANGAR_FILTERED: '{}_off'.format(STATE_HANGAR_FILTERED)
        },
        exitStates={},
        persistentSounds=(),
        stoppableSounds=(),
        priorities=(),
        autoStart=True)
    rankedController = dependency.descriptor(IRankedBattlesController)
    epicSkillsController = dependency.descriptor(IEpicBattleMetaGameController)
    itemsCache = dependency.descriptor(IItemsCache)
    igrCtrl = dependency.descriptor(IIGRController)
    lobbyContext = dependency.descriptor(ILobbyContext)
    statsCollector = dependency.descriptor(IStatisticsCollector)
    _settingsCore = dependency.descriptor(ISettingsCore)
    hangarSpace = dependency.descriptor(IHangarSpace)
    _COMMON_SOUND_SPACE = __SOUND_SETTINGS

    def __init__(self, _=None):
        LobbySelectableView.__init__(self, 0)
        self.__currentCarouselAlias = None
        self.__isSpaceReadyForC11n = False
        self.__isVehicleReadyForC11n = False
        self.__isVehicleCameraReadyForC11n = False
        return

    def onEscape(self):
        dialogsContainer = self.app.containerManager.getContainer(
            ViewTypes.TOP_WINDOW)
        if not dialogsContainer.getView(
                criteria={POP_UP_CRITERIA.VIEW_ALIAS: VIEW_ALIAS.LOBBY_MENU}):
            self.fireEvent(events.LoadViewEvent(VIEW_ALIAS.LOBBY_MENU),
                           scope=EVENT_BUS_SCOPE.LOBBY)

    def showHelpLayout(self):
        containerManager = self.app.containerManager
        dialogsContainer = containerManager.getContainer(ViewTypes.TOP_WINDOW)
        windowsContainer = containerManager.getContainer(ViewTypes.WINDOW)
        browserWindowContainer = containerManager.getContainer(
            ViewTypes.BROWSER)
        overlayContainer = containerManager.getContainer(ViewTypes.OVERLAY)
        if not dialogsContainer.getViewCount(
        ) and not windowsContainer.getViewCount(
        ) and not browserWindowContainer.getViewCount(
        ) and not overlayContainer.getViewCount():
            containerManager.onViewAddedToContainer += self.__onViewAddedToContainer
            self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.SHOW_HELPLAYOUT),
                           scope=EVENT_BUS_SCOPE.LOBBY)
            self.as_showHelpLayoutS()

    def closeHelpLayout(self):
        self.app.containerManager.onViewAddedToContainer -= self.__onViewAddedToContainer
        self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.CLOSE_HELPLAYOUT),
                       scope=EVENT_BUS_SCOPE.LOBBY)
        self.as_closeHelpLayoutS()

    def _populate(self):
        LobbySelectableView._populate(self)
        self.__isSpaceReadyForC11n = self.hangarSpace.spaceInited
        self.__isVehicleReadyForC11n = self.hangarSpace.isModelLoaded
        self.__checkVehicleCameraState()
        g_currentVehicle.onChanged += self.__onCurrentVehicleChanged
        self.hangarSpace.onVehicleChangeStarted += self.__onVehicleLoading
        self.hangarSpace.onVehicleChanged += self.__onVehicleLoaded
        self.hangarSpace.onSpaceRefresh += self.__onSpaceRefresh
        self.hangarSpace.onSpaceCreate += self.__onSpaceCreate
        self.igrCtrl.onIgrTypeChanged += self.__onIgrTypeChanged
        self.itemsCache.onSyncCompleted += self.onCacheResync
        self.rankedController.onUpdated += self.onRankedUpdate
        self.rankedController.onPrimeTimeStatusUpdated += self.__onRankedPrimeStatusUpdate
        self.epicSkillsController.onUpdated += self.__onEpicSkillsUpdate
        self.epicSkillsController.onPrimeTimeStatusUpdated += self.__onEpicSkillsUpdate
        self.hangarSpace.setVehicleSelectable(True)
        g_prbCtrlEvents.onVehicleClientStateChanged += self.__onVehicleClientStateChanged
        self.lobbyContext.getServerSettings(
        ).onServerSettingsChange += self.__onServerSettingChanged
        self._settingsCore.onSettingsChanged += self.__onSettingsChanged
        g_clientUpdateManager.addMoneyCallback(self.onMoneyUpdate)
        g_clientUpdateManager.addCallbacks({})
        self.startGlobalListening()
        self.__updateAll()
        self.addListener(LobbySimpleEvent.WAITING_SHOWN, self.__onWaitingShown,
                         EVENT_BUS_SCOPE.LOBBY)
        self.addListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE,
                         self.__handleFightButtonUpdated,
                         scope=EVENT_BUS_SCOPE.LOBBY)
        self.addListener(CameraRelatedEvents.CAMERA_ENTITY_UPDATED,
                         self.__handleSelectedEntityUpdated)
        self._onPopulateEnd()
        self.statsCollector.noteHangarLoadingState(
            HANGAR_LOADING_STATE.HANGAR_UI_READY, showSummaryNow=True)

    def _dispose(self):
        self.removeListener(LobbySimpleEvent.WAITING_SHOWN,
                            self.__onWaitingShown, EVENT_BUS_SCOPE.LOBBY)
        self.removeListener(events.FightButtonEvent.FIGHT_BUTTON_UPDATE,
                            self.__handleFightButtonUpdated,
                            scope=EVENT_BUS_SCOPE.LOBBY)
        self.removeListener(CameraRelatedEvents.CAMERA_ENTITY_UPDATED,
                            self.__handleSelectedEntityUpdated)
        self.itemsCache.onSyncCompleted -= self.onCacheResync
        g_clientUpdateManager.removeObjectCallbacks(self)
        g_currentVehicle.onChanged -= self.__onCurrentVehicleChanged
        self.hangarSpace.onVehicleChangeStarted -= self.__onVehicleLoading
        self.hangarSpace.onVehicleChanged -= self.__onVehicleLoaded
        self.hangarSpace.onSpaceRefresh -= self.__onSpaceRefresh
        self.hangarSpace.onSpaceCreate -= self.__onSpaceCreate
        self.igrCtrl.onIgrTypeChanged -= self.__onIgrTypeChanged
        self.rankedController.onUpdated -= self.onRankedUpdate
        self.rankedController.onPrimeTimeStatusUpdated -= self.__onRankedPrimeStatusUpdate
        self.epicSkillsController.onUpdated -= self.__onEpicSkillsUpdate
        self.epicSkillsController.onPrimeTimeStatusUpdated -= self.__onEpicSkillsUpdate
        self.hangarSpace.setVehicleSelectable(False)
        g_prbCtrlEvents.onVehicleClientStateChanged -= self.__onVehicleClientStateChanged
        self._settingsCore.onSettingsChanged -= self.__onSettingsChanged
        self.lobbyContext.getServerSettings(
        ).onServerSettingsChange -= self.__onServerSettingChanged
        self.closeHelpLayout()
        self.stopGlobalListening()
        LobbySelectableView._dispose(self)

    def __onViewAddedToContainer(self, _, pyEntity):
        self.closeHelpLayout()

    def __switchCarousels(self):
        prevCarouselAlias = self.__currentCarouselAlias
        linkage = HANGAR_ALIASES.TANK_CAROUSEL_UI
        newCarouselAlias = HANGAR_ALIASES.TANK_CAROUSEL
        if self.prbDispatcher is not None:
            if self.prbDispatcher.getFunctionalState().isInPreQueue(
                    QUEUE_TYPE.RANKED):
                linkage = HANGAR_ALIASES.TANK_CAROUSEL_UI
                newCarouselAlias = HANGAR_ALIASES.RANKED_TANK_CAROUSEL
            elif self.prbDispatcher.getFunctionalState().isInPreQueue(
                    QUEUE_TYPE.EPIC) or self.prbDispatcher.getFunctionalState(
                    ).isInUnit(PREBATTLE_TYPE.EPIC):
                linkage = HANGAR_ALIASES.TANK_CAROUSEL_UI
                newCarouselAlias = HANGAR_ALIASES.EPICBATTLE_TANK_CAROUSEL
        if prevCarouselAlias != newCarouselAlias:
            self.as_setCarouselS(linkage, newCarouselAlias)
            self.__currentCarouselAlias = newCarouselAlias
        return

    def __updateAmmoPanel(self):
        if self.ammoPanel:
            self.ammoPanel.update()

    def __updateParams(self):
        if self.paramsPanel:
            self.paramsPanel.update()

    def __updateVehicleInResearchPanel(self):
        if self.researchPanel is not None:
            self.researchPanel.onCurrentVehicleChanged()
        return

    def __updateNavigationInResearchPanel(self):
        if self.prbDispatcher is not None and self.researchPanel is not None:
            self.researchPanel.setNavigationEnabled(
                not self.prbDispatcher.getFunctionalState(
                ).isNavigationDisabled())
        return

    def __updateHeaderWidget(self):
        if self.prbDispatcher is not None:
            if self.prbDispatcher.getFunctionalState().isInPreQueue(
                    QUEUE_TYPE.RANKED):
                if not self.rankedWidget:
                    self.as_setHeaderTypeS(HANGAR_ALIASES.RANKED_WIDGET)
            elif self.prbDispatcher.getFunctionalState().isInPreQueue(
                    QUEUE_TYPE.EPIC) or self.prbDispatcher.getFunctionalState(
                    ).isInUnit(PREBATTLE_TYPE.EPIC):
                if not self.epicWidget:
                    self.as_setHeaderTypeS(HANGAR_ALIASES.EPIC_WIDGET)
            elif not self.headerComponent:
                self.as_setDefaultHeaderS()
        if self.headerComponent is not None:
            self.headerComponent.update()
        if self.epicWidget is not None:
            self.epicWidget.update()
        if self.rankedWidget is not None:
            vehicle = g_currentVehicle.item
            ranks = self.rankedController.getAllRanksChain(vehicle)
            currentRank = self.rankedController.getCurrentRank(vehicle)
            lastRank = self.rankedController.getLastRank(vehicle)
            self.rankedWidget.update(ranks, currentRank, lastRank)
        return

    def __updateCrew(self):
        if self.crewPanel is not None:
            self.crewPanel.updateTankmen()
        return

    def __updateAlertMessage(self):
        if self.prbDispatcher is not None and self.prbDispatcher.getFunctionalState(
        ).isInPreQueue(QUEUE_TYPE.RANKED):
            status, timeLeft, _ = self.rankedController.getPrimeTimeStatus()
            visible = status == PRIME_TIME_STATUS.NOT_AVAILABLE
            self.as_setAlertMessageBlockVisibleS(visible)
            if visible and self.alertMessage is not None:
                self.alertMessage.updateTimeLeft(timeLeft)
        else:
            self.as_setAlertMessageBlockVisibleS(False)
        return

    def __onWaitingShown(self, event):
        self.closeHelpLayout()

    def __handleFightButtonUpdated(self, _):
        self.__updateNavigationInResearchPanel()

    def __handleSelectedEntityUpdated(self, event):
        ctx = event.ctx
        if ctx['state'] != CameraMovementStates.FROM_OBJECT:
            entity = BigWorld.entities.get(ctx['entityId'], None)
            if isinstance(entity, HeroTank):
                descriptor = entity.typeDescriptor
                if descriptor:
                    shared_events.showHeroTankPreview(
                        descriptor.type.compactDescr)
        self.__checkVehicleCameraState()
        self.__updateState()
        return

    def _highlight3DEntityAndShowTT(self, entity):
        LobbySelectableView._highlight3DEntityAndShowTT(self, entity)
        itemId = entity.selectionId
        if itemId:
            self.as_show3DSceneTooltipS(TOOLTIPS_CONSTANTS.ENVIRONMENT,
                                        [itemId])

    def _fade3DEntityAndHideTT(self, entity):
        LobbySelectableView._fade3DEntityAndHideTT(self, entity)
        self.as_hide3DSceneTooltipS()

    @property
    def ammoPanel(self):
        return self.getComponent(HANGAR_ALIASES.AMMUNITION_PANEL)

    @property
    def paramsPanel(self):
        return self.getComponent(HANGAR_ALIASES.VEHICLE_PARAMETERS)

    @property
    def crewPanel(self):
        return self.getComponent(HANGAR_ALIASES.CREW)

    @property
    def researchPanel(self):
        return self.getComponent(HANGAR_ALIASES.RESEARCH_PANEL)

    @property
    def headerComponent(self):
        return self.getComponent(HANGAR_ALIASES.HEADER)

    @property
    def rankedWidget(self):
        return self.getComponent(HANGAR_ALIASES.RANKED_WIDGET)

    @property
    def alertMessage(self):
        return self.getComponent(HANGAR_ALIASES.ALERT_MESSAGE_BLOCK)

    @property
    def epicWidget(self):
        return self.getComponent(HANGAR_ALIASES.EPIC_WIDGET)

    def onCacheResync(self, reason, diff):
        if reason == CACHE_SYNC_REASON.SHOP_RESYNC:
            self.__updateAll()
            return
        else:
            if diff is not None and GUI_ITEM_TYPE.VEHICLE in diff:
                self.__updateAmmoPanel()
            return

    def onPlayerStateChanged(self, entity, roster, accountInfo):
        if accountInfo.isCurrentPlayer():
            self.__updateState()
            self.__updateAmmoPanel()

    def onUnitPlayerStateChanged(self, pInfo):
        if pInfo.isCurrentPlayer():
            self.__onEntityChanged()

    def onUnitPlayersListChanged(self):
        self.__updateHeaderWidget()

    def onPrbEntitySwitched(self):
        self.__onEntityChanged()

    def onEnqueued(self, queueType, *args):
        self.__onEntityChanged()

    def onDequeued(self, queueType, *args):
        self.__onEntityChanged()

    def onMoneyUpdate(self, *args):
        self.__updateAmmoPanel()

    def onRankedUpdate(self):
        self.__updateHeaderWidget()

    def _onPopulateEnd(self):
        pass

    def __onRankedPrimeStatusUpdate(self, status):
        if not self.prbDispatcher:
            return
        if self.prbDispatcher.getFunctionalState().isInPreQueue(
                QUEUE_TYPE.RANKED):
            self.as_setAlertMessageBlockVisibleS(
                status != PRIME_TIME_STATUS.AVAILABLE)

    def __onEpicSkillsUpdate(self, *_):
        self.__updateHeaderWidget()
        self.__updateAmmoPanel()

    def __updateAll(self):
        Waiting.show('updateVehicle')
        self.__switchCarousels()
        self.__updateState()
        self.__updateAmmoPanel()
        self.__updateParams()
        self.__updateVehicleInResearchPanel()
        self.__updateNavigationInResearchPanel()
        self.__updateHeaderWidget()
        self.__updateCrew()
        self.__updateAlertMessage()
        Waiting.hide('updateVehicle')

    def __onCurrentVehicleChanged(self):
        Waiting.show('updateVehicle')
        self.__updateState()
        self.__updateAmmoPanel()
        self.__updateParams()
        self.__updateVehicleInResearchPanel()
        self.__updateHeaderWidget()
        self.__updateCrew()
        Waiting.hide('updateVehicle')

    def __onSpaceRefresh(self):
        self.__isSpaceReadyForC11n = False
        self.__updateState()

    def __onSpaceCreate(self):
        self.__isSpaceReadyForC11n = True
        self.__updateState()

    def __onVehicleLoading(self):
        self.__isVehicleReadyForC11n = False
        self.__updateState()

    def __onVehicleLoaded(self):
        self.__isVehicleReadyForC11n = True
        self.__checkVehicleCameraState()
        self.__updateState()

    def __onIgrTypeChanged(self, *args):
        self.__updateVehicleInResearchPanel()
        self.__updateHeaderWidget()
        self.__updateParams()

    def __updateState(self):
        state = g_currentVehicle.getViewState()
        self.as_setCrewEnabledS(state.isCrewOpsEnabled())
        isC11nEnabled = self.lobbyContext.getServerSettings(
        ).isCustomizationEnabled() and state.isCustomizationEnabled(
        ) and not state.isOnlyForEventBattles(
        ) and self.__isSpaceReadyForC11n and self.__isVehicleReadyForC11n and self.__isVehicleCameraReadyForC11n
        if isC11nEnabled:
            customizationTooltip = makeTooltip(
                _ms(TOOLTIPS.HANGAR_TUNING_HEADER),
                _ms(TOOLTIPS.HANGAR_TUNING_BODY))
        else:
            customizationTooltip = makeTooltip(
                _ms(TOOLTIPS.HANGAR_TUNING_DISABLED_HEADER),
                _ms(TOOLTIPS.HANGAR_TUNING_DISABLED_BODY))
        self.as_setupAmmunitionPanelS(state.isMaintenanceEnabled(),
                                      TOOLTIPS.HANGAR_MAINTENANCE,
                                      isC11nEnabled, customizationTooltip)
        self.as_setControlsVisibleS(state.isUIShown())

    def __onEntityChanged(self):
        self.__updateState()
        self.__updateAmmoPanel()
        self.__switchCarousels()
        self.__updateAlertMessage()
        self.__updateNavigationInResearchPanel()
        self.__updateHeaderWidget()
        self.__switchCarousels()

    def __onVehicleClientStateChanged(self, vehicles):
        self.__updateAmmoPanel()

    def __onServerSettingChanged(self, diff):
        if 'isRegularQuestEnabled' in diff:
            self.__updateHeaderWidget()
        if 'isCustomizationEnabled' in diff:
            self.__updateState()

    def __onSettingsChanged(self, diff):
        if SETTINGS_SECTIONS.UI_STORAGE in diff:
            if self.ammoPanel:
                self.ammoPanel.update()

    def __checkVehicleCameraState(self):
        vehicleEntity = self.hangarSpace.getVehicleEntity()
        if vehicleEntity is None:
            return
        else:
            self.__isVehicleCameraReadyForC11n = vehicleEntity.state == CameraMovementStates.ON_OBJECT
            return
    PROGRESSION_STATE_3_DIVISION = 'STATE_rank_level_02'
    PROGRESSION_STATE_2_DIVISION = 'STATE_rank_level_03'
    PROGRESSION_STATE_1_DIVISION = 'STATE_rank_level_04'
    PROGRESSION_STATE_LEAGUES = 'STATE_rank_level_05'
    PROGRESSION_STATE_SHOP = 'STATE_rank_level_05'


RANKED_MAIN_PAGE_SOUND_SPACE = CommonSoundSpaceSettings(
    name=Sounds.MAIN_PAGE_SPACE_NAME,
    entranceStates={
        Sounds.HANGAR_PLACE_STATE: Sounds.HANGAR_PLACE_GARAGE,
        Sounds.MAIN_PAGE_STATE: Sounds.MAIN_PAGE_STATE_ON,
        Sounds.MAIN_PAGE_AMBIENT_STATE: Sounds.MAIN_PAGE_AMBIENT_STATE_1
    },
    exitStates={
        Sounds.MAIN_PAGE_STATE: Sounds.MAIN_PAGE_STATE_OFF,
        Sounds.SUBVIEW_HANGAR_GENERAL: Sounds.SUBVIEW_HANGAR_GENERAL_OFF
    },
    persistentSounds=(),
    stoppableSounds=(),
    priorities=(),
    autoStart=True,
    enterEvent=Sounds.MAIN_PAGE_AMBIENT_ON_EVENT,
    exitEvent=Sounds.MAIN_PAGE_AMBIENT_OFF_EVENT)
RANKED_OVERLAY_SOUND_SPACE = CommonSoundSpaceSettings(
    name=Sounds.OVERLAY_SPACE_NAME,
    entranceStates={
        Sounds.OVERLAY_HANGAR_GENERAL: Sounds.OVERLAY_HANGAR_GENERAL_ON,
        Sounds.OVERLAY_HANGAR_FILTERED: Sounds.OVERLAY_HANGAR_FILTERED_ON
    },
    exitStates={
Ejemplo n.º 16
0
class BCIntroVideoPage(BCIntroPage, IArenaVehiclesController):
    sessionProvider = dependency.descriptor(IBattleSessionProvider)
    _HANGAR_OVERLAY_STATE = 'STATE_video_overlay'
    __SOUND_SETTINGS = CommonSoundSpaceSettings(
        name='hangar_video',
        entranceStates={
            _HANGAR_OVERLAY_STATE: '{}_on'.format(_HANGAR_OVERLAY_STATE)
        },
        exitStates={
            _HANGAR_OVERLAY_STATE: '{}_off'.format(_HANGAR_OVERLAY_STATE)
        },
        persistentSounds=(),
        stoppableSounds=(),
        priorities=(),
        autoStart=True,
        enterEvent='',
        exitEvent='')
    _COMMON_SOUND_SPACE = __SOUND_SETTINGS

    def __init__(self, settings):
        super(BCIntroVideoPage, self).__init__(settings)
        self._movieFile = settings.get('video', '')
        self._backgroundVideo = settings.get('backgroundVideo', '')
        self._backgroundVideoBufferTime = settings.get(
            'bufferTime', _DEFAULT_VIDEO_BUFFERING_TIME)
        self._backgroundMusicStartEvent = settings.get(
            'backgroundMusicStartEvent', '')
        self._backgroundMusicStopEvent = settings.get(
            'backgroundMusicStopEvent', '')
        self._backgroundMusicPauseEvent = settings.get(
            'backgroundMusicPauseEvent', '')
        self._backgroundMusicResumeEvent = settings.get(
            'backgroundMusicResumeEvent', '')
        self._backgroundMusicToLoopEvent = settings.get(
            'backgroundMusicToLoopEvent', '')
        self._goToBattleEvent = g_bootcampEvents.onBootcampGoNext
        self._delaySpaceLoaded = False
        self._started = False

    def stopVideo(self):
        self._onFinish()

    def updateSpaceLoadProgress(self, progress):
        if not self._videoPlayerVisible:
            self.as_updateProgressS(progress)

    def _getVideoFiles(self):
        return [
            '/'.join((SCALEFORM_SWF_PATH_V3, videoName))
            for videoName in (self._movieFile, self._backgroundVideo)
            if videoName
        ]

    def _populate(self):
        videoFiles = self._getVideoFiles()
        if videoFiles:
            ScaleformFileLoader.enableStreaming(videoFiles)
            self._videoPlayerVisible = True
        g_bootcampEvents.onArenaStarted += self._onArenaStarted
        g_bootcampEvents.onBootcampSpaceLoaded += self._onBootcampSpaceLoaded
        self.sessionProvider.addArenaCtrl(self)
        super(BCIntroVideoPage, self)._populate()

    def _dispose(self):
        if self._getVideoFiles():
            ScaleformFileLoader.disableStreaming()
        g_bootcampEvents.onBootcampSpaceLoaded -= self._onBootcampSpaceLoaded
        g_bootcampEvents.onArenaStarted -= self._onArenaStarted
        self.sessionProvider.removeArenaCtrl(self)
        super(BCIntroVideoPage, self)._dispose()

    def _onBootcampSpaceLoaded(self):
        if self._started:
            self._onLoaded()
        else:
            self._delaySpaceLoaded = True

    def _onArenaStarted(self):
        self.destroy()

    @simpleLog(action=BC_LOG_ACTIONS.SKIP_VIDEO)
    def _onFinish(self):
        if self._movieFile and self._backgroundMusicToLoopEvent:
            WWISE.WW_eventGlobal(self._backgroundMusicToLoopEvent)
        g_bootcampEvents.onIntroVideoStop()
        if self._videoPlayerVisible:
            self._showHighlight()

    @loggerEntry
    def _start(self):
        super(BCIntroVideoPage, self)._start()
        self._started = True
        if self._delaySpaceLoaded:
            self._onLoaded()

    def _onLoaded(self):
        self.as_loadedS()
        if not self._videoPlayerVisible:
            self._showHighlight()

    @logOnCondition(instanceMethod='_shouldHighlight',
                    valueToCheck=INTRO_HIGHLIGHT_TYPE.START_BUTTON,
                    action=BC_LOG_ACTIONS.MOUSE_CLICK)
    def _showHighlight(self):
        if self._shouldHighlight(INTRO_HIGHLIGHT_TYPE.START_BUTTON):
            self._setHighlighting(INTRO_HIGHLIGHT_TYPE.START_BUTTON, True)
        if self._isCurrentlyHighlighting(INTRO_HIGHLIGHT_TYPE.ARROWS):
            self._setHighlighting(INTRO_HIGHLIGHT_TYPE.ARROWS, False)

    @simpleLog(action=BC_LOG_ACTIONS.CONTINUE_BUTTON_PRESSED)
    def goToBattle(self):
        super(BCIntroVideoPage, self).goToBattle()