Exemplo n.º 1
0
        public void SetColors(float value, ColorPicker.E_PaletteMode mode)
        {
            List <Color> colors = new List <Color>();

            switch (mode)
            {
            case ColorPicker.E_PaletteMode.Red:
                foreach (Color mColor in m_Colors)
                {
                    colors.Add(new Color(value, mColor.g, mColor.b, mColor.a));
                }
                break;

            case ColorPicker.E_PaletteMode.Green:
                foreach (Color mColor in m_Colors)
                {
                    colors.Add(new Color(mColor.r, value, mColor.b, mColor.a));
                }
                break;

            case ColorPicker.E_PaletteMode.Blue:
                foreach (Color mColor in m_Colors)
                {
                    colors.Add(new Color(mColor.r, mColor.g, value, mColor.a));
                }
                break;
            }
            m_Colors.Clear();
            m_Colors = colors;
            Rebuild();
        }
Exemplo n.º 2
0
        public void SetColors(float value, ColorPicker.E_PaletteMode mode)
        {
            switch (mode)
            {
            case ColorPicker.E_PaletteMode.Red:
                TopLeft.r     = value;
                TopRight.r    = value;
                BottomLeft.r  = value;
                BottomRight.r = value;
                break;

            case ColorPicker.E_PaletteMode.Green:
                TopLeft.g     = value;
                TopRight.g    = value;
                BottomLeft.g  = value;
                BottomRight.g = value;
                break;

            case ColorPicker.E_PaletteMode.Blue:
                TopLeft.b     = value;
                TopRight.b    = value;
                BottomLeft.b  = value;
                BottomRight.b = value;
                break;
            }
            Rebuild();
        }
Exemplo n.º 3
0
        public Vector2 GetPosition(Color color0, ColorPicker.E_PaletteMode mode)
        {
            var red    = color0.r;
            var green  = color0.g;
            var blue   = color0.b;
            var origin = new Vector2(-RectSize.x / 2.0f, -RectSize.y / 2.0f);

            switch (mode)
            {
            case ColorPicker.E_PaletteMode.Red:
                return(origin + new Vector2(RectSize.x * blue, RectSize.y * green));

            case ColorPicker.E_PaletteMode.Green:
                return(origin + new Vector2(RectSize.x * blue, RectSize.y * red));

            case ColorPicker.E_PaletteMode.Blue:
                return(origin + new Vector2(RectSize.x * red, RectSize.y * green));
            }
            return(Vector2.zero);
        }