Beispiel #1
0
        /// <summary>
        /// Set the refresh rate (number of Update() calls per triggered update).
        /// The lower of the current data rate and the new data rate is used.
        /// </summary>
        /// <param name="newDataRate">New data rate</param>
        internal void UpdateDataRefreshRate(int newDataRate)
        {
            refreshDataRate = Math.Max(RPMGlobals.minimumRefreshRate, Math.Min(newDataRate, refreshDataRate));

            RPMVesselComputer comp = null;

            if (RPMVesselComputer.TryGetInstance(vessel, ref comp))
            {
                comp.UpdateDataRefreshRate(newDataRate);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Take care of updating everything.
        /// </summary>
        /// <param name="seatID"></param>
        /// <param name="activeKerbal"></param>
        private void UpdateCameras(int seatID, Kerbal activeKerbal)
        {
            InternalCamera.Instance.SetFOV(seats[seatID].fov);
            InternalCamera.Instance.maxRot   = seats[seatID].maxRot;
            InternalCamera.Instance.maxPitch = seats[seatID].maxPitch;
            InternalCamera.Instance.minPitch = seats[seatID].minPitch;

            RPMVesselComputer comp = null;

            if (RPMVesselComputer.TryGetInstance(vessel, ref comp))
            {
                comp.SetKerbalVisible(activeKerbal, seats[seatID].hideKerbal);
            }

            oldSeat = seatID;
        }
Beispiel #3
0
 public void OnDestroy()
 {
     if (del != null)
     {
         try
         {
             RPMVesselComputer comp = null;
             if (RPMVesselComputer.TryGetInstance(vessel, ref comp))
             {
                 comp.UnregisterCallback(variableName, del);
             }
         }
         catch
         {
             //JUtil.LogMessage(this, "Trapped exception unregistering JSIVariableLabel (you can ignore this)");
         }
     }
     //JUtil.LogMessage(this, "OnDestroy()");
     Destroy(textObj);
     textObj = null;
 }
Beispiel #4
0
        /// <summary>
        /// Callback to tell us our vessel was modified (and we thus need to
        /// re-examine some values.
        /// </summary>
        /// <param name="who"></param>
        private void onVesselWasModified(Vessel who)
        {
            if (who.id == vessel.id)
            {
                vid = vessel.id;
                //JUtil.LogMessage(this, "onVesselWasModified(): RPMCid {0} / vessel {1}", RPMCid, vid;)
                ClearVariables();
                UpdateLocalCrew();

                for (int i = 0; i < installedModules.Count; ++i)
                {
                    installedModules[i].vessel = vessel;
                }

                RPMVesselComputer comp = null;
                if (RPMVesselComputer.TryGetInstance(vessel, ref comp))
                {
                    comp.UpdateDataRefreshRate(refreshDataRate);
                }
            }
        }
        public void OnDestroy()
        {
            for (int i = 0; i < variableSets.Count; ++i)
            {
                variableSets[i].TearDown();
            }
            variableSets.Clear();

            try
            {
                RPMVesselComputer comp = null;
                // It appears that the vessel computer is sometimes unloaded
                // before this triggers when a craft is destroyed.
                if (RPMVesselComputer.TryGetInstance(vessel, ref comp))
                {
                    comp.UnregisterCallback(variableName, del);
                }
            }
            catch
            {
                //JUtil.LogMessage(this, "Trapped exception unregistering JSICallback (you can ignore this)");
            }
        }