Пример #1
0
        public BoxToolPanel()
        {
            Title = "Settings";

            fillBoxOption = new CheckBox(18, 1);
            fillBoxOption.Text = "Fill";

            useCharBorder = new CheckBox(18, 1);
            useCharBorder.Text = "Char. Border";
            useCharBorder.IsSelectedChanged += (s, o) => { characterPicker.IsVisible = useCharBorder.IsSelected; EditorConsoleManager.ToolsPane.RedrawPanels(); };

            lineForeColor = new Controls.ColorPresenter("Border Fore", Settings.Green, 18);
            lineForeColor.SelectedColor = Color.White;

            lineBackColor = new Controls.ColorPresenter("Border Back", Settings.Green, 18);
            lineBackColor.SelectedColor = Color.Black;

            fillColor = new Controls.ColorPresenter("Fill Color", Settings.Green, 18);
            fillColor.SelectedColor = Color.Black;

            characterPicker = new Controls.CharacterPicker(Settings.Red, Settings.Color_ControlBack, Settings.Green);
            characterPicker.IsVisible = false;

            Controls = new ControlBase[] { lineForeColor, lineBackColor, fillColor, fillBoxOption, useCharBorder, characterPicker };
        }
Пример #2
0
        public BoxToolPanel()
        {
            Title = "Settings";

            fillBoxOption      = new CheckBox(18, 1);
            fillBoxOption.Text = "Fill";

            useCharBorder      = new CheckBox(18, 1);
            useCharBorder.Text = "Char. Border";
            useCharBorder.IsSelectedChanged += (s, o) => { characterPicker.IsVisible = useCharBorder.IsSelected; MainScreen.Instance.ToolsPane.RedrawPanels(); };

            lineForeColor = new Controls.ColorPresenter("Border Fore", Settings.Green, 18);
            lineForeColor.SelectedColor = Color.White;

            lineBackColor = new Controls.ColorPresenter("Border Back", Settings.Green, 18);
            lineBackColor.SelectedColor = Color.Black;

            fillColor = new Controls.ColorPresenter("Fill Color", Settings.Green, 18);
            fillColor.SelectedColor = Color.Black;

            characterPicker           = new Controls.CharacterPicker(Settings.Red, Settings.Color_ControlBack, Settings.Green);
            characterPicker.IsVisible = false;

            Controls = new ControlBase[] { lineForeColor, lineBackColor, fillColor, fillBoxOption, useCharBorder, characterPicker };
        }
Пример #3
0
        public CharacterPickPanel(string title, bool hideCharacter, bool hideForeground, bool hideBackground)
        {
            Title = title;

            _foreColor            = new ColorPresenter("Foreground", Settings.Green, SadConsoleEditor.Consoles.ToolPane.PanelWidthControls);
            _backColor            = new ColorPresenter("Background", Settings.Green, SadConsoleEditor.Consoles.ToolPane.PanelWidthControls);
            _charPreview          = new ColorPresenter("Character", Settings.Green, SadConsoleEditor.Consoles.ToolPane.PanelWidthControls);
            _mirrorLR             = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            _mirrorTB             = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            _characterPicker      = new CharacterPicker(Settings.Red, Settings.Color_ControlBack, Settings.Green);
            _popupCharacterWindow = new Windows.CharacterQuickSelectPopup(0);

            _mirrorLR.Text = "Mirror Horiz.";
            _mirrorTB.Text = "Mirror Vert.";

            _foreColor.SelectedColor = Color.White;
            _backColor.SelectedColor = Color.Black;

            _foreColor.RightClickedColor += (s, e) => { var tempColor = SettingBackground; SettingBackground = SettingForeground; SettingForeground = tempColor; };
            _backColor.RightClickedColor += (s, e) => { var tempColor = SettingForeground; SettingForeground = SettingBackground; SettingBackground = tempColor; };

            _charPreview.CharacterColor        = _foreColor.SelectedColor;
            _charPreview.SelectedColor         = _backColor.SelectedColor;
            _charPreview.Character             = 0;
            _charPreview.DisableColorPicker    = true;
            _charPreview.EnableCharacterPicker = true;

            _popupCharacterWindow.TextSurface.Font = Settings.Config.ScreenFont;
            _popupCharacterWindow.Closed          += (o, e) => { _characterPicker.SelectedCharacter = _popupCharacterWindow.SelectedCharacter; };

            _mirrorLR.IsSelectedChanged += Mirror_IsSelectedChanged;
            _mirrorTB.IsSelectedChanged += Mirror_IsSelectedChanged;
            _foreColor.ColorChanged     += (o, e) => { _charPreview.CharacterColor = _foreColor.SelectedColor; OnChanged(); };
            _backColor.ColorChanged     += (o, e) => { _charPreview.SelectedColor = _backColor.SelectedColor; OnChanged(); };
            _characterPicker.SelectedCharacterChanged += (sender, e) => { _charPreview.Character = e.NewCharacter; _charPreview.Title = "Character (" + e.NewCharacter.ToString() + ")"; OnChanged(); };
            _characterPicker.SelectedCharacter         = 1;
            _charPreview.MouseButtonClicked           += (o, e) => {
                if (e.MouseState.Mouse.LeftClicked)
                {
                    _popupCharacterWindow.Center();
                    _popupCharacterWindow.Show(true);
                }
            };


            HideCharacter  = hideCharacter;
            HideForeground = hideForeground;
            HideBackground = hideBackground;

            HideMirrorLR = HideMirrorTB = HideCharacter;

            Reset();
        }
