Example #1
0
def launch(spaceName):
    global g_enablePostProcessing
    global g_offlineModeEnabled
    print 'Entering offline space', spaceName
    BigWorld.clearAllSpaces()
    BigWorld.worldDrawEnabled(False)
    _displayGUI(spaceName)
    spaceID = BigWorld.createSpace()
    BigWorld.addSpaceGeometryMapping(spaceID, None, spaceName)
    _loadCameraTransforms()
    camera = BigWorld.FreeCamera()
    camera.spaceID = spaceID
    BigWorld.camera(camera)
    _setCameraTransform(g_curCameraTransform)
    BigWorld.camera().fixed = True
    BigWorld.projection().fov = math.radians(75.0)
    BigWorld.setWatcher('Client Settings/Strafe Rate', 175.0)
    BigWorld.setWatcher('Client Settings/Camera Mass', 5.0)
    BigWorld.setCursor(GUI.mcursor())
    GUI.mcursor().visible = True
    GUI.mcursor().clipped = False
    g_offlineModeEnabled = True
    BigWorld.callback(1.0, _offlineLoadCheck)
    g_postProcessing.init()
    _enablePostProcessing(g_enablePostProcessing, 'arcade')
    return
Example #2
0
def launch(spaceName):
    global g_offlineModeEnabled
    global g_spaceID
    global g_videoCamera
    print 'Entering offline space', spaceName
    BigWorld.clearAllSpaces()
    BigWorld.worldDrawEnabled(False)
    _displayGUI(spaceName)
    g_spaceID = BigWorld.createSpace()
    BigWorld.addSpaceGeometryMapping(g_spaceID, None, spaceName)
    BigWorld.setCursor(GUI.mcursor())
    GUI.mcursor().visible = False
    GUI.mcursor().clipped = True
    g_offlineModeEnabled = True
    BigWorld.callback(1.0, _offlineLoadCheck)
    rootSection = ResMgr.openSection(AvatarInputHandler._INPUT_HANDLER_CFG)
    videoSection = rootSection['videoMode']
    videoCameraSection = videoSection['camera']
    g_videoCamera = VideoCamera(videoCameraSection)
    g_videoCamera.enable(camMatrix=mathUtils.createTranslationMatrix((0.0, 0.0, 0.0)))
    BigWorld.camera().spaceID = g_spaceID
    import game
    game.handleKeyEvent = handleKeyEvent
    game.handleMouseEvent = handleMouseEvent
    BigWorld.player = lambda : g_fakeAvatar
    return
Example #3
0
    def create(self, mapName):
        global _V_START_POS
        global _V_START_ANGLES
        try:
            LOG_DEBUG('OfflineMapCreator.Create( %s )' % mapName)
            g_appLoader.showBattle()
            cfgType = 'basic'
            self.__loadCfg(cfgType, mapName)
            BigWorld.worldDrawEnabled(False)
            BigWorld.setWatcher('Visibility/GUI', False)
            self.__spaceId = BigWorld.createSpace()
            self.__isActive = True
            self.__arenaTypeID = self._arenaTypeIDByArenaName.get(mapName)
            self.__accountID = BigWorld.createEntity('Account', self.__spaceId, 0, _V_START_POS, (_V_START_ANGLES[2], _V_START_ANGLES[1], _V_START_ANGLES[0]), dict())
            self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, 'spaces/' + mapName)
            self.__vEntityId = BigWorld.createEntity('Avatar', self.__spaceId, 0, _V_START_POS, (_V_START_ANGLES[2], _V_START_ANGLES[1], _V_START_ANGLES[0]), dict())
            BigWorld.player(BigWorld.entities[self.__vEntityId])
            self.__setupCamera()
            BigWorld.worldDrawEnabled(True)
        except:
            LOG_DEBUG('OfflineMapCreator.Create( %s ): FAILED with: ' % mapName)
            LOG_CURRENT_EXCEPTION()
            self.cancel()

        return
    def create(self, mapName):
        global _V_START_POS
        global _V_START_ANGLES
        try:
            LOG_DEBUG('OfflineMapCreator.Create( %s )' % mapName)
            g_appLoader.showBattle()
            cfgType = 'basic'
            self.__loadCfg(cfgType, mapName)
            BigWorld.worldDrawEnabled(False)
            BigWorld.setWatcher('Visibility/GUI', False)
            self.__spaceId = BigWorld.createSpace()
            self.__isActive = True
            self.__arenaTypeID = self._arenaTypeIDByArenaName.get(mapName)
            self.__accountID = BigWorld.createEntity('Account', self.__spaceId, 0, _V_START_POS, (_V_START_ANGLES[2], _V_START_ANGLES[1], _V_START_ANGLES[0]), dict())
            self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, 'spaces/' + mapName)
            self.__vEntityId = BigWorld.createEntity('Avatar', self.__spaceId, 0, _V_START_POS, (_V_START_ANGLES[2], _V_START_ANGLES[1], _V_START_ANGLES[0]), dict())
            BigWorld.player(BigWorld.entities[self.__vEntityId])
            self.__setupCamera()
            BigWorld.worldDrawEnabled(True)
        except:
            LOG_DEBUG('OfflineMapCreator.Create( %s ): FAILED with: ' % mapName)
            LOG_CURRENT_EXCEPTION()
            self.cancel()

        return
