Esempio n. 1
0
        /// <summary>
        /// プリセットの保存
        /// </summary>
        public static void SetList(PresetList presetList)
        {
            var json = JsonUtility.ToJson(presetList);

            EditorPrefs.SetString(PRESET_KEY, json);

            ColorWindow.NeedReload = true;
        }
Esempio n. 2
0
        /// <summary>
        /// プリセットの削除
        /// </summary>
        public static void RemoveAt(int index)
        {
            PresetList presetList = GetList();

            presetList.List.RemoveAt(index);

            var json = JsonUtility.ToJson(presetList);

            EditorPrefs.SetString(PRESET_KEY, json);

            ColorWindow.NeedReload = true;
        }
Esempio n. 3
0
        /// <summary>
        /// プリセットの取得
        /// </summary>
        public static PresetList GetList()
        {
            PresetList presetList;

            if (EditorPrefs.HasKey(PRESET_KEY))
            {
                presetList = (PresetList)JsonUtility.FromJson(EditorPrefs.GetString(PRESET_KEY), typeof(PresetList));
            }
            else
            {
                presetList = new PresetList();
            }
            return(presetList);
        }
Esempio n. 4
0
        /// <summary>
        /// プリセットの登録
        /// </summary>
        public static void Add(string name, Color[] colors)
        {
            var preset = new ColorPreset();

            preset.Name       = name;
            preset.ColorArray = colors;

            PresetList presetList = GetList();

            presetList.List.Add(preset);

            var json = JsonUtility.ToJson(presetList);

            EditorPrefs.SetString(PRESET_KEY, json);

            ColorWindow.NeedReload = true;
        }
Esempio n. 5
0
 void ReloadPreset()
 {
     this.presetList = ColorDatabase.GetList();
 }