3using System.Collections.Generic;
20 protected List<Color>
presets =
new List<Color>();
24 public enum SaveType { None, PlayerPrefs, JsonFile }
33 get {
return Application.persistentDataPath +
"/" +
playerPrefsKey +
".json"; }
77 throw new System.NotImplementedException(saveType.ToString());
80 if (!
string.IsNullOrEmpty(jsonData))
84 var jsonColors = JsonUtility.FromJson<
JsonColor>(jsonData);
85 presets.AddRange(jsonColors.GetColors());
87 catch (System.Exception e)
89 Debug.LogException(e);
104 "presets cannot be null or empty: " + (
presets ==
null ?
"NULL" :
"EMPTY"));
109 jsonColor.SetColors(
presets.ToArray());
112 string jsonData = JsonUtility.ToJson(jsonColor);
117 Debug.LogWarning(
"Called SavePresets with SaveType = None...");
127 throw new System.NotImplementedException(saveType.ToString());
136 this.colors =
new Color32[colorsIn.Length];
137 for (
int i = 0; i < colorsIn.Length; i++)
139 this.colors[i] = colorsIn[i];
146 for (
int i = 0; i <
colors.Length; i++)
159 newPresetButton.transform.SetAsLastSibling();
160 newPresetButton.SetActive(
true);
161 newPresetButton.GetComponent<
Image>().color = color;
System.Drawing.Image Image
HSVChangedEvent onHSVChanged
ColorChangedEvent onValueChanged
void SetColors(Color[] colorsIn)
virtual void ColorChanged(Color color)
virtual void LoadPresets(SaveType saveType)
virtual void CreatePreset(Color color, bool loading)
virtual void PresetSelect(Image sender)
virtual void SavePresets(SaveType saveType)
virtual string JsonFilePath
virtual void CreatePreset(Color color)
Color[] predefinedPresets
virtual void CreatePresetButton()
ColorPickerControl picker
virtual void HSVChanged(float h, float s, float v)