상속: ISatellite
 public void Draw()
 {
     if (mBackup != null)
     {
         GUI.depth = 0;
         Vector2 screenCoord = ScreenSafeUI.referenceCam.WorldToScreenPoint(mBackup.TimeQuadrant.timeQuadrantTab.transform.position);
         Rect    screenPos   = new Rect(5.0f, Screen.height - screenCoord.y + 11f, 19, 18);
         GUI.Label(screenPos, DisplayText, mTextStyle);
         screenPos.x += 84f;
         screenPos.y += 1f;
         if (GUI.Button(screenPos, "", ButtonStyle))
         {
             if (Event.current.button == 1)
             {
                 VesselSatellite vs = RTCore.Instance.Satellites[FlightGlobals.ActiveVessel];
                 if (vs != null)
                 {
                     vs.LocalControl = !vs.LocalControl;
                 }
             }
             else
             {
                 RTCore.Instance.Gui.OpenFlightComputer();
             }
         }
     }
 }
예제 #2
0
 public void Draw()
 {
     mScrollPosition = GUILayout.BeginScrollView(mScrollPosition, GUILayout.Height(Screen.height - 350), GUILayout.Width(300));
     {
         Color pushColor = GUI.contentColor;
         TextAnchor pushAlign = GUI.skin.button.alignment;
         GUI.skin.button.alignment = TextAnchor.MiddleLeft;
         foreach (var sat in RTCore.Instance.Satellites)
         {
             String text = sat.Name.Truncate(25);
             RTUtil.StateButton(text, mSelection == sat ? 1 : 0, 1, s =>
             {
                 mSelection = (s > 0) ? sat : null;
                 if (mSelection != null)
                 {
                     var newTarget = PlanetariumCamera.fetch.targets.FirstOrDefault(t => t.gameObject.name == sat.Name);
                     if (newTarget == null)
                     {
                         var vessel = sat.SignalProcessor.Vessel;
                         var scaledMovement = new GameObject().AddComponent<ScaledMovement>();
                         scaledMovement.tgtRef = vessel.transform;
                         scaledMovement.name = sat.Name;
                         scaledMovement.transform.parent = ScaledSpace.Instance.transform;
                         newTarget = scaledMovement;
                     }
                     sat.SignalProcessor.Vessel.orbitDriver.Renderer.isFocused = true;
                     PlanetariumCamera.fetch.SetTarget(newTarget);
                 }
             });
         }
         GUI.skin.button.alignment = pushAlign;
         GUI.contentColor = pushColor;
     }
     GUILayout.EndScrollView();
 }
예제 #3
0
        public void Update()
        {
            if (FrameUpdated != null)
            {
                FrameUpdated.Invoke();
            }

            if (FlightGlobals.ActiveVessel != null)
            {
                VesselSatellite vs = Satellites[FlightGlobals.ActiveVessel];
                if (vs != null)
                {
                    GetLocks();
                    if (vs.Master.FlightComputer != null &&
                        vs.Master.FlightComputer.InputAllowed)
                    {
                        foreach (KSPActionGroup g in GetActivatedGroup())
                        {
                            vs.Master.FlightComputer.Enqueue(ActionGroupCommand.Group(g));
                        }
                    }
                }
                else
                {
                    ReleaseLocks();
                }
            }
        }
예제 #4
0
        public void OpenFlightComputer(Vessel v)
        {
            VesselSatellite vs = RTCore.Instance.Satellites[v];

            if (vs != null && vs.Master.FlightComputer != null)
            {
                (new FlightComputerWindow(vs.Master.FlightComputer)).Show();
            }
        }
        public SatelliteConfigFragment(VesselSatellite vs, OnClick forceClose, OnAntenna onClick)
        {
            mForceClose = forceClose;
            mOnClick    = onClick;

            mFocus = vs;
            RebuildAntennaList();

            RTCore.Instance.Antennas.Registered     += OnAntenna;
            RTCore.Instance.Antennas.Unregistered   += OnAntenna;
            RTCore.Instance.Satellites.Unregistered += OnSatellite;
        }
        public SatelliteConfigFragment(VesselSatellite vs, OnClick forceClose, OnAntenna onClick)
        {
            mForceClose = forceClose;
            mOnClick = onClick;

            mFocus = vs;
            RebuildAntennaList();

            RTCore.Instance.Antennas.Registered += OnAntenna;
            RTCore.Instance.Antennas.Unregistered += OnAntenna;
            RTCore.Instance.Satellites.Unregistered += OnSatellite;
        }