Example #5
0
def launch(spaceName):
    global g_enablePostProcessing
    global g_offlineModeEnabled
    print 'Entering offline space', spaceName
    BigWorld.clearAllSpaces()
    BigWorld.worldDrawEnabled(False)
    _displayGUI(spaceName)
    spaceID = BigWorld.createSpace()
    BigWorld.addSpaceGeometryMapping(spaceID, None, spaceName)
    _loadCameraTransforms()
    camera = BigWorld.FreeCamera()
    camera.spaceID = spaceID
    BigWorld.camera(camera)
    _setCameraTransform(g_curCameraTransform)
    BigWorld.camera().fixed = True
    BigWorld.projection().fov = math.radians(75.0)
    BigWorld.setWatcher('Client Settings/Strafe Rate', 175.0)
    BigWorld.setWatcher('Client Settings/Camera Mass', 5.0)
    BigWorld.setCursor(GUI.mcursor())
    GUI.mcursor().visible = True
    GUI.mcursor().clipped = False
    g_offlineModeEnabled = True
    BigWorld.callback(1.0, _offlineLoadCheck)
    g_postProcessing.init()
    _enablePostProcessing(g_enablePostProcessing, 'arcade')
    return
def BigWorld_connect(baseFunc, server, loginParams, progressFn):
	if server == OFFLINE_SERVER_ADDRES:
		LOG_DEBUG('BigWorld.connect')
		progressFn(1, LOGIN_STATUS.LOGGED_ON, '{}')
		BigWorld.createEntity('Account', BigWorld.createSpace(), 0, (0, 0, 0), (0, 0, 0), {})
	else:
		baseFunc(server, loginParams, progressFn)
Example #7
0
def launch(spaceName):
    global g_offlineModeEnabled
    global g_spaceID
    global g_videoCamera
    print 'Entering offline space', spaceName
    BigWorld.clearAllSpaces()
    BigWorld.worldDrawEnabled(False)
    _displayGUI(spaceName)
    g_spaceID = BigWorld.createSpace()
    BigWorld.addSpaceGeometryMapping(g_spaceID, None, spaceName)
    BigWorld.setCursor(GUI.mcursor())
    GUI.mcursor().visible = False
    GUI.mcursor().clipped = True
    g_offlineModeEnabled = True
    BigWorld.callback(1.0, _offlineLoadCheck)
    rootSection = ResMgr.openSection(AvatarInputHandler._INPUT_HANDLER_CFG)
    videoSection = rootSection['videoMode']
    videoCameraSection = videoSection['camera']
    g_videoCamera = VideoCamera(videoCameraSection)
    g_videoCamera.enable(camMatrix=mathUtils.createTranslationMatrix((0.0, 0.0,
                                                                      0.0)))
    BigWorld.camera().spaceID = g_spaceID
    import game
    game.handleKeyEvent = handleKeyEvent
    game.handleMouseEvent = handleMouseEvent
    BigWorld.player = lambda: g_fakeAvatar
Example #8
0
    def create(self, mapName):
        global _V_START_POS
        global _V_START_ANGLES
        try:
            LOG_DEBUG('OfflineMapCreator.Create( %s )' % mapName)
            g_appLoader.showBattlePage()
            cfgType = 'basic'
            self.__loadCfg(cfgType, mapName)
            BigWorld.worldDrawEnabled(False)
            BigWorld.setWatcher('Visibility/GUI', False)
            self.__spaceId = BigWorld.createSpace()
            self.__isActive = True
            self.__arenaTypeID = self.__getArenaTypeId(mapName)
            self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, 'spaces/' + mapName)
            self.__vEntityId = BigWorld.createEntity('Avatar', self.__spaceId, 0, _V_START_POS, (_V_START_ANGLES[2], _V_START_ANGLES[1], _V_START_ANGLES[0]), {})
            avatar = BigWorld.entities[self.__vEntityId]
            avatar.arenaUniqueID = 0
            avatar.arenaTypeID = self.__arenaTypeID
            avatar.arenaBonusType = constants.ARENA_BONUS_TYPE.UNKNOWN
            avatar.arenaGuiType = constants.ARENA_GUI_TYPE.UNKNOWN
            avatar.arenaExtraData = {}
            avatar.weatherPresetID = 0
            BigWorld.player(avatar)
            self.__setupCamera()
            BigWorld.worldDrawEnabled(True)
        except:
            LOG_DEBUG('OfflineMapCreator.Create( %s ): FAILED with: ' % mapName)
            LOG_CURRENT_EXCEPTION()
            self.cancel()

        return
