Beispiel #1
0
        public EditorKeyBinding RegisterKeyBinding(EditorKeyBinding binding)
        {
            EditorKeyBinding b;

            if (AdditionalKeyBindings.TryGetValue(binding.Name, out b))
            {
                return(b);
            }
            else
            {
                setKeyBindingFromPrefs(binding, false);
                AdditionalKeyBindings.Add(binding.Name, binding);
                return(binding);
            }
        }
Beispiel #2
0
        void setKeyBindingFromPrefs(EditorKeyBinding binding, bool removePrefsIfEqual = true)
        {
            string newBindString = GetEditorPrefs <string>(binding.Name, "");

            if (!string.IsNullOrEmpty(newBindString))
            {
                // Same binding? Then remove prefs setting
                if (removePrefsIfEqual && newBindString == binding.ToPrefsString())
                {
                    DeleteEditorPrefs(binding.Name);
                }
                else // load and set new binding
                {
                    binding.Set(newBindString);
                }
            }
        }