def __destroy(self):
     LOG_DEBUG('Hangar successfully destroyed.')
     MusicControllerWWISE.unloadCustomSounds()
     if self.__cameraManager:
         self.__cameraManager.destroy()
         self.__cameraManager = None
     self.__loadingStatus = 0.0
     self.__onLoadedCallback = None
     if self.__waitCallback is not None:
         BigWorld.cancelCallback(self.__waitCallback)
         self.__waitCallback = None
     BigWorld.SetDrawInflux(False)
     MapActivities.g_mapActivities.stop()
     if self.__spaceId is not None and BigWorld.isClientSpace(
             self.__spaceId):
         if self.__spaceMappingId is not None:
             BigWorld.delSpaceGeometryMapping(self.__spaceId,
                                              self.__spaceMappingId)
         BigWorld.clearSpace(self.__spaceId)
         BigWorld.releaseSpace(self.__spaceId)
     self.__spaceMappingId = None
     self.__spaceId = None
     self.__vEntityId = None
     BigWorld.wg_disableSpecialFPSMode()
     return
Example #2
0
    def destroy(self):
        try:
            LOG_DEBUG('OfflineMapCreator.destroy()')
            self.__isActive = False
            BigWorld.worldDrawEnabled(False)
            BigWorld.setWatcher('Visibility/GUI', True)
            self.__spaceMappingId = 0
            BigWorld.cameraSpaceID(0)
            BigWorld.camera(None)
            self.__cam = None
            BigWorld.clearEntitiesAndSpaces()
            MapActivities.g_mapActivities.stop()
            if self.__spaceId and BigWorld.isClientSpace(self.__spaceId):
                if self.__spaceMappingId:
                    BigWorld.delSpaceGeometryMapping(self.__spaceId,
                                                     self.__spaceMappingId)
                BigWorld.clearSpace(self.__spaceId)
                BigWorld.releaseSpace(self.__spaceId)
            self.__spaceId = 0
            self.__spaceMappingId = 0
            self.__arenaTypeID = 0
            self.__vEntityId = 0
            BigWorld.worldDrawEnabled(True)
        except:
            LOG_DEBUG('OfflineMapCreator.destroy(): FAILED with: ')
            LOG_CURRENT_EXCEPTION()
            self.cancel()

        return
 def __destroy(self):
     self.__vsePlansStarted = False
     BigWorld.stopArenaScripts()
     if self.__hangarVehicleScenarioController:
         self.__hangarVehicleScenarioController.destroy()
         self.__hangarVehicleScenarioController = None
     self.__hangarCamera.destroy()
     self.__loadingStatus = 0.0
     if self.__modelManipulator:
         self.__modelManipulator.destroy()
         self.__modelManipulator = None
     self.__onLoadedCallback = None
     if self.__isKeyEventSubsribed:
         GlobalEvents.onKeyEvent -= self.handleKeyEvent
         self.__isKeyEventSubsribed = False
     if BigWorld.clentSpaceExists(self.__spaceId):
         if self.__spaceId is not None and self.__spaceMappingId is not None:
             BigWorld.delSpaceGeometryMapping(self.__spaceId, self.__spaceMappingId)
         if self.__spaceId is not None:
             BigWorld.clearSpace(self.__spaceId)
             BigWorld.releaseSpace(self.__spaceId)
     self.__spaceMappingId = None
     self.__spaceId = None
     GameSound().stopHangar()
     self.__scriptsObj.onHangarUnloaded()
     getHangarScriptsByName('planeBirthday').onHangarUnloaded()
     BigWorld.resetGraphicsDevice()
     LOG_DEBUG('Hangar successfully destroyed.')
     return
 def __destroy(self):
     LOG_DEBUG('Hangar successfully destroyed.')
     MusicController.g_musicController.unloadCustomSounds()
     if self.__cam == BigWorld.camera():
         self.__cam.spaceID = 0
         BigWorld.camera(None)
         BigWorld.worldDrawEnabled(False)
     self.__cam = None
     self.__loadingStatus = 0.0
     if self.__vAppearance is not None:
         self.__vAppearance.destroy()
         self.__vAppearance = None
     self.__onLoadedCallback = None
     self.__boundingRadius = None
     if self.__waitCallback is not None:
         BigWorld.cancelCallback(self.__waitCallback)
         self.__waitCallback = None
     g_keyEventHandlers.remove(self.handleKeyEvent)
     g_mouseEventHandlers.remove(self.handleMouseEventGlobal)
     BigWorld.SetDrawInflux(False)
     MapActivities.g_mapActivities.stop()
     if self.__spaceId is not None and BigWorld.isClientSpace(self.__spaceId):
         if self.__spaceMappingId is not None:
             BigWorld.delSpaceGeometryMapping(self.__spaceId, self.__spaceMappingId)
         BigWorld.clearSpace(self.__spaceId)
         BigWorld.releaseSpace(self.__spaceId)
     self.__spaceMappingId = None
     self.__spaceId = None
     self.__vEntityId = None
     BigWorld.wg_disableSpecialFPSMode()
     g_postProcessing.disable()
     FovExtended.instance().resetFov()
     return
 def __destroy(self):
     LOG_DEBUG('Hangar successfully destroyed.')
     if self.__cam == BigWorld.camera():
         self.__cam.spaceID = 0
         BigWorld.camera(None)
         BigWorld.worldDrawEnabled(False)
     self.__cam = None
     self.__loadingStatus = 0.0
     if self.__vAppearance is not None:
         self.__vAppearance.destroy()
         self.__vAppearance = None
     self.__onLoadedCallback = None
     self.__boundingRadius = None
     g_keyEventHandlers.remove(self.handleKeyEvent)
     g_mouseEventHandlers.remove(self.handleMouseEventGlobal)
     entity = None if self.__vEntityId is None else BigWorld.entity(self.__vEntityId)
     BigWorld.SetDrawInflux(False)
     MapActivities.g_mapActivities.stop()
     if self.__spaceId is not None and BigWorld.isClientSpace(self.__spaceId):
         if self.__spaceMappingId is not None:
             BigWorld.delSpaceGeometryMapping(self.__spaceId, self.__spaceMappingId)
         BigWorld.clearSpace(self.__spaceId)
         BigWorld.releaseSpace(self.__spaceId)
     self.__spaceMappingId = None
     self.__spaceId = None
     if entity is None or not entity.inWorld:
         return
     BigWorld.destroyEntity(self.__vEntityId)
     self.__vEntityId = None
     BigWorld.wg_disableSpecialFPSMode()
     g_postProcessing.disable()
 def __destroy(self):
     LOG_DEBUG('Hangar successfully destroyed.')
     if self.__cam == BigWorld.camera():
         self.__cam.spaceID = 0
         BigWorld.camera(None)
         BigWorld.worldDrawEnabled(False)
     self.__cam = None
     self.__loadingStatus = 0.0
     if self.__vAppearance is not None:
         self.__vAppearance.destroy()
         self.__vAppearance = None
     self.__onLoadedCallback = None
     self.__boundingRadius = None
     entity = None if self.__vEntityId is None else BigWorld.entity(self.__vEntityId)
     BigWorld.SetDrawInflux(False)
     MapActivities.g_mapActivities.stop()
     if self.__spaceId is not None and BigWorld.isClientSpace(self.__spaceId):
         if self.__spaceMappingId is not None:
             BigWorld.delSpaceGeometryMapping(self.__spaceId, self.__spaceMappingId)
         BigWorld.clearSpace(self.__spaceId)
         BigWorld.releaseSpace(self.__spaceId)
     self.__spaceMappingId = None
     self.__spaceId = None
     if entity is None or not entity.inWorld:
         return
     else:
         BigWorld.destroyEntity(self.__vEntityId)
         self.__vEntityId = None
         BigWorld.wg_disableSpecialFPSMode()
         if hasattr(BigWorld.player(), 'inputHandler') and self.__savedInputHandler is not None:
             BigWorld.player().inputHandler = self.__savedInputHandler
             g_hangarInputHandler.hangarSpace = None
             self.__savedInputHandler = None
         return
 def __destroy(self):
     LOG_DEBUG('Hangar successfully destroyed.')
     MusicControllerWWISE.unloadCustomSounds()
     if self.__cam == BigWorld.camera():
         self.__cam.spaceID = 0
         BigWorld.camera(None)
         BigWorld.worldDrawEnabled(False)
     self.__cam = None
     self.__loadingStatus = 0.0
     if self.__vAppearance is not None:
         self.__vAppearance.destroy()
         self.__vAppearance = None
     self.__onLoadedCallback = None
     self.__boundingRadius = None
     if self.__waitCallback is not None:
         BigWorld.cancelCallback(self.__waitCallback)
         self.__waitCallback = None
     g_keyEventHandlers.remove(self.handleKeyEvent)
     g_mouseEventHandlers.remove(self.handleMouseEventGlobal)
     BigWorld.SetDrawInflux(False)
     MapActivities.g_mapActivities.stop()
     if self.__spaceId is not None and BigWorld.isClientSpace(
             self.__spaceId):
         if self.__spaceMappingId is not None:
             BigWorld.delSpaceGeometryMapping(self.__spaceId,
                                              self.__spaceMappingId)
         BigWorld.clearSpace(self.__spaceId)
         BigWorld.releaseSpace(self.__spaceId)
     self.__spaceMappingId = None
     self.__spaceId = None
     self.__vEntityId = None
     BigWorld.wg_disableSpecialFPSMode()
     g_postProcessing.disable()
     FovExtended.instance().resetFov()
     return
    def create(self, isPremium, onSpaceLoadedCallback = None):
        global _EVENT_HANGAR_PATHS
        global _CFG
        BigWorld.worldDrawEnabled(False)
        BigWorld.wg_setSpecialFPSMode()
        self.__onLoadedCallback = onSpaceLoadedCallback
        self.__spaceId = BigWorld.createSpace()
        type = self.getSpaceType(isPremium)
        _CFG = copy.copy(_DEFAULT_CFG[type])
        spacePath = _DEFAULT_CFG[type]['path']
        LOG_DEBUG('load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format(type, spacePath))
        if game_control.g_instance.igr.getRoomType() == constants.IGR_TYPE.PREMIUM:
            if _CFG.get(self.__igrHangarPathKey) is not None:
                spacePath = _CFG[self.__igrHangarPathKey]
        if _EVENT_HANGAR_PATHS.has_key(isPremium):
            spacePath = _EVENT_HANGAR_PATHS[isPremium]
        safeSpacePath = _DEFAULT_CFG[type]['path']
        if ResMgr.openSection(spacePath) is None:
            LOG_ERROR('Failed to load hangar from path: %s; default hangar will be loaded instead' % spacePath)
            spacePath = safeSpacePath
        try:
            self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath)
        except:
            try:
                LOG_CURRENT_EXCEPTION()
                spacePath = safeSpacePath
                self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath)
            except:
                BigWorld.releaseSpace(self.__spaceId)
                self.__spaceMappingId = None
                self.__spaceId = None
                LOG_CURRENT_EXCEPTION()
                return

        spacePathLC = spacePath.lower()
        if _HANGAR_CFGS.has_key(spacePathLC):
            self.__loadConfig(_CFG, _HANGAR_CFGS[spacePathLC], _CFG)
        self.__vEntityId = BigWorld.createEntity('HangarVehicle', self.__spaceId, 0, _CFG['v_start_pos'], (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1], _CFG['v_start_angles'][0]), dict())
        self.__vAppearance = _VehicleAppearance(self.__spaceId, self.__vEntityId, self)
        self.__yawCameraFilter = HangarCameraYawFilter(math.radians(_CFG['cam_yaw_constr'][0]), math.radians(_CFG['cam_yaw_constr'][1]), _CFG['cam_sens'])
        self.__setupCamera()
        distConstrs = _CFG['cam_dist_constr']
        previewConstr = _CFG.get('preview_cam_dist_constr', distConstrs)
        if distConstrs is not None:
            if previewConstr is not None:
                self.__camDistConstr = (distConstrs, previewConstr)
            else:
                self.__camDistConstr = (distConstrs, distConstrs)
        else:
            self.__camDistConstr = ((0.0, 0.0), (0.0, 0.0))
        self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace)
        self.__destroyFunc = None
        MapActivities.g_mapActivities.generateOfflineActivities(spacePath)
        g_keyEventHandlers.add(self.handleKeyEvent)
        g_mouseEventHandlers.add(self.handleMouseEventGlobal)
        g_postProcessing.enable('hangar')
        BigWorld.pauseDRRAutoscaling(True)
        return
