Exemplo n.º 1
0
 public void Update()
 {
     if(FlightGlobals.ActiveVessel != null) // Grab active vessel.
     {
         vessel = FlightGlobals.ActiveVessel;
         if (vessel.FindPartModulesImplementing<ESLDHailer>().Count == 0) // Has a hailer?
         {
             canHail = false;
             hailer = null;
         }
         else
         {
             canHail = true;
             hailer = vessel.FindPartModulesImplementing<ESLDHailer>().First();
             foreach (ESLDHailer ehail in vessel.FindPartModulesImplementing<ESLDHailer>())
             {
                 ehail.masterClass = this;
             }
         }
     }
     if (canHail && this.button == null)
     {
         onGUIApplicationLauncherReady();
     }
     if (!canHail && this.button != null)
     {
         killButton();
     }
     // Sync GUI & Button States
     if (this.button != null)
     {
         if (this.button.State == RUIToggleButton.ButtonState.TRUE && !hailer.guiopen)
         {
             this.button.SetFalse();
         }
         if (this.button.State == RUIToggleButton.ButtonState.FALSE && hailer.guiopen)
         {
             this.button.SetTrue();
         }
     }
 }