diff --git a/Assets/SEE/Controls/SEEInput.cs b/Assets/SEE/Controls/SEEInput.cs
index 4949199b23..6deeab5ba0 100644
--- a/Assets/SEE/Controls/SEEInput.cs
+++ b/Assets/SEE/Controls/SEEInput.cs
@@ -97,15 +97,6 @@ public static bool ToggleMirror()
return KeyboardShortcutsEnabled && KeyBindings.IsDown(KeyAction.ToggleMirror);
}
- ///
- /// Opens/closes the search menu.
- ///
- /// true if the user requests this action and
- internal static bool ToggleSearch()
- {
- return KeyboardShortcutsEnabled && KeyBindings.IsDown(KeyAction.ToggleSettings);
- }
-
///
/// True if KeyboardShortcutsEnabled and the key for the given
/// was pressed. Used as shortcuts for the menu entries.
diff --git a/Assets/SEE/UI/Notification/ShowNotification.cs b/Assets/SEE/UI/Notification/ShowNotification.cs
index 628cd1a251..e49c8aa948 100644
--- a/Assets/SEE/UI/Notification/ShowNotification.cs
+++ b/Assets/SEE/UI/Notification/ShowNotification.cs
@@ -72,14 +72,15 @@ private static SEENotificationManager CreateManager()
/// Description of the notification.
/// Time in seconds the notification should stay on the screen.
/// Whether to log the given notification in Unity's log as well
- public static void Info(string title, string description, float duration = defaultDuration,
+ /// The notification object representing the newly created notification.
+ public static Notification Info(string title, string description, float duration = defaultDuration,
bool log = true)
{
if (log)
{
Debug.Log($"{title}: {description}\n");
}
- Show(title, description, infoIcon, infoColor, duration);
+ return Show(title, description, infoIcon, infoColor, duration);
}
///
@@ -89,14 +90,15 @@ public static void Info(string title, string description, float duration = defau
/// Description of the notification.
/// Time in seconds the notification should stay on the screen.
/// Whether to log the given notification in Unity's log as well
- public static void Warn(string title, string description, float duration = defaultDuration,
+ /// The notification object representing the newly created notification.
+ public static Notification Warn(string title, string description, float duration = defaultDuration,
bool log = true)
{
if (log)
{
Debug.LogWarning($"{title}: {description}\n");
}
- Show(title, description, warningIcon, warningColor, duration);
+ return Show(title, description, warningIcon, warningColor, duration);
}
///
@@ -106,14 +108,15 @@ public static void Warn(string title, string description, float duration = defau
/// Description of the notification.
/// Time in seconds the notification should stay on the screen.
/// Whether to log the given notification in Unity's log as well
- public static void Error(string title, string description, float duration = defaultDuration,
+ /// The notification object representing the newly created notification.
+ public static Notification Error(string title, string description, float duration = defaultDuration,
bool log = true)
{
if (log)
{
Debug.LogError($"{title}: {description}\n");
}
- Show(title, description, errorIcon, errorColor, duration);
+ return Show(title, description, errorIcon, errorColor, duration);
}
///
@@ -124,14 +127,16 @@ public static void Error(string title, string description, float duration = defa
/// The icon of the notification.
/// The color of the notification.
/// The duration of the notification.
- private static void Show(string title, string description, Lazy icon, Color color,
- float duration = defaultDuration)
+ /// The notification object representing the newly created notification.
+ private static Notification Show(string title, string description, Lazy icon, Color color,
+ float duration = defaultDuration)
{
// Only show the notification if we are on the main thread.
if (AsyncUtils.IsRunningOnMainThread)
{
- manager.Value.Show(title, description, icon.Value, color, duration);
+ return manager.Value.Show(title, description, icon.Value, color, duration);
}
+ return null;
}
}
}
diff --git a/Assets/SEE/UI/SettingsMenu.cs b/Assets/SEE/UI/SettingsMenu.cs
index 784c1a68a4..abfe790e81 100644
--- a/Assets/SEE/UI/SettingsMenu.cs
+++ b/Assets/SEE/UI/SettingsMenu.cs
@@ -136,6 +136,9 @@ protected override void UpdateDesktop()
/// The new key code to assign to the key binding.
private async UniTaskVoid ReassignKeyAsync(KeyActionDescriptor descriptor, KeyCode newKey)
{
+ bindingToRebind = null;
+ SEEInput.KeyboardShortcutsEnabled = true;
+ bindingNotification.Close();
string question = $"Do you really want to reassign action \"{descriptor.Name}\" to key {newKey}?";
if (!await ConfirmDialog.ConfirmAsync(new(question, title: "Change Key?")))
{
@@ -150,22 +153,24 @@ private async UniTaskVoid ReassignKeyAsync(KeyActionDescriptor descriptor, KeyCo
{
ShowNotification.Error("Key code already bound", ex.Message, log: false);
}
-
- bindingToRebind = null;
- SEEInput.KeyboardShortcutsEnabled = true;
}
///
/// The keyBinding which gets updated.
///
- private KeyActionDescriptor bindingToRebind = null;
+ private KeyActionDescriptor bindingToRebind;
+
+ ///
+ /// The notification telling the user to press a key to rebind the keyBinding.
+ ///
+ private Notification.Notification bindingNotification;
///
/// Sets the .
///
private void StartRebindFor(KeyActionDescriptor binding)
{
- ShowNotification.Info("Bind action to key", "Press a key to bind this action.");
+ bindingNotification = ShowNotification.Info("Bind action to key", "Press a key to bind this action.");
bindingToRebind = binding;
}