public RenamePopup(string text, string title = "Rename") : base(22, 7) { Title = title; okButton = new Button(8, 1); cancelButton = new Button(8, 1); textBox = new InputBox(textSurface.Width - 4); textBox.Text = text; okButton.Position = new Microsoft.Xna.Framework.Point(textSurface.Width - okButton.Width - 2, textSurface.Height - 3); cancelButton.Position = new Microsoft.Xna.Framework.Point(2, textSurface.Height - 3); textBox.Position = new Microsoft.Xna.Framework.Point(2, 2); okButton.ButtonClicked += (o, e) => { DialogResult = true; Hide(); }; cancelButton.ButtonClicked += (o, e) => { DialogResult = false; Hide(); }; okButton.Text = "Ok"; cancelButton.Text = "Cancel"; Add(okButton); Add(cancelButton); Add(textBox); FocusedControl = textBox; }
public AnimationSpeedPopup(float speed) : base(22, 6) { Title = "Animation Speed"; okButton = new Button(8, 1); cancelButton = new Button(8, 1); textBox = new InputBox(textSurface.Width - 4); textBox.IsNumeric = true; textBox.AllowDecimal = true; textBox.Text = speed.ToString(); okButton.Position = new Microsoft.Xna.Framework.Point(textSurface.Width - okButton.Width - 2, textSurface.Height - 2); cancelButton.Position = new Microsoft.Xna.Framework.Point(2, textSurface.Height - 2); textBox.Position = new Microsoft.Xna.Framework.Point(2, 2); okButton.ButtonClicked += (o, e) => { DialogResult = true; Hide(); }; cancelButton.ButtonClicked += (o, e) => { DialogResult = false; Hide(); }; okButton.Text = "Ok"; cancelButton.Text = "Cancel"; Add(okButton); Add(cancelButton); Add(textBox); }
public KeyValueEditPopup(Dictionary<string, string> settings) : base(55, 18) { Title = "Settings"; // Setting controls of the game object objectSettingsListbox = new ListBox(25, 10); settingNameInput = new InputBox(25); settingValueInput = new InputBox(25); objectSettingsListbox.HideBorder = true; objectSettingsListbox.Position = new Point(2, 3); settingNameInput.Position = new Point(objectSettingsListbox.Bounds.Right + 1, objectSettingsListbox.Bounds.Top); settingValueInput.Position = new Point(objectSettingsListbox.Bounds.Right + 1, settingNameInput.Bounds.Bottom + 2); addFieldButton = new Button(14, 1); addFieldButton.Text = "Add/Update"; addFieldButton.Position = new Point(settingValueInput.Bounds.Left, settingValueInput.Bounds.Bottom + 1); removeFieldButton = new Button(14, 1); removeFieldButton.Text = "Remove"; removeFieldButton.Position = new Point(objectSettingsListbox.Bounds.Left, objectSettingsListbox.Bounds.Bottom + 1); removeFieldButton.IsEnabled = false; objectSettingsListbox.SelectedItemChanged += _objectSettingsListbox_SelectedItemChanged; addFieldButton.ButtonClicked += _addFieldButton_ButtonClicked; removeFieldButton.ButtonClicked += _removeFieldButton_ButtonClicked; Add(objectSettingsListbox); Add(settingNameInput); Add(settingValueInput); Add(addFieldButton); Add(removeFieldButton); // Save/close buttons saveButton = new Button(10, 1); cancelButton = new Button(10, 1); saveButton.Text = "Save"; cancelButton.Text = "Cancel"; saveButton.ButtonClicked += _saveButton_ButtonClicked; cancelButton.ButtonClicked += (o, e) => { DialogResult = false; Hide(); }; saveButton.Position = new Point(textSurface.Width - 12, 16); cancelButton.Position = new Point(2, 16); Add(saveButton); Add(cancelButton); // Read the settings foreach (var item in settings) objectSettingsListbox.Items.Add(new SettingKeyValue() { Key = item.Key, Value = item.Value }); SettingsDictionary = settings; Redraw(); }
public ResizeSurfacePopup(int width, int height) : base(22, 7) { //this.DefaultShowPosition = StartupPosition.CenterScreen; Title = "Resize"; textSurface.DefaultBackground = Settings.Color_MenuBack; textSurface.DefaultForeground = Settings.Color_TitleText; okButton = new Button(8, 1) { Text = "Accept", Position = new Microsoft.Xna.Framework.Point(base.TextSurface.Width - 10, 5) }; okButton.ButtonClicked += new EventHandler(_okButton_Action); cancelButton = new Button(8, 1) { Text = "Cancel", Position = new Microsoft.Xna.Framework.Point(2, 5) }; cancelButton.ButtonClicked += new EventHandler(_cancelButton_Action); //Print(2, 3, "Name"); Print(2, 2, "Width"); Print(2, 3, "Height"); widthBox = new InputBox(3) { Text = width.ToString(), MaxLength = 3, IsNumeric = true, Position = new Microsoft.Xna.Framework.Point(base.TextSurface.Width - 5, 2) }; heightBox = new InputBox(3) { Text = height.ToString(), MaxLength = 3, IsNumeric = true, Position = new Microsoft.Xna.Framework.Point(base.TextSurface.Width - 5, 3) }; //_name = new InputBox(20) //{ // Text = name, // Position = new Microsoft.Xna.Framework.Point(9, 3) //}; Add(widthBox); Add(heightBox); Add(cancelButton); Add(okButton); //Add(_name); }
public SelectFilePopup() : base(70, 30) { Title = "Select File"; fileLoadersList = new ListBox<FileLoaderListBoxItem>(15, Height - 7); fileLoadersList.Position = new Point(2, 4); fileLoadersList.SelectedItemChanged += FileLoadersList_SelectedItemChanged; fileLoadersList.HideBorder = true; Print(fileLoadersList.Bounds.Left, fileLoadersList.Bounds.Top - 2, "Type of file", Settings.Color_TitleText); Print(fileLoadersList.Bounds.Left, fileLoadersList.Bounds.Top - 1, new string((char)196, fileLoadersList.Width)); directoryListBox = new SadConsoleEditor.Controls.FileDirectoryListbox(this.TextSurface.Width - fileLoadersList.Bounds.Right - 3, Height - 10) { Position = new Point(fileLoadersList.Bounds.Right + 1, fileLoadersList.Bounds.Top), HideBorder = true }; directoryListBox.HighlightedExtentions = ".con;.console;.brush"; directoryListBox.SelectedItemChanged += _directoryListBox_SelectedItemChanged; directoryListBox.SelectedItemExecuted += _directoryListBox_SelectedItemExecuted; directoryListBox.CurrentFolder = Environment.CurrentDirectory; //directoryListBox.HideBorder = true; Print(directoryListBox.Bounds.Left, directoryListBox.Bounds.Top - 2, "Files/Directories", Settings.Color_TitleText); Print(directoryListBox.Bounds.Left, directoryListBox.Bounds.Top - 1, new string((char)196, directoryListBox.Width)); fileName = new InputBox(directoryListBox.Width) { Position = new Point(directoryListBox.Bounds.Left, directoryListBox.Bounds.Bottom + 2), }; fileName.TextChanged += _fileName_TextChanged; Print(fileName.Bounds.Left, fileName.Bounds.Top - 1, "Selected file", Settings.Color_TitleText); selectButton = new Button(8, 1) { Text = "Open", Position = new Point(Width - 10, this.TextSurface.Height - 2), IsEnabled = false }; selectButton.ButtonClicked += new EventHandler(_selectButton_Action); cancelButton = new Button(8, 1) { Text = "Cancel", Position = new Point(2, this.TextSurface.Height - 2) }; cancelButton.ButtonClicked += new EventHandler(_cancelButton_Action); Add(directoryListBox); Add(fileName); Add(selectButton); Add(cancelButton); Add(fileLoadersList); }
public ColorPickerPopup() : base(Settings.Config.ColorPickerSettings.WindowWidth, Settings.Config.ColorPickerSettings.WindowHeight) { Center(); otherColorPopup = new OtherColorsPopup(); otherColorPopup.Closed += (sender2, e2) => { if (otherColorPopup.DialogResult) { _barR.SelectedColor = otherColorPopup.SelectedColor.RedOnly(); _barG.SelectedColor = otherColorPopup.SelectedColor.GreenOnly(); _barB.SelectedColor = otherColorPopup.SelectedColor.BlueOnly(); _alphaInput.Text = otherColorPopup.SelectedColor.A.ToString(); } }; _picker = new Controls.ColorPicker(textSurface.Width - RideSideX - 1, textSurface.Height - 11, Color.YellowGreen) { Position = new Point(1, 1) }; _picker.SelectedColorChanged += _picker_SelectedColorChanged; Add(_picker); #region TextBoxes _redInput = new InputBox(5); _redInput.IsNumeric = true; _redInput.MaxLength = 3; _redInput.Position = new Point(textSurface.Width - 7, textSurface.Height - 14); _redInput.TextChanged += (sender, e) => { _barR.SelectedColor = new Color(int.Parse(_redInput.Text), 0, 0); }; Add(_redInput); _greenInput = new InputBox(5); _greenInput.IsNumeric = true; _greenInput.MaxLength = 3; _greenInput.Position = new Point(textSurface.Width - 7, textSurface.Height - 13); _greenInput.TextChanged += (sender, e) => { _barG.SelectedColor = new Color(0, int.Parse(_greenInput.Text), 0); }; Add(_greenInput); _blueInput = new InputBox(5); _blueInput.IsNumeric = true; _blueInput.MaxLength = 3; _blueInput.Position = new Point(textSurface.Width - 7, textSurface.Height - 12); _blueInput.TextChanged += (sender, e) => { _barB.SelectedColor = new Color(0, 0, int.Parse(_blueInput.Text)); }; Add(_blueInput); _alphaInput = new InputBox(5); _alphaInput.IsNumeric = true; _alphaInput.MaxLength = 3; _alphaInput.Position = new Point(textSurface.Width - 7, textSurface.Height - 11); _alphaInput.Text = "255"; Add(_alphaInput); #endregion #region Bars _barH = new HueBar(base.TextSurface.RenderArea.Width - 2); _barH.Position = new Point(1, textSurface.Height - 9); _barH.ColorChanged += _barH_ColorChanged; Add(_barH); _barR = new ColorBar(base.TextSurface.RenderArea.Width - 2); _barR.StartingColor = Color.Black; _barR.EndingColor = Color.Red; _barR.Position = new Point(1, textSurface.Height - 7); _barR.ColorChanged += bar_ColorChanged; Add(_barR); _barG = new ColorBar(base.TextSurface.RenderArea.Width - 2); _barG.StartingColor = Color.Black; _barG.EndingColor = new Color(0, 255, 0); _barG.Position = new Point(1, textSurface.Height - 5); _barG.ColorChanged += bar_ColorChanged; Add(_barG); _barB = new ColorBar(base.TextSurface.RenderArea.Width - 2); _barB.StartingColor = Color.Black; _barB.EndingColor = Color.Blue; _barB.Position = new Point(1, textSurface.Height - 3); _barB.ColorChanged += bar_ColorChanged; Add(_barB); _selectedColor = _picker.SelectedColor; _barH.SelectedColor = _selectedColor; #endregion #region Buttons _okButton = new Button(RideSideX - 4, 1); _okButton.Text = "OK"; _okButton.Position = new Point(textSurface.Width - RideSideX + 2, textSurface.Height - 18); _okButton.ButtonClicked += (sender, r) => { this.DialogResult = true; _selectedColor.A = byte.Parse(_alphaInput.Text); AddPreviousColor(SelectedColor); Hide(); }; Add(_okButton); _cancelButton = new Button(RideSideX - 4, 1); _cancelButton.Text = "Cancel"; _cancelButton.Position = new Point(textSurface.Width - RideSideX + 2, textSurface.Height - 16); _cancelButton.ButtonClicked += (sender, r) => { this.DialogResult = false; Hide(); }; Add(_cancelButton); _otherColorsButton = new Button(RideSideX - 4, 1); _otherColorsButton.Text = "Other Colors"; _otherColorsButton.Position = new Point(textSurface.Width - RideSideX + 2, textSurface.Height - 20); _otherColorsButton.ButtonClicked += (sender, e) => { otherColorPopup.Show(true); }; Add(_otherColorsButton); #endregion _previousColors = new ListBox<ListBoxItemColor>(RideSideX - 4, textSurface.Height - 20 - 9 + 1); _previousColors.Position = new Point(textSurface.Width - RideSideX + 2, 8); _previousColors.SelectedItemChanged += (sender, e) => { if (_previousColors.SelectedItem != null) SelectedColor = (Color)_previousColors.SelectedItem; }; Add(_previousColors); this.CloseOnESC = true; this.Title = "Select Color"; }
public NewConsolePopup() : base(40, 14) { //this.DefaultShowPosition = StartupPosition.CenterScreen; Title = "New Console"; textSurface.DefaultBackground = Settings.Color_MenuBack; textSurface.DefaultForeground = Settings.Color_TitleText; Clear(); Redraw(); okButton = new Button(8, 1) { Text = "Accept", Position = new Microsoft.Xna.Framework.Point(base.TextSurface.Width - 10, 12) }; okButton.ButtonClicked += new EventHandler(_okButton_Action); cancelButton = new Button(8, 1) { Text = "Cancel", Position = new Microsoft.Xna.Framework.Point(2, 12) }; cancelButton.ButtonClicked += new EventHandler(_cancelButton_Action); //Print(2, 3, "Name"); Print(2, 2, "Editor"); Print(2, 7, "Width"); Print(2, 8, "Height"); editorsListBox = new ListBox(Width - 11, 4) { Position = new Point(9, 2), HideBorder = true }; editorsListBox.SelectedItemChanged += editorsListBox_SelectedItemChanged; widthBox = new InputBox(3) { Text = "0", MaxLength = 3, IsNumeric = true, Position = new Microsoft.Xna.Framework.Point(base.TextSurface.Width - 5, 7) }; heightBox = new InputBox(3) { Text = "0", MaxLength = 3, IsNumeric = true, Position = new Microsoft.Xna.Framework.Point(base.TextSurface.Width - 5, 8) }; //_name = new InputBox(20) //{ // Text = name, // Position = new Microsoft.Xna.Framework.Point(9, 3) //}; _foregroundPicker = new SadConsoleEditor.Controls.ColorPresenter("Foreground", Theme.FillStyle.Foreground, textSurface.Width - 4); _foregroundPicker.Position = new Point(2, 9); _foregroundPicker.SelectedColor = Color.White; _backgroundPicker = new SadConsoleEditor.Controls.ColorPresenter("Background", Theme.FillStyle.Foreground, textSurface.Width - 4); _backgroundPicker.Position = new Point(2, 10); _backgroundPicker.SelectedColor = Color.Black; Add(editorsListBox); Add(widthBox); Add(heightBox); Add(cancelButton); Add(okButton); Add(_foregroundPicker); Add(_backgroundPicker); //Add(_name); foreach (var editor in EditorConsoleManager.Editors.Keys) editorsListBox.Items.Add(editor); editorsListBox.SelectedItem = editorsListBox.Items[0]; }
public EditHotspotPopup(Hotspot oldHotspot) : base(39, 29) { textSurface.Font = Settings.Config.ScreenFont; Title = "Hotspot Editor"; CreatedHotspot = new Hotspot(); CreatedHotspot.Title = oldHotspot.Title; CreatedHotspot.Positions = new List<Point>(oldHotspot.Positions); oldHotspot.DebugAppearance.CopyAppearanceTo(CreatedHotspot.DebugAppearance); foreach (var key in oldHotspot.Settings.Keys) CreatedHotspot.Settings[key] = oldHotspot.Settings[key]; // Settings of the appearance fields nameInput = new InputBox(13); characterPicker = new SadConsoleEditor.Controls.CharacterPicker(Settings.Red, Settings.Color_ControlBack, Settings.Green); foregroundPresenter = new SadConsoleEditor.Controls.ColorPresenter("Foreground", Settings.Green, 18); backgroundPresenter = new SadConsoleEditor.Controls.ColorPresenter("Background", Settings.Green, 18); characterPresenter = new SadConsoleEditor.Controls.ColorPresenter("Preview", Settings.Green, 18); mirrorHorizCheck = new CheckBox(18, 1); mirrorVertCheck = new CheckBox(18, 1); characterPicker.SelectedCharacterChanged += (o, e) => characterPresenter.Character = characterPicker.SelectedCharacter; foregroundPresenter.ColorChanged += (o, e) => characterPresenter.CharacterColor = foregroundPresenter.SelectedColor; backgroundPresenter.ColorChanged += (o, e) => characterPresenter.SelectedColor = backgroundPresenter.SelectedColor; Print(2, 2, "Name", Settings.Green); nameInput.Position = new Point(7, 2); foregroundPresenter.Position = new Point(2, 4); backgroundPresenter.Position = new Point(2, 5); characterPresenter.Position = new Point(2, 6); characterPicker.Position = new Point(21, 2); mirrorHorizCheck.Position = new Point(2, 7); mirrorVertCheck.Position = new Point(2, 8); nameInput.Text = "New"; mirrorHorizCheck.IsSelectedChanged += Mirror_IsSelectedChanged; mirrorVertCheck.IsSelectedChanged += Mirror_IsSelectedChanged; mirrorHorizCheck.Text = "Mirror Horiz."; mirrorVertCheck.Text = "Mirror Vert."; foregroundPresenter.SelectedColor = Color.White; backgroundPresenter.SelectedColor = Color.DarkRed; characterPresenter.CharacterColor = foregroundPresenter.SelectedColor; characterPresenter.SelectedColor = backgroundPresenter.SelectedColor; characterPicker.SelectedCharacter = 1; Add(characterPicker); Add(nameInput); Add(foregroundPresenter); Add(backgroundPresenter); Add(characterPresenter); Add(mirrorHorizCheck); Add(mirrorVertCheck); // Setting controls of the game object objectSettingsListbox = new ListBox(18, 7); settingNameInput = new InputBox(18); settingValueInput = new InputBox(18); objectSettingsListbox.HideBorder = true; Print(2, 10, "Settings/Flags", Settings.Green); objectSettingsListbox.Position = new Point(2, 11); Print(2, 19, "Setting Name", Settings.Green); Print(2, 22, "Setting Value", Settings.Green); settingNameInput.Position = new Point(2, 20); settingValueInput.Position = new Point(2, 23); addFieldButton = new Button(16, 1); addFieldButton.Text = "Save/Update"; addFieldButton.Position = new Point(textSurface.Width - 18, 20); removeFieldButton = new Button(16, 1); removeFieldButton.Text = "Remove"; removeFieldButton.Position = new Point(textSurface.Width - 18, 21); removeFieldButton.IsEnabled = false; objectSettingsListbox.SelectedItemChanged += _objectSettingsListbox_SelectedItemChanged; addFieldButton.ButtonClicked += _addFieldButton_ButtonClicked; removeFieldButton.ButtonClicked += _removeFieldButton_ButtonClicked; Add(objectSettingsListbox); Add(settingNameInput); Add(settingValueInput); Add(addFieldButton); Add(removeFieldButton); // Save/close buttons saveButton = new Button(10, 1); cancelButton = new Button(10, 1); saveButton.Text = "Save"; cancelButton.Text = "Cancel"; saveButton.ButtonClicked += _saveButton_ButtonClicked; cancelButton.ButtonClicked += (o, e) => { DialogResult = false; Hide(); }; saveButton.Position = new Point(textSurface.Width - 12, 26); cancelButton.Position = new Point(2, 26); Add(saveButton); Add(cancelButton); // Read the gameobject nameInput.Text = CreatedHotspot.Title; mirrorHorizCheck.IsSelected = (CreatedHotspot.DebugAppearance.SpriteEffect & Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally) == Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally; mirrorVertCheck.IsSelected = (CreatedHotspot.DebugAppearance.SpriteEffect & Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipVertically) == Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipVertically; characterPicker.SelectedCharacter = CreatedHotspot.DebugAppearance.GlyphIndex; foregroundPresenter.SelectedColor = CreatedHotspot.DebugAppearance.Foreground; backgroundPresenter.SelectedColor = CreatedHotspot.DebugAppearance.Background; foreach (var item in CreatedHotspot.Settings) { var newSetting = new SettingKeyValue() { Key = item.Key, Value = item.Value }; objectSettingsListbox.Items.Add(newSetting); } Redraw(); }