Example #9
0
    def create(self, isPremium, onSpaceLoadedCallback=None):
        global _CFG
        BigWorld.worldDrawEnabled(False)
        BigWorld.wg_setSpecialFPSMode()
        self.__onLoadedCallback = onSpaceLoadedCallback
        self.__spaceId = BigWorld.createSpace()
        isIGR = self.igrCtrl.getRoomType() == constants.IGR_TYPE.PREMIUM
        spacePath = _getHangarPath(isPremium, isIGR)
        spaceType = _getHangarType(isPremium)
        spaceVisibilityMask = _getHangarVisibilityMask(isPremium)
        LOG_DEBUG(
            'load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format(
                spaceType, spacePath))
        safeSpacePath = _getDefaultHangarPath(False)
        if ResMgr.openSection(spacePath) is None:
            LOG_ERROR(
                'Failed to load hangar from path: %s; default hangar will be loaded instead'
                % spacePath)
            spacePath = safeSpacePath
        try:
            self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(
                self.__spaceId, None, spacePath, spaceVisibilityMask)
            BigWorld.enableLowFrequencyAnimation(self.__spaceId, True)
        except Exception:
            try:
                LOG_CURRENT_EXCEPTION()
                spacePath = safeSpacePath
                self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(
                    self.__spaceId, None, spacePath, spaceVisibilityMask)
                BigWorld.enableLowFrequencyAnimation(self.__spaceId, True)
            except Exception:
                BigWorld.releaseSpace(self.__spaceId)
                self.__spaceMappingId = None
                self.__spaceId = None
                LOG_CURRENT_EXCEPTION()
                return

        self.__spacePath = spacePath
        self.__spaceVisibilityMask = spaceVisibilityMask
        spaceKey = _getHangarKey(spacePath)
        _CFG = copy.deepcopy(_HANGAR_CFGS[spaceKey])
        self.turretAndGunAngles.init()
        self.__vEntityId = BigWorld.createEntity(
            'HangarVehicle', self.__spaceId, 0, _CFG['v_start_pos'],
            (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1],
             _CFG['v_start_angles'][0]), dict())
        self.__cameraManager = HangarCameraManager(self.__spaceId)
        self.__cameraManager.init()
        self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace)
        BigWorld.wg_enableGUIBackground(True, False)
        BigWorld.wg_setGUIBackground(_LOGIN_BLACK_BG_IMG)
        self.mapActivities.generateOfflineActivities(spacePath)
        BigWorld.pauseDRRAutoscaling(True)
        vsePlans = _CFG.get('vse_plans', None)
        if vsePlans is not None:
            self._vsePlans.load(vsePlans)
            self._vsePlans.start()
        return
