Esempio n. 1
0
 /// <summary>
 /// Show info when switching to IVA
 /// </summary>
 /// <param name="cameraMode"></param>
 private void OnCameraChange(CameraManager.CameraMode cameraMode)
 {
     if (cameraMode == CameraManager.CameraMode.IVA)
     {
         ShowInfo();
     }
 }
Esempio n. 2
0
            protected override float GetScaleOffset()
            {
                CameraManager.CameraMode mode = CameraManager.Instance.currentCameraMode;
                if (mode != CameraManager.CameraMode.IVA)
                {
                    FlightCamera camera = FlightCamera.fetch;
                    if (camera == null)
                    {
                        return(0.0f / 400.0f);
                    }
                    switch (camera.mode)
                    {
                    case FlightCamera.Modes.AUTO: return(250.0f / 400.0f);

                    case FlightCamera.Modes.FREE: return(200.0f / 400.0f);

                    case FlightCamera.Modes.ORBITAL: return(150.0f / 400.0f);

                    case FlightCamera.Modes.CHASE: return(100.0f / 400.0f);

                    case FlightCamera.Modes.LOCKED: return(50.0f / 400.0f);

                    default: return(0.0f / 400.0f);
                    }
                }
                else
                {
                    return(300.0f / 400.0f);
                }
            }
Esempio n. 3
0
 public void Update()
 {
     if (CameraManager.Instance.currentCameraMode != CameraManager.CameraMode.IVA)
     {
         if (_lastCameraMode == CameraManager.CameraMode.IVA)
         {
             // Switching away from IVA.
             //InputLockManager.RemoveControlLock("FreeIVA");
             // Return the kerbal to its original seat.
             TargetedSeat = ActiveKerbal.seat;
             Buckle();
         }
     }
     else
     {
         // In IVA.
         if (_lastCameraMode != CameraManager.CameraMode.IVA)
         {
             // Switching to IVA.
             FreeIva.EnableInternals();
             SetCameraToSeat();
             InternalCollider.HideAllColliders();
         }
         GetInput();
     }
     _lastCameraMode = CameraManager.Instance.currentCameraMode;
 }
Esempio n. 4
0
            public void SetEnabledInCamera(CameraManager.CameraMode camMode, bool enabled)
            {
                Configuration config = NanoGauges.configuration;

                switch (camMode)
                {
                case CameraManager.CameraMode.External:
                case CameraManager.CameraMode.Flight:
                    if (config.gaugesInFlightEnabled != enabled)
                    {
                        config.gaugesInFlightEnabled = enabled;
                        CheckCamera(true);
                    }
                    break;

                case CameraManager.CameraMode.IVA:
                    if (config.gaugesInIvaEnabled != enabled)
                    {
                        config.gaugesInIvaEnabled = enabled;
                        CheckCamera(true);
                    }
                    break;

                case CameraManager.CameraMode.Map:
                    if (config.gaugesInMapEnabled != enabled)
                    {
                        config.gaugesInMapEnabled = enabled;
                        CheckCamera(true);
                    }
                    break;
                }
            }
Esempio n. 5
0
    private bool checkCamMode()
    {                
        cameraMode = CameraManager.Instance.currentCameraMode;

        if (cameraMode != oldCameraMode)
        {            
            doUpdate = true;
            oldCameraMode = cameraMode;  

            switch (cameraMode)
            {
                case CameraManager.CameraMode.Flight:
                    if (showInFlightCam) return true;
                    else return false;
                case CameraManager.CameraMode.IVA:
                    if (showInIVACam) return true;
                    else return false;
                case CameraManager.CameraMode.Internal:
                    if (showInInternalCam) return true;
                    else return false;
                case CameraManager.CameraMode.External:
                    if (showInExternalCam) return true;
                    else return false;
                default:
                    return true;
            }
        }
        return true;          
    }
Esempio n. 6
0
 void OnCameraChange(CameraManager.CameraMode cameraMode)
 {
     //DebugPrint(string.Format("camera mode changed to {0}", cameraMode.ToString()));
     if (cameraMode == CameraManager.CameraMode.IVA && targetTransform != null)
     {
         ResetFocus();
     }
 }
