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

            EditorPrefs.SetString(PRESET_KEY, json);

            ColorWindow.NeedReload = true;
        }
Beispiel #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;
        }
Beispiel #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);
        }
Beispiel #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;
        }
Beispiel #5
0
 void ReloadPreset()
 {
     this.presetList = ColorDatabase.GetList();
 }