예제 #1
0
 private void RevertColors()
 {
     foreach (KeyValuePair <string, PrefColor> kvp in PrefSettings.Prefs <PrefColor>())
     {
         kvp.Value.ResetToDefault();
         EditorPrefs.SetString(kvp.Value.Name, kvp.Value.ToUniqueString());
     }
 }
예제 #2
0
 private PrefKey(string name, string shortcut)
 {
     this.m_name            = name;
     this.m_Shortcut        = shortcut;
     this.m_DefaultShortcut = shortcut;
     PrefSettings.Add(this);
     m_Loaded = false;
 }
예제 #3
0
 public PrefColor(string name, float defaultRed, float defaultGreen, float defaultBlue, float defaultAlpha, float defaultRed2, float defaultGreen2, float defaultBlue2, float defaultAlpha2)
 {
     this.m_Name              = name;
     this.m_Color             = this.m_DefaultColor = new Color(defaultRed, defaultGreen, defaultBlue, defaultAlpha);
     this.m_SeparateColors    = true;
     this.m_OptionalDarkColor = this.m_OptionalDarkDefaultColor = new Color(defaultRed2, defaultGreen2, defaultBlue2, defaultAlpha2);
     PrefSettings.Add(this);
     m_Loaded = false;
 }
예제 #4
0
        public void Load()
        {
            if (m_Loaded)
            {
                return;
            }

            m_Loaded = true;

            this.m_event = Event.KeyboardEvent(m_Shortcut);
            PrefKey pk = PrefSettings.Get(m_name, this);

            this.m_name  = pk.Name;
            this.m_event = pk.KeyboardEvent;
        }
예제 #5
0
        public void Load()
        {
            if (m_Loaded)
            {
                return;
            }

            m_Loaded = true;

            PrefColor pk = PrefSettings.Get(m_Name, this);

            this.m_Name              = pk.m_Name;
            this.m_Color             = pk.m_Color;
            this.m_SeparateColors    = pk.m_SeparateColors;
            this.m_OptionalDarkColor = pk.m_OptionalDarkColor;
        }
예제 #6
0
        private void ShowColors(string searchContext)
        {
            if (s_CachedColors == null)
            {
                s_CachedColors = OrderPrefs(PrefSettings.Prefs <PrefColor>());
            }

            var       changedColor = false;
            PrefColor ccolor       = null;

            foreach (KeyValuePair <string, List <KeyValuePair <string, PrefColor> > > category in s_CachedColors)
            {
                GUILayout.Label(category.Key, EditorStyles.boldLabel);
                foreach (KeyValuePair <string, PrefColor> kvp in category.Value)
                {
                    EditorGUI.BeginChangeCheck();
                    Color c = EditorGUILayout.ColorField(kvp.Key, kvp.Value.Color);
                    if (EditorGUI.EndChangeCheck())
                    {
                        ccolor       = kvp.Value;
                        ccolor.Color = c;
                        changedColor = true;
                    }
                }
                if (ccolor != null)
                {
                    PrefSettings.Set(ccolor.Name, ccolor);
                }
            }
            GUILayout.Space(5f);

            if (GUILayout.Button(ColorsProperties.userDefaults, GUILayout.Width(120)))
            {
                RevertColors();
                changedColor = true;
            }

            if (changedColor)
            {
                EditorApplication.RequestRepaintAllViews();
            }
        }