示例#1
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();
        }