public override List <DialogGUIBase> getContentComponents()
        {
            List <DialogGUIBase> layout = new List <DialogGUIBase>();

            DialogGUILabel msgLbl = new DialogGUILabel(Localizer.Format("#CNC_getContentCompon_msgLabel4"), 100, 32);//"Set up the master frequency in one go. All antennas will be assigned to this frequency, and Comm powers of those deployed antennas will be combined."

            layout.Add(new DialogGUIHorizontalLayout(true, false, 0, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { msgLbl }));

            DialogGUILabel freqLabel = new DialogGUILabel("<b>" + Localizer.Format("#CNC_Generic_FrequencyLabel") + "</b>", 52, 12);//Frequency

            frequencyInput = new DialogGUITextInput(CNCSettings.Instance.PublicRadioFrequency + "", false, CNCSettings.MaxDigits, setConstellFreq, 45, 25);
            DialogGUIToggle membershipToggle = new DialogGUIToggle(false, "", membershipFlagToggle);
            DialogGUILabel  membershipLabel  = new DialogGUILabel("<b>" + Localizer.Format("#CNC_getContentCompon_membershipLabel") + "</b>", 200, 12);//Talk to constellation members only

            DialogGUIHorizontalLayout constellationGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleCenter, new DialogGUIBase[] { freqLabel, frequencyInput, new DialogGUISpace(20), membershipToggle, membershipLabel });

            layout.Add(constellationGroup);

            constellationColorImage = new DialogGUIImage(new Vector2(32, 32), Vector2.one, Color.white, colorTexture);
            DialogGUILabel constNameLabel = new DialogGUILabel(getConstellationName, 200, 12);

            layout.Add(new DialogGUIHorizontalLayout(false, false, 0, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { constNameLabel, constellationColorImage }));

            DialogGUIButton           updateButton = new DialogGUIButton(Localizer.Format("#CNC_Generic_UpdateButton"), updateClick, false);  //"Update"
            DialogGUIButton           publicButton = new DialogGUIButton(Localizer.Format("#CNC_Generic_PublicButton"), defaultClick, false); //"Revert to public"
            DialogGUIHorizontalLayout actionGroup  = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleCenter, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), updateButton, publicButton, new DialogGUIFlexibleSpace() });

            layout.Add(actionGroup);

            return(layout);
        }
예제 #2
0
        private DialogGUIBase DrawProgressionTab()
        {
            if (this.progress.Count == 0)
            {
                return(new DialogGUILabel("No technologies are being researched here."));
            }

            DialogGUIBase[] rows = new DialogGUIBase[this.progress.Count + 1];
            rows[0] = new DialogGUIHorizontalLayout(
                new DialogGUILabel(TextEffects.DialogHeading("Researching:"), 160),
                new DialogGUILabel(TextEffects.DialogHeading("Progress:"), 70),
                new DialogGUILabel(TextEffects.DialogHeading("Notes:"), 140)
                );

            for (int i = 0; i < this.progress.Count; ++i)
            {
                var field = this.progress[i];

                string fieldName = field.IsAtMaxTier
                    ? field.Category.DisplayName
                    : $"{field.TierBeingResearched.DisplayName()} {field.Category.DisplayName}";
                string progressText = field.HasProgress ? $"{100 * field.AccumulatedKerbalDays / field.KerbalDaysRequired:N}%" : "-";
                string notes        = field.KerbalDaysContributedPerDay > 0
                    ? $"{(field.KerbalDaysRequired - field.AccumulatedKerbalDays) / field.KerbalDaysContributedPerDay:N} days to go"
                    : field.WhyBlocked;

                rows[i + 1] = new DialogGUIHorizontalLayout(
                    new DialogGUILabel(fieldName, 160),
                    new DialogGUILabel(progressText, 70),
                    new DialogGUILabel(notes, 140));
            }

            return(new DialogGUIVerticalLayout(rows));
        }
        protected override List <DialogGUIBase> drawContentComponents()
        {
            List <DialogGUIBase> listComponments = new List <DialogGUIBase>();

            listComponments.Add(new DialogGUILabel(Localizer.Format("#CNC_ConstellationControl_listComponments"), false, false));//"Manage communication networks of ground, air and space vessels."

            float           btnWidth         = (600 - 50) / 3;
            float           btnHeight        = 32;
            DialogGUIButton constellationBtn = new DialogGUIButton(Localizer.Format("#CNC_ConstellationControl_ConstellationBtn"), delegate { displayContentLayout(ContentType.CONSTELLATIONS); }, btnWidth, btnHeight, false); //"Constellations"
            DialogGUIButton groundstationBtn = new DialogGUIButton(Localizer.Format("#CNC_ConstellationControl_GroundstationBtn"), delegate { displayContentLayout(ContentType.GROUNDSTATIONS); }, btnWidth, btnHeight, false); //"Ground Stations"
            DialogGUIButton vesselBtn        = new DialogGUIButton(Localizer.Format("#CNC_ConstellationControl_VesselBtn"), delegate { displayContentLayout(ContentType.VESSELS); }, btnWidth, btnHeight, false);               //"CommNet Vessels"

            listComponments.Add(new DialogGUIHorizontalLayout(true, false, 0, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { constellationBtn, groundstationBtn, vesselBtn }));

            contentLayout = new DialogGUIVerticalLayout(true, false, 4, new RectOffset(5, 25, 5, 5), TextAnchor.UpperLeft, new DialogGUIBase[] { new DialogGUIContentSizer(ContentSizeFitter.FitMode.Unconstrained, ContentSizeFitter.FitMode.PreferredSize, true) });
            contentLayout.AddChildren(getVesselContentLayout().ToArray());
            this.currentContentType = ContentType.VESSELS;
            scrollArea = new CustomDialogGUIScrollList(new Vector2(550, 250), false, true, contentLayout);
            listComponments.Add(scrollArea);

            sortVesselBtnLayout = new DialogGUIHorizontalLayout(true, false, 0, new RectOffset(), TextAnchor.MiddleLeft, getVesselSortLayout());
            listComponments.Add(sortVesselBtnLayout);

            return(listComponments);
        }
        /// <summary>
        /// Create table row for displayed result
        /// </summary>
        /// <param name="result"></param>
        /// <returns>DialogGUIHorizontalLayout row</returns>
        private DialogGUIHorizontalLayout CreateListLayoutRow(DisplayedSystemCheckResult result)
        {
            DialogGUIHorizontalLayout row = null;

            if (result.Tooltip.Length > 0)
            {
                row = new DialogGUIHorizontalLayout(
                    new DialogGUILabel(result.Label + ":", 100f),
                    new DialogGUILabel(result.Text),
                    new DialogGUISpace(1f),
                    // Add a button with transparent background and label style just to display a tooltip when hovering over it
                    // Transparent sprite is needed to hide button borders
                    TooltipExtension.DeferTooltip(new DialogGUIButton(CommonWindowProperties.transparent, "(?)", () => { }, 17f, 18f, false)
                {
                    tooltipText = result.Tooltip, guiStyle = CommonWindowProperties.Style_Button_Label
                })
                    );
            }
            else
            {
                row = new DialogGUIHorizontalLayout(
                    new DialogGUILabel(result.Label + ":", 100f),
                    new DialogGUILabel(result.Text)
                    );
            }

            return(row);
        }
