Example #1
0
class BattleEntry(SFApplication):
    def __init__(self, appNS):
        super(BattleEntry, self).__init__(
            'battle.swf', appNS,
            DAAPIRootBridge(initCallback='registerBattleTest'))
        self.__input = None
        return

    @property
    def cursorMgr(self):
        return self.__getCursorFromContainer()

    def afterCreate(self):
        super(BattleEntry, self).afterCreate()
        self.__input = BattleGameInputMgr()
        self.__input.start()

    def beforeDelete(self):
        if self.__input is not None:
            self.__input.stop()
            self.__input = None
        super(BattleEntry, self).beforeDelete()
        return

    def handleKey(self, isDown, key, mods):
        if self.__input is not None:
            return self.__input.handleKey(isDown, key, mods)
        else:
            return False
            return

    def enterGuiControlMode(self,
                            consumerID,
                            cursorVisible=True,
                            enableAiming=True):
        if self.__input is not None:
            self.__input.enterGuiControlMode(consumerID,
                                             cursorVisible=cursorVisible,
                                             enableAiming=enableAiming)
        return

    def leaveGuiControlMode(self, consumerID):
        if self.__input is not None:
            self.__input.leaveGuiControlMode(consumerID)
        return

    def hasGuiControlModeConsumers(self, *consumersIDs):
        if self.__input is not None:
            return self.__input.hasGuiControlModeConsumers(*consumersIDs)
        else:
            return False
            return

    def registerGuiKeyHandler(self, handler):
        if self.__input is not None:
            self.__input.registerGuiKeyHandler(handler)
        return

    def unregisterGuiKeyHandler(self, handler):
        if self.__input is not None:
            self.__input.unregisterGuiKeyHandler(handler)
        return

    def _createLoaderManager(self):
        return LoaderManager(weakref.proxy(self))

    def _createContainerManager(self):
        return ContainerManager(
            self._loaderMgr, DefaultContainer(ViewTypes.DEFAULT),
            DefaultContainer(ViewTypes.CURSOR),
            PopUpContainer(ViewTypes.WINDOW),
            TopWindowContainer(ViewTypes.TOP_WINDOW, weakref.proxy(self)))

    def _createToolTipManager(self):
        tooltip = ToolTip(GUI_GLOBAL_SPACE_ID.BATTLE_LOADING)
        tooltip.setEnvironment(self)
        return tooltip

    def _createGlobalVarsManager(self):
        return GlobalVarsManager()

    def _createSoundManager(self):
        return SoundManager()

    def _createColorSchemeManager(self):
        return BattleColorSchemeManager()

    def _createVoiceChatManager(self):
        return BattleVoiceChatManager(weakref.proxy(self))

    def _createUtilsManager(self):
        return UtilsManager()

    def _createContextMenuManager(self):
        return ContextMenuManager(self.proxy)

    def _createTutorialManager(self):
        return TutorialManager(None, False, {})

    def _createPopoverManager(self):
        return PopoverManager(EVENT_BUS_SCOPE.BATTLE)

    def _createTweenManager(self):
        return TweenManager()

    def _setup(self):
        self.component.wg_inputKeyMode = 1
        self.component.position.z = DEPTH_OF_Battle
        self.movie.backgroundAlpha = 0.0
        self.movie.setFocussed(SCALEFORM_SWF_PATH_V3)
        BigWorld.wg_setRedefineKeysMode(False)

    def _loadWaiting(self):
        pass

    def _getRequiredLibraries(self):
        return ('windows.swf', 'common_i18n.swf', 'popovers.swf',
                'guiControlsLobbyBattleDynamic.swf',
                'guiControlsLoginBattleDynamic.swf', 'battleMessages.swf')

    def __getCursorFromContainer(self):
        if self._containerMgr is not None:
            return self._containerMgr.getView(ViewTypes.CURSOR)
        else:
            return