Esempio n. 7
0
        public void Update()
        {
            if (CameraManager.Instance.currentCameraMode != CameraManager.CameraMode.IVA)
            {
                if (_lastCameraMode == CameraManager.CameraMode.IVA) // Switching away from IVA.
                {
                    InputLockManager.RemoveControlLock("FreeIVA");

                    // Return the kerbal to its original seat.
                    TargetedSeat = ActiveKerbal.seat;
                    if (!buckled)
                    {
                        Buckle();
                    }
                }
            }
            else
            {
                // In IVA.
                if (_lastCameraMode != CameraManager.CameraMode.IVA)
                {
                    // Switching to IVA.
                    FreeIva.EnableInternals();
                    UpdateActiveKerbal();//false);
                    SetCameraToSeat();
                    InternalCollider.HideAllColliders();
                }

                // Check if we're changing crew member using the 'V' key.
                if (GameSettings.CAMERA_NEXT.GetKeyDown())
                {
                    _changingCurrentIvaCrew = true;
                }
                else
                {
                    if (_changingCurrentIvaCrew)
                    {
                        UpdateActiveKerbal();//false);
                        _changingCurrentIvaCrew = false;
                    }
                }

                // TODO: Doesn't get mouse input when in FixedUpdate.
                // Split this out to flags set in Update and acted upon in FixedUpdate.
                GetInput();

                /*FreeIva.InitialPart.Events.Clear();
                 * if (_transferStart != 0 && Planetarium.GetUniversalTime() > (0.25 + _transferStart))
                 * {
                 *  FlightGlobals.ActiveVessel.SpawnCrew();
                 *  GameEvents.onVesselChange.Fire(FlightGlobals.ActiveVessel);
                 *  InternalCamera.Instance.transform.parent = ActiveKerbal.KerbalRef.eyeTransform;
                 *  _transferStart = 0;
                 * }*/
            }
            _lastCameraMode = CameraManager.Instance.currentCameraMode;
        }
        // Reset textures when entering IVA. Parts might have loaded or changed their internal spaces
        // in the meantime
        private void OnCameraChanged(CameraManager.CameraMode mode)
        {
            if (mode != CameraManager.CameraMode.IVA)
            {
                return;
            }

            UpdateIvaTextures();
        }
Esempio n. 9
0
    private bool checkCamMode()
    {
        cameraMode = CameraManager.Instance.currentCameraMode;

        if (cameraMode != oldCameraMode)
        {
            doUpdate      = true;
            oldCameraMode = cameraMode;

            switch (cameraMode)
            {
            case CameraManager.CameraMode.Flight:
                if (showInFlightCam)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case CameraManager.CameraMode.IVA:
                if (showInIVACam)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case CameraManager.CameraMode.Internal:
                if (showInInternalCam)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case CameraManager.CameraMode.External:
                if (showInExternalCam)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            default:
                return(true);
            }
        }
        return(true);
    }
        // Reset textures when entering IVA. Parts might have loaded or changed their internal spaces
        // in the meantime
        private void OnCameraChanged(CameraManager.CameraMode mode)
        {
            IVAactive = (mode == CameraManager.CameraMode.IVA);
            if (!IVAactive)
            {
                return;
            }

            UpdateIvaTextures();
        }
Esempio n. 11
0
 /// <summary>
 /// Callback used when camera switches (so I can mute audio when not in craft).
 /// </summary>
 /// <param name="newCameraMode"></param>
 private void OnCameraChange(CameraManager.CameraMode newCameraMode)
 {
     try
     {
         audioSource.mute = ((CameraManager.Instance.currentCameraMode != CameraManager.CameraMode.IVA) && (CameraManager.Instance.currentCameraMode != CameraManager.CameraMode.Internal));
     }
     catch (Exception e)
     {
         throw new ArgumentException("Error in AudioPlayer OnCameraChange: \"" + e.Source + e.TargetSite + e.Data + e.StackTrace + CameraManager.Instance.currentCameraMode + "\"", e);
     }
 }
Esempio n. 12
0
        /*private void onActiveJointNeedUpdate(Vessel v) { Utils.Log("#onActiveJointNeedUpdate"); }*/
        private void OnCameraChange(CameraManager.CameraMode cameraMode)
        {
            Enums.CameraModes currentCameraMode = Enums.ConvertCameraMode(cameraMode);
            bool cameraChanged = SoundtrackEditor.CurrentSituation.cameraMode != currentCameraMode;

            SoundtrackEditor.CurrentSituation.cameraMode = currentCameraMode;
            if (cameraChanged && MonitorCameraMode)
            {
                SoundtrackEditor.Instance.OnSituationChanged();
            }
        }
