예제 #1
0
        public void Register(MyCameraBlock camera)
        {
            MyDebug.AssertDebug(camera != null);
            MyDebug.AssertDebug(!m_cameras.Contains(camera));

            m_cameras.Add(camera);
        }
예제 #2
0
        public void SetAsCurrent(MyCameraBlock newCamera)
        {
            MyDebug.AssertDebug(newCamera != null);
            
            if (m_currentCamera == newCamera)
            {
                return;
            }

            if (newCamera.BlockDefinition.OverlayTexture != null)
            {
                MyHudCameraOverlay.TextureName = newCamera.BlockDefinition.OverlayTexture;
                MyHudCameraOverlay.Enabled = true;
            }
            else
            {
                MyHudCameraOverlay.Enabled = false;
            }

            string shipName = MyAntennaSystem.GetLogicalGroupRepresentative(m_grid).DisplayName ?? "";
            string cameraName = newCamera.DisplayNameText;
            
            MyHud.CameraInfo.Enable(shipName, cameraName);
            m_currentCamera = newCamera;
            m_ignoreNextInput = true;

            MySessionComponentVoxelHand.Static.Enabled = false;
            MyCubeBuilder.Static.Deactivate();
        }
예제 #3
0
        public void Unregister(MyCameraBlock camera)
        {
            MyDebug.AssertDebug(camera != null);
            MyDebug.AssertDebug(m_cameras.Contains(camera));

            if (camera == m_currentCamera)
            {
                ResetCamera();
            }

            m_cameras.Remove(camera);
        }
예제 #4
0
        private MyCameraBlock GetPrev(MyCameraBlock current)
        {
            MyDebug.AssertDebug(current != null);
            MyDebug.AssertDebug(m_cameras.Contains(current));

            if (m_relayedCameras.Count == 1)
            {
                return current;
            }

            int indexOf = m_relayedCameras.IndexOf(current);
            if (indexOf == -1)
            {
                ResetCamera();
                return null;
            }
            int prevIndex = indexOf - 1;
            if (prevIndex < 0)
            {
                prevIndex = m_relayedCameras.Count - 1;
            }
            return m_relayedCameras[prevIndex];
        }
예제 #5
0
        private void SetCamera(MyCameraBlock newCamera)
        {
            if (newCamera == m_currentCamera)
            {
                return;
            }

            if (m_cameras.Contains(newCamera))
            {
                SetAsCurrent(newCamera);
                newCamera.SetView();
            }
            else
            {
                MyHudCameraOverlay.Enabled = false;
                MyHud.CameraInfo.Disable();
                ResetCurrentCamera();
                newCamera.RequestSetView();
            }
        }
예제 #6
0
        private MyCameraBlock GetNext(MyCameraBlock current)
        {
            MyDebug.AssertDebug(current != null);
            MyDebug.AssertDebug(m_cameras.Contains(current));

            if (m_relayedCameras.Count == 1)
            {
                return current;
            }

            int indexOf = m_relayedCameras.IndexOf(current);

            if (indexOf == -1)
            {
                ResetCamera();
                return null;
            }

            return m_relayedCameras[(indexOf + 1) % m_relayedCameras.Count];
        }
예제 #7
0
 private void ResetCurrentCamera()
 {
     m_currentCamera.OnExitView();
     
     m_currentCamera = null;
 }
예제 #8
0
        public static bool CameraIsInRangeAndPlayerHasAccess(MyCameraBlock camera)
        {
            if (MySession.ControlledEntity != null)
            {
                MyIDModule module;
                if ((camera as IMyComponentOwner<MyIDModule>).GetComponent(out module))
                {
                    if (!(camera.HasPlayerAccess(MySession.LocalPlayerId) || module.Owner == 0))
                    {
                        return false;
                    }
                }

                if (MySession.ControlledEntity is MyCharacter)
                {
                    return MyAntennaSystem.CheckConnection(MySession.LocalCharacter, camera.CubeGrid, MySession.LocalHumanPlayer);
                }
                else if (MySession.ControlledEntity is MyShipController)
                {
                    return MyAntennaSystem.CheckConnection((MySession.ControlledEntity as MyShipController).CubeGrid, camera.CubeGrid, MySession.LocalHumanPlayer);
                }
            }

            return false;
        }
예제 #9
0
 public MySyncCameraBlock(MyCameraBlock cameraBlock)
     : base(cameraBlock)
 {
 }
예제 #10
0
 public MySyncCameraBlock(MyCameraBlock cameraBlock)
     : base(cameraBlock)
 {
 }
        public void SetAsCurrent(MyCameraBlock newCamera)
        {
            MyDebug.AssertDebug(newCamera != null);
            
            if (m_currentCamera == newCamera)
            {
                return;
            }

            if (newCamera.BlockDefinition.OverlayTexture != null)
            {
                MyHudCameraOverlay.TextureName = newCamera.BlockDefinition.OverlayTexture;
                MyHudCameraOverlay.Enabled = true;
            }
            else
            {
                MyHudCameraOverlay.Enabled = false;
            }

            //By Gregory: Temporary fix cause Session component for antenna system hasn't been called yet and Static isn't assigned yet at game load(see BeforeStart function).
            string shipName = "";
            if (MyAntennaSystem.Static != null)
            {
                shipName = MyAntennaSystem.Static.GetLogicalGroupRepresentative(m_grid).DisplayName ?? "";
            }
            string cameraName = newCamera.DisplayNameText;
            
            MyHud.CameraInfo.Enable(shipName, cameraName);
            m_currentCamera = newCamera;
            m_ignoreNextInput = true;

            MySessionComponentVoxelHand.Static.Enabled = false;
            MySession.Static.GameFocusManager.Clear();
            //MyCubeBuilder.Static.Deactivate();
        }