예제 #1
0
        private static ColorPickerViewController MakePicker(SubMenu subMenu, string id, string name, string description, string hex, bool setter = true)
        {
            Color col = Color.red;

            ColorUtility.TryParseHtmlString(config.GetString("Colors", id, hex, true), out col);
            colorMap[id] = col;

            ColorPickerViewController newPicker = subMenu.AddColorPicker(name, description, colorMap[id]);

            newPicker.GetValue += delegate
            {
                return(colorMap[id]);
            };
            if (setter)
            {
                newPicker.SetValue += delegate(Color value)
                {
                    string newHex = "#" + ColorUtility.ToHtmlStringRGB(value);
                    hexMap[hex] = newHex;
                    config.SetString("Colors", id, newHex);
                };
            }

            return(newPicker);
        }