Esempio n. 13
0
 void Update()
 {
     var current = CameraManager.Instance.currentCameraMode;
     if (current == CameraManager.CameraMode.IVA) {
         if (lastCameraMode != current) {
             lastCameraMode = current;
             StartCoroutine (WaitAndSetInternalsVisible ());
         }
     } else {
         lastCameraMode = current;
     }
 }
Esempio n. 14
0
            private void CheckCamera(bool force = false)
            {
                CameraManager.CameraMode camMode = CameraManager.Instance.currentCameraMode;
                bool evaCam = IsEvaCamera();

                //

                if (force || camMode != this.currentCamMode || (camMode == CameraManager.CameraMode.Flight && evaCam != this.isEvaCam))
                {
                    if (force)
                    {
                        if (camMode == CameraManager.CameraMode.Flight && evaCam)
                        {
                            bool visible = NanoGauges.configuration.gaugesInEvaEnabled;
                            Log.Detail("forced test if gauges visible in EVA, gauges visible: " + visible);
                            SetEnabledGaugesVisible(visible);
                        }
                        else
                        {
                            bool visible = IsEnabledInCamera(camMode);
                            Log.Detail("forced test if gauges visible in non EVA, gauges visible: " + visible);
                            SetEnabledGaugesVisible(visible);
                        }
                    }
                    else if (camMode == CameraManager.CameraMode.Flight && evaCam)
                    {
                        // switch to EVA in flight
                        bool visible = NanoGauges.configuration.gaugesInEvaEnabled;
                        Log.Detail("camera changed to EVA, gauges visible: " + visible);
                        SetEnabledGaugesVisible(visible);
                    }
                    else if (camMode == CameraManager.CameraMode.Flight && !evaCam)
                    {
                        // switch from EVA in flight
                        bool visible = IsEnabledInCamera(camMode);
                        Log.Detail("camera changed to non EVA, gauges visible: " + visible);
                        SetEnabledGaugesVisible(visible);
                    }
                    else if (camMode != this.currentCamMode)
                    {
                        // camera changed
                        bool visible = IsEnabledInCamera(camMode);
                        Log.Detail("camera changed to " + camMode + ", gauges visible: " + visible);
                        SetEnabledGaugesVisible(visible);
                    }
                    this.isEvaCam       = evaCam;
                    this.currentCamMode = camMode;
                }
            }
Esempio n. 15
0
 void OnCameraChange(CameraManager.CameraMode cameraMode)
 {
     if (QSettings.Instance.AutoHideUI)
     {
         if (isIVA())
         {
             StartCoroutine(WaitToHideUI());
         }
         if (isMAP)
         {
             StartCoroutine(WaitToShowUI());
         }
     }
     Log("OnCameraChange", "QIVA");
 }
Esempio n. 16
0
 public void ShowGauges()
 {
     ResetInspecteurs();
     //
     this.currentCamMode = CameraManager.Instance.currentCameraMode;
     this.hidden         = false;
     //
     foreach (AbstractGauge gauge in gauges.Values)
     {
         if (NanoGauges.configuration.IsGaugeEnabled(gauge.GetWindowId()))
         {
             gauge.Reset();
             gauge.SetVisible(true);
         }
     }
 }
Esempio n. 17
0
    // Use this for initialization
    void Start()
    {
        //~ sateliteController = GameManager.Instance.CameraManager.SateliteCamera.gameObject.GetComponent(typeof(SateliteController)) as SateliteController;
        //~ sateliteCam = GameManager.Instance.CameraManager.SateliteCamera.gameObject.GetComponent(typeof(SateliteCam)) as SateliteCam;
        _sensitivity = MouseSensitivity;
        if (_SateliteCam != null)
        {
            _SateliteCam = GameManager.Instance.CameraManager.SateliteCamera.GetComponent(typeof(SateliteCam)) as SateliteCam;
        }
        if (_OrbitCam != null)
        {
            _OrbitCam = GameManager.Instance.CameraManager.MainCamera.GetComponent(typeof(OrbitCam)) as OrbitCam;
        }

        CamMode = GameManager.Instance.CameraManager.CamMode;
    }
