private void updateVesselGUIRow(Vessel updatedVessel) { if (this.currentContentType != ContentType.VESSELS) { return; } CNCCommNetVessel thisVessel = (CNCCommNetVessel)updatedVessel.Connection; List <DialogGUIBase> rows = contentLayout.children; for (int i = 0; i < rows.Count; i++) { DialogGUIBase thisRow = rows[i]; if (thisRow.OptionText.Equals(updatedVessel.id.ToString())) { DialogGUILabel freqLabel = thisRow.children[2] as DialogGUILabel; freqLabel.SetOptionText(getFreqString(thisVessel.getFrequencyList(), thisVessel.getStrongestFrequency())); return; } } }
private DialogGUIHorizontalLayout createVesselRow(CNCCommNetVessel thisVessel) { //answer is from FlagBrowserGUIButton DialogGUIImage focusImage = new DialogGUIImage(new Vector2(32f, 32f), Vector2.zero, Color.white, focusTexture); DialogGUIHorizontalLayout imageBtnLayout = new DialogGUIHorizontalLayout(true, true, 0f, new RectOffset(1, 1, 1, 1), TextAnchor.MiddleCenter, new DialogGUIBase[] { focusImage }); DialogGUIButton focusButton = new DialogGUIButton("", delegate { vesselFocusClick(thisVessel.Vessel); }, 34, 34, false, new DialogGUIBase[] { imageBtnLayout }); DialogGUILabel vesselLabel = new DialogGUILabel(thisVessel.Vessel.GetDisplayName(), 160, 12); DialogGUILabel freqLabel = new DialogGUILabel(getFreqString(thisVessel.getFrequencyList(), thisVessel.getStrongestFrequency()), 160, 12); DialogGUILabel locationLabel = new DialogGUILabel(Localizer.Format("#CNC_ConstellationControl_locationLabel", thisVessel.Vessel.mainBody.GetDisplayName()), 100, 12); //Orbiting: <<1>> DialogGUIButton setupButton = new DialogGUIButton(Localizer.Format("#CNC_Generic_Setupbutton"), delegate { vesselSetupClick(thisVessel.Vessel); }, 70, 32, false); //"Setup" DialogGUIHorizontalLayout vesselGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleCenter, new DialogGUIBase[] { focusButton, vesselLabel, freqLabel, locationLabel, setupButton }); vesselGroup.SetOptionText(thisVessel.Vessel.id.ToString()); return(vesselGroup); }