Example #1
0
        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;
        }
Example #2
0
 public void OpenInputBox(string _header, InputBoxCallback _callback, string _defaultStr = "")
 {
     inputBox.gameObject.SetActive(true);
     inputBox.Init(_header, _callback, _defaultStr);
 }
Example #3
0
 public InputBoxOption(String caption, InputBoxCallback callback)
 {
     this.caption  = caption;
     this.callback = callback;
 }