Esempio n. 18
0
        private void cameraChange(CameraManager.CameraMode c)
        {
            if (c == CameraManager.CameraMode.Flight)
            {
                if (cMode != CameraManager.CameraMode.Flight)
                {
                    if (resetting)
                    {
                        StopCoroutine("delayedReset");
                    }

                    StartCoroutine("delayedReset", true);
                }
            }

            cMode = c;
        }
Esempio n. 19
0
        /// <summary>
        /// Callback to handle when the camera is switched from IVA to flight
        /// </summary>
        /// <param name="newMode"></param>
        public void CameraChangeCallback(CameraManager.CameraMode newMode)
        {
            inIVA = (CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA);

            if (inIVA)
            {
                if (audioOutput != null && alarmActive)
                {
                    audioOutput.audio.volume = alarmSoundVolume * GameSettings.SHIP_VOLUME;
                }
            }
            else
            {
                if (audioOutput != null && alarmActive)
                {
                    audioOutput.audio.volume = 0.0f;
                }
            }
        }
Esempio n. 20
0
 /// <summary>
 /// If the camera mode changes, we need to reset our local cache.
 /// </summary>
 /// <param name="newMode"></param>
 private void OnCameraChange(CameraManager.CameraMode newMode)
 {
     if (newMode == CameraManager.CameraMode.IVA)
     {
         Kerbal activeKerbal = part.FindCurrentKerbal();
         if (activeKerbal != null)
         {
             int seatID = activeKerbal.protoCrewMember.seatIdx;
             if (seatID != oldSeat)
             {
                 UpdateCameras(seatID, activeKerbal);
             }
         }
     }
     else
     {
         oldSeat = -1;
     }
 }
Esempio n. 21
0
 void OnSelectedCameraChanged()
 {
     //Debug.Log("CamMode changed");
     CamMode = GameManager.Instance.CameraManager.CamMode;
     if (CamMode == CameraManager.CameraMode.Satelite)
     {
         //Disable SurfaceControl script and enable satelite control
         _OrbitCam.Enabled = false;
         //_SateliteCam.enabled = true;
         //_MapMove.enabled = true;
     }
     else
     {
         _OrbitCam.Enabled = true;
         //_SateliteCam.enabled = false;
         //_MapMove.enabled = false;
         //Disable satelite, enable surface
     }
 }
        //Flight -> IVA
        void OnCameraChange(CameraManager.CameraMode m)
        {
            if (CameraManager.Instance == null)
            {
                return;
            }

            if (m == CameraManager.CameraMode.IVA)
            {
                Kerbal k = CameraManager.Instance.IVACameraActiveKerbal;
                if (k.InPart == null || string.IsNullOrEmpty(k.InPart.partInfo.title))
                {
                    ScreenMessages.PostScreenMessage("IVA: " + k.crewMemberName, 5f, ScreenMessageStyle.UPPER_CENTER);
                }
                else
                {
                    ScreenMessages.PostScreenMessage(string.Format("IVA: {0} ({1})", k.crewMemberName, k.InPart.partInfo.title), 5f, ScreenMessageStyle.UPPER_CENTER);
                }
            }
        }
Esempio n. 23
0
        private void Lock()
        {
            if (!isLocked)
            {
                isLocked = true;

                cameraManager         = CameraManager.Instance;
                cameraModeWhenOpened  = cameraManager.currentCameraMode;
                cameraManager.enabled = false;

                InputLockManager.SetControlLock("kOSTerminal");

                // Prevent editor keys from being pressed while typing
                EditorLogic editor = EditorLogic.fetch;
                if (editor != null && !EditorLogic.softLock)
                {
                    editor.Lock(true, true, true);
                }
            }
        }
Esempio n. 24
0
        public void OnCameraChange(CameraManager.CameraMode cameraMode)
        {
            if (cameraMode != CameraManager.CameraMode.IVA && _previousCameraMode == CameraManager.CameraMode.IVA)
            {
#if Experimental
                KerbalWorldSpaceCollider.enabled = false;
#endif
                if (!buckled)
                {
                    ReturnToSeat();
                }
            }
#if Experimental
            if (cameraMode == CameraManager.CameraMode.IVA)
            {
                //KerbalWorldSpaceCollider.enabled = true;
            }
#endif
            _previousCameraMode = cameraMode;
        }
