Ejemplo n.º 1
0
 void Awake()
 {
     Debug.Log("[ColorPickerPopup:Awake]");
     if (singleton == null)
     {
         Debug.Log("ColorPickerPopup checking in.");
         singleton = this;
         swatches  = new SwatchData[NUM_SWATCHES + 1];
         for (int ii = 0; ii <= NUM_SWATCHES; ++ii)
         {
             swatches[ii] = new SwatchData();
         }
         swatchButtons    = new Button[NUM_SWATCHES + 1];
         swatchButtons[0] = swatchButton0;
         swatchButtons[1] = swatchButton1;
         swatchButtons[2] = swatchButton2;
         swatchButtons[3] = swatchButton3;
         swatchButtons[4] = swatchButton4;
         swatchButtons[5] = swatchButton5;
         swatchButtons[6] = backgroundSwatchButton;
         selectedSwatch   = 0;
         gameObject.SetActive(false);
     }
     else
     {
         Debug.Log("ColorPickerPopup checking out.");
         GameObject.Destroy(gameObject);
     }
 }
Ejemplo n.º 2
0
        private void editColorsButton_Click(object sender, EventArgs e)
        {
            ColorPickerPopup window = new ColorPickerPopup();

            window.Center();
            window.SelectedColor = ((ValueTuple <Color, string>)_colorsListBox.SelectedItem).Item1;
            window.Closed       += (s, e) =>
            {
                if (window.DialogResult)
                {
                    var selectedColor = window.SelectedColor;
                    var selectedItem  = (ValueTuple <Color, string>)_colorsListBox.SelectedItem;
                    var newItem       = (selectedColor, selectedItem.Item2);

                    if (!Container.EditingColors.TryToColorName(selectedItem.Item1, out var colorEnumValue))
                    {
                        throw new Exception("How did this happen? Color not in editing colors collection");
                    }

                    _colorsListBox.Items.Insert(_colorsListBox.SelectedIndex, newItem);
                    _colorsListBox.Items.Remove(selectedItem);
                    _colorsListBox.SelectedItem = newItem;

                    Container.EditingColors.SetColorByName(colorEnumValue, selectedColor);

                    DrawThemeParts();
                }
            };
            window.Show(true);
        }
Ejemplo n.º 3
0
        private void themePartSettingColorSet_Click(object sender, EventArgs e)
        {
            AdjustableColor setting = _themeParts[_themePartSelectedIndex];

            if (setting.IsCustomColor)
            {
                ColorPickerPopup window = new ColorPickerPopup();
                window.Center();
                window.SelectedColor = _themeParts[_themePartSelectedIndex].BaseColor;
                window.Closed       += (s, e) =>
                {
                    if (window.DialogResult)
                    {
                        _themeParts[_themePartSelectedIndex].SetColor(window.SelectedColor, Container.EditingColors, Colors.Brightness.Normal);
                        DrawThemeParts();
                    }
                };
                window.Show(true);
            }
            else
            {
                SelectPaletteColor window = new SelectPaletteColor(setting.UIColor);
                window.Center();
                window.Closed += (s, e) =>
                {
                    if (window.DialogResult)
                    {
                        _themeParts[_themePartSelectedIndex].SetUIColor(window.SelectedColor, Container.EditingColors, Colors.Brightness.Normal);
                        DrawThemeParts();
                    }
                };
                window.Show(true);
            }
        }
Ejemplo n.º 4
0
        public ColorPicker()
        {
            this.DrawMode = DrawMode.OwnerDrawFixed;
            this.DropDownStyle = ComboBoxStyle.DropDownList; // DropDownList
            this.DropDownHeight = 1;
            this.Items.AddRange(StaticLists.ColorList);
            Font = new Font("Arial", 8, FontStyle.Bold | FontStyle.Italic);

            _DropListBox = new ColorPickerPopup(this);
        }
Ejemplo n.º 5
0
        public AboutPage()
        {
            InitializeComponent();
            PaoloAbilita.On   = Preferences.Get("Paolo", false);
            Pts.On            = Services.Services.test;
            _colorPickerPopup = new ColorPickerPopup();
            _colorPickerPopup.ColorChanged += ColorPickerPopupOnColorChanged;
            Version.Text = "Version:" + "0.8Beta";
            //switch (Device.RuntimePlatform)             //Se il dispositivo è Android non mostra la Top Bar della Navigation Page, se è iOS la mostra
            //{
            //    default:
            //        NavigationPage.SetHasNavigationBar(this, true);
            //        break;
            //    case Device.Android:
            //        NavigationPage.SetHasNavigationBar(this, false);
            //        break;

            //}
        }
Ejemplo n.º 6
0
 private void ColorEdit_Click(object?sender, RoutedEventArgs e)
 {
     ColorPickerPopup.Open();
 }