示例#1
0
 public void HookPartMenus()
 {
     UIPartActionMenuPatcher.Wrap(vessel, (e, ignore_delay) =>
     {
         var v = FlightGlobals.ActiveVessel;
         if (v == null || v.isEVA || RTCore.Instance == null)
         {
             e.Invoke();
             return;
         }
         var vs = RTCore.Instance.Satellites[v];
         if (vs == null || vs.HasLocalControl)
         {
             e.Invoke();
         }
         else if (vs.FlightComputer != null && vs.FlightComputer.InputAllowed)
         {
             if (ignore_delay)
             {
                 e.Invoke();
             }
             else
             {
                 vs.SignalProcessor.FlightComputer.Enqueue(EventCommand.Event(e));
             }
         }
         else
         {
             ScreenMessages.PostScreenMessage(new ScreenMessage("No connection to send command on.", 4.0f, ScreenMessageStyle.UPPER_LEFT));
         }
     });
 }
 public void HookPartMenus()
 {
     UIPartActionMenuPatcher.Wrap(vessel, (e) => {
         Vessel v = e.listParent.part.vessel;
         if (v != null && v.loaded)
         {
             var vs = RTCore.Instance.Satellites[v];
             if (vs != null)
             {
                 vs.Master.FlightComputer.Enqueue(EventCommand.Event(e));
             }
         }
         else
         {
             e.Invoke();
         }
     });
 }