Exemplo n.º 1
0
    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
Exemplo n.º 2
0
 def enable(self, **args):
     SoundGroups.g_instance.changePlayMode(2)
     targetPos = args.get('preferredPos', Vector3(0, 0, 0))
     self.__cam.enable(targetPos, args.get('saveDist', True))
     self.__aimingMode = args.get('aimingMode', self.__aimingMode)
     self.setGUIVisible(BigWorld.player().isGuiVisible)
     self.__isEnabled = True
     g_postProcessing.enable('strategic')
     BigWorld.setFloraEnabled(False)
     equipmentID = args.get('equipmentID', None)
     if equipmentID is None:
         self.__activeSelector = _DefaultStrikeSelector(Vector3(0, 0, 0), None)
     else:
         self.activateEquipment(equipmentID)
     return
Exemplo n.º 3
0
 def enable(self, **args):
     SoundGroups.g_instance.changePlayMode(2)
     targetPos = args.get("preferredPos", Vector3(0, 0, 0))
     self.__cam.enable(targetPos, args.get("saveDist", True))
     self.__aimingMode = args.get("aimingMode", self.__aimingMode)
     self.__isEnabled = True
     g_postProcessing.enable("strategic")
     BigWorld.setFloraEnabled(False)
     equipmentID = args.get("equipmentID", None)
     if equipmentID is None:
         self.__activeSelector = _DefaultStrikeSelector(Vector3(0, 0, 0), None)
     else:
         self.activateEquipment(equipmentID)
     self.setGUIVisible(BigWorld.player().isGuiVisible)
     if BigWorld.player().gunRotator is not None:
         BigWorld.player().gunRotator.clientMode = False
Exemplo n.º 4
0
 def enable(self, **args):
     SoundGroups.g_instance.changePlayMode(2)
     targetPos = args.get('preferredPos', Vector3(0, 0, 0))
     self.__cam.enable(targetPos, args.get('saveDist', True))
     self.__aimingMode = args.get('aimingMode', self.__aimingMode)
     self.__isEnabled = True
     g_postProcessing.enable('strategic')
     BigWorld.setFloraEnabled(False)
     equipmentID = args.get('equipmentID', None)
     if equipmentID is None:
         self.__activeSelector = _DefaultStrikeSelector(Vector3(0, 0, 0), None)
     else:
         self.activateEquipment(equipmentID)
     self.setGUIVisible(self.__aih.isGuiVisible)
     if BigWorld.player().gunRotator is not None:
         BigWorld.player().gunRotator.clientMode = False
     return
Exemplo n.º 5
0
    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 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]
        if _EVENT_HANGAR_VISIBILITY_MASK.has_key(isPremium):
            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 _HANGAR_CFGS.has_key(spacePathLC):
            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
Exemplo n.º 6
0
def _enablePostProcessing(bool, mode):
    g_postProcessing.disable()
    if bool:
        g_postProcessing.enable(mode)
Exemplo n.º 7
0
def _enablePostProcessing(bool, mode):
    g_postProcessing.disable()
    if bool:
        g_postProcessing.enable(mode)