public override List <DialogGUIBase> getContentComponents() { List <DialogGUIBase> layout = new List <DialogGUIBase>(); DialogGUILabel msgLbl = new DialogGUILabel(Localizer.Format("#CNC_getContentCompon_msgLabel2"), 100, 16);//"Change the frequency of each antenna." layout.Add(new DialogGUIHorizontalLayout(true, false, 0, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { msgLbl })); freqInputArray = new DialogGUITextInput[antennas.Count]; DialogGUIVerticalLayout nameColumn = new DialogGUIVerticalLayout(false, false, 0, new RectOffset(), TextAnchor.MiddleLeft); DialogGUIVerticalLayout useColumn = new DialogGUIVerticalLayout(false, false, 0, new RectOffset(), TextAnchor.MiddleLeft); DialogGUIVerticalLayout freqColumn = new DialogGUIVerticalLayout(false, false, 0, new RectOffset(), TextAnchor.MiddleLeft); DialogGUIVerticalLayout freqInputColumn = new DialogGUIVerticalLayout(false, false, 0, new RectOffset(), TextAnchor.MiddleLeft); DialogGUIVerticalLayout updateColumn = new DialogGUIVerticalLayout(false, false, 0, new RectOffset(), TextAnchor.MiddleLeft); for (int i = 0; i < antennas.Count; i++) { int index = i;//convert to solid-reference variable for delegate block CNCAntennaPartInfo antennaInfo = antennas[i]; DialogGUILabel nameLabel = new DialogGUILabel(Localizer.Format("#CNC_getContentCompon_nameLabel", antennaInfo.name), style); nameLabel.size = new Vector2(200, 32); //string.Format("Name: {0}",) DialogGUILabel usageLabel = new DialogGUILabel(Localizer.Format("#CNC_getContentCompon_usageLabel") + ": " + (antennaInfo.inUse ? "<color=green>" + Localizer.Format("#CNC_Generic_Yes") + "</color>" : "<color=red>" + Localizer.Format("#CNC_Generic_No") + "</color>"), style); usageLabel.size = new Vector2(75, 32); //In UseYesNo DialogGUILabel freqLabel = new DialogGUILabel(Localizer.Format("#CNC_Generic_FrequencyLabel"), style); freqLabel.size = new Vector2(65, 32); //"Frequency" freqInputArray[i] = new DialogGUITextInput(antennaInfo.frequency.ToString(), false, CNCSettings.MaxDigits, setAntennaFreq, 65, 25); DialogGUIButton updateButton = new DialogGUIButton(Localizer.Format("#CNC_Generic_UpdateButton"), delegate { updateAntennaFreq(antennaInfo, freqInputArray[index].uiItem.GetComponent <TMP_InputField>().text); }, 70, 25, false); //"Update" nameColumn.AddChild(nameLabel); useColumn.AddChild(usageLabel); freqColumn.AddChild(freqLabel); freqInputColumn.AddChild(new DialogGUISpace(3)); freqInputColumn.AddChild(freqInputArray[index]); freqInputColumn.AddChild(new DialogGUISpace(4)); updateColumn.AddChild(new DialogGUISpace(3)); updateColumn.AddChild(updateButton); updateColumn.AddChild(new DialogGUISpace(4)); } layout.Add(new DialogGUIHorizontalLayout(true, false, 0, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { nameColumn, useColumn, freqColumn, freqInputColumn, updateColumn })); return(layout); }
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); }
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>Name</b>", 30, 12); nameInput = new DialogGUITextInput(this.hostStation.stationName, false, CNCSettings.MaxLengthName, setNameInput, 145, 25); DialogGUIButton defaultButton = new DialogGUIButton("Reset", defaultNameClick, 40, 25, false); 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>New frequency</b>", 85, 12); frequencyInput = new DialogGUITextInput("", false, CNCSettings.MaxDigits, setFreqInput, 60, 25); DialogGUIButton addButton = new DialogGUIButton("Add", addClick, 40, 25, false); stationColorImage = new DialogGUIImage(new Vector2(16f, 16f), Vector2.zero, this.hostStation.Color, groundstationTexture); 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("Update", updateAction, false); DialogGUIButton cancelButton = new DialogGUIButton("Cancel", delegate { this.dismiss(); }, false); DialogGUIHorizontalLayout actionGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), updateButton, cancelButton, new DialogGUIFlexibleSpace() }); listComponments.Add(actionGroup); return listComponments; }
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>Name</b>", 40, 12); nameInput = new DialogGUITextInput(antennaModule.Name, false, CNCSettings.MaxLengthName, setNameInput, 145, 25); DialogGUIButton defaultButton = new DialogGUIButton("Reset", defaultNameClick, 45, 25, false); DialogGUIHorizontalLayout nameGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleCenter, new DialogGUIBase[] { nameLabel, nameInput, defaultButton }); listComponments.Add(nameGroup); DialogGUILabel freqLabel = new DialogGUILabel("<b>Frequency</b>", 52, 12); frequencyInput = new DialogGUITextInput(antennaModule.Frequency.ToString(), false, CNCSettings.MaxDigits, setConstellFreq, 45, 25); DialogGUIButton publicButton = new DialogGUIButton("Revert to public", defaultFreqClick, 100, 25, false); DialogGUIHorizontalLayout freqGRoup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleCenter, new DialogGUIBase[] { freqLabel, frequencyInput, publicButton }); listComponments.Add(freqGRoup); constellationColorImage = new DialogGUIImage(new Vector2(32, 32), Vector2.one, Color.white, colorTexture); DialogGUILabel constNameLabel = new DialogGUILabel(getConstellationName, 200, 12); DialogGUIHorizontalLayout constellationGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(5, 25, 5, 5), TextAnchor.MiddleCenter, new DialogGUIBase[] { constellationColorImage, constNameLabel }); listComponments.Add(new DialogGUIScrollList(new Vector2(200, 40), false, false, constellationGroup)); DialogGUIButton updateButton = new DialogGUIButton("Update", updateAction, false); DialogGUIButton cancelButton = new DialogGUIButton("Cancel", delegate { this.dismiss(); }, false); DialogGUIHorizontalLayout actionGroup = new DialogGUIHorizontalLayout(true, false, 4, new RectOffset(), TextAnchor.MiddleLeft, new DialogGUIBase[] { new DialogGUIFlexibleSpace(), updateButton, cancelButton, new DialogGUIFlexibleSpace() }); listComponments.Add(actionGroup); return(listComponments); }
public void Show(Part part) { if (IsVisible()) { Hide(); newPart = part; return; } LoadCfgFile(); this.part = part; DialogGUISpace spaceAxisLeft = new DialogGUISpace(30f); DialogGUISpace spaceAxisCenter = new DialogGUISpace(115f); DialogGUISpace spaceAxisRight = new DialogGUISpace(120f); DialogGUISpace spaceTransform = new DialogGUISpace(15f); DialogGUIButton buttonReferenceSpace = new DialogGUIButton(GetReferenceSpaceLabel, ToggleReferenceSpace, 100f, LINE_HEIGHT, false); DialogGUILabel labelX = new DialogGUILabel(FormatLabel("X"), LINE_HEIGHT); DialogGUILabel labelY = new DialogGUILabel(FormatLabel("Y"), LINE_HEIGHT); DialogGUILabel labelZ = new DialogGUILabel(FormatLabel("Z"), LINE_HEIGHT); DialogGUILabel labelMinusPlus = new DialogGUILabel(FormatLabel("- / +"), LINE_HEIGHT); DialogGUILabel labelPosition = new DialogGUILabel(FormatLabel("Position"), LABEL_WIDTH); DialogGUILabel labelRotation = new DialogGUILabel(FormatLabel("Rotation"), LABEL_WIDTH); DialogGUITextInput inputPositionX = new DialogGUITextInput("", false, MAXLENGTH, delegate(string value) { return(SetPosition(0, value)); }, delegate { return(GetPosition(0)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputPositionY = new DialogGUITextInput("", false, MAXLENGTH, delegate(string value) { return(SetPosition(1, value)); }, delegate { return(GetPosition(1)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputPositionZ = new DialogGUITextInput("", false, MAXLENGTH, delegate(string value) { return(SetPosition(2, value)); }, delegate { return(GetPosition(2)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputDeltaPosition = new DialogGUITextInput("", false, MAXLENGTH, delegate(string value) { return(SetDeltaPosition(value)); }, delegate { return(deltaPosition.ToString(FORMAT)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputRotationX = new DialogGUITextInput("", false, MAXLENGTH, delegate(string value) { return(SetRotation(0, value)); }, delegate { return(GetRotation(0)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputRotationY = new DialogGUITextInput("", false, MAXLENGTH, delegate(string value) { return(SetRotation(1, value)); }, delegate { return(GetRotation(1)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputRotationZ = new DialogGUITextInput("", false, MAXLENGTH, delegate(string value) { return(SetRotation(2, value)); }, delegate { return(GetRotation(2)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputDeltaRotation = new DialogGUITextInput("", false, MAXLENGTH, delegate(string value) { return(SetDeltaRotation(value)); }, delegate { return(deltaRotation.ToString(FORMAT)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUIButton buttonPosXMinus = new DialogGUIButton("-", delegate { Translate(0, true); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonPosXPlus = new DialogGUIButton("+", delegate { Translate(0, false); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonPosYMinus = new DialogGUIButton("-", delegate { Translate(1, true); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonPosYPlus = new DialogGUIButton("+", delegate { Translate(1, false); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonPosZMinus = new DialogGUIButton("-", delegate { Translate(2, true); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonPosZPlus = new DialogGUIButton("+", delegate { Translate(2, false); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonDeltaPosDiv = new DialogGUIButton("/10", delegate { SetDeltaPosition((deltaPosition / 10).ToString()); }, 35f, LINE_HEIGHT, false); DialogGUIButton buttonDeltaPosMult = new DialogGUIButton("×10", delegate { SetDeltaPosition((deltaPosition * 10).ToString()); }, 35f, LINE_HEIGHT, false); DialogGUIButton buttonRotXMinus = new DialogGUIButton("-", delegate { Rotate(0, true); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonRotXPlus = new DialogGUIButton("+", delegate { Rotate(0, false); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonRotYMinus = new DialogGUIButton("-", delegate { Rotate(1, true); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonRotYPlus = new DialogGUIButton("+", delegate { Rotate(1, false); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonRotZMinus = new DialogGUIButton("-", delegate { Rotate(2, true); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonRotZPlus = new DialogGUIButton("+", delegate { Rotate(2, false); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonDeltaRotDiv = new DialogGUIButton("/10", delegate { SetDeltaRotation((deltaRotation / 10).ToString()); }, 35f, LINE_HEIGHT, false); DialogGUIButton buttonDeltaRotMult = new DialogGUIButton("×10", delegate { SetDeltaRotation((deltaRotation * 10).ToString()); }, 35f, LINE_HEIGHT, false); DialogGUIToggleButton toggleButtonAttachment = new DialogGUIToggleButton(showAttachment, "Attachment Rules", delegate { ToggleAttachment(); }, -1, LINE_HEIGHT); DialogGUIToggleButton toggleButtonColliders = new DialogGUIToggleButton(showColliders, "Colliders", delegate { ToggleColliders(); }, -1, LINE_HEIGHT); DialogGUISpace spaceToCenter = new DialogGUISpace(-1); DialogGUIButton buttonClose = new DialogGUIButton("Close", delegate { CloseWindow(); }, 140f, LINE_HEIGHT, true); List <DialogGUIBase> dialogGUIBaseList = new List <DialogGUIBase> { new DialogGUIHorizontalLayout(TextAnchor.MiddleCenter, buttonReferenceSpace, spaceAxisLeft, labelX, spaceAxisCenter, labelY, spaceAxisCenter, labelZ, spaceAxisRight, labelMinusPlus), new DialogGUIHorizontalLayout(TextAnchor.MiddleCenter, labelPosition, buttonPosXMinus, inputPositionX, buttonPosXPlus, spaceTransform, buttonPosYMinus, inputPositionY, buttonPosYPlus, spaceTransform, buttonPosZMinus, inputPositionZ, buttonPosZPlus, spaceTransform, buttonDeltaPosDiv, inputDeltaPosition, buttonDeltaPosMult), new DialogGUIHorizontalLayout(TextAnchor.MiddleCenter, labelRotation, buttonRotXMinus, inputRotationX, buttonRotXPlus, spaceTransform, buttonRotYMinus, inputRotationY, buttonRotYPlus, spaceTransform, buttonRotZMinus, inputRotationZ, buttonRotZPlus, spaceTransform, buttonDeltaRotDiv, inputDeltaRotation, buttonDeltaRotMult) }; if (part.isCompund) { DialogGUILabel labelCompound = new DialogGUILabel(FormatLabel("Anchor"), LABEL_WIDTH); DialogGUIButton buttonCompound = new DialogGUIButton(GetCompoundLabel, ToggleCompound, 100f, LINE_HEIGHT, false); dialogGUIBaseList.Add(new DialogGUIHorizontalLayout(TextAnchor.MiddleCenter, labelCompound, buttonCompound)); } dialogGUIBaseList.Add(new DialogGUIHorizontalLayout(toggleButtonAttachment, toggleButtonColliders)); dialogGUIBaseList.Add(new DialogGUIHorizontalLayout(spaceToCenter, buttonClose, spaceToCenter)); string windowTitle = FormatLabel("Precise Editor - ") + part.partInfo.title; dialog = new MultiOptionDialog("partEditionDialog", "", windowTitle, HighLogic.UISkin, dialogRect, new DialogGUIVerticalLayout(dialogGUIBaseList.ToArray())); popupDialog = PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), dialog, false, HighLogic.UISkin, false); popupDialog.onDestroy.AddListener(SaveWindowPosition); popupDialog.onDestroy.AddListener(RemoveControlLock); popupDialog.onDestroy.AddListener(OnPopupDialogDestroy); SetTextInputColor(inputPositionX, axisLines.red); SetTextInputColor(inputPositionY, axisLines.green); SetTextInputColor(inputPositionZ, axisLines.cyan); SetTextInputColor(inputRotationX, axisLines.red); SetTextInputColor(inputRotationY, axisLines.green); SetTextInputColor(inputRotationZ, axisLines.cyan); SetTextInputListeners(inputPositionX); SetTextInputListeners(inputPositionY); SetTextInputListeners(inputPositionZ); SetTextInputListeners(inputRotationX); SetTextInputListeners(inputRotationY); SetTextInputListeners(inputRotationZ); SetTextInputListeners(inputDeltaPosition); SetTextInputListeners(inputDeltaRotation); if (showAttachment) { attachmentWindow.Show(part); } if (showColliders) { colliderWindow.Show(part); } axisLines.Show(part, referenceSpace, compoundTargetSelected); }
/// <summary> /// Spawns the window. This will destroy an existing window from this object. /// </summary> /// <returns>The KSP <see cref="PopupDialog"/> spawned.</returns> public PopupDialog SpawnPopupDialog() { useSelfAxesToggle[0] = grapher.useSelfAxes[0]; useSelfAxesToggle[1] = grapher.useSelfAxes[1]; useSelfAxesToggle[2] = grapher.useSelfAxes[2]; OnAutoToggle(0, useSelfAxesToggle[0]); OnAutoToggle(1, useSelfAxesToggle[1]); OnAutoToggle(2, useSelfAxesToggle[2]); xMinInput = new DialogGUITextInput(xMinStr, false, 10, (str) => xMinStr = str, 25) { OptionInteractableCondition = () => !useSelfAxesToggle[0] }; xMaxInput = new DialogGUITextInput(xMaxStr, false, 10, (str) => xMaxStr = str, 25) { OptionInteractableCondition = () => !useSelfAxesToggle[0] }; yMinInput = new DialogGUITextInput(yMinStr, false, 10, (str) => yMinStr = str, 25) { OptionInteractableCondition = () => !useSelfAxesToggle[1] }; yMaxInput = new DialogGUITextInput(yMaxStr, false, 10, (str) => yMaxStr = str, 25) { OptionInteractableCondition = () => !useSelfAxesToggle[1] }; zMinInput = new DialogGUITextInput(zMinStr, false, 10, (str) => zMinStr = str, 25) { OptionInteractableCondition = () => !useSelfAxesToggle[2] }; zMaxInput = new DialogGUITextInput(zMaxStr, false, 10, (str) => zMaxStr = str, 25) { OptionInteractableCondition = () => !useSelfAxesToggle[2] }; grapher.ValueChangedExternally += OnValueChanged; List <DialogGUIBase> dialog = new List <DialogGUIBase> { //new DialogGUIToggleButton(() => useSelfAxesToggle[0] && useSelfAxesToggle[1] && useSelfAxesToggle[2], "Auto Axes", (value) => useSelfAxesToggle[0] = useSelfAxesToggle[1] = useSelfAxesToggle[2] = value, h: 20), //new DialogGUISpace(5), new DialogGUILabel("X-Axis"), new DialogGUIToggle(() => useSelfAxesToggle[0], "Auto", (value) => { OnAutoToggle(0, value); SetText(xMinInput, xMinStr); SetText(xMaxInput, xMaxStr); }, h: 20), new DialogGUIHorizontalLayout(new DialogGUILabel(String.Format("Min:\t")), xMinInput), new DialogGUIHorizontalLayout(new DialogGUILabel(String.Format("Max:\t")), xMaxInput), new DialogGUISpace(5), new DialogGUILabel("Y-Axis"), new DialogGUIToggle(() => useSelfAxesToggle[1], "Auto", (value) => { OnAutoToggle(1, value); SetText(yMinInput, yMinStr); SetText(yMaxInput, yMaxStr); }, h: 20), new DialogGUIHorizontalLayout(new DialogGUILabel(String.Format("Min:\t")), yMinInput), new DialogGUIHorizontalLayout(new DialogGUILabel(String.Format("Max:\t")), yMaxInput), new DialogGUISpace(5), new DialogGUIButton("Apply", () => { float[] temp = new float[6]; if (float.TryParse(xMinStr, out temp[0]) && float.TryParse(xMaxStr, out temp[1])) { setXmin = temp[0]; setXmax = temp[1]; } if (float.TryParse(yMinStr, out temp[2]) && float.TryParse(yMaxStr, out temp[3])) { setYmin = temp[2]; setYmax = temp[3]; } if (float.TryParse(zMinStr, out temp[4]) && float.TryParse(zMaxStr, out temp[5])) { setZmin = temp[4]; setZmax = temp[5]; } if (!useSelfAxesToggle[0]) { grapher.SetAxesLimits(0, setXmin, setXmax, true); } else { grapher.ReleaseAxesLimits(0, true); } if (!useSelfAxesToggle[1]) { grapher.SetAxesLimits(1, setYmin, setYmax, true); } else { grapher.ReleaseAxesLimits(1, true); } if (!useSelfAxesToggle[2]) { grapher.SetAxesLimits(2, setZmin, setZmax, true); } else { grapher.ReleaseAxesLimits(2, true); } if (grapher.RecalculateLimits()) { grapher.OnAxesChanged(); } }, false), new DialogGUIButton("Close", () => { grapher.ValueChangedExternally -= OnValueChanged; }, true) }; if (grapher.Any(g => g is IGraphable3)) { dialog.InsertRange(10, new List <DialogGUIBase> { new DialogGUILabel("Z-Axis"), new DialogGUIToggle(() => useSelfAxesToggle[2], "Auto", (value) => { OnAutoToggle(2, value); SetText(zMinInput, zMinStr); SetText(zMaxInput, zMaxStr); }, h: 20), new DialogGUIHorizontalLayout(new DialogGUILabel(String.Format("Min:\t")), zMinInput), new DialogGUIHorizontalLayout(new DialogGUILabel(String.Format("Max:\t")), zMaxInput), new DialogGUISpace(5) }); } return(PopupDialog.SpawnPopupDialog(new Vector2(0, 1), new Vector2(0, 1), new MultiOptionDialog("KWTAxesSettings", "", "Axes Settings", UISkinManager.defaultSkin, 150, dialog.ToArray()), false, UISkinManager.defaultSkin)); }
private static void SetText(DialogGUITextInput field, string text) { field.uiItem.GetComponent <TMPro.TMP_InputField>().text = text; }
public void Show(Part part) { this.part = part; DismissDialog(); const string TITLE = "Precise Editor - Part Edition Window"; const string MESSAGE = ""; const int MAXLENGTH = 14; const float LABEL_WIDTH = 100; const float TRANSFORM_SPACER_WIDTH = 15f; Vector3 position = part.transform.position; Vector3 localPosition = part.transform.localPosition; Quaternion rotation = part.transform.rotation; Quaternion localRotation = part.transform.localRotation; DialogGUILabel labelPartName = new DialogGUILabel("Part Name", LABEL_WIDTH, LINE_HEIGHT); DialogGUILabel labelPartNameValue = new DialogGUILabel(delegate { return(this.GetPartName()); }, 250, LINE_HEIGHT); DialogGUILabel labelAxisLeftSpacer = new DialogGUILabel("", 160f, LINE_HEIGHT); DialogGUILabel labelAxisCenterSpacer = new DialogGUILabel("", 115f, LINE_HEIGHT); DialogGUILabel labelX = new DialogGUILabel("X", LINE_HEIGHT, LINE_HEIGHT); DialogGUILabel labelY = new DialogGUILabel("Y", LINE_HEIGHT, LINE_HEIGHT); DialogGUILabel labelZ = new DialogGUILabel("Z", LINE_HEIGHT, LINE_HEIGHT); DialogGUILabel labelPosition = new DialogGUILabel("Absolute Position", LABEL_WIDTH, LINE_HEIGHT); DialogGUILabel labelLocalPosition = new DialogGUILabel("Local Position", LABEL_WIDTH, LINE_HEIGHT); DialogGUILabel labelRotation = new DialogGUILabel("Absolute Rotation", LABEL_WIDTH, LINE_HEIGHT); DialogGUILabel labelLocalRotation = new DialogGUILabel("Local Rotation", LABEL_WIDTH, LINE_HEIGHT); DialogGUILabel labelDeltaPosition = new DialogGUILabel("-/+ Position", LABEL_WIDTH, LINE_HEIGHT); DialogGUILabel labelDeltaAngle = new DialogGUILabel("-/+ Angle", LABEL_WIDTH, LINE_HEIGHT); DialogGUILabel labelTransformSpacer = new DialogGUILabel("", TRANSFORM_SPACER_WIDTH, LINE_HEIGHT); DialogGUILabel labelCloseButtonSpacer = new DialogGUILabel("", 185f, LINE_HEIGHT); DialogGUITextInput inputPositionX = new DialogGUITextInput(position.x.ToString(FORMAT_POSITION), false, MAXLENGTH, delegate(string value) { return(this.SetPosition(0, value, Space.World)); }, delegate { return(this.GetPosition(0, Space.World)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputPositionY = new DialogGUITextInput(position.y.ToString(FORMAT_POSITION), false, MAXLENGTH, delegate(string value) { return(this.SetPosition(1, value, Space.World)); }, delegate { return(this.GetPosition(1, Space.World)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputPositionZ = new DialogGUITextInput(position.z.ToString(FORMAT_POSITION), false, MAXLENGTH, delegate(string value) { return(this.SetPosition(2, value, Space.World)); }, delegate { return(this.GetPosition(2, Space.World)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputLocalPositionX = new DialogGUITextInput(localPosition.x.ToString(FORMAT_POSITION), false, MAXLENGTH, delegate(string value) { return(this.SetPosition(0, value, Space.Self)); }, delegate { return(this.GetPosition(0, Space.Self)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputLocalPositionY = new DialogGUITextInput(localPosition.y.ToString(FORMAT_POSITION), false, MAXLENGTH, delegate(string value) { return(this.SetPosition(1, value, Space.Self)); }, delegate { return(this.GetPosition(1, Space.Self)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputLocalPositionZ = new DialogGUITextInput(localPosition.z.ToString(FORMAT_POSITION), false, MAXLENGTH, delegate(string value) { return(this.SetPosition(2, value, Space.Self)); }, delegate { return(this.GetPosition(2, Space.Self)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputRotationX = new DialogGUITextInput(rotation.eulerAngles.x.ToString(FORMAT_ANGLE), false, MAXLENGTH, delegate(string value) { return(this.SetRotation(0, value, Space.World)); }, delegate { return(this.GetRotation(0, Space.World)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputRotationY = new DialogGUITextInput(rotation.eulerAngles.y.ToString(FORMAT_ANGLE), false, MAXLENGTH, delegate(string value) { return(this.SetRotation(1, value, Space.World)); }, delegate { return(this.GetRotation(1, Space.World)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputRotationZ = new DialogGUITextInput(rotation.eulerAngles.z.ToString(FORMAT_ANGLE), false, MAXLENGTH, delegate(string value) { return(this.SetRotation(2, value, Space.World)); }, delegate { return(this.GetRotation(2, Space.World)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputLocalRotationX = new DialogGUITextInput(localRotation.eulerAngles.x.ToString(FORMAT_ANGLE), false, MAXLENGTH, delegate(string value) { return(this.SetRotation(0, value, Space.Self)); }, delegate { return(this.GetRotation(0, Space.Self)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputLocalRotationY = new DialogGUITextInput(localRotation.eulerAngles.y.ToString(FORMAT_ANGLE), false, MAXLENGTH, delegate(string value) { return(this.SetRotation(1, value, Space.Self)); }, delegate { return(this.GetRotation(1, Space.Self)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputLocalRotationZ = new DialogGUITextInput(localRotation.eulerAngles.z.ToString(FORMAT_ANGLE), false, MAXLENGTH, delegate(string value) { return(this.SetRotation(2, value, Space.Self)); }, delegate { return(this.GetRotation(2, Space.Self)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputDeltaPosition = new DialogGUITextInput(this.deltaPosition.ToString(FORMAT_POSITION), false, MAXLENGTH, delegate(string value) { return(this.SetDeltaPosition(value)); }, delegate { return(this.deltaPosition.ToString(FORMAT_POSITION)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUITextInput inputDeltaRotation = new DialogGUITextInput(this.deltaRotation.ToString(FORMAT_POSITION), false, MAXLENGTH, delegate(string value) { return(this.SetDeltaRotation(value)); }, delegate { return(this.deltaRotation.ToString(FORMAT_POSITION)); }, TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); DialogGUIButton buttonPosXMinus = new DialogGUIButton("-", delegate { this.Translate(0, true, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonPosXPlus = new DialogGUIButton("+", delegate { this.Translate(0, false, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonPosYMinus = new DialogGUIButton("-", delegate { this.Translate(1, true, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonPosYPlus = new DialogGUIButton("+", delegate { this.Translate(1, false, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonPosZMinus = new DialogGUIButton("-", delegate { this.Translate(2, true, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonPosZPlus = new DialogGUIButton("+", delegate { this.Translate(2, false, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocPosXMinus = new DialogGUIButton("-", delegate { this.Translate(0, true, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocPosXPlus = new DialogGUIButton("+", delegate { this.Translate(0, false, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocPosYMinus = new DialogGUIButton("-", delegate { this.Translate(1, true, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocPosYPlus = new DialogGUIButton("+", delegate { this.Translate(1, false, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocPosZMinus = new DialogGUIButton("-", delegate { this.Translate(2, true, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocPosZPlus = new DialogGUIButton("+", delegate { this.Translate(2, false, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonRotXMinus = new DialogGUIButton("-", delegate { this.Rotate(0, true, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonRotXPlus = new DialogGUIButton("+", delegate { this.Rotate(0, false, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonRotYMinus = new DialogGUIButton("-", delegate { this.Rotate(1, true, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonRotYPlus = new DialogGUIButton("+", delegate { this.Rotate(1, false, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonRotZMinus = new DialogGUIButton("-", delegate { this.Rotate(2, true, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonRotZPlus = new DialogGUIButton("+", delegate { this.Rotate(2, false, Space.World); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocRotXMinus = new DialogGUIButton("-", delegate { this.Rotate(0, true, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocRotXPlus = new DialogGUIButton("+", delegate { this.Rotate(0, false, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocRotYMinus = new DialogGUIButton("-", delegate { this.Rotate(1, true, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocRotYPlus = new DialogGUIButton("+", delegate { this.Rotate(1, false, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocRotZMinus = new DialogGUIButton("-", delegate { this.Rotate(2, true, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonLocRotZPlus = new DialogGUIButton("+", delegate { this.Rotate(2, false, Space.Self); }, LINE_HEIGHT, LINE_HEIGHT, false); DialogGUIButton buttonClose = new DialogGUIButton("Close Window", delegate { SaveWindowPosition(); }, 140f, LINE_HEIGHT, true); List <DialogGUIBase> dialogGUIBaseList = new List <DialogGUIBase> { new DialogGUIHorizontalLayout(labelPartName, labelPartNameValue), new DialogGUIHorizontalLayout(labelAxisLeftSpacer, labelX, labelAxisCenterSpacer, labelY, labelAxisCenterSpacer, labelZ), new DialogGUIHorizontalLayout(labelPosition, buttonPosXMinus, inputPositionX, buttonPosXPlus, labelTransformSpacer, buttonPosYMinus, inputPositionY, buttonPosYPlus, labelTransformSpacer, buttonPosZMinus, inputPositionZ, buttonPosZPlus), new DialogGUIHorizontalLayout(labelLocalPosition, buttonLocPosXMinus, inputLocalPositionX, buttonLocPosXPlus, labelTransformSpacer, buttonLocPosYMinus, inputLocalPositionY, buttonLocPosYPlus, labelTransformSpacer, buttonLocPosZMinus, inputLocalPositionZ, buttonLocPosZPlus), new DialogGUIHorizontalLayout(labelRotation, buttonRotXMinus, inputRotationX, buttonRotXPlus, labelTransformSpacer, buttonRotYMinus, inputRotationY, buttonRotYPlus, labelTransformSpacer, buttonRotZMinus, inputRotationZ, buttonRotZPlus), new DialogGUIHorizontalLayout(labelLocalRotation, buttonLocRotXMinus, inputLocalRotationX, buttonLocRotXPlus, labelTransformSpacer, buttonLocRotYMinus, inputLocalRotationY, buttonLocRotYPlus, labelTransformSpacer, buttonLocRotZMinus, inputLocalRotationZ, buttonLocRotZPlus), new DialogGUIHorizontalLayout(labelDeltaPosition, inputDeltaPosition, labelTransformSpacer, labelDeltaAngle, inputDeltaRotation) }; List <DialogGUITextInput> partModuleInputList = new List <DialogGUITextInput>(); foreach (var tweakable in part.GetTweakables()) { var labelField = new DialogGUILabel(tweakable.Label, LABEL_WIDTH, LINE_HEIGHT); var inputField = new DialogGUITextInput( tweakable.GetValue(), false, MAXLENGTH, value => tweakable.SetValueWithSymmetry(value), () => tweakable.GetValue(), TMP_InputField.ContentType.DecimalNumber, LINE_HEIGHT); dialogGUIBaseList.Add(new DialogGUIHorizontalLayout(labelField, inputField)); partModuleInputList.Add(inputField); } dialogGUIBaseList.Add(new DialogGUIFlexibleSpace()); dialogGUIBaseList.Add(new DialogGUIHorizontalLayout(labelCloseButtonSpacer, buttonClose)); MultiOptionDialog dialog = new MultiOptionDialog("partEditionDialog", MESSAGE, TITLE, HighLogic.UISkin, this.dialogRect, new DialogGUIFlexibleSpace(), new DialogGUIVerticalLayout(dialogGUIBaseList.ToArray())); this.popupDialog = PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), dialog, false, HighLogic.UISkin, false); this.popupDialog.OnDismiss = this.SaveWindowPosition; this.popupDialog.onDestroy.AddListener(this.OnPopupDialogDestroy); TMP_InputField tmp_InputPositionX = inputPositionX.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputPositionY = inputPositionY.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputPositionZ = inputPositionZ.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputLocalPositionX = inputLocalPositionX.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputLocalPositionY = inputLocalPositionY.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputLocalPositionZ = inputLocalPositionZ.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputRotationX = inputRotationX.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputRotationY = inputRotationY.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputRotationZ = inputRotationZ.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputLocalRotationX = inputLocalRotationX.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputLocalRotationY = inputLocalRotationY.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputLocalRotationZ = inputLocalRotationZ.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputDeltaPosition = inputDeltaPosition.uiItem.GetComponent <TMP_InputField>(); TMP_InputField tmp_InputDeltaRotation = inputDeltaRotation.uiItem.GetComponent <TMP_InputField>(); tmp_InputPositionX.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputPositionX.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputPositionY.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputPositionY.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputPositionZ.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputPositionZ.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputLocalPositionX.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputLocalPositionX.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputLocalPositionY.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputLocalPositionY.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputLocalPositionZ.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputLocalPositionZ.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputRotationX.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputRotationX.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputRotationY.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputRotationY.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputRotationZ.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputRotationZ.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputLocalRotationX.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputLocalRotationX.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputLocalRotationY.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputLocalRotationY.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputLocalRotationZ.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputLocalRotationZ.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputDeltaPosition.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputDeltaPosition.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); tmp_InputDeltaRotation.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputDeltaRotation.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); foreach (DialogGUITextInput partModuleInput in partModuleInputList) { TMP_InputField tmp_InputField = partModuleInput.uiItem.GetComponent <TMP_InputField>(); tmp_InputField.onSelect.AddListener(new UnityAction <string>(this.OnSelectTextInput)); tmp_InputField.onDeselect.AddListener(new UnityAction <string>(this.OnDeselectTextInput)); } }
/// <summary> /// Constructor /// </summary> internal SettingsWindowView(SettingsWindowModel m, Vector3 mwp, UnityAction close) : base( CommonWindowProperties.settingsMinWidth, // min width CommonWindowProperties.settingsMinHeight, // min height CommonWindowProperties.settingsWindowSpacing, // spacing CommonWindowProperties.settingsElementPadding, // padding TextAnchor.UpperLeft // text anchor ) { model = m; mainWindowPosition = mwp; closeCallback = close; AddChild(TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GetDewarpToggleState(), Localizer.Format("#LOC_BV_AutomaticDewarp"), model.DewarpChecked, 130f) { tooltipText = Localizer.Format("#LOC_BV_AutomaticDewarp_Tooltip") })); AddChild(TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GeDisableRotationToggleState(), Localizer.Format("#LOC_BV_DisableRotation"), model.DisableRotationChecked, 130f) { tooltipText = Localizer.Format("#LOC_BV_DisableRotation_Tooltip") })); AddChild(TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GeShowBiomeToggleState(), Localizer.Format("#LOC_BV_ShowBiome"), model.ShowBiomeChecked, 130f) { tooltipText = Localizer.Format("#LOC_BV_ShowBiome_Tooltip") })); AddChild(new DialogGUIBox("", 140f, 80f, null, new DialogGUIVerticalLayout(140f, 80f, CommonWindowProperties.settingsWindowSpacing, CommonWindowProperties.boxPadding, TextAnchor.UpperLeft, new DialogGUILabel(Localizer.Format("#LOC_BV_Style"), 135f), new DialogGUISpace(10f), new DialogGUIToggleGroup( new DialogGUIToggle(model.GetKSPSkinToggleState(), Localizer.Format("#LOC_BV_Style_KSP"), model.KSPSkinChecked, 135f), new DialogGUIToggle(model.GetUnitySkinToggleState(), Localizer.Format("#LOC_BV_Style_Unity"), model.UnitySkinChecked, 135f) ) ) )); AddChild(new DialogGUISpace(4f)); AddChild(new DialogGUIBox("", 140f, 80f, null, new DialogGUIVerticalLayout(140f, 80f, CommonWindowProperties.settingsWindowSpacing, CommonWindowProperties.boxPadding, TextAnchor.UpperLeft, new DialogGUILabel(Localizer.Format("#LOC_BV_Toolbar"), 135f), new DialogGUISpace(10f), TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GetKSPToolbarToggleState(), Localizer.Format("#LOC_BV_Toolbar_KSP"), model.KSPToolbarChecked, 135f) { tooltipText = Localizer.Format("#LOC_BV_Toolbar_KSP_Tooltip") }), TooltipExtension.DeferTooltip(new DialogGUIToggle(model.GetTCToggleState(), Localizer.Format("#LOC_BV_Toolbar_TC"), model.TCChecked, 135f) { tooltipText = Localizer.Format("#LOC_BV_Toolbar_TC_Tooltip") }) ) )); AddChild(new DialogGUISpace(4f)); DialogGUITextInput heightOffsetField = new DialogGUITextInput("", false, 20, (string s) => { model.HeightOffset = s; return(s); }, model.GetHeightOffset, TMPro.TMP_InputField.ContentType.DecimalNumber, CommonWindowProperties.buttonHeight); model.AddLockControlToTextField(heightOffsetField); AddChild(new DialogGUIVerticalLayout( new DialogGUILabel(Localizer.Format("#LOC_BV_HeightOffset")), new DialogGUIHorizontalLayout(TextAnchor.MiddleLeft, heightOffsetField, new DialogGUILabel(Localizer.Format("m"))) )); }
protected void SetTextInputColor(DialogGUITextInput textInput, Color color) { textInput.uiItem.GetComponent <TMP_InputField>().textComponent.color = color; }