Example #10
0
    def create(self, isPremium, onSpaceLoadedCallback=None):
        global _EVENT_HANGAR_PATHS
        global _CFG
        global g_hangarInputHandler
        BigWorld.worldDrawEnabled(False)
        BigWorld.wg_setSpecialFPSMode()
        self.__onLoadedCallback = onSpaceLoadedCallback
        self.__spaceId = BigWorld.createSpace()
        type = self.getSpaceType(isPremium)
        _CFG = copy.copy(_DEFAULT_CFG[type])
        spacePath = _DEFAULT_CFG[type]['path']
        LOG_DEBUG(
            'load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format(
                type, spacePath))
        if _EVENT_HANGAR_PATHS.has_key(isPremium):
            spacePath = _EVENT_HANGAR_PATHS[isPremium]
        safeSpacePath = _DEFAULT_CFG[type]['path']
        if ResMgr.openSection(spacePath) is None:
            LOG_ERROR(
                'Failed to load hangar from path: %s; default hangar will be loaded instead'
                % spacePath)
            spacePath = safeSpacePath
        try:
            self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(
                self.__spaceId, None, spacePath)
        except:
            try:
                LOG_CURRENT_EXCEPTION()
                spacePath = safeSpacePath
                self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(
                    self.__spaceId, None, spacePath)
            except:
                BigWorld.releaseSpace(self.__spaceId)
                self.__spaceMappingId = None
                self.__spaceId = None
                LOG_CURRENT_EXCEPTION()
                return

        spacePathLC = spacePath.lower()
        if _HANGAR_CFGS.has_key(spacePathLC):
            self.__loadConfig(_CFG, _HANGAR_CFGS[spacePathLC], _CFG)
        self.__vEntityId = BigWorld.createEntity(
            'OfflineEntity', self.__spaceId, 0, _CFG['v_start_pos'],
            (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1],
             _CFG['v_start_angles'][0]), dict())
        self.__vAppearance = _VehicleAppearance(self.__spaceId,
                                                self.__vEntityId)
        self.__setupCamera()
        self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace)
        MapActivities.g_mapActivities.generateHangarActivities(spacePath)
        inputHandler = getattr(BigWorld.player(), 'inputHandler', None)
        if inputHandler is not None:
            self.__savedInputHandler = inputHandler
            g_hangarInputHandler.hangarSpace = weakref.proxy(self)
            BigWorld.player().inputHandler = g_hangarInputHandler
        return
    def create(self, isPremium, onSpaceLoadedCallback=None):
        global _CFG
        BigWorld.worldDrawEnabled(False)
        BigWorld.wg_setSpecialFPSMode()
        self.__onLoadedCallback = onSpaceLoadedCallback
        self.__spaceId = BigWorld.createSpace()
        isIGR = self.igrCtrl.getRoomType() == constants.IGR_TYPE.PREMIUM
        spacePath = _getHangarPath(isPremium, isIGR)
        spaceType = _getHangarType(isPremium)
        LOG_DEBUG(
            'load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format(
                spaceType, spacePath))
        safeSpacePath = _getDefaultHangarPath(False)
        if ResMgr.openSection(spacePath) is None:
            LOG_ERROR(
                'Failed to load hangar from path: %s; default hangar will be loaded instead'
                % spacePath)
            spacePath = safeSpacePath
        try:
            self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(
                self.__spaceId, None, spacePath)
        except Exception:
            try:
                LOG_CURRENT_EXCEPTION()
                spacePath = safeSpacePath
                self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(
                    self.__spaceId, None, spacePath)
            except Exception:
                BigWorld.releaseSpace(self.__spaceId)
                self.__spaceMappingId = None
                self.__spaceId = None
                LOG_CURRENT_EXCEPTION()
                return

        spaceKey = _getHangarKey(spacePath)
        _CFG = copy.deepcopy(_HANGAR_CFGS[spaceKey])
        self.__vEntityId = BigWorld.createEntity(
            'HangarVehicle', self.__spaceId, 0, _CFG['v_start_pos'],
            (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1],
             _CFG['v_start_angles'][0]), dict())
        self.__cameraManager = HangarCameraManager(self.__spaceId)
        self.__cameraManager.init()
        self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace)
        self.__gfxOptimizerMgr = GraphicsOptimizationManager()
        size = BigWorld.screenSize()
        self.__optimizerID = self.__gfxOptimizerMgr.registerOptimizationArea(
            0, 0, size[0], size[1])
        MapActivities.g_mapActivities.generateOfflineActivities(spacePath)
        BigWorld.pauseDRRAutoscaling(True)
        return
    def create(self, isPremium, onSpaceLoadedCallback = None):
        global _EVENT_HANGAR_PATHS
        global _CFG
        global g_hangarInputHandler
        BigWorld.worldDrawEnabled(False)
        BigWorld.wg_setSpecialFPSMode()
        self.__onLoadedCallback = onSpaceLoadedCallback
        self.__spaceId = BigWorld.createSpace()
        type = self.getSpaceType(isPremium)
        _CFG = copy.copy(_DEFAULT_CFG[type])
        spacePath = _DEFAULT_CFG[type]['path']
        LOG_DEBUG('load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format(type, spacePath))
        if _EVENT_HANGAR_PATHS.has_key(isPremium):
            spacePath = _EVENT_HANGAR_PATHS[isPremium]
        safeSpacePath = _DEFAULT_CFG[type]['path']
        if ResMgr.openSection(spacePath) is None:
            LOG_ERROR('Failed to load hangar from path: %s; default hangar will be loaded instead' % spacePath)
            spacePath = safeSpacePath
        try:
            self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath)
        except:
            try:
                LOG_CURRENT_EXCEPTION()
                spacePath = safeSpacePath
                self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, spacePath)
            except:
                BigWorld.releaseSpace(self.__spaceId)
                self.__spaceMappingId = None
                self.__spaceId = None
                LOG_CURRENT_EXCEPTION()
                return

        spacePathLC = spacePath.lower()
        if _HANGAR_CFGS.has_key(spacePathLC):
            self.__loadConfig(_CFG, _HANGAR_CFGS[spacePathLC], _CFG)
        self.__vEntityId = BigWorld.createEntity('OfflineEntity', self.__spaceId, 0, _CFG['v_start_pos'], (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1], _CFG['v_start_angles'][0]), dict())
        self.__vAppearance = _VehicleAppearance(self.__spaceId, self.__vEntityId)
        self.__setupCamera()
        self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace)
        MapActivities.g_mapActivities.generateHangarActivities(spacePath)
        inputHandler = getattr(BigWorld.player(), 'inputHandler', None)
        if inputHandler is not None:
            self.__savedInputHandler = inputHandler
            g_hangarInputHandler.hangarSpace = weakref.proxy(self)
            BigWorld.player().inputHandler = g_hangarInputHandler
        return