예제 #7
0
        public void Draw()
        {
            mScrollPosition = GUILayout.BeginScrollView(mScrollPosition, AbstractWindow.Frame);
            {
                Color      pushColor = GUI.contentColor;
                TextAnchor pushAlign = GUI.skin.button.alignment;
                GUI.skin.button.alignment = TextAnchor.MiddleLeft;
                foreach (VesselSatellite sat in RTCore.Instance.Satellites)
                {
                    if (sat.parentVessel != null && !MapViewFiltering.CheckAgainstFilter(sat.parentVessel))
                    {
                        continue;
                    }

                    String text = sat.Name.Truncate(25);
                    RTUtil.StateButton(text, mSelection == sat ? 1 : 0, 1, s =>
                    {
                        mSelection = (s > 0) ? sat : null;
                        if (mSelection != null)
                        {
                            MapObject newTarget = PlanetariumCamera.fetch.targets.FirstOrDefault(t => t != null && t.gameObject.name == sat.Name);
                            if (newTarget == null)
                            {
                                Vessel vessel = sat.SignalProcessor.Vessel;
                                ScaledMovement scaledMovement   = new GameObject().AddComponent <ScaledMovement>();
                                scaledMovement.tgtRef           = vessel.transform;
                                scaledMovement.name             = sat.Name;
                                scaledMovement.transform.parent = ScaledSpace.Instance.transform;
                                scaledMovement.vessel           = vessel;
                                scaledMovement.type             = MapObject.MapObjectType.VESSEL;
                                newTarget = scaledMovement;
                                PlanetariumCamera.fetch.SetTarget(PlanetariumCamera.fetch.AddTarget(newTarget));
                                PlanetariumCamera.fetch.targets.Remove(newTarget);
                            }
                            else
                            {
                                PlanetariumCamera.fetch.SetTarget(PlanetariumCamera.fetch.AddTarget(newTarget));
                            }
                        }
                    });
                }
                GUI.skin.button.alignment = pushAlign;
                GUI.contentColor          = pushColor;
            }
            GUILayout.EndScrollView();
        }
예제 #8
0
 public void Draw()
 {
     mScrollPosition = GUILayout.BeginScrollView(mScrollPosition, AbstractWindow.Frame);
     {
         Color pushColor = GUI.contentColor;
         TextAnchor pushAlign = GUI.skin.button.alignment;
         GUI.skin.button.alignment = TextAnchor.MiddleLeft;
         foreach (var sat in RTCore.Instance.Satellites)
         {
             String text = sat.Name.Truncate(25);
             RTUtil.StateButton(text, mSelection == sat ? 1 : 0, 1, s =>
             {
                 mSelection = (s > 0) ? sat : null;
                 if (mSelection != null)
                 {
                     var newTarget = PlanetariumCamera.fetch.targets.FirstOrDefault(t => t != null && t.gameObject.name == sat.Name);
                     if (newTarget == null)
                     {
                         var vessel = sat.SignalProcessor.Vessel;
                         var scaledMovement = new GameObject().AddComponent<ScaledMovement>();
                         scaledMovement.tgtRef = vessel.transform;
                         scaledMovement.name = sat.Name;
                         scaledMovement.transform.parent = ScaledSpace.Instance.transform;
                         scaledMovement.vessel = vessel;
                         scaledMovement.type = MapObject.MapObjectType.VESSEL;
                         newTarget = scaledMovement;
                         PlanetariumCamera.fetch.SetTarget(PlanetariumCamera.fetch.AddTarget(newTarget));
                         PlanetariumCamera.fetch.targets.Remove(newTarget);
                     }
                     else
                     {
                         PlanetariumCamera.fetch.SetTarget(PlanetariumCamera.fetch.AddTarget(newTarget));
                     }
                     
                 }
             });
         }
         GUI.skin.button.alignment = pushAlign;
         GUI.contentColor = pushColor;
     }
     GUILayout.EndScrollView();
 }
예제 #9
0
 private void ChangeTarget(MapObject mo)
 {
     if (mo != null && mo.type == MapObject.MapObjectType.VESSEL)
     {
         mSatellite = RTCore.Instance.Satellites[mo.vessel];
     }
     else
     {
         mSatellite = null;
     }
     if (mConfig != null)
     {
         mConfig.Hide();
     }
     if (mSatellite != null)
     {
         mConfig = new SatelliteConfigWindow(null, new Rect(0, 0, 0, 0),
                                             WindowAlign.BottomRight, mSatellite);
     }
 }
 private void ChangeTarget(MapObject mo)
 {
     if (mo != null && mo.type == MapObject.MapObjectType.VESSEL) {
         mSatellite = RTCore.Instance.Satellites[mo.vessel];
     } else {
         mSatellite = null;
     }
     if (mConfig != null) {
         mConfig.Hide();
     }
     if (mSatellite != null) {
         mConfig = new SatelliteConfigWindow(null, new Rect(0,0,0,0),
             WindowAlign.BottomRight, mSatellite);
     }
 }
예제 #11
0
 public SatelliteConfigWindow(String name, Rect pos, WindowAlign align,
                              VesselSatellite satellite) : base(name, pos, align)
 {
     mSatellite = satellite;
 }
        private void OnRemoteTechUpdate(VesselSatellite s)
        {
            Initialize();

            // Don't care about unpowered satellites or satellites that don't call home
            if (!s.Powered || !API.HasConnectionToKSC(s.Guid))
            {
                return;
            }

            // Get info about the body being orbited
            CelestialBodyInfo orbitedCBI = celestialBodies[s.parentVessel.mainBody];

            // Find active
            foreach (IAntenna a in s.Antennas.Where(a => a.Activated))
            {
                // Targetting active vessel
                if (a.Omni > 0.0 || a.Target == NetworkManager.ActiveVesselGuid)
                {
                    orbitedCBI.activeRange = Math.Max(orbitedCBI.activeRange, Math.Max(a.Omni, a.Dish));
                }
            }

        }
 public SatelliteConfigWindow(String name, Rect pos, WindowAlign align,
         VesselSatellite satellite)
     : base(name, pos, align)
 {
     mSatellite = satellite;
 }
 protected void OnRemoteTechUpdate(VesselSatellite s)
 {
     CheckVessel(s.parentVessel);
 }