Esempio n. 25
0
            private bool IsEnabledInCamera(CameraManager.CameraMode camMode, bool isEva = false)
            {
                Configuration config = NanoGauges.configuration;

                switch (camMode)
                {
                case CameraManager.CameraMode.External:
                case CameraManager.CameraMode.Flight:
                    if (!isEva)
                    {
                        return(config.gaugesInFlightEnabled);
                    }
                    return(config.gaugesInEvaEnabled);

                case CameraManager.CameraMode.IVA:
                    return(config.gaugesInIvaEnabled);

                case CameraManager.CameraMode.Map:
                    return(config.gaugesInMapEnabled);
                }
                return(true);
            }
Esempio n. 26
0
        public static CameraModes ConvertCameraMode(CameraManager.CameraMode mode)
        {
            switch (mode)
            {
            case CameraManager.CameraMode.External:
            {
                return(CameraModes.External);
            }

            case CameraManager.CameraMode.Flight:
            {
                return(CameraModes.Flight);
            }

            case CameraManager.CameraMode.Internal:
            {
                return(CameraModes.Internal);
            }

            case CameraManager.CameraMode.IVA:
            {
                return(CameraModes.IVA);
            }

            case CameraManager.CameraMode.Map:
            {
                return(CameraModes.Map);
            }

            default:
            {
                throw new ArgumentException("Soundtrack Editor: Invalid camera mode: " + mode +
                                            "\nCheck for an updated version of Soundtrack Editor.");
            }
            }
        }
Esempio n. 27
0
 bool isIVA(CameraManager.CameraMode cameraMode)
 {
     return(cameraMode == CameraManager.CameraMode.IVA);
 }
 /// <summary>
 /// Callback used when camera switches (so I can mute audio when not in craft).
 /// </summary>
 /// <param name="newCameraMode"></param>
 private void OnCameraChange(CameraManager.CameraMode newCameraMode)
 {
     audioSource.mute = (newCameraMode != CameraManager.CameraMode.IVA);
 }
Esempio n. 29
0
 /// <summary>
 /// The player changed camera modes.  If we're going from 'outside' to
 /// 'inside', we can figure out which part we're in, and thus whether
 /// there are docks available.  To do that, we have to reprocess the
 /// reference transform.
 /// </summary>
 /// <param name="newMode"></param>
 private void onCameraChange(CameraManager.CameraMode newMode)
 {
     vesselActive = ActiveVessel(vessel);
     UpdateReferenceTransform(_referenceTransform, vesselActive);
 }
Esempio n. 30
0
 public void Update()
 {
     if (CameraManager.Instance.currentCameraMode != CameraManager.CameraMode.IVA)
     {
         if (_lastCameraMode == CameraManager.CameraMode.IVA)
         {
             // Switching away from IVA.
             //InputLockManager.RemoveControlLock("FreeIVA");
             // Return the kerbal to its original seat.
             TargetedSeat = ActiveKerbal.seat;
             Buckle();
         }
     }
     else
     {
         // In IVA.
         if (_lastCameraMode != CameraManager.CameraMode.IVA)
         {
             // Switching to IVA.
             FreeIva.EnableInternals();
             SetCameraToSeat();
             InternalCollider.HideAllColliders();
         }
         GetInput();
     }
     _lastCameraMode = CameraManager.Instance.currentCameraMode;
 }
Esempio n. 31
0
 private void onCameraChange(CameraManager.CameraMode c)
 {
     //ProbeControlRoomUtils.Logger.message("OnCameraChange: " + c.ToString());
     //needCamReset = true;
 }
Esempio n. 32
0
        private void Lock()
        {
            if (!isLocked)
            {
                isLocked = true;

                cameraManager = CameraManager.Instance;
                cameraModeWhenOpened = cameraManager.currentCameraMode;
                cameraManager.enabled = false;

                InputLockManager.SetControlLock("kOSTerminal");

                // Prevent editor keys from being pressed while typing
                EditorLogic editor = EditorLogic.fetch;
                if (editor != null && !EditorLogic.softLock) editor.Lock(true, true, true);
            }
        }
Esempio n. 33
0
 void Awake()
 {
     lastCameraMode = CameraManager.Instance.currentCameraMode;
 }