Add notification text to Editor status bar after saving to improve user awareness
This commit is contained in:
@@ -585,6 +585,7 @@ namespace FlaxEditor
|
||||
Windows.SaveCurrentLayout();
|
||||
Scene.SaveScenes();
|
||||
SaveContent();
|
||||
UI.AddStatusMessage("Saved!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -238,6 +238,7 @@ namespace FlaxEditor.Modules
|
||||
node.IsEdited = false;
|
||||
}
|
||||
Level.SaveAllScenesAsync();
|
||||
Editor.UI.AddStatusMessage("Saved!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using FlaxEditor.Gizmo;
|
||||
using FlaxEditor.GUI;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
@@ -30,6 +31,7 @@ namespace FlaxEditor.Modules
|
||||
{
|
||||
private Label _progressLabel;
|
||||
private ProgressBar _progressBar;
|
||||
private List<KeyValuePair<string, DateTime>> _statusMessages;
|
||||
|
||||
private ContextMenuButton _menuFileSaveScenes;
|
||||
private ContextMenuButton _menuFileCloseScenes;
|
||||
@@ -251,18 +253,35 @@ namespace FlaxEditor.Modules
|
||||
|
||||
Color color;
|
||||
if (Editor.StateMachine.IsPlayMode)
|
||||
{
|
||||
color = Color.OrangeRed;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Style.Current.BackgroundSelected;
|
||||
}
|
||||
|
||||
StatusBar.Text = Editor.StateMachine.CurrentState.Status ?? "Ready";
|
||||
string text;
|
||||
if (_statusMessages != null && _statusMessages.Count != 0)
|
||||
text = _statusMessages[0].Key;
|
||||
else if (Editor.StateMachine.CurrentState.Status != null)
|
||||
text = Editor.StateMachine.CurrentState.Status;
|
||||
else
|
||||
text = "Ready";
|
||||
|
||||
StatusBar.Text = text;
|
||||
StatusBar.StatusColor = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the status bar message text to be displayed as a notification.
|
||||
/// </summary>
|
||||
/// <param name="message">The message to display.</param>
|
||||
public void AddStatusMessage(string message)
|
||||
{
|
||||
if (_statusMessages == null)
|
||||
_statusMessages = new List<KeyValuePair<string, DateTime>>();
|
||||
_statusMessages.Add(new KeyValuePair<string, DateTime>(message, DateTime.Now + TimeSpan.FromSeconds(3.0f)));
|
||||
if (_statusMessages.Count == 1)
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
||||
internal bool ProgressVisible
|
||||
{
|
||||
get => _progressLabel?.Parent.Visible ?? false;
|
||||
@@ -306,6 +325,16 @@ namespace FlaxEditor.Modules
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnUpdate()
|
||||
{
|
||||
if (_statusMessages != null && _statusMessages.Count > 0 && _statusMessages[0].Value - DateTime.Now < TimeSpan.Zero)
|
||||
{
|
||||
_statusMessages.RemoveAt(0);
|
||||
UpdateStatusBar();
|
||||
}
|
||||
}
|
||||
|
||||
private class CustomWindowBorderControl : Control
|
||||
{
|
||||
@@ -814,6 +843,7 @@ namespace FlaxEditor.Modules
|
||||
StatusBar = null;
|
||||
_progressLabel = null;
|
||||
_progressBar = null;
|
||||
_statusMessages = null;
|
||||
|
||||
MenuFile = null;
|
||||
MenuGame = null;
|
||||
|
||||
Reference in New Issue
Block a user