示例#1
0
文件: GameView.cs 项目: lbm7926/Imp
        protected override void AwakeOverride()
        {
            WindowType    = RuntimeWindowType.Game;
            m_gameCameras = Editor.Object.Get(false).Select(obj => obj.GetComponent <GameViewCamera>()).Where(obj => obj != null && obj.IsAwaked).ToList();

            if (m_gameCameras.Count > 0)
            {
                m_camera = m_gameCameras[0].Camera;
            }

            if (m_renderTextureOutput != null)
            {
                m_renderTextureCameras = new List <RenderTextureCamera>();
                for (int i = 0; i < m_gameCameras.Count; ++i)
                {
                    GameViewCamera gameViewCamera = m_gameCameras[i];
                    CreateRenderTextureCamera(gameViewCamera);
                }
            }

            UpdateVisualState();

            GameViewCamera._Awaked         += OnCameraAwaked;
            GameViewCamera._Destroyed      += OnCameraDestroyed;
            GameViewCamera._Enabled        += OnCameraEnabled;
            GameViewCamera._Disabled       += OnCameraDisabled;
            GameViewCamera._CameraEnabled  += OnCameraComponentEnabled;
            GameViewCamera._CameraDisabled += OnCameraComponentDisabled;

            m_gameView = this;

            base.AwakeOverride();
        }
示例#2
0
 private void OnSceneSaved()
 {
     for (int i = 0; i < m_gameCameras.Count; ++i)
     {
         GameViewCamera gameCamera = m_gameCameras[i];
         gameCamera.Camera.enabled = enabled;
     }
 }
示例#3
0
 private void OnBeforeSceneSave(UIControls.CancelArgs arg)
 {
     for (int i = 0; i < m_gameCameras.Count; ++i)
     {
         GameViewCamera gameCamera = m_gameCameras[i];
         gameCamera.Camera.enabled = gameCamera.IsCameraEnabled;
     }
 }
示例#4
0
 public override void SetCameraDepth(int depth)
 {
     base.SetCameraDepth(depth);
     for (int i = 0; i < m_gameCameras.Count; ++i)
     {
         GameViewCamera gameCamera = m_gameCameras[i];
         gameCamera.Camera.depth = depth + gameCamera.Depth;
     }
 }
示例#5
0
文件: GameView.cs 项目: lbm7926/Imp
 protected virtual void OnEnable()
 {
     for (int i = 0; i < m_gameCameras.Count; ++i)
     {
         GameViewCamera gameCamera = m_gameCameras[i];
         gameCamera.Camera.enabled = gameCamera.IsCameraEnabled;
         gameCamera.enabled        = true;
     }
 }
示例#6
0
 protected override void OnEnable()
 {
     base.OnEnable();
     for (int i = 0; i < m_gameCameras.Count; ++i)
     {
         GameViewCamera gameCamera = m_gameCameras[i];
         gameCamera.Camera.enabled = gameCamera.IsCameraEnabled;
         gameCamera.enabled        = true;
     }
 }
示例#7
0
        private void CreateRenderTextureCamera(GameViewCamera gameViewCamera)
        {
            GameObject gameViewCameraGo = gameViewCamera.gameObject;
            bool       wasActive        = gameViewCameraGo.activeSelf;

            gameViewCameraGo.SetActive(false);

            RenderTextureCamera renderTextureCamera = gameViewCameraGo.AddComponent <RenderTextureCamera>();

            renderTextureCamera.OutputRoot = m_renderTextureOutput;
            m_renderTextureCameras.Add(renderTextureCamera);

            gameViewCameraGo.SetActive(wasActive);
        }
示例#8
0
文件: GameView.cs 项目: lbm7926/Imp
 protected virtual void OnDisable()
 {
     if (m_gameView == this)
     {
         for (int i = 0; i < m_gameCameras.Count; ++i)
         {
             GameViewCamera gameCamera = m_gameCameras[i];
             if (gameCamera.Camera != null)
             {
                 if (Editor.IsOpened)
                 {
                     gameCamera.enabled        = false;
                     gameCamera.Camera.enabled = false;
                 }
             }
         }
     }
 }