예제 #5
0
        /// <summary>
        /// Refresh list of vessels without reloading the list of controllers
        /// </summary>
        internal void RefreshVesselListLayout()
        {
            lock (refreshLock)                                            // Only one refresh at a time
            {
                Stack <Transform> stack = new Stack <Transform>();        // some data on hierarchy of GUI components
                stack.Push(vesselListLayout.uiItem.gameObject.transform); // need the reference point of the parent GUI component for position and size

                List <DialogGUIBase> rows = vesselListLayout.children;

                // Clear list. We are skiping DialogGUIContentSizer
                while (rows.Count > 1)
                {
                    DialogGUIBase child = rows.ElementAt(1);              // Get child
                    rows.RemoveAt(1);                                     // Drop row
                    child.uiItem.gameObject.DestroyGameObjectImmediate(); // Free memory up
                }

                // Add rows
                foreach (BVController controller in BonVoyage.Instance.BVControllers.Values)
                {
                    controller.OnStateChanged -= OnControllerStateChanged; // Clear possible event
                    DialogGUIHorizontalLayout row = CreateListLayoutRow(controller);
                    if (row != null)
                    {
                        rows.Add(row);
                        rows.Last().Create(ref stack, CommonWindowProperties.ActiveSkin); // required to force the GUI creation
                    }
                }
            }
        }
예제 #6
0
        /// <summary>
        /// Gets the dialog GUI for use with the stock popup dialog system.
        /// </summary>
        private DialogGUIBase[] GetDialogGUI()
        {
            // layout containing the settings gui objects
            DialogGUIVerticalLayout settingsLayout = new DialogGUIVerticalLayout(0f, 0f, 0f, new RectOffset(5, 25, 5, 5), TextAnchor.UpperLeft,
                                                                                 new DialogGUIToggleButton(tempConfig.discardDuplicates, "Automatically Discard Duplicates", value => tempConfig.discardDuplicates = value, h: 30f),
                                                                                 new DialogGUIToggleButton(tempConfig.saveExperimentsResultDialogPosition, "Save Experiements Result Dialog Position", value => tempConfig.saveExperimentsResultDialogPosition = value, h: 30f)
                                                                                 );

            // scroll list for containing the settings layout
            DialogGUIScrollList settingsScrollList = new DialogGUIScrollList(-Vector2.one, false, true, settingsLayout);

            // layout containing the bottom gui objects
            DialogGUIBase bottomLayout = new DialogGUIHorizontalLayout
                                             (TextAnchor.MiddleLeft,

                                             // version
                                             new DialogGUIFlexibleSpace(),
                                             new DialogGUILabel($"<color=#eee><i>v{Assembly.GetExecutingAssembly().GetName().Version}</i></color>"),
                                             new DialogGUIFlexibleSpace(),

                                             // buttons
                                             new DialogGUIButton("Apply", Apply, 80f, 30f, false),
                                             new DialogGUIButton("Accept", Accept, 80f, 30f, false),
                                             new DialogGUIButton("Close", Close, 80f, 30f, false)
                                             );

            return(new DialogGUIBase[2] {
                settingsScrollList, bottomLayout
            });
        }
        private DialogGUIHorizontalLayout createConstellationRow(Constellation thisConstellation)
        {
            Color color = Constellation.getColor(thisConstellation.frequency);

            DialogGUIImage        colorImage     = new DialogGUIImage(new Vector2(32, 32), Vector2.zero, thisConstellation.color, colorTexture);
            DialogGUILabel        constNameLabel = new DialogGUILabel(thisConstellation.name, 170, 12);
            DialogGUILabel        freqLabel      = new DialogGUILabel(Localizer.Format("#CNC_Generic_FrequencyLabel") + string.Format(": <color={0}>{1}</color>", UIUtils.colorToHex(color), thisConstellation.frequency), 100, 12); //Frequency
            DialogGUILabel        numSatsLabel   = new DialogGUILabel(Localizer.Format("#CNC_ConstellationControl_numSatsLabel", Constellation.countVessels(thisConstellation)), 75, 12);                                            //string.Format("{0} vessels", )
            DialogGUIButton       updateButton   = new DialogGUIButton(Localizer.Format("#CNC_Generic_Editbutton"), delegate { editConstellationClick(thisConstellation); }, 50, 32, false);                                         //"Edit"
            DialogGUIToggleButton toggleButton   = new DialogGUIToggleButton(thisConstellation.visibility, Localizer.Format("#CNC_Generic_Mapbutton"), delegate { toggleConstellationVisibility(thisConstellation); }, 45, 32);      //"Map"

            DialogGUIBase[] rowGUIBase = new DialogGUIBase[] { colorImage, constNameLabel, freqLabel, numSatsLabel, toggleButton, updateButton, null };
            if (thisConstellation.frequency == CNCSettings.Instance.PublicRadioFrequency)
            {
                rowGUIBase[rowGUIBase.Length - 1] = new DialogGUIButton(Localizer.Format("#CNC_Generic_Resetbutton"), resetPublicConstClick, 60, 32, false);//"Reset"
            }
            else
            {
                rowGUIBase[rowGUIBase.Length - 1] = new DialogGUIButton(Localizer.Format("#CNC_Generic_DeleteButton"), delegate { deleteConstellationClick(thisConstellation); }, 60, 32, false);//"Delete"
            }
            DialogGUIHorizontalLayout constellationGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleCenter, rowGUIBase);

            constellationGroup.SetOptionText(thisConstellation.frequency.ToString()); //for quick identification
            return(constellationGroup);
        }
        private DialogGUIBase DisplayStatDialog(float labelWidth, string title, System.Func <string> display)
        {
            var horizontal = new DialogGUIHorizontalLayout();

            horizontal.AddChild(new DialogGUILabel(false, () => { return(title); }, labelWidth));
            horizontal.AddChild(new DialogGUILabel(display));
            return(horizontal);
        }
예제 #9
0
        /// <summary>
        /// Get layout of the list of vessels
        /// </summary>
        /// <returns></returns>
        internal DialogGUIVerticalLayout GetVesselListLayout()
        {
            // Count disabled controllers
            int disabledControllersCount = 0;
            int controllersCount         = BonVoyage.Instance.BVControllers.Count();

            foreach (BVController controller in BonVoyage.Instance.BVControllers.Values)
            {
                if (controller.Shutdown)
                {
                    disabledControllersCount++;
                }
            }

            int listLength = 1;

            if (activeControllersChecked)
            {
                listLength += controllersCount - disabledControllersCount;
            }
            if (disabledControllersChecked)
            {
                listLength += disabledControllersCount;
            }

            DialogGUIBase[] list = new DialogGUIBase[listLength];
            list[0] = new DialogGUIContentSizer(UnityEngine.UI.ContentSizeFitter.FitMode.Unconstrained, UnityEngine.UI.ContentSizeFitter.FitMode.PreferredSize, true);

            if (listLength > 1) // anything is checked
            {
                int counter = 1;
                foreach (BVController controller in BonVoyage.Instance.BVControllers.Values)
                {
                    DialogGUIHorizontalLayout row = CreateListLayoutRow(controller);
                    if (row != null)
                    {
                        list[counter] = row;
                        counter++;
                        if (counter >= listLength) // break if we are at the end of list
                        {
                            break;
                        }
                    }
                }
            }

            vesselListLayout = new DialogGUIVerticalLayout(
                CommonWindowProperties.mainListMinWidth,
                CommonWindowProperties.mainListMinHeight,
                CommonWindowProperties.mainWindowSpacing,
                CommonWindowProperties.mainListPadding,
                TextAnchor.UpperLeft,
                list
                );

            return(vesselListLayout);
        }
        /// <summary>
        /// Action to create a new constellation and save it
        /// </summary>
        private void createNewConstellation(Constellation newConstellation)
        {
            DialogGUIHorizontalLayout newConstellationGUIRow = createConstellationRow(newConstellation);

            contentLayout.AddChild(newConstellationGUIRow);

            Stack <Transform> stack = new Stack <Transform>();

            stack.Push(contentLayout.uiItem.gameObject.transform); // transform effect: new row goes to the end of the list
            newConstellationGUIRow.Create(ref stack, HighLogic.UISkin);
        }
        public static DialogGUIHorizontalLayout GUIHorizontalLayout(Action optionBuilder, Modifier <DialogGUIHorizontalLayout> modifier = null)
        {
            DialogGUIHorizontalLayout element = new DialogGUIHorizontalLayout(Declare(optionBuilder));

            if (modifier != null)
            {
                element = modifier(element);
            }
            _elements.Add(element);
            return(element);
        }
        private DialogGUIBase SetFloatDialog(float labelWidth, string title, Func <string> currentValue,
                                             Func <string, string> processor, Func <float> incSize, Callback <float> increment)
        {
            var setDialog = new DialogGUIHorizontalLayout();

            setDialog.AddChild(new DialogGUILabel(false, () => { return(title); }, labelWidth));
            setDialog.AddChild(new DialogGUIButton("-", () => { increment(-incSize()); }, false));
            setDialog.AddChild(new DialogGUITextInput(currentValue(), false, 10, processor, currentValue, TMP_InputField.ContentType.DecimalNumber));
            setDialog.AddChild(new DialogGUIButton("+", () => { increment(incSize()); }, false));
            return(setDialog);
        }
        public static DialogGUIHorizontalLayout GUIHorizontalLayout(Single minWidth, Single minHeight, Single sp, RectOffset pad, TextAnchor achr, Action optionBuilder, Modifier <DialogGUIHorizontalLayout> modifier = null)
        {
            DialogGUIHorizontalLayout element = new DialogGUIHorizontalLayout(minWidth, minHeight, sp, pad, achr, Declare(optionBuilder));

            if (modifier != null)
            {
                element = modifier(element);
            }
            _elements.Add(element);
            return(element);
        }
        public static DialogGUIHorizontalLayout GUIHorizontalLayout(Single minWidth, Single minHeight, Action optionBuilder, Modifier <DialogGUIHorizontalLayout> modifier = null)
        {
            DialogGUIHorizontalLayout element = new DialogGUIHorizontalLayout(minWidth, minHeight, Declare(optionBuilder));

            if (modifier != null)
            {
                element = modifier(element);
            }
            _elements.Add(element);
            return(element);
        }
        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);
        }
        // TODO: Complete implementation
        private void showAddWindow()
        {
            // This is a list of content items to add to the dialog
            List <DialogGUIBase> dialog = new List <DialogGUIBase>();

            var                       noPad = new RectOffset();
            DialogGUIButton           b;
            DialogGUILabel            l;
            DialogGUIHorizontalLayout hl;
            DialogGUIVerticalLayout   vl;

            // Window Contents - scroll list of all available experiments with their descriptions
            vl         = new DialogGUIVerticalLayout(true, false);
            vl.padding = new RectOffset(6, 24, 6, 6); // Padding between border and contents - ensure we don't overlay content over scrollbar
            vl.spacing = 4;                           // Spacing between elements
            vl.AddChild(new DialogGUIContentSizer(ContentSizeFitter.FitMode.Unconstrained, ContentSizeFitter.FitMode.PreferredSize, true));

            int numExperiments = availableExperiments.Count;

            for (int idx = 0; idx < numExperiments; idx++)
            {
                var e = availableExperiments[idx];
                b      = new DialogGUIButton <ExperimentData>(e.getAbbreviation(), onAddExperiment, e, true);
                b.size = new Vector2(60, 30);
                l      = new DialogGUILabel(e.getDescription(), true, false);
                hl     = new DialogGUIHorizontalLayout(false, false, 4, new RectOffset(), TextAnchor.MiddleCenter, b, l);

                vl.AddChild(hl);
            }

            hl = new DialogGUIHorizontalLayout(true, true, new DialogGUIScrollList(Vector2.one, false, true, vl));
            dialog.Add(hl);

            // Add a centered "Cancel" button
            dialog.Add(new DialogGUIHorizontalLayout(new DialogGUIBase[]
            {
                new DialogGUIFlexibleSpace(),
                new DialogGUIButton("#ne_Cancel", null, true),
                new DialogGUIFlexibleSpace(),
            }));

            // Actually create and show the dialog
            Rect pos = new Rect(0.5f, 0.5f, 400, 400);

            PopupDialog.SpawnPopupDialog(
                new MultiOptionDialog("", "", "#ne_Add_Experiment", HighLogic.UISkin, pos, dialog.ToArray()),
                false, HighLogic.UISkin);
        }
        protected override List <DialogGUIBase> drawContentComponents()
        {
            List <DialogGUIBase> listComponments = new List <DialogGUIBase>();

            listComponments.Add(new DialogGUIHorizontalLayout(true, false, 0, new RectOffset(), TextAnchor.UpperCenter, new DialogGUIBase[] { new DialogGUILabel(this.description + "\n\n", false, false) }));

            //Current group
            DialogGUILabel currentLevelLabel = new DialogGUILabel("<b>" + Localizer.Format("#CNC_GroundStationBuild_currentLevelLabel") + "</b>");//Current tech level

            currentTexture = new DialogGUIImage(new Vector2(100, 100), Vector2.zero, Color.white, getLevelTexture(this.hostStation.TechLevel));
            DialogGUILabel          currentPower      = new DialogGUILabel(currentPowerFunc);
            DialogGUIVerticalLayout currentLevelGroup = new DialogGUIVerticalLayout(100, 100, 4, new RectOffset(), TextAnchor.MiddleCenter,
                                                                                    new DialogGUIBase[] { currentLevelLabel, currentTexture, currentPower });

            //Upgrade arrow
            DialogGUIImage arrowTexture = new DialogGUIImage(new Vector2(40, 40), Vector2.zero, Color.white, upgradeArrowTexture);

            //Next group
            DialogGUILabel nextLevelLabel = new DialogGUILabel("<b>" + Localizer.Format("#CNC_GroundStationBuild_nextLevelLabel") + "</b>");//Next tech level

            nextTexture = new DialogGUIImage(new Vector2(100, 100), Vector2.zero, Color.white, getLevelTexture((short)(this.hostStation.TechLevel + 1)));
            DialogGUILabel          nextPower      = new DialogGUILabel(nextPowerFunc);
            DialogGUIVerticalLayout nextLevelGroup = new DialogGUIVerticalLayout(100, 100, 4, new RectOffset(), TextAnchor.MiddleCenter,
                                                                                 new DialogGUIBase[] { nextLevelLabel, nextTexture, nextPower });

            listComponments.Add(new CustomDialogGUIScrollList(new Vector2(300 - 10, 150), false, false,
                                                              new DialogGUIHorizontalLayout(TextAnchor.MiddleCenter, new DialogGUIBase[] { currentLevelGroup, arrowTexture, nextLevelGroup })));

            //Requirements
            if (Funding.Instance != null) //only available in Career mode
            {
                DialogGUILabel costLabel      = new DialogGUILabel(costFunc);
                DialogGUILabel availableLabel = new DialogGUILabel(availableFunc);
                listComponments.Add(new DialogGUIHorizontalLayout(TextAnchor.MiddleCenter, new DialogGUIBase[] { costLabel }));
                listComponments.Add(new DialogGUIHorizontalLayout(TextAnchor.MiddleCenter, new DialogGUIBase[] { availableLabel }));
            }
            listComponments.Add(new DialogGUISpace(10));

            DialogGUIButton upgradeButton = new DialogGUIButton(Localizer.Format("#CNC_Generic_Upgradebutton"), onClickUpgrade, false);//Upgrade

            upgradeButton.OptionInteractableCondition = () => this.hostStation.TechLevel < 3 ? true : false;
            DialogGUIButton           closeButton = new DialogGUIButton(Localizer.Format("#CNC_Generic_Close"), delegate { this.dismiss(); }, false);//Close
            DialogGUIHorizontalLayout actionGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), upgradeButton, closeButton, new DialogGUIFlexibleSpace() });

            listComponments.Add(actionGroup);

            return(listComponments);
        }
예제 #18
0
            public IEnumerable <DialogGUIBase> GetTraitDescription(bool showParts, List <ProtoCrewMember> crew)
            {
                List <ExperienceTraitConfig> careers = GameDatabase.Instance.ExperienceConfigs
                                                       .GetTraitsWithEffect(this.Trait)
                                                       .Select(name => GameDatabase.Instance.ExperienceConfigs.GetExperienceTraitConfig(name))
                                                       .ToList();

                //  #Needed    Specialist   #Crew    Generalist   #Crew
                //  1.5        Miner        2        3*Engineer   0
                //    Scrounger Drill-

                var requirementRow = new DialogGUIHorizontalLayout();

                string quantity = UncrewedQuantity + DisabledQuantity > 0.001
                    ? $"{this.TotalQuantity - UncrewedQuantity - DisabledQuantity:N1}/{this.TotalQuantity:N1}"
                    : this.TotalQuantity.ToString("N1");

                if (UncrewedQuantity > 0.001)
                {
                    quantity = TextEffects.Red(quantity);
                }
                else if (DisabledQuantity > 0.001)
                {
                    quantity = TextEffects.Yellow(quantity);
                }
                requirementRow.AddChild(new DialogGUILabel(quantity, width: NumberColumnWidth));
                for (int i = 0; i < careers.Count; ++i)
                {
                    ExperienceEffectConfig effectConfig = careers[i].Effects.First(effect => effect.Name == this.Trait);
                    var levelString = effectConfig.Config.GetValue("level");
                    int numStars    = SkillLevel - int.Parse(levelString ?? "0");

                    requirementRow.AddChild(new DialogGUILabel(
                                                PksCrewRequirement.DescribeKerbalTrait(numStars, careers[i].Title), ProfessionColumnWidth));
                    requirementRow.AddChild(new DialogGUILabel(
                                                $"{crew.Count(c => c.trait == careers[i].Title && c.experienceLevel >= numStars)}",
                                                width: NumberColumnWidth));
                }
                yield return(requirementRow);

                if (showParts)
                {
                    var partsRow = new DialogGUIHorizontalLayout();
                    partsRow.AddChild(new DialogGUISpace(15));
                    partsRow.AddChild(new DialogGUILabel($"<I>{string.Join(", ", this.PartNames)}</I>"));
                    yield return(partsRow);
                }
            }
        /////////////////////
        // CONSTELLATIONS
        /////////////////////

        /////////////////////
        // GUI
        private List <DialogGUIBase> getConstellationContentLayout()
        {
            List <DialogGUIBase> constellationComponments = new List <DialogGUIBase>();

            DialogGUIButton           createButton  = new DialogGUIButton("New constellation", newConstellationClick, false);
            DialogGUIHorizontalLayout creationGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), createButton, new DialogGUIFlexibleSpace() });

            constellationComponments.Add(creationGroup);

            for (int i = 0; i < CNCCommNetScenario.Instance.constellations.Count; i++)
            {
                constellationComponments.Add(createConstellationRow(CNCCommNetScenario.Instance.constellations[i]));
            }

            return(constellationComponments);
        }
예제 #20
0
        /// <summary>
        /// This function gets called when the user clicks the "New Game" button in the main menu
        /// </summary>
        void OnNewGameBtnTap()
        {
            FieldInfo createGameDialog = typeof(MainMenu).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(f => f.FieldType == typeof(PopupDialog));

            if (createGameDialog == null)
            {
                return;
            }
            PopupDialog dialog = createGameDialog.GetValue(menu) as PopupDialog;

            if (dialog == null)
            {
                return;
            }
            if (dialog.dialogToDisplay == null)
            {
                return;
            }
            DialogGUIHorizontalLayout d1 = dialog.dialogToDisplay.Options[0] as DialogGUIHorizontalLayout;

            if (d1 == null)
            {
                return;
            }
            DialogGUIVerticalLayout d2 = d1.children[0] as DialogGUIVerticalLayout;

            if (d2 == null)
            {
                return;
            }

            // Create the new layout
            DialogGUIHorizontalLayout layout = new DialogGUIHorizontalLayout(new DialogGUIBase[]
            {
                new DialogGUILabel(Localizer.Format("#LOC_PlanetaryDiversity_SeedParams_Seed"), true, false),
                new DialogGUIFlexibleSpace(),
                new DialogGUITextInput(Seed ?? "", Localizer.Format("#LOC_PlanetaryDiversity_SeedParams_Placeholder"), false, 32, (s) => Seed = s, 200f, 30f)
            });

            d2.children.Insert(1, layout);
            d1.children[0] = d2;
            dialog.dialogToDisplay.Options[0] = d1;
            PopupDialog newDialog = PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), dialog.dialogToDisplay, false, menu.guiSkinDef.SkinDef, true, "");

            dialog.Dismiss();
            createGameDialog.SetValue(menu, newDialog);
        }
예제 #21
0
 private void createHeaders()
 {
     ColumnHeaders = new DialogGUIHorizontalLayout();
     for (int i = 0; i < Columns.Length; ++i)
     {
         ColumnDefinition col = Columns[i];
         // Skip columns that require an active vessel if we don't have one
         if (col.vesselSpecific && FlightGlobals.ActiveVessel == null)
         {
             continue;
         }
         if (col.requiresPatchedConics && (
                 !patchedConicsUnlocked() ||
                 !vesselControllable(FlightGlobals.ActiveVessel) ||
                 model.origin == null ||
                 Landed(model.origin)
                 ))
         {
             continue;
         }
         float width = 0;
         for (int span = 0; span < col.headerColSpan; ++span)
         {
             width += Columns[i + span].width;
         }
         if (width > 0)
         {
             // Add in the spacing gaps that got left out from colspanning
             width += (col.headerColSpan - 1) * spacing;
             if (col.header != "")
             {
                 ColumnHeaders.AddChild(headerButton(
                                            col.header + columnSortIndicator(col),
                                            col.headerStyle, Localizer.Format("astrogator_columnHeaderTooltip"), width, rowHeight, () => {
                     SortClicked(col.sortKey);
                 }
                                            ));
             }
             else
             {
                 ColumnHeaders.AddChild(new DialogGUISpace(width));
             }
         }
     }
     AddChild(ColumnHeaders);
 }
        private void Show(Action <PartSetupDialog> onSet)
        {
            this.CalculateTierLabels(false);
            var tierSelector = new DialogGUIVerticalLayout(this.tierToggles);

            DialogGUIBase mainForm;

            if (this.Product.ResearchCategory.Type == ProductionRestriction.Space)
            {
                mainForm = tierSelector;
            }
            else
            {
                var bodySelector = new DialogGUIVerticalLayout(
                    ColonizationResearchScenario.Instance.UnlockedBodies
                    .Select(b => new DialogGUIToggle(() => b == this.Body, b, isSelected => { if (isSelected)
                                                                                              {
                                                                                                  this.SetBody(b);
                                                                                              }
                                                     })).ToArray());

                mainForm = new DialogGUIHorizontalLayout(
                    tierSelector,
                    new DialogGUISpace(50),
                    bodySelector);
            }

            PopupDialog.SpawnPopupDialog(
                new MultiOptionDialog(
                    "Whatsthisdoeven",
                    "", // This actually shows up on the screen as a sort of a wierd-looking subtitle
                    "Tiered Part Configuration",
                    HighLogic.UISkin,
                    new DialogGUIVerticalLayout(
                        mainForm,
                        new DialogGUIHorizontalLayout(
                            new DialogGUIButton("Setup This Part", () => { this.Applicability = DecisionImpact.ThisPart; onSet(this); }, dismissOnSelect: true),
                            new DialogGUIFlexibleSpace(),
                            new DialogGUIButton("Setup All Parts", () => { this.Applicability = DecisionImpact.AllParts; onSet(this); }, dismissOnSelect: true),
                            new DialogGUIFlexibleSpace(),
                            new DialogGUIButton("Cancel", () => { }, dismissOnSelect: true)))),
                persistAcrossScenes: false,
                skin: HighLogic.UISkin,
                isModal: true,
                titleExtra: "TITLE EXTRA!");
        }
예제 #23
0
        protected override List <DialogGUIBase> drawContentComponents()
        {
            List <DialogGUIBase> listComponments = new List <DialogGUIBase>();

            listComponments.Add(new DialogGUIHorizontalLayout(true, false, 0, new RectOffset(), TextAnchor.UpperCenter, new DialogGUIBase[] { new DialogGUILabel(this.description + "\n\n", false, false) }));

            DialogGUILabel nameLabel = new DialogGUILabel("<b>" + Localizer.Format("#CNC_Generic_nameLabel") + "</b>", 30, 12);//Name

            nameInput = new DialogGUITextInput(this.hostStation.stationName, false, CNCSettings.MaxLengthName, setNameInput, 145, 25);
            DialogGUIButton           defaultButton = new DialogGUIButton(Localizer.Format("#CNC_Generic_Resetbutton"), defaultNameClick, 40, 25, false);//"Reset"
            DialogGUIHorizontalLayout nameGroup     = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleCenter, new DialogGUIBase[] { nameLabel, nameInput, new DialogGUIFlexibleSpace(), defaultButton });

            listComponments.Add(nameGroup);

            DialogGUILabel freqLabel = new DialogGUILabel("<b>" + Localizer.Format("#CNC_GroundStationEdit_freqLabel") + "</b>", 85, 12);//New frequency

            frequencyInput = new DialogGUITextInput("", false, CNCSettings.MaxDigits, setFreqInput, 60, 25);
            DialogGUIButton addButton = new DialogGUIButton(Localizer.Format("#CNC_Generic_Addbutton"), addClick, 40, 25, false);//"Add"

            stationColorImage = new DialogGUIImage(new Vector2(16f, 16f), Vector2.zero, this.hostStation.Color, CNCCommNetHome.getGroundStationTexture(this.hostStation.TechLevel));
            DialogGUIHorizontalLayout imageBtnLayout = new DialogGUIHorizontalLayout(true, true, 0f, new RectOffset(5, 5, 5, 5), TextAnchor.MiddleCenter, new DialogGUIBase[] { stationColorImage });
            DialogGUIButton           colorButton    = new DialogGUIButton("", colorEditClick, 26, 26, false, new DialogGUIBase[] { imageBtnLayout });

            DialogGUIHorizontalLayout freqGRoup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleCenter, new DialogGUIBase[] { freqLabel, frequencyInput, addButton, new DialogGUISpace(50), colorButton });

            listComponments.Add(freqGRoup);

            //Prepare a list container for the GUILayout rows
            DialogGUIBase[] rows = new DialogGUIBase[this.hostStation.getFrequencyList().Count + 1];
            rows[0] = new DialogGUIContentSizer(ContentSizeFitter.FitMode.Unconstrained, ContentSizeFitter.FitMode.PreferredSize, true);
            for (int i = 0; i < this.freqListShown.Count; i++)
            {
                rows[i + 1] = createConstellationRow(this.freqListShown[i]);
            }

            frequencyRowLayout = new DialogGUIVerticalLayout(10, 100, 0, new RectOffset(5, 25, 5, 5), TextAnchor.UpperLeft, rows);
            listComponments.Add(new CustomDialogGUIScrollList(new Vector2(240, 100), false, true, frequencyRowLayout));

            DialogGUIButton           updateButton = new DialogGUIButton(Localizer.Format("#CNC_Generic_UpdateButton"), updateAction, false);                 //"Update"
            DialogGUIButton           cancelButton = new DialogGUIButton(Localizer.Format("#CNC_Generic_CancelButton"), delegate { this.dismiss(); }, false); //"Cancel"
            DialogGUIHorizontalLayout actionGroup  = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), updateButton, cancelButton, new DialogGUIFlexibleSpace() });

            listComponments.Add(actionGroup);

            return(listComponments);
        }
        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);
        }
예제 #25
0
        private PopupDialog GenerateDialog()
        {
            List <DialogGUIBase> guiItems = new List <DialogGUIBase>();

            if (EditorLogic.fetch == null || EditorLogic.fetch.ship == null)
            {
                guiItems.Add(new DialogGUILabel("No Vessel Detected"));
            }
            else
            {
                guiItems.Add(new DialogGUILabel(_utilities.SystemNotes, _utilities.CreateNoteStyle()));
                guiItems.Add(new DialogGUILabel(_utilities.Warnings, _utilities.CreateNoteStyle()));
                DialogGUIBase[] vertical   = new DialogGUIBase[_utilities.Planets.Count];
                DialogGUIBase[] horizontal = new DialogGUIBase[2];
                horizontal[0] = new DialogGUIToggle(() => _returnTrip, "Return Trip?", delegate { SetReturnTrip(); });
                horizontal[1] = new DialogGUIToggle(() => payloadOnly, "Payload Only", delegate { SetPayoadOnly(); });
                guiItems.Add(new DialogGUIHorizontalLayout(horizontal));
                for (int i = 0; i < _utilities.Planets.Count; i++)
                {
                    PlanetDeltaV p = _utilities.Planets.ElementAt(i);
                    horizontal    = new DialogGUIBase[4];
                    horizontal[0] = new DialogGUILabel(p.GetName(), _utilities.GenerateStyle(-1, false));
                    horizontal[1] = GetDeltaVString(p, "Flyby: ");
                    horizontal[2] = GetDeltaVString(p, "Orbiting: ");
                    if (p.IsHomeWorld && p.SynchronousDv != -1)
                    {
                        horizontal[3] = GetDeltaVString(p, "Synchronous Orbit: ");
                    }
                    else
                    {
                        horizontal[3] = GetDeltaVString(p, "Landing: ");
                    }
                    vertical[i] = new DialogGUIHorizontalLayout(horizontal);
                }
                DialogGUIVerticalLayout layout = new DialogGUIVerticalLayout(vertical);
                guiItems.Add(new DialogGUIScrollList(-Vector2.one, false, true, layout));
            }
            guiItems.Add(new DialogGUILabel("*Assuming craft has enough chutes"));
            guiItems.Add(new DialogGUIButton("Close", () => _utilities.CloseDialog(_uiDialog), false));
            return(PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
                                                new MultiOptionDialog("WhereCanIGoDialog", "", "Where Can I Go", UISkinManager.defaultSkin,
                                                                      _geometry,
                                                                      guiItems.ToArray()), false, UISkinManager.defaultSkin));
        }
        private void showLabWindow()
        {
            // This is a list of content items to add to the dialog
            List <DialogGUIBase> dialog = new List <DialogGUIBase>();

            dialog.Add(new DialogGUILabel("#ne_Chooose_Lab"));

            // Build a button list of all available experiments with their descriptions
            int numLabs = availableLabs.Count;

            DialogGUIBase[] scrollList = new DialogGUIBase[numLabs + 1];
            scrollList[0] = new DialogGUIContentSizer(ContentSizeFitter.FitMode.Unconstrained, ContentSizeFitter.FitMode.PreferredSize, true);
            for (int idx = 0; idx < numLabs; idx++)
            {
                var lab    = availableLabs[idx];
                var button = new DialogGUIButton <Lab>(lab.abbreviation, installExperimentInLab, lab, true);
                button.size = new Vector2(60, 30);
                var label = new DialogGUILabel(lab.GetInfo(), true, true);
                var h     = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.UpperLeft, new DialogGUIBase[] { button, label });

                scrollList[idx + 1] = h;
            }

#if true
            dialog.Add(new DialogGUIScrollList(new Vector2(200, 300), false, true, //Vector2.one, false, true,
                                               new DialogGUIVerticalLayout(10, 100, 4, new RectOffset(6, 24, 10, 10), TextAnchor.UpperLeft, scrollList)
                                               ));
#else
            dialog.Add(new DialogGUIVerticalLayout(10, 100, 4, new RectOffset(6, 24, 10, 10), TextAnchor.MiddleLeft, scrollList));
#endif

            // Add a centered "Cancel" button
            dialog.Add(new DialogGUIHorizontalLayout(new DialogGUIBase[]
            {
                new DialogGUIFlexibleSpace(),
                new DialogGUIButton("#ne_Cancel", null, true),
                new DialogGUIFlexibleSpace(),
            }));

            // Actually create and show the dialog
            PopupDialog.SpawnPopupDialog(
                new MultiOptionDialog("", "", "#ne_Install_Experiment", HighLogic.UISkin, dialog.ToArray()),
                false, HighLogic.UISkin);
        }
예제 #27
0
        /// <summary>
        /// Create table row for displayed result
        /// </summary>
        /// <param name="result"></param>
        /// <returns>DialogGUIHorizontalLayout row</returns>
        private DialogGUIHorizontalLayout CreateListLayoutRow(DisplayedSystemCheckResult[] result)
        {
            DialogGUIHorizontalLayout row = new DialogGUIHorizontalLayout();

            for (int i = 0; i < result.Length; i++)
            {
                if (result[i].Toggle)
                {
                    row.AddChild(
                        (result[i].Tooltip.Length > 0)
                        ?
                        TooltipExtension.DeferTooltip(new DialogGUIToggle(result[i].GetToggleValue, result[i].Text, result[i].ToggleSelectedCallback)
                    {
                        tooltipText = result[i].Tooltip
                    })
                        :
                        new DialogGUIToggle(result[i].GetToggleValue, result[i].Text, result[i].ToggleSelectedCallback)
                        );
                }
                else
                {
                    row.AddChild(new DialogGUILabel(result[i].Label + ":", 100f));
                    if (result[i].Text.Length > 0)
                    {
                        row.AddChild(new DialogGUILabel(result[i].Text));
                    }
                    if (result[i].Tooltip.Length > 0)
                    {
                        if (result[i].Text.Length > 0)
                        {
                            row.AddChild(new DialogGUISpace(1f));
                        }
                        // Add a button with transparent background and label style just to display a tooltip when hovering over it
                        // Transparent sprite is needed to hide button borders
                        row.AddChild(TooltipExtension.DeferTooltip(new DialogGUIButton(CommonWindowProperties.transparent, "(?)", () => { }, 17f, 18f, false)
                        {
                            tooltipText = result[i].Tooltip, guiStyle = CommonWindowProperties.Style_Button_Label
                        }));
                    }
                }
            }

            return(row);
        }
        /////////////////////
        // GROUND STATIONS
        /////////////////////

        /////////////////////
        // GUI
        private List <DialogGUIBase> getGroundstationContentLayout()
        {
            List <DialogGUIBase> stationComponments = new List <DialogGUIBase>();

            //toggle button for ground station markers
            DialogGUIToggleButton     toggleStationButton = new DialogGUIToggleButton(CNCCommNetScenario.Instance.hideGroundStations, Localizer.Format("#CNC_ConstellationControl_toggleStationButton"), delegate(bool b) { CNCCommNetScenario.Instance.hideGroundStations = !CNCCommNetScenario.Instance.hideGroundStations; }, 60, 25);//"Hide all station markers"
            DialogGUIHorizontalLayout toggleStationGroup  = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleCenter, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), toggleStationButton, new DialogGUIFlexibleSpace() });

            stationComponments.Add(toggleStationGroup);

            List <DialogGUIHorizontalLayout> rows = populateGroundStationRows();

            for (int i = 0; i < rows.Count; i++)
            {
                stationComponments.Add(rows[i]);
            }

            return(stationComponments);
        }
        /////////////////////
        // CONSTELLATIONS
        /////////////////////

        /////////////////////
        // GUI
        private List <DialogGUIBase> getConstellationContentLayout()
        {
            List <DialogGUIBase> constellationComponments = new List <DialogGUIBase>();

            DialogGUIButton           createButton      = new DialogGUIButton(Localizer.Format("#CNC_ConstellationControl_createButton"), newConstellationClick, false);                                                                                                                                               //"New constellation"
            DialogGUIToggleButton     toggleOrbitButton = new DialogGUIToggleButton(CNCSettings.Instance.LegacyOrbitLineColor, Localizer.Format("#CNC_ConstellationControl_toggleOrbitButton"), delegate(bool b) { CNCSettings.Instance.LegacyOrbitLineColor = !CNCSettings.Instance.LegacyOrbitLineColor; }, 35, 25); //"Toggle colorized orbits"
            DialogGUIHorizontalLayout creationGroup     = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), createButton, new DialogGUIFlexibleSpace() });
            DialogGUIHorizontalLayout toggleGroup       = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), toggleOrbitButton, new DialogGUIFlexibleSpace() });

            constellationComponments.Add(creationGroup);
            constellationComponments.Add(toggleGroup);

            for (int i = 0; i < CNCCommNetScenario.Instance.constellations.Count; i++)
            {
                constellationComponments.Add(createConstellationRow(CNCCommNetScenario.Instance.constellations[i]));
            }

            return(constellationComponments);
        }
예제 #30
0
        protected override List <DialogGUIBase> drawContentComponents()
        {
            string constellName = "";
            short  constellFreq = 0;

            if (this.existingConstellation != null)
            {
                constellName = this.existingConstellation.name;
                constellFreq = this.existingConstellation.frequency;
            }

            List <DialogGUIBase> listComponments = new List <DialogGUIBase>();

            listComponments.Add(new DialogGUIHorizontalLayout(true, false, 0, new RectOffset(), TextAnchor.UpperCenter, new DialogGUIBase[] { new DialogGUILabel(this.description + "\n\n", false, false) }));

            DialogGUILabel nameLabel = new DialogGUILabel("<b>" + Localizer.Format("#CNC_Generic_nameLabel") + "</b>", 60, 12);//Name

            nameInput = new DialogGUITextInput(constellName, false, CNCSettings.MaxLengthName, setConstellName, 170, 25);
            DialogGUIHorizontalLayout nameGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { nameLabel, nameInput });

            listComponments.Add(nameGroup);

            DialogGUILabel freqLabel = new DialogGUILabel("<b>" + Localizer.Format("#CNC_Generic_FrequencyLabel") + "</b>", 60, 12);//Frequency

            frequencyInput = new DialogGUITextInput(constellFreq.ToString(), false, CNCSettings.MaxDigits, setConstellFreq, 55, 25);

            constellationColorImage = new DialogGUIImage(new Vector2(32f, 32f), Vector2.zero, this.constellColor, colorTexture);
            DialogGUIHorizontalLayout imageBtnLayout = new DialogGUIHorizontalLayout(true, true, 0f, new RectOffset(1, 1, 1, 1), TextAnchor.MiddleCenter, new DialogGUIBase[] { constellationColorImage });
            DialogGUIButton           colorButton    = new DialogGUIButton("", colorEditClick, 34, 34, false, new DialogGUIBase[] { imageBtnLayout });

            DialogGUIHorizontalLayout freqColorGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { freqLabel, frequencyInput, new DialogGUISpace(30), colorButton, new DialogGUISpace(30) });

            listComponments.Add(freqColorGroup);

            DialogGUIButton           updateButton = new DialogGUIButton(this.actionButtonText, actionClick, false);
            DialogGUIButton           cancelButton = new DialogGUIButton(Localizer.Format("#CNC_Generic_CancelButton"), delegate { this.dismiss(); }, false);//"Cancel"
            DialogGUIHorizontalLayout actionGroup  = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), updateButton, cancelButton, new DialogGUIFlexibleSpace() });

            listComponments.Add(actionGroup);

            return(listComponments);
        }