Esempio n. 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; 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 };
        }
Esempio n. 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; 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 };
        }
Esempio n. 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();
        }
        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 CharacterQuickSelectPopup(int character)
            : base(18, 18)
        {
            Center();
            _picker = new Controls.CharacterPicker(Settings.Red, Settings.Color_ControlBack, Settings.Green);
            _picker.Position = new Point(1, 1);
            _picker.SelectedCharacter = character;
            _picker.UseFullClick = true;
            _picker.SelectedCharacterChanged += (sender, e) =>
            {
                SelectedCharacter = e.NewCharacter;
                this.Hide();
            };
            Add(_picker);

            this.CloseOnESC = true;
            this.Title = "Pick a character";
        }
        public CharacterQuickSelectPopup(int character)
            : base(18, 18)
        {
            Center();
            _picker                           = new Controls.CharacterPicker(Settings.Red, Settings.Color_ControlBack, Settings.Green);
            _picker.Position                  = new Point(1, 1);
            _picker.SelectedCharacter         = character;
            _picker.UseFullClick              = true;
            _picker.SelectedCharacterChanged += (sender, e) =>
            {
                SelectedCharacter = e.NewCharacter;
                this.Hide();
            };
            Add(_picker);

            this.CloseOnESC = true;
            this.Title      = "Pick a character";
        }
        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();
        }
        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();
        }