def launch(spaceName):
    global g_offlineModeEnabled
    print 'Entering offline space', spaceName
    BigWorld.clearAllSpaces()
    BigWorld.worldDrawEnabled(False)
    _displayGUI(spaceName)
    spaceID = BigWorld.createSpace()
    visibilityMask = game_mode_emulator.gameModeVisibilityMask()
    BigWorld.addSpaceGeometryMapping(spaceID, None, spaceName, visibilityMask)
    _loadCameraTransforms()
    camera = BigWorld.FreeCamera()
    camera.spaceID = spaceID
    BigWorld.camera(camera)
    _setCameraTransform(g_curCameraTransform)
    BigWorld.camera().fixed = True
    BigWorld.projection().fov = math.radians(75.0)
    BigWorld.setWatcher('Client Settings/Strafe Rate', 175.0)
    BigWorld.setWatcher('Client Settings/Camera Mass', 5.0)
    BigWorld.setCursor(GUI.mcursor())
    GUI.mcursor().visible = True
    GUI.mcursor().clipped = False
    g_offlineModeEnabled = True
    BigWorld.callback(1.0, _offlineLoadCheck)
    createFakeAvatar()
    return
Example #10
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
    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 #12
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 observerStart(self, connectionManager=None, lobbyContext=None):
        LOG_DEBUG('Observer Start')
        self.isStarted = True
        # constants.IS_DEVELOPMENT = True

        self.lobbyContext.setServerSettings(
            {'roamingSettings': [0, 0, [], []]})

        BigWorld.clearEntitiesAndSpaces()
        self.connectionManager.onConnected()

        LOG_DEBUG('createEntity')
        BigWorld.worldDrawEnabled(False)
        LOG_DEBUG(
            BigWorld.createEntity('Avatar', BigWorld.createSpace(), 0,
                                  (0, 0, 0), (0, 0, 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, hangarConfig, onSpaceLoadedCallback = None, overrideSpace = None):
        import db.DBLogic
        LOG_TRACE('ClientHangarSpace:: create', hangarConfig, onSpaceLoadedCallback, overrideSpace)
        self.__vsePlansStarted = False
        self.__needCameraReset = True
        self.__spaceId = BigWorld.createSpace()
        self.__hangarCamera.createCamera(self.__spaceId)
        self.__hangarConfig = hangarConfig
        self.__selectHangarType(self.__settings.airplane.visualSettings.hangarConfig if self.__settings else ClientHangarSpace.AMPTY_HANGAR_SIZE)
        self.__spaceName = self.__hangarCfg.space_name
        if overrideSpace:
            self.__spaceName = overrideSpace
        hSettings = db.DBLogic.g_instance.userHangarSpaces.get(self.__spaceName, None)
        if hSettings:
            self.__spaceName = hSettings.get('overrideSpaceID', overrideSpace)
        self.__spaceName = self.__spaceName[self.__spaceName.rfind('/') + 1:]
        self.__scriptsObj = getHangarScriptsByName(self.__spaceName)
        import BWPersonality
        if not BWPersonality.g_settings.hangarSpaceSettings['spaceID']:
            BWPersonality.g_settings.hangarSpaceSettings['spaceID'] = self.__spaceName
        self.__onLoadedCallback = onSpaceLoadedCallback
        try:
            self.__spaceMappingId = BigWorld.addSpaceGeometryMapping(self.__spaceId, None, 'db/spaces/{0}.settings'.format(self.__spaceName))
        except:
            LOG_CURRENT_EXCEPTION()

        self.__waitCallback = BigWorld.callback(0.1, self.__waitLoadingSpace)
        if self.__hangarCfg.static_rotor:
            self.__initialAngleL = 0
            self.__initialAngleR = 0
        else:
            seed()
            self.__initialAngleL = randrange(0, 360) / 180.0 * math.pi
            self.__initialAngleR = randrange(0, 360) / 180.0 * math.pi
        isPremium = hangarConfig != 'basic'
        LOG_DEBUG_DEV('play music', overrideSpace if overrideSpace else self.__hangarCfg.space_name)
        GameSound().music.playHangar(isPremium, overrideSpace if overrideSpace else self.__hangarCfg.space_name)
        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