Example #1
0
        public void ClearHotkeyConflicts(int optionID, KeyCode hotkey, EventModifiers modifiers)
        {
            if (hotkey == KeyCode.None)
            {
                return;
            }
            var fullscreenOptions = typeof(EditorFullscreenSettings).GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public).Where(field => (field.FieldType == typeof(FullscreenOption))).ToList();

            foreach (var fsOp in fullscreenOptions)
            {
                var fullscreenOption = (FullscreenOption)fsOp.GetValue(this);
                if (optionID != fullscreenOption.OptionID && EditorInput.HotkeysMatch(hotkey, modifiers, fullscreenOption.hotkey, fullscreenOption.modifiers))
                {
                    //Clear the conflicting hotkey
                    fullscreenOption.hotkey    = KeyCode.None;
                    fullscreenOption.modifiers = EventModifiers.None;
                }
                fsOp.SetValue(this, fullscreenOption);
            }
        }
Example #2
0
 private static bool CheckHotkeyTriggered(KeyCode keyCode, EventModifiers modifiers, EditorFullscreenSettings.FullscreenOption fullscreenOption)
 {
     if (keyCode == KeyCode.None)
     {
         return(false);
     }
     if (EditorInput.HotkeysMatch(keyCode, modifiers, fullscreenOption.hotkey, fullscreenOption.modifiers))
     {
         if (EditorFullscreenSettingsWindow.window != null && EditorFullscreenSettingsWindow.window.IsFocusedOnHotkeyField())
         {
             //Don't trigger the fullscreen hotkey if currently focused on the hotkey field in the settings window.
             EditorFullscreenSettingsWindow.window.HotkeyConflictResendEvent(keyCode, modifiers); //Resend the hotkey event to the settings window so the hotkey can be changed.
             return(false);
         }
         else
         {
             //Trigger the fullscreen hotkey
             triggeredHotkey = fullscreenOption;
             return(true);
         }
     }
     return(false);
 }