private void updateGroundStationGUIRow(string stationID)
        {
            if (this.currentContentType != ContentType.GROUNDSTATIONS)
            {
                return;
            }

            List <DialogGUIBase> rows = contentLayout.children;

            for (int i = 1; i < rows.Count; i++)
            {
                DialogGUIBase thisRow = rows[i];
                if (thisRow.OptionText.Equals(stationID))
                {
                    DialogGUIImage colorImage = thisRow.children[0] as DialogGUIImage;
                    DialogGUILabel nameLabel  = thisRow.children[1] as DialogGUILabel;
                    DialogGUILabel freqsLabel = thisRow.children[3] as DialogGUILabel;
                    CNCCommNetHome station    = CNCCommNetScenario.Instance.groundStations.Find(x => x.ID.Equals(stationID));
                    colorImage.uiItem.GetComponent <RawImage>().color = station.Color;
                    nameLabel.SetOptionText(station.stationName);
                    freqsLabel.SetOptionText(getFreqString(station.getFrequencyList()));

                    break;
                }
            }
        }
        private DialogGUIHorizontalLayout createGroundStationRow(CNCCommNetHome thisStation)
        {
            DialogGUIImage  colorImage       = new DialogGUIImage(new Vector2(16, 16), Vector2.one, thisStation.Color, groundstationTexture);
            DialogGUILabel  stationNameLabel = new DialogGUILabel(thisStation.stationName, 170, 12);
            DialogGUILabel  locationLabel    = new DialogGUILabel(Localizer.Format("#CNC_ConstellationControl_LatitudeAndLongitude", string.Format("{0:0.0}", thisStation.latitude), string.Format("{0:0.0}", thisStation.longitude)), 100, 24); //string.Format("LAT: \nLON: ", , )
            DialogGUILabel  freqsLabel       = new DialogGUILabel(getFreqString(thisStation.getFrequencyList()), 210, 12);
            DialogGUIButton updateButton     = new DialogGUIButton(Localizer.Format("#CNC_Generic_Editbutton"), delegate { groundstationEditClick(thisStation); }, 50, 32, false);                                                               //"Edit"

            DialogGUIBase[]           rowGUIBase         = new DialogGUIBase[] { colorImage, stationNameLabel, locationLabel, freqsLabel, updateButton };
            DialogGUIHorizontalLayout groundStationGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleCenter, rowGUIBase);

            groundStationGroup.SetOptionText(thisStation.ID); //for quick identification
            return(groundStationGroup);
        }
Exemple #3
0
        public GroundStationEditDialog(string title, CNCCommNetHome thisStation, Callback <string> updateCallback) : base("gsEdit",
                                                                                                                          title,
                                                                                                                          0.5f, //x
                                                                                                                          0.5f, //y
                                                                                                                          290,  //width
                                                                                                                          300,  //height
                                                                                                                          new DialogOptions[] { DialogOptions.HideCloseButton })
        {
            this.hostStation    = thisStation;
            this.updateCallback = updateCallback;
            this.description    = Localizer.Format("#CNC_GroundStationEdit_desc", thisStation.stationName);//string.Format("You are editing the ground station '{0}'.", )
            this.freqListShown.AddRange(thisStation.getFrequencyList());
            this.freqListShown.Sort();
            this.constellColor = thisStation.Color;

            this.GetInputLocks();
        }