Exemplo n.º 1
0
        /// <summary>
        /// Sets the currently selected color
        /// </summary>
        /// <param name="color">The new value for the currently selected color</param>
        /// <param name="keepTransparency">Whether to keep the current alpha channel unmodified</param>
        public void SetCurrentColor(AhslColor color, bool keepTransparency = false)
        {
            AhslColor oldColor = Color.White.ToAhsl();

            if (keepTransparency)
            {
                color = new AhslColor(GetCurrentColor().A, color.Hf, color.Sf, color.Lf);
            }

            switch (_selectedColor)
            {
            case ColorPickerColor.FirstColor:
                oldColor       = _firstColor;
                FirstAhslColor = color;
                break;

            case ColorPickerColor.SecondColor:
                oldColor        = _secondColor;
                SecondAhslColor = color;
                break;
            }

            UpdateSliders();

            ColorPick?.Invoke(this, new ColorPickEventArgs(oldColor.ToColor(), color.ToColor(), _selectedColor));
        }
Exemplo n.º 2
0
Arquivo: Data.cs Projeto: Goodos/Snake
    public static Color GetColor(ColorPick color)
    {
        switch (color)
        {
        case ColorPick.Red:
            return(Color.red);

        case ColorPick.Magenta:
            return(Color.magenta);

        case ColorPick.Yellow:
            return(Color.yellow);

        case ColorPick.Green:
            return(Color.green);

        case ColorPick.Blue:
            return(Color.blue);

        case ColorPick.Cyan:
            return(Color.cyan);

        default:
            return(Color.white);
        }
    }
Exemplo n.º 3
0
 private void BgColorButton_Click(object sender, EventArgs e)
 {
     if (ColorPick.ShowDialog() == DialogResult.OK)
     {
         Program.BgColor       = ColorPick.Color;
         pictureBox1.BackColor = Program.BgColor;
     }
     SettingsManager.ChangeSetting(SettingsManager.ColorToString(Program.BgColor), "Color");
 }
Exemplo n.º 4
0
        private void Colorpicker_SelectedIndexChanged(object sender, EventArgs e)
        {
            var picker        = (Picker)sender;
            int selectedIndex = picker.SelectedIndex;

            if (selectedIndex >= 0)
            {
                ColorPick selected = (ColorPick)picker.SelectedItem;
                model.Color = selected.Color;
            }
        }
Exemplo n.º 5
0
 internal void setButtons(ColorPick colorPicker)
 {
     buttonPanel.chooseButton0.setChooseButton(colorPicker);
     buttonPanel.chooseButton1.setChooseButton(colorPicker);
     buttonPanel.chooseButton2.setChooseButton(colorPicker);
     buttonPanel.chooseButton3.setChooseButton(colorPicker);
     buttonPanel.chooseButton4.setChooseButton(colorPicker);
     buttonPanel.chooseButton5.setChooseButton(colorPicker);
     buttonPanel.toggleSwitch1.setToggleSwitch(colorPicker);
     buttonPanel.toggleSwitch2.setToggleSwitch(colorPicker);
 }
Exemplo n.º 6
0
        public LocationCardPage(LocationViewModel lvm)
        {
            model          = lvm;
            BindingContext = model;
            InitializeComponent();
            Title = AppResources.LocationNewPage_Title;


            colorpicker.ItemsSource = Global.Colors;
            ColorPick color = Global.Colors.Find(x => x.Color == lvm.Color);

            if (color is ColorPick)
            {
                colorpicker.SelectedItem = color;
            }
        }
Exemplo n.º 7
0
        public ZoneCardPage(ZoneViewModel zvm)
        {
            model          = zvm;
            BindingContext = model;
            InitializeComponent();

            colorpicker.ItemsSource = Global.Colors;
            ColorPick color = Global.Colors.Find(x => x.Color == zvm.Color);

            if (color is ColorPick)
            {
                colorpicker.SelectedItem = color;
            }
            UpdateTitle();

            MessagingCenter.Subscribe <ZoneViewModel>(this, "LocationsIsLoaded", LocationsIsLoaded);
            MessagingCenter.Subscribe <ZoneViewModel>(this, "BinTypesIsLoaded", BinTypesIsLoaded);
            model.State = ModelState.Normal;
        }
Exemplo n.º 8
0
    public void Initiliaze(int _startingColor, int _blockedColor)
    {
        availableColors = GameData.Instance.Colors.TeamColors;
        IdSelected      = _startingColor;
        colorPickList   = new List <ColorPick>();
        int id = 0;

        foreach (Color color in availableColors)
        {
            ColorPick pick = Instantiate(colorPickTemplate, colorPickContainer);
            pick.SetColor(color);
            pick.Id = id;
            pick.SetSelected(id == _startingColor);
            pick.interactable = id != _blockedColor;
            id++;
            pick.onClick.AddListener(delegate
            {
                SelectColor(pick.Id);
            });
            colorPickList.Add(pick);
        }
    }
Exemplo n.º 9
0
 public PropertyControl()
 {
     InitializeComponent();
     propertyPanelController = new PropertyPanelController(this.property_panel);
     colorPicker             = propertyPanelController.colorPicker;
 }