class BattleEntry(AppEntry):

    def __init__(self, appNS, ctrlModeFlags):
        super(BattleEntry, self).__init__(R.entries.battle(), appNS, ctrlModeFlags, daapiBridge=DAAPIRootBridge(initCallback='registerBattleTest'))
        self.__input = None
        return

    @uniprof.regionDecorator(label='gui.battle', scope='enter')
    def afterCreate(self):
        super(BattleEntry, self).afterCreate()
        self.__input = BattleGameInputMgr()
        self.__input.start()

    @uniprof.regionDecorator(label='gui.battle', scope='exit')
    def beforeDelete(self):
        if self.__input is not None:
            self.__input.stop()
            self.__input = None
        super(BattleEntry, self).beforeDelete()
        return

    def handleKey(self, isDown, key, mods):
        return self.__input.handleKey(isDown, key, mods) if self.__input is not None else False

    def enterGuiControlMode(self, consumerID, cursorVisible=True, enableAiming=True):
        if self.__input is not None:
            self.__input.enterGuiControlMode(consumerID, cursorVisible=cursorVisible, enableAiming=enableAiming)
        return

    def leaveGuiControlMode(self, consumerID):
        if self.__input is not None:
            self.__input.leaveGuiControlMode(consumerID)
        return

    def hasGuiControlModeConsumers(self, *consumersIDs):
        return self.__input.hasGuiControlModeConsumers(*consumersIDs) if self.__input is not None else False

    def registerGuiKeyHandler(self, handler):
        if self.__input is not None:
            self.__input.registerGuiKeyHandler(handler)
        return

    def unregisterGuiKeyHandler(self, handler):
        if self.__input is not None:
            self.__input.unregisterGuiKeyHandler(handler)
        return

    def _createLoaderManager(self):
        return LoaderManager(weakref.proxy(self))

    def _createContainerManager(self):
        return ContainerManager(self._loaderMgr, DefaultContainer(WindowLayer.HIDDEN_SERVICE_LAYOUT), DefaultContainer(WindowLayer.VIEW), DefaultContainer(WindowLayer.CURSOR), PopUpContainer(WindowLayer.WINDOW), PopUpContainer(WindowLayer.FULLSCREEN_WINDOW), TopWindowContainer(WindowLayer.TOP_WINDOW, weakref.proxy(self)), DefaultContainer(WindowLayer.SERVICE_LAYOUT), PopUpContainer(WindowLayer.OVERLAY))

    def _createToolTipManager(self):
        tooltip = ToolTip(BATTLE_TOOLTIPS_BUILDERS_PATHS, {}, GuiGlobalSpaceID.BATTLE_LOADING)
        tooltip.setEnvironment(self)
        return tooltip

    def _createGlobalVarsManager(self):
        return GlobalVarsManager()

    def _createSoundManager(self):
        return SoundManager()

    def _createCursorManager(self):
        cursor = CursorManager()
        cursor.setEnvironment(self)
        return cursor

    def _createColorSchemeManager(self):
        return BattleColorSchemeManager()

    def _createVoiceChatManager(self):
        return BattleVoiceChatManager(weakref.proxy(self))

    def _createUtilsManager(self):
        return UtilsManager()

    def _createContextMenuManager(self):
        return ContextMenuManager(self.proxy)

    def _createTutorialManager(self):
        return ScaleformTutorialManager()

    def _createUILoggerManager(self):
        return UILoggerManager()

    def _createImageManager(self):
        return ImageManager()

    def _createPopoverManager(self):
        return PopoverManager(EVENT_BUS_SCOPE.BATTLE)

    def _createTweenManager(self):
        return TweenManager()

    def _createGraphicsOptimizationManager(self):
        return GraphicsOptimizationManager(config=BATTLE_OPTIMIZATION_CONFIG)

    def _setup(self):
        self.component.wg_inputKeyMode = InputKeyMode.IGNORE_RESULT
        self.component.position.z = DEPTH_OF_Battle
        self.movie.backgroundAlpha = 0.0
        self.movie.setFocused(SCALEFORM_SWF_PATH_V3)
        BigWorld.wg_setRedefineKeysMode(False)

    def _loadWaiting(self):
        pass

    def _getRequiredLibraries(self):
        pass

    def __getCursorFromContainer(self):
        return self._containerMgr.getView(WindowLayer.CURSOR) if self._containerMgr is not None else None
