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
Exemple #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
Exemple #3
0
 def init(self):
     if not IS_DEVELOPMENT:
         return
     else:
         rootSection = ResMgr.openSection(AvatarInputHandler.INPUT_HANDLER_CFG)
         if rootSection is None:
             return
         videoSection = rootSection['videoMode']
         if videoSection is None:
             return
         videoCameraSection = videoSection['camera']
         self.__videoCamera = VideoCamera(videoCameraSection)
         InputHandler.g_instance.onKeyDown += self.handleKeyEvent
         InputHandler.g_instance.onKeyUp += self.handleKeyEvent
         g_mouseEventHandlers.add(self.handleMouseEvent)
         return
Exemple #4
0
class HangarVideoCameraController(object):
    hangarSpace = dependency.descriptor(IHangarSpace)
    appLoader = dependency.descriptor(IAppLoader)

    def __init__(self):
        self.__videoCamera = None
        self.__enabled = False
        self.__videoCamera = None
        return

    def init(self):
        if not IS_DEVELOPMENT:
            return
        else:
            rootSection = ResMgr.openSection(
                AvatarInputHandler.INPUT_HANDLER_CFG)
            if rootSection is None:
                return
            videoSection = rootSection['videoMode']
            if videoSection is None:
                return
            videoCameraSection = videoSection['camera']
            self.__videoCamera = VideoCamera(videoCameraSection)
            InputHandler.g_instance.onKeyDown += self.handleKeyEvent
            InputHandler.g_instance.onKeyUp += self.handleKeyEvent
            g_mouseEventHandlers.add(self.handleMouseEvent)
            return

    def destroy(self):
        if self.__videoCamera is None:
            return
        else:
            self.__videoCamera.destroy()
            InputHandler.g_instance.onKeyDown -= self.handleKeyEvent
            InputHandler.g_instance.onKeyUp -= self.handleKeyEvent
            g_mouseEventHandlers.discard(self.handleMouseEvent)
            return

    def handleKeyEvent(self, event):
        if self.__videoCamera is None:
            return
        else:
            if BigWorld.isKeyDown(Keys.KEY_CAPSLOCK) and event.isKeyDown(
            ) and event.key == Keys.KEY_F3:
                self.__enabled = not self.__enabled
                if self.__enabled:
                    self.__enableVideoCamera()
                else:
                    self.__disableVideoCamera()
            return self.__videoCamera.handleKeyEvent(
                event.key, event.isKeyDown()) if self.__enabled else False

    def __enableVideoCamera(self):
        playerVehicle = self.hangarSpace.space.getVehicleEntity()
        if playerVehicle is not None and playerVehicle.state != CameraMovementStates.ON_OBJECT:
            self.__enabled = False
            return
        else:
            self.__videoCamera.enable()
            self.appLoader.detachCursor(app_settings.APP_NAME_SPACE.SF_LOBBY)
            BigWorld.player().objectsSelectionEnabled(False)
            g_eventDispatcher.loadHangar()
            return

    def __disableVideoCamera(self):
        self.__videoCamera.disable()
        BigWorld.camera(self.hangarSpace.space.camera)
        self.appLoader.attachCursor(app_settings.APP_NAME_SPACE.SF_LOBBY,
                                    _CTRL_FLAG.GUI_ENABLED)
        BigWorld.player().objectsSelectionEnabled(True)

    def handleMouseEvent(self, event):
        if self.__videoCamera is None:
            return
        else:
            return self.__videoCamera.handleMouseEvent(
                event.dx, event.dy, event.dz) if self.__enabled else False