public void OnAddPresetClick(object sender, EventArgs e) { InputBoxCallback okCallback = (input) => { if (input.Length <= 0) { return(false); } EditorPreset newPreset = new EditorPreset(input, bodyGrid.Selection, altSlider.Value); if (!ProcAirships.Instance.Presets.Contains(newPreset)) { ProcAirships.Instance.Presets.Add(newPreset); RefreshPresets(); return(true); } else { return(false); } }; InputBoxCallback cancelCallback = (input) => { return(true); }; InputBox inputBox = InputBox("Celestial Body: " + availableBodies[bodyGrid.Selection].theName + "\nAltitude: " + altSlider.Value + "m", "Preset generation", new InputBoxOption("OK", okCallback), new InputBoxOption("Cancel", cancelCallback)); inputBox.Position = new Vector2(Rectangle.xMax, Rectangle.yMin); inputBox.Height = 200; }
public void OpenInputBox(string _header, InputBoxCallback _callback, string _defaultStr = "") { inputBox.gameObject.SetActive(true); inputBox.Init(_header, _callback, _defaultStr); }
public InputBoxOption(String caption, InputBoxCallback callback) { this.caption = caption; this.callback = callback; }