Example #13
0
 def destroy(self):
     try:
         LOG_DEBUG('OfflineMapCreator.destroy()')
         self.__isActive = False
         BigWorld.worldDrawEnabled(False)
         BigWorld.setWatcher('Visibility/GUI', True)
         self.__spaceMappingId = 0
         BigWorld.cameraSpaceID(0)
         BigWorld.camera(None)
         self.__cam = None
         BigWorld.clearEntitiesAndSpaces()
         BigWorld.releaseSpace(self.__spaceId)
         self.__spaceId = 0
         self.__arenaTypeID = 0
         accountId = 0
         self.__vEntityId = 0
         BigWorld.worldDrawEnabled(True)
     except:
         LOG_DEBUG('OfflineMapCreator.destroy(): FAILED with: ')
         LOG_CURRENT_EXCEPTION()
         self.cancel()
Example #14
0
 def destroy(self):
     try:
         LOG_DEBUG('OfflineMapCreator.destroy()')
         self.__isActive = False
         BigWorld.worldDrawEnabled(False)
         BigWorld.setWatcher('Visibility/GUI', True)
         self.__spaceMappingId = 0
         BigWorld.cameraSpaceID(0)
         BigWorld.camera(None)
         self.__cam = None
         BigWorld.clearEntitiesAndSpaces()
         BigWorld.releaseSpace(self.__spaceId)
         self.__spaceId = 0
         self.__arenaTypeID = 0
         accountId = 0
         self.__vEntityId = 0
         BigWorld.worldDrawEnabled(True)
     except:
         LOG_DEBUG('OfflineMapCreator.destroy(): FAILED with: ')
         LOG_CURRENT_EXCEPTION()
         self.cancel()