Пример #4
0
        public CharacterPickPanel(string title, bool hideCharacter, bool hideForeground, bool hideBackground)
        {
            Title = title;

            _foreColor = new ColorPresenter("Foreground", Settings.Green, SadConsoleEditor.Consoles.ToolPane.PanelWidthControls);
            _backColor = new ColorPresenter("Background", Settings.Green, SadConsoleEditor.Consoles.ToolPane.PanelWidthControls);
            _charPreview = new ColorPresenter("Character", Settings.Green, SadConsoleEditor.Consoles.ToolPane.PanelWidthControls);
            _mirrorLR = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            _mirrorTB = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            _characterPicker = new CharacterPicker(Settings.Red, Settings.Color_ControlBack, Settings.Green);
            _popupCharacterWindow = new Windows.CharacterQuickSelectPopup(0);

            _mirrorLR.Text = "Mirror Horiz.";
            _mirrorTB.Text = "Mirror Vert.";

            _foreColor.SelectedColor = Color.White;
            _backColor.SelectedColor = Color.Black;

            _foreColor.RightClickedColor += (s, e) => { var tempColor = SettingBackground; SettingBackground = SettingForeground; SettingForeground = tempColor; };
            _backColor.RightClickedColor += (s, e) => { var tempColor = SettingForeground; SettingForeground = SettingBackground; SettingBackground = tempColor; };

            _charPreview.CharacterColor = _foreColor.SelectedColor;
            _charPreview.SelectedColor = _backColor.SelectedColor;
            _charPreview.Character = 0;
            _charPreview.DisableColorPicker = true;
            _charPreview.EnableCharacterPicker = true;

            _popupCharacterWindow.TextSurface.Font = Settings.Config.ScreenFont;
            _popupCharacterWindow.Closed += (o, e) => { _characterPicker.SelectedCharacter = _popupCharacterWindow.SelectedCharacter; };

            _mirrorLR.IsSelectedChanged += Mirror_IsSelectedChanged;
            _mirrorTB.IsSelectedChanged += Mirror_IsSelectedChanged;
            _foreColor.ColorChanged += (o, e) => { _charPreview.CharacterColor = _foreColor.SelectedColor; OnChanged(); };
            _backColor.ColorChanged += (o, e) => { _charPreview.SelectedColor = _backColor.SelectedColor; OnChanged(); };
            _characterPicker.SelectedCharacterChanged += (sender, e) => { _charPreview.Character = e.NewCharacter; _charPreview.Title = "Character (" + e.NewCharacter.ToString() + ")"; OnChanged(); };
            _characterPicker.SelectedCharacter = 1;
            _charPreview.MouseButtonClicked += (o, e) => {
                if (e.LeftButtonClicked)
                {
                    _popupCharacterWindow.Center();
                    _popupCharacterWindow.Show(true);
                }
            };

            HideCharacter = hideCharacter;
            HideForeground = hideForeground;
            HideBackground = hideBackground;

            HideMirrorLR = HideMirrorTB = HideCharacter;

            Reset();
        }
        public SelectionToolAltPanel()
        {
            Title = "Sel.Rect Options";

            skipEmptyColor = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            skipEmptyColor.Text = "Skip Empty";

            altEmptyColorCheck = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            altEmptyColorCheck.Text = "Use Alt. Empty";

            altEmptyColor = new Controls.ColorPresenter("Alt. Empty Clr", Settings.Green, 18);
            altEmptyColor.SelectedColor = Color.Black;

            Controls = new ControlBase[] { skipEmptyColor, altEmptyColorCheck, altEmptyColor };
        }
        public SelectionToolAltPanel()
        {
            Title = "Sel.Rect Options";

            skipEmptyColor      = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            skipEmptyColor.Text = "Skip Empty";

            altEmptyColorCheck      = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            altEmptyColorCheck.Text = "Use Alt. Empty";

            altEmptyColor = new Controls.ColorPresenter("Alt. Empty Clr", Settings.Green, 18);
            altEmptyColor.SelectedColor = Color.Black;

            Controls = new ControlBase[] { skipEmptyColor, altEmptyColorCheck, altEmptyColor };
        }
        public RegionManagementPanel()
        {
            Title                               = "Zones";
            GameObjectList                      = new ListBox <EntityListBoxItem>(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 4);
            GameObjectList.HideBorder           = true;
            GameObjectList.SelectedItemChanged += GameObject_SelectedItemChanged;
            GameObjectList.CompareByReference   = true;

            removeSelected        = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            removeSelected.Text   = "Remove";
            removeSelected.Click += RemoveSelected_Click;

            moveSelectedUp        = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedUp.Text   = "Move Up";
            moveSelectedUp.Click += MoveSelectedUp_Click;

            moveSelectedDown        = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedDown.Text   = "Move Down";
            moveSelectedDown.Click += MoveSelectedDown_Click;

            renameZoneButton        = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            renameZoneButton.Text   = "Rename";
            renameZoneButton.Click += RenameZone_Click;

            addZoneButton        = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            addZoneButton.Text   = "Add New";
            addZoneButton.Click += AddZone_Click;

            editSettings        = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            editSettings.Text   = "Edit Settings";
            editSettings.Click += EditSettings_Click;

            zoneColorPresenter = new SadConsoleEditor.Controls.ColorPresenter("Zone Color", Settings.Green, SadConsoleEditor.Consoles.ToolPane.PanelWidthControls);
            zoneColorPresenter.SelectedColor = Color.Aqua;
            zoneColorPresenter.IsEnabled     = false;
            zoneColorPresenter.ColorChanged += ZoneColorPresenter_ColorChanged;

            drawZonesCheckbox            = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            drawZonesCheckbox.IsSelected = true;
            drawZonesCheckbox.Text       = "Draw zones";

            propertySurface = new DrawingSurface(Consoles.ToolPane.PanelWidthControls, 2);

            Controls = new ControlBase[] { addZoneButton, null, GameObjectList, removeSelected, moveSelectedUp, moveSelectedDown, renameZoneButton, editSettings, null, drawZonesCheckbox, null, zoneColorPresenter, propertySurface };

            GameObject_SelectedItemChanged(null, null);
        }
        public RegionManagementPanel()
        {
            Title = "Zones";
            GameObjectList = new ListBox<EntityListBoxItem>(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 4);
            GameObjectList.HideBorder = true;
            GameObjectList.SelectedItemChanged += GameObject_SelectedItemChanged;
            GameObjectList.CompareByReference = true;

            removeSelected = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            removeSelected.Text = "Remove";
            removeSelected.ButtonClicked += RemoveSelected_ButtonClicked;

            moveSelectedUp = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedUp.Text = "Move Up";
            moveSelectedUp.ButtonClicked += MoveSelectedUp_ButtonClicked;

            moveSelectedDown = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedDown.Text = "Move Down";
            moveSelectedDown.ButtonClicked += MoveSelectedDown_ButtonClicked;

            renameZoneButton = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            renameZoneButton.Text = "Rename";
            renameZoneButton.ButtonClicked += RenameZone_ButtonClicked;

            addZoneButton = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            addZoneButton.Text = "Add New";
            addZoneButton.ButtonClicked += AddZone_ButtonClicked;

            editSettings = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            editSettings.Text = "Edit Settings";
            editSettings.ButtonClicked += EditSettings_ButtonClicked;

            zoneColorPresenter = new SadConsoleEditor.Controls.ColorPresenter("Zone Color", Settings.Green, SadConsoleEditor.Consoles.ToolPane.PanelWidthControls);
            zoneColorPresenter.SelectedColor = Color.Aqua;
            zoneColorPresenter.IsEnabled = false;
            zoneColorPresenter.ColorChanged += ZoneColorPresenter_ColorChanged;

            drawZonesCheckbox = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            drawZonesCheckbox.IsSelected = true;
            drawZonesCheckbox.Text = "Draw zones";

            propertySurface = new DrawingSurface(Consoles.ToolPane.PanelWidthControls, 2);

            Controls = new ControlBase[] { addZoneButton, null, GameObjectList, removeSelected, moveSelectedUp, moveSelectedDown, renameZoneButton, editSettings, null, drawZonesCheckbox, null, zoneColorPresenter, propertySurface };

            GameObject_SelectedItemChanged(null, null);
        }
Пример #9
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.Click    += _addFieldButton_Click;
            removeFieldButton.Click += _removeFieldButton_Click;

            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.Click   += _saveButton_Click;
            cancelButton.Click += (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.Mirror & Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally) == Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipHorizontally;
            mirrorVertCheck.IsSelected        = (CreatedHotspot.DebugAppearance.Mirror & Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipVertically) == Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipVertically;
            characterPicker.SelectedCharacter = CreatedHotspot.DebugAppearance.Glyph;
            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();
        }
Пример #10
0
        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.Click += new EventHandler(_okButton_Action);

            cancelButton = new Button(8, 1)
            {
                Text     = "Cancel",
                Position = new Microsoft.Xna.Framework.Point(2, 12)
            };
            cancelButton.Click += 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 MainScreen.Instance.Editors.Keys)
            {
                editorsListBox.Items.Add(editor);
            }

            editorsListBox.SelectedItem = editorsListBox.Items[0];
        }
Пример #11
0
        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];
        }
Пример #12
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();
        }