Example #3
0
class BattleEntry(SFApplication):

    def __init__(self, appNS):
        super(BattleEntry, self).__init__('battle.swf', appNS, DAAPIRootBridge(initCallback='registerBattleTest'))
        self.__markers2D = None
        self.__crosshairPanel = None
        self.__input = None
        return

    @property
    def cursorMgr(self):
        return self.__getCursorFromContainer()

    @property
    def markersManager(self):
        return self.__markers2D

    @property
    def crosshairPanel(self):
        return self.__crosshairPanel

    def afterCreate(self):
        super(BattleEntry, self).afterCreate()
        self.__markers2D = MarkersManager(self.proxy)
        self.__markers2D.active(True)
        self.__crosshairPanel = CrosshairPanel()
        self.__crosshairPanel.active(True)
        self.__input = BattleGameInputMgr()
        self.__input.start()

    def beforeDelete(self):
        if self.__markers2D is not None:
            self.__markers2D.close()
            self.__markers2D = None
        if self.__crosshairPanel is not None:
            self.__crosshairPanel.close()
            self.__crosshairPanel = None
        if self.__input is not None:
            self.__input.stop()
            self.__input = None
        super(BattleEntry, self).beforeDelete()
        return

    def handleKey(self, isDown, key, mods):
        if self.__input is not None:
            return self.__input.handleKey(isDown, key, mods)
        else:
            return False
            return

    def enterGuiControlMode(self, consumerID, cursorVisible = True, enableAiming = True):
        if self.__input is not None:
            self.__input.enterGuiControlMode(consumerID, cursorVisible=cursorVisible, enableAiming=enableAiming)
        return

    def leaveGuiControlMode(self, consumerID):
        if self.__input is not None:
            self.__input.leaveGuiControlMode(consumerID)
        return

    def hasGuiControlModeConsumers(self, *consumersIDs):
        if self.__input is not None:
            return self.__input.hasGuiControlModeConsumers(*consumersIDs)
        else:
            return False
            return

    def registerGuiKeyHandler(self, handler):
        if self.__input is not None:
            self.__input.registerGuiKeyHandler(handler)
        return

    def unregisterGuiKeyHandler(self, handler):
        if self.__input is not None:
            self.__input.unregisterGuiKeyHandler(handler)
        return

    def _createLoaderManager(self):
        return LoaderManager(weakref.proxy(self))

    def _createContainerManager(self):
        return ContainerManager(self._loaderMgr, DefaultContainer(ViewTypes.DEFAULT), DefaultContainer(ViewTypes.CURSOR), PopUpContainer(ViewTypes.WINDOW), TopWindowContainer(ViewTypes.TOP_WINDOW, weakref.proxy(self)))

    def _createToolTipManager(self):
        return ToolTip(GUI_GLOBAL_SPACE_ID.BATTLE_LOADING)

    def _createGlobalVarsManager(self):
        return GlobalVarsManager()

    def _createSoundManager(self):
        return SoundManager()

    def _createColorSchemeManager(self):
        return BattleColorSchemeManager()

    def _createVoiceChatManager(self):
        return BattleVoiceChatManager(weakref.proxy(self))

    def _createUtilsManager(self):
        return UtilsManager()

    def _createContextMenuManager(self):
        return ContextMenuManager(self.proxy)

    def _createTutorialManager(self):
        return TutorialManager(None, False, {})

    def _setup(self):
        self.component.wg_inputKeyMode = 1
        self.component.position.z = DEPTH_OF_Battle
        self.movie.backgroundAlpha = 0.0
        self.movie.setFocussed(SCALEFORM_SWF_PATH_V3)
        BigWorld.wg_setRedefineKeysMode(False)

    def _loadWaiting(self):
        pass

    def _getRequiredLibraries(self):
        return ('windows.swf', 'common_i18n.swf', 'guiControlsLobbyBattleDynamic.swf', 'guiControlsLoginBattleDynamic.swf', 'battleMessages.swf')

    def __getCursorFromContainer(self):
        if self._containerMgr is not None:
            return self._containerMgr.getView(ViewTypes.CURSOR)
        else:
            return