Esempio n. 1
0
        private void ParseWidgetContainer()
        {
            int count = _TrackingStation.listContainer.childCount;

            for (int i = _TrackingStation.listContainer.childCount - 1; i >= 0; i--)
            {
                Transform t = _TrackingStation.listContainer.GetChild(i);

                TrackingStationWidget widget = t.GetComponent <TrackingStationWidget>();

                if (widget != null && widget.vessel != null)
                {
                    _TrackedVesselWidgets.Add(widget);

                    if (!_VesselManeuvers.ContainsKey(widget.vessel))
                    {
                        bool maneuver = false;

                        double time = Vessel.GetNextManeuverTime(widget.vessel, out maneuver);

                        if (maneuver)
                        {
                            _VesselManeuvers.Add(widget.vessel, time);
                        }
                        else
                        {
                            _VesselManeuvers.Add(widget.vessel, -1000000000);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private void OnWidgetSelected(TrackingStationWidget widget)
        {
            if (_TrackingGroups == null || _TrackingGroups.Count <= 0)
            {
                return;
            }

            if (widget == null)
            {
                return;
            }
            else if (widget.vessel == null)
            {
                return;
            }

            for (int i = _TrackingGroups.Count - 1; i >= 0; i--)
            {
                IVesselItem vessel = _TrackingGroups[i].FindVessel(widget.vessel);

                if (vessel != null)
                {
                    vessel.OnVesselSelect();
                    break;
                }
            }
        }
Esempio n. 3
0
        public Tracking_Vessel(TrackingStationWidget widget)
        {
            _vesselWidget = widget;

            _iconSprite = GameObject.Instantiate(Tracking_Loader.IconPrefab);

            _iconSprite.SetType(widget.vessel.vesselType);
        }
Esempio n. 4
0
        private static void PostUpdate(TrackingStationWidget __instance)
        {
            if (MainSystem.NetworkState < ClientState.Connected)
            {
                return;
            }

            LabelEvent.onMapWidgetTextProcessed.Fire(__instance);
        }
Esempio n. 5
0
        private void OnWidgetAwaken(TrackingStationWidget widget)
        {
            if (_widgetAwakeSet || _NewTrackingList == null)
            {
                return;
            }

            _widgetAwakeSet = true;

            StartCoroutine(WidgetListReset(2));
        }
Esempio n. 6
0
        private void Awake()
        {
            _widget = GetComponent <TrackingStationWidget>();

            if (_widget == null)
            {
                return;
            }

            _widget.toggle.onValueChanged.AddListener(new UnityEngine.Events.UnityAction <bool>(OnToggle));

            Tracking_Controller.OnWidgetAwake.Invoke(_widget);
        }
Esempio n. 7
0
        public void OnMapWidgetTextProcessed(TrackingStationWidget widget)
        {
            if (widget.vessel == null)
            {
                return;
            }

            var owner = LockSystem.LockQuery.GetControlLockOwner(widget.vessel.id);

            if (!string.IsNullOrEmpty(owner))
            {
                widget.textName.text = $"({owner}) {widget.textName.text}";
            }
        }
Esempio n. 8
0
        protected void RenderWidgetColors()
        {
            this.needsWidgetColorRender = false;

            // apply shading to vessel icons
            if (this.currentMode == FilterMode.Maneuver)
            {
                for (var i = 0; i < this.vesselsSortedByNextManeuverNode.Count() - 1; ++i)
                {
                    Vessel vessel     = this.vesselsSortedByNextManeuverNode.ElementAt(i);
                    Vessel nextVessel = this.vesselsSortedByNextManeuverNode.ElementAt(i + 1);

                    TrackingStationWidget vesselWidget = this.GetWidgetForVessel(vessel);

                    double mnvTime1 = this.NextManeuverNodeForVessel(vessel).UT;
                    double mnvTime2 = this.NextManeuverNodeForVessel(nextVessel).UT;

                    // if two maneuver nodes are less than minimumManeuverDeltaT secs apart - yellow
                    if (mnvTime2 - mnvTime1 < ManeuverQueue.minimumManeuverDeltaT)
                    {
                        TrackingStationWidget nextVesselWidget = this.GetWidgetForVessel(nextVessel);


                        if (vesselWidget != null)
                        {
                            this.ApplyColorToVesselWidget(vesselWidget, this.nodeWarningColor);
                        }


                        if (nextVesselWidget != null)
                        {
                            this.ApplyColorToVesselWidget(nextVesselWidget, this.nodeWarningColor);
                        }
                    }

                    if (vesselWidget)
                    {
                        this.UpdateWidgetColorForCurrentTime(vesselWidget);
                    }
                }
            }
        }
Esempio n. 9
0
        protected void UpdateWidgetColorForCurrentTime(TrackingStationWidget widget)
        {
            ManeuverNode node = this.NextManeuverNodeForVessel(widget.vessel);

            if (node == null)
            {
                return;
            }

            double maneuverTime = node.UT;

            // if the maneuver node is less than 15mins away - yellow
            if (maneuverTime < Planetarium.GetUniversalTime() + ManeuverQueue.minimumManeuverDeltaT)
            {
                this.ApplyColorToVesselWidget(widget, this.nodeWarningColor);
            }

            // if the maneuver nodes is in the past - red
            if (maneuverTime < Planetarium.GetUniversalTime())
            {
                this.ApplyColorToVesselWidget(widget, this.nodePassedColor);
            }
        }
Esempio n. 10
0
        private void AddVessel(TrackingStationWidget widget)
        {
            Tracking_Vessel vessel = new Tracking_Vessel(widget);

            _vessels.Add(vessel);
        }
Esempio n. 11
0
        protected void ApplyColorToVesselWidget(TrackingStationWidget widget, Color color)
        {
            var image = (Image)widget.iconSprite.GetType().GetField("image", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(widget.iconSprite);

            image.color = color;
        }