mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-23 00:07:49 +01:00
feat: add ImGui notifications/toasts
This commit is contained in:
parent
33634f7fb9
commit
a03db8b35d
4 changed files with 392 additions and 1 deletions
|
|
@ -1018,6 +1018,38 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
|
||||
ImGui.Button("THIS IS A BUTTON###hoverTestButton");
|
||||
this.dalamud.InterfaceManager.OverrideGameCursor = !ImGui.IsItemHovered();
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
if (ImGui.Button("Add random notification"))
|
||||
{
|
||||
var rand = new Random();
|
||||
|
||||
var title = rand.Next(0, 5) switch
|
||||
{
|
||||
0 => "This is a toast",
|
||||
1 => "Truly, a toast",
|
||||
2 => "I am testing this toast",
|
||||
3 => "I hope this looks right",
|
||||
4 => "Good stuff",
|
||||
5 => "Nice",
|
||||
_ => null,
|
||||
};
|
||||
|
||||
var type = rand.Next(0, 4) switch
|
||||
{
|
||||
0 => Notifications.Notification.Type.Error,
|
||||
1 => Notifications.Notification.Type.Warning,
|
||||
2 => Notifications.Notification.Type.Info,
|
||||
3 => Notifications.Notification.Type.Success,
|
||||
4 => Notifications.Notification.Type.None,
|
||||
_ => Notifications.Notification.Type.None,
|
||||
};
|
||||
|
||||
var text = "Bla bla bla bla bla bla bla bla bla bla bla.\nBla bla bla bla bla bla bla bla bla bla bla bla bla bla.";
|
||||
|
||||
this.dalamud.InterfaceManager.Notifications.AddNotification(text, title, type);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawTex()
|
||||
|
|
|
|||
|
|
@ -315,6 +315,11 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
if (this.updatePluginCount > 0)
|
||||
{
|
||||
this.dalamud.PluginManager.PrintUpdatedPlugins(this.updatedPlugins, Locs.PluginUpdateHeader_Chatbox);
|
||||
this.dalamud.InterfaceManager.Notifications.AddNotification($"Updates for {this.updatePluginCount} of your plugins were installed.", "Updates installed!", Notifications.Notification.Type.Success);
|
||||
}
|
||||
else if (this.updatePluginCount == 0)
|
||||
{
|
||||
this.dalamud.InterfaceManager.Notifications.AddNotification("No updates were found.", "No updates", Notifications.Notification.Type.Info);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -682,7 +687,10 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
{
|
||||
// There is no need to set as Complete for an individual plugin installation
|
||||
this.installStatus = OperationStatus.Idle;
|
||||
this.DisplayErrorContinuation(task, Locs.ErrorModal_InstallFail(manifest.Name));
|
||||
if (this.DisplayErrorContinuation(task, Locs.ErrorModal_InstallFail(manifest.Name)))
|
||||
{
|
||||
this.dalamud.InterfaceManager.Notifications.AddNotification($"The plugin {manifest.Name} was successfully installed.", "Plugin installed!", Notifications.Notification.Type.Success);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue