protected override List <DialogGUIBase> drawContentComponents() { List <DialogGUIBase> listComponments = new List <DialogGUIBase>(); DialogGUILabel newColorLabel = new DialogGUILabel("<b> " + Localizer.Format("#CNC_ColorPicker_newColorLabel") + "</b>", 40, 12);//New newColorImage = new DialogGUIImage(new Vector2(30, 24), Vector2.zero, chosenColor, UIUtils.createAndColorize(30, 24, Color.white)); DialogGUILabel currentColorLabel = new DialogGUILabel("<b>" + Localizer.Format("#CNC_ColorPicker_CurrentColorLabel") + " </b>", 45, 12);//Current DialogGUIImage currentColorImage = new DialogGUIImage(new Vector2(30, 24), Vector2.zero, currentColor, UIUtils.createAndColorize(30, 24, Color.white)); listComponments.Add(new DialogGUIHorizontalLayout(true, false, 0, new RectOffset(), TextAnchor.MiddleCenter, new DialogGUIBase[] { new DialogGUISpace(40), newColorImage, newColorLabel, new DialogGUISpace(dialogWidth - 80 - 145), currentColorLabel, currentColorImage, new DialogGUISpace(40) })); colorPickerImage = new DialogGUIImage(new Vector2(displayTextureWidth, displayTextureHeight), Vector2.zero, Color.white, colorPickerTexture); DialogGUIImage hueSliderImage = new DialogGUIImage(new Vector2(displayTextureWidth, sliderHeight * 2), Vector2.zero, Color.white, renderHueSliderTexture()); DialogGUISlider hueSlider = new DialogGUISlider(() => hueValue, 0f, 1f, false, displayTextureWidth, sliderHeight, setHueValue); listComponments.Add(new DialogGUIVerticalLayout(true, false, 0, new RectOffset(), TextAnchor.UpperCenter, new DialogGUIBase[] { colorPickerImage, new DialogGUISpace(5f), hueSliderImage, hueSlider })); DialogGUILabel hexColorLabel = new DialogGUILabel("<b>" + Localizer.Format("#CNC_ColorPicker_HexColorLabel") + " <size=15>#</size></b>", true, false);//Or hex color colorHexInput = new DialogGUITextInput("", false, 6, setColorHexString, 75, 24); DialogGUIButton hexGoButton = new DialogGUIButton(Localizer.Format("#CNC_ColorPicker_HexGoButton"), delegate { this.readColorHexString(); }, 40, 24, false);//"Parse" listComponments.Add(new DialogGUIHorizontalLayout(true, false, 0, new RectOffset(0, 0, 0, 5), TextAnchor.MiddleCenter, new DialogGUIBase[] { new DialogGUISpace(5), hexColorLabel, colorHexInput, new DialogGUISpace(3), hexGoButton, new DialogGUISpace(5) })); return(listComponments); }
public static DialogGUISlider GUISlider(Func <Single> setValue, Single min, Single max, Boolean wholeNumbers, Single width, Single height, UnityAction <Single> setCallback, Modifier <DialogGUISlider> modifier = null) { DialogGUISlider element = new DialogGUISlider(setValue, min, max, wholeNumbers, width, height, setCallback); if (modifier != null) { element = modifier(element); } _elements.Add(element); return(element); }
private PopupDialog EditKerbalDialog() { List <DialogGUIBase> dialogElements = new List <DialogGUIBase>(); LockCamera(); dialogElements.Add(new DialogGUITextInput(kerbalToEdit.name, false, 100, SetName, 30)); DialogGUIBase[] horizontal = new DialogGUIBase[2]; horizontal[0] = new DialogGUILabel(() => "Gender: " + kerbalToEdit.gender); horizontal[1] = new DialogGUIButton("Change", SwitchGender, 50.0f, 20.0f, false); dialogElements.Add(new DialogGUIHorizontalLayout(horizontal)); dialogElements.Add(new DialogGUILabel(() => "Class: " + kerbalToEdit.trait)); dialogElements.Add(TraitDialogOptions(kerbalToEdit)); horizontal[0] = new DialogGUILabel(() => "Stupidity: " + kerbalToEdit.stupidity); horizontal[1] = new DialogGUISlider(() => kerbalToEdit.stupidity, 0.0f, 1.0f, false, 100.0f, 30.0f, newValue => { kerbalToEdit.stupidity = newValue; }); dialogElements.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(() => "Courage: " + kerbalToEdit.courage); horizontal[1] = new DialogGUISlider(() => kerbalToEdit.courage, 0.0f, 1.0f, false, 100.0f, 30.0f, newValue => { kerbalToEdit.courage = newValue; }); dialogElements.Add(new DialogGUIHorizontalLayout(horizontal)); dialogElements.Add(new DialogGUIButton("Done", () => ClearControlLock(true))); return(PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new MultiOptionDialog("FirstKerbaliserEditKerbalDialog", "", "Earn Your Stripes", UISkinManager.defaultSkin, new Rect(0.5f, 0.5f, 240.0f, 90.0f), dialogElements.ToArray()), false, UISkinManager.defaultSkin)); }
private PopupDialog RandomKerbalDialog() { List <DialogGUIBase> dialogElements = new List <DialogGUIBase>(); int numberOfRandomKerbals = 4; dialogElements.Add(new DialogGUIToggle(() => randomKerbals, "Generate Random Kerbals", b => { SwitchMode(); })); DialogGUIBase[] verticalArray = new DialogGUIBase[3]; verticalArray[0] = new DialogGUILabel(() => "Number of Kerbals: " + numberOfRandomKerbals); verticalArray[1] = new DialogGUISpace(30.0f); verticalArray[2] = new DialogGUISlider(() => numberOfRandomKerbals, 1, 10, true, 90.0f, 30.0f, newValue => { numberOfRandomKerbals = (int)newValue; }); dialogElements.Add(new DialogGUIHorizontalLayout(verticalArray)); verticalArray = new DialogGUIBase[2]; DialogGUIBase[] splitBox = new DialogGUIBase[2]; verticalArray[0] = new DialogGUIToggle(allowFemales, "Allow Female Kerbals", b => allowFemales = b); verticalArray[1] = new DialogGUIToggle(allowMales, "Allow Male Kerbals", b => allowMales = b); splitBox[0] = new DialogGUIVerticalLayout(verticalArray); splitBox[1] = new DialogGUIVerticalLayout(TraitDialogOptions()); dialogElements.Add(new DialogGUIHorizontalLayout(splitBox)); dialogElements.Add(new DialogGUISpace(5.0f)); dialogElements.Add(new DialogGUIButton("I'm Done", () => GenerateRandomKerbals(numberOfRandomKerbals), true)); return(PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new MultiOptionDialog("FirstKerbaliserRandomKerbals", "", "Earn Your Stripes", UISkinManager.defaultSkin, new Rect(0.5f, 0.5f, 280.0f, 210), dialogElements.ToArray()), false, UISkinManager.defaultSkin)); }
private PopupDialog GenerateDialog() { List <DialogGUIBase> dialog = new List <DialogGUIBase>(); DialogGUIBase[] horizontal = new DialogGUIBase[2]; if (page1) { dialog.Add(new DialogGUILabel("MAIN SETTINGS")); dialog.Add(new DialogGUIToggle(() => masterSwitch, "Mod Enabled", (bool b) => { ToggleMasterSwitch(); })); if (masterSwitch) { dialog.Add(new DialogGUIToggle(() => hardMode, "Penalty for not spending entire budget?", (bool b) => { hardMode = b; })); dialog.Add(new DialogGUIToggle(() => contractInterceptor, "Contracts pay rep instead of funds?", (bool b) => { contractInterceptor = b; })); dialog.Add(new DialogGUIToggle(() => coverCosts, "Always try to deduct costs from budget, even if current funds are higher?", (bool b) => { coverCosts = b; })); dialog.Add(new DialogGUIToggle(() => stopTimewarp, "Stop Timewarp / Set KAC Alarm on budget", (bool b) => { stopTimewarp = b; })); dialog.Add(new DialogGUIToggle(() => decayEnabled, "Decay Reputation each budget?", (bool b) => { decayEnabled = b; })); dialog.Add(new DialogGUIToggle(() => buildingCostsEnabled, "Enable maintenance costs for buildings", (bool b) => { buildingCostsEnabled = b; })); dialog.Add(new DialogGUIToggle(() => launchCostsEnabled, "Enable maintenance costs for launches", (bool b) => { launchCostsEnabled = b; })); } } else { dialog.Add(new DialogGUILabel("VALUES")); if (masterSwitch) { if (decayEnabled) { horizontal[0] = new DialogGUILabel(delegate { return("Decay per budget: " + repDecay + "%"); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(repDecay); }, 0.0f, 100.0f, true, 280.0f, 30.0f, (float newValue) => { repDecay = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); } horizontal[0] = new DialogGUILabel(delegate { return("Budget Interval: " + friendlyInterval + " days"); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(friendlyInterval); }, 0.0f, 427.0f, true, 280.0f, 30.0f, (float newValue) => { friendlyInterval = newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Budget Multiplier: " + multiplier); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(multiplier); }, 0.0f, 9999.0f, true, 280.0f, 30.0f, (float newValue) => { multiplier = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Unassigned Kerbal Base Wage: $" + availableWages); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(availableWages); }, 0.0f, 100000.0f, true, 280.0f, 30.0f, (float newValue) => { availableWages = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Assigned Kerbal Base Wage: $" + assignedWages); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(assignedWages); }, 0.0f, 100000.0f, true, 280.0f, 30.0f, (float newValue) => { assignedWages = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Monthly Cost per active vessel: $" + vesselCost); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(vesselCost); }, 0.0f, 100000.0f, true, 280.0f, 30.0f, (float newValue) => { vesselCost = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); if (buildingCostsEnabled) { horizontal[0] = new DialogGUILabel(delegate { return("Base Cost for SPH: $" + sphCost); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(sphCost); }, 0.0f, 10000.0f, true, 280.0f, 30.0f, (float newValue) => { sphCost = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Base Cost for Mission Control: $" + missionControlCost); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(missionControlCost); }, 0.0f, 10000.0f, true, 280.0f, 30.0f, (float newValue) => { missionControlCost = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Base Cost for Astronaut Complex: $" + astronautComplexCost); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(astronautComplexCost); }, 0.0f, 10000.0f, true, 280.0f, 30.0f, (float newValue) => { astronautComplexCost = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Base Cost for Administration: $" + administrationCost); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(administrationCost); }, 0.0f, 10000.0f, true, 280.0f, 30.0f, (float newValue) => { administrationCost = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Base Cost for VAB: $" + vabCost); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(vabCost); }, 0.0f, 10000.0f, true, 280.0f, 30.0f, (float newValue) => { vabCost = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Base Cost for Tracking Station: $" + trackingStationCost); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(trackingStationCost); }, 0.0f, 10000.0f, true, 280.0f, 30.0f, (float newValue) => { trackingStationCost = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Base Cost for R&D: $" + rndCost); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(rndCost); }, 0.0f, 10000.0f, true, 280.0f, 30.0f, (float newValue) => { rndCost = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Base Cost for Other Facilities (non-stock): $" + otherFacilityCost); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(otherFacilityCost); }, 0.0f, 10000.0f, true, 280.0f, 30.0f, (float newValue) => { otherFacilityCost = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); } if (launchCostsEnabled) { horizontal[0] = new DialogGUILabel(delegate { return("Base Cost Per Launch(SPH): $" + launchCostsSPH); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(launchCostsSPH); }, 0.0f, 10000.0f, true, 280.0f, 30.0f, (float newValue) => { launchCostsSPH = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); horizontal[0] = new DialogGUILabel(delegate { return("Base Cost Per Launch(VAB): $" + launchCostsVAB); }, false, false); horizontal[1] = new DialogGUISlider(delegate { return(launchCostsVAB); }, 0.0f, 10000.0f, true, 280.0f, 30.0f, (float newValue) => { launchCostsVAB = (int)newValue; }); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); } } } horizontal[0] = new DialogGUIButton("Switch Page", () => SwitchPage(), false); horizontal[1] = new DialogGUIButton("Close", () => CloseDialog(), false); dialog.Add(new DialogGUIHorizontalLayout(horizontal)); return(PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new MultiOptionDialog("MonthlyBudgetsDialog", "", "Monthly Budgets", UISkinManager.defaultSkin, geometry, dialog.ToArray()), true, UISkinManager.defaultSkin)); }