瀏覽代碼

Tweak settings GUI and controls

KeyRebindButton will be blank when listening for a new key.

KeyRebindButton will also cancel rebind when escape is pushed.

The rest of the settings in SettingsWindowPane will be disabled when
rebinding keys.

Settings close button will be disabled when rebinding a key.
habeebweeb 4 年之前
父節點
當前提交
d9cbb44344

+ 3 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/KeyRebindButton.cs

@@ -39,6 +39,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private void StartListening()
         {
             listening = true;
+            button.Label = string.Empty;
             InputManager.StartListening();
             InputManager.KeyChange += KeyChange;
         }
@@ -46,7 +47,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private void KeyChange(object sender, EventArgs args)
         {
             listening = false;
-            KeyCode = InputManager.CurrentKeyCode;
+            if (InputManager.CurrentKeyCode != KeyCode.Escape) KeyCode = InputManager.CurrentKeyCode;
+            else KeyCode = KeyCode;
             InputManager.KeyChange -= KeyChange;
             OnControlEvent(EventArgs.Empty);
         }

+ 6 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/SettingsWindowPane.cs

@@ -99,9 +99,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 DrawSetting(key);
             }
 
+            GUI.enabled = !InputManager.Listening;
+
+            // Translation settings
             MpsGui.WhiteLine();
             reloadTranslationButton.Draw();
+
             GUILayout.EndScrollView();
+
+            GUI.enabled = true;
         }
 
         private void DrawSetting(MpsKey key)

+ 2 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/MainWindow.cs

@@ -119,7 +119,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             GUILayout.BeginHorizontal();
             GUILayout.Label(MeidoPhotoStudio.pluginString, labelStyle);
             GUILayout.FlexibleSpace();
+            GUI.enabled = !InputManager.Listening;
             settingsButton.Draw(GUILayout.ExpandWidth(false));
+            GUI.enabled = true;
             GUILayout.EndHorizontal();
 
             GUI.DragWindow();