void OnCallback(RPMVesselComputer comp, float value)
 {
     // Sanity checks:
     if (vessel == null || vessel.id != comp.id)
     {
         // Stop getting callbacks if for some reason a different
         // computer is talking to us.
         comp.UnregisterCallback(variableName, del);
     }
     else
     {
         for (int i = 0; i < variableSets.Count; ++i)
         {
             variableSets[i].Update(comp, value);
         }
     }
 }
Beispiel #2
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;
 }
        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)");
            }
        }
Beispiel #4
0
        private void OnCallback(RPMVesselComputer comp, float value)
        {
            // Sanity checks:
            if (vessel == null || vessel.id != comp.id)
            {
                // We're not attached to a ship?
                comp.UnregisterCallback(variableName, del);
                return;
            }

            if (value < 0.0f)
            {
                textObj.text.Color = negativeColorValue;
            }
            else if (value > 0.0f)
            {
                textObj.text.Color = positiveColorValue;
            }
            else
            {
                textObj.text.Color = zeroColorValue;
            }
        }