Example #15
0
 def __destroy(self):
     LOG_DEBUG('Hangar successfully destroyed.')
     if self.__cam == BigWorld.camera():
         self.__cam.spaceID = 0
         BigWorld.camera(None)
         BigWorld.worldDrawEnabled(False)
     self.__cam = None
     self.__loadingStatus = 0.0
     if self.__vAppearance is not None:
         self.__vAppearance.destroy()
         self.__vAppearance = None
     self.__onLoadedCallback = None
     self.__boundingRadius = None
     entity = None if self.__vEntityId is None else BigWorld.entity(
         self.__vEntityId)
     BigWorld.SetDrawInflux(False)
     MapActivities.g_mapActivities.stop()
     if self.__spaceId is not None and BigWorld.isClientSpace(
             self.__spaceId):
         if self.__spaceMappingId is not None:
             BigWorld.delSpaceGeometryMapping(self.__spaceId,
                                              self.__spaceMappingId)
         BigWorld.clearSpace(self.__spaceId)
         BigWorld.releaseSpace(self.__spaceId)
     self.__spaceMappingId = None
     self.__spaceId = None
     if entity is None or not entity.inWorld:
         return
     else:
         BigWorld.destroyEntity(self.__vEntityId)
         self.__vEntityId = None
         BigWorld.wg_disableSpecialFPSMode()
         if hasattr(
                 BigWorld.player(),
                 'inputHandler') and self.__savedInputHandler is not None:
             BigWorld.player().inputHandler = self.__savedInputHandler
             g_hangarInputHandler.hangarSpace = None
             self.__savedInputHandler = None
         return
    def create(self, isPremium, onSpaceLoadedCallback=None):
        global _EVENT_HANGAR_PATHS
        global _CFG
        BigWorld.worldDrawEnabled(False)
        BigWorld.wg_setSpecialFPSMode()
        self.__onLoadedCallback = onSpaceLoadedCallback
        self.__spaceId = BigWorld.createSpace()
        type = getSpaceType(isPremium)
        _CFG = copy.copy(_DEFAULT_CFG[type])
        spacePath = _DEFAULT_CFG[type]['path']
        LOG_DEBUG(
            'load hangar: hangar type = <{0:>s}>, space = <{1:>s}>'.format(
                type, spacePath))
        visibilityMask = 4294967295L
        if self.igrCtrl.getRoomType() == constants.IGR_TYPE.PREMIUM:
            if _CFG.get(self.__igrHangarPathKey) is not None:
                spacePath = _CFG[self.__igrHangarPathKey]
        if isPremium in _EVENT_HANGAR_PATHS:
            spacePath = _EVENT_HANGAR_PATHS[isPremium]
        if isPremium in _EVENT_HANGAR_VISIBILITY_MASK:
            visibilityMask = _EVENT_HANGAR_VISIBILITY_MASK[isPremium]
        safeSpacePath = _DEFAULT_CFG[type]['path']
        if ResMgr.openSection(spacePath) is None:
            LOG_ERROR(
                'Failed to load hangar from path: %s; default hangar will be loaded instead'
                % spacePath)
            spacePath = safeSpacePath
            visibilityMask = 4294967295L
        BigWorld.wg_setSpaceItemsVisibilityMask(self.__spaceId, visibilityMask)
        try:
            self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(
                self.__spaceId, None, spacePath)
        except:
            try:
                LOG_CURRENT_EXCEPTION()
                spacePath = safeSpacePath
                self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(
                    self.__spaceId, None, spacePath)
            except:
                BigWorld.releaseSpace(self.__spaceId)
                self.__spaceMappingId = None
                self.__spaceId = None
                LOG_CURRENT_EXCEPTION()
                return

        spacePathLC = spacePath.lower()
        if spacePathLC in _HANGAR_CFGS:
            loadConfig(_CFG, _HANGAR_CFGS[spacePathLC], _CFG)
        self.__vEntityId = BigWorld.createEntity(
            'HangarVehicle', self.__spaceId, 0, _CFG['v_start_pos'],
            (_CFG['v_start_angles'][2], _CFG['v_start_angles'][1],
             _CFG['v_start_angles'][0]), dict())
        self.__vAppearance = _VehicleAppearance(self.__spaceId,
                                                self.__vEntityId, self)
        self.__yawCameraFilter = HangarCameraYawFilter(
            math.radians(_CFG['cam_yaw_constr'][0]),
            math.radians(_CFG['cam_yaw_constr'][1]), _CFG['cam_sens'])
        self.__setupCamera()
        distConstrs = _CFG['cam_dist_constr']
        previewConstr = _CFG.get('preview_cam_dist_constr', distConstrs)
        if distConstrs is not None:
            if previewConstr is not None:
                self.__camDistConstr = (distConstrs, previewConstr)
            else:
                self.__camDistConstr = (distConstrs, distConstrs)
        else:
            self.__camDistConstr = ((0.0, 0.0), (0.0, 0.0))
        self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace)
        self.__destroyFunc = None
        MapActivities.g_mapActivities.generateOfflineActivities(spacePath)
        g_keyEventHandlers.add(self.handleKeyEvent)
        g_mouseEventHandlers.add(self.handleMouseEventGlobal)
        g_postProcessing.enable('hangar')
        BigWorld.pauseDRRAutoscaling(True)
        return