mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Normalize namespaces
This commit is contained in:
parent
04c6be5671
commit
7aba15ef5b
21 changed files with 124 additions and 47 deletions
|
|
@ -56,15 +56,16 @@ namespace Dalamud.CorePlugin
|
|||
/// </summary>
|
||||
/// <param name="pluginInterface">Dalamud plugin interface.</param>
|
||||
/// <param name="log">Logging service.</param>
|
||||
public PluginImpl(DalamudPluginInterface pluginInterface, IPluginLog log)
|
||||
public PluginImpl(DalamudPluginInterface pluginInterface, IPluginLog log, INotificationManager notificationManager)
|
||||
{
|
||||
this.NotificationManager = notificationManager;
|
||||
try
|
||||
{
|
||||
// this.InitLoc();
|
||||
this.Interface = pluginInterface;
|
||||
this.pluginLog = log;
|
||||
|
||||
this.windowSystem.AddWindow(new PluginWindow());
|
||||
this.windowSystem.AddWindow(new PluginWindow(this));
|
||||
|
||||
this.Interface.UiBuilder.Draw += this.OnDraw;
|
||||
this.Interface.UiBuilder.OpenConfigUi += this.OnOpenConfigUi;
|
||||
|
|
@ -84,6 +85,8 @@ namespace Dalamud.CorePlugin
|
|||
}
|
||||
}
|
||||
|
||||
public INotificationManager NotificationManager { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the plugin interface.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.Windowing;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.CorePlugin
|
||||
|
|
@ -14,15 +16,19 @@ namespace Dalamud.CorePlugin
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginWindow"/> class.
|
||||
/// </summary>
|
||||
public PluginWindow()
|
||||
/// <param name="pluginImpl"></param>
|
||||
public PluginWindow(PluginImpl pluginImpl)
|
||||
: base("CorePlugin")
|
||||
{
|
||||
this.PluginImpl = pluginImpl;
|
||||
this.IsOpen = true;
|
||||
|
||||
this.Size = new Vector2(810, 520);
|
||||
this.SizeCondition = ImGuiCond.FirstUseEver;
|
||||
}
|
||||
|
||||
public PluginImpl PluginImpl { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
@ -36,6 +42,72 @@ namespace Dalamud.CorePlugin
|
|||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
if (ImGui.Button("Legacy"))
|
||||
this.PluginImpl.Interface.UiBuilder.AddNotification("asdf");
|
||||
if (ImGui.Button("Test"))
|
||||
{
|
||||
const string 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.";
|
||||
|
||||
NewRandom(out var title, out var type);
|
||||
var n = this.PluginImpl.NotificationManager.AddNotification(
|
||||
new()
|
||||
{
|
||||
Content = text,
|
||||
Title = title,
|
||||
Type = type,
|
||||
Interactible = true,
|
||||
Expiry = DateTime.MaxValue,
|
||||
});
|
||||
|
||||
var nclick = 0;
|
||||
n.Click += _ => nclick++;
|
||||
n.DrawActions += an =>
|
||||
{
|
||||
if (ImGui.Button("Update in place"))
|
||||
{
|
||||
NewRandom(out title, out type);
|
||||
an.Update(an.CloneNotification() with { Title = title, Type = type });
|
||||
}
|
||||
|
||||
if (an.IsMouseHovered)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button("Dismiss"))
|
||||
an.DismissNow();
|
||||
}
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted($"Clicked {nclick} time(s)");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static void NewRandom(out string? title, out NotificationType type)
|
||||
{
|
||||
var rand = new Random();
|
||||
|
||||
title = rand.Next(0, 7) 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,
|
||||
};
|
||||
|
||||
type = rand.Next(0, 5) switch
|
||||
{
|
||||
0 => NotificationType.Error,
|
||||
1 => NotificationType.Warning,
|
||||
2 => NotificationType.Info,
|
||||
3 => NotificationType.Success,
|
||||
4 => NotificationType.None,
|
||||
_ => NotificationType.None,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using Dalamud.Game.Gui;
|
|||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.Internal.Windows;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
|
||||
namespace Dalamud.Interface.ImGuiNotification;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public interface INotification
|
|||
/// <remarks>Set to <see cref="DateTime.MaxValue"/> to make the notification not have an expiry time
|
||||
/// (sticky, indeterminate, permanent, or persistent).</remarks>
|
||||
DateTime Expiry { get; }
|
||||
|
||||
|
||||
/// <summary>Gets a value indicating whether this notification may be interacted.</summary>
|
||||
/// <remarks>
|
||||
/// Set this value to <c>true</c> if you want to respond to user inputs from
|
||||
|
|
@ -52,7 +52,7 @@ public interface INotification
|
|||
/// This property is applicable regardless of <see cref="Interactible"/>.
|
||||
/// </remarks>
|
||||
TimeSpan HoverExtendDuration { get; }
|
||||
|
||||
|
||||
/// <summary>Gets the progress for the progress bar of the notification.
|
||||
/// The progress should either be in the range between 0 and 1 or be a negative value.
|
||||
/// Specifying a negative value will show an indeterminate progress bar.</summary>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Dalamud.Interface.Animation;
|
|||
using Dalamud.Interface.Animation.EasingFunctions;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.ImGuiNotification;
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal.Windows;
|
||||
using Dalamud.Interface.ManagedFontAtlas;
|
||||
using Dalamud.Interface.Utility;
|
||||
|
|
@ -2,7 +2,7 @@ using System.Numerics;
|
|||
|
||||
using Dalamud.Interface.Utility;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Notifications;
|
||||
namespace Dalamud.Interface.ImGuiNotification.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// Constants for drawing notification windows.
|
||||
|
|
@ -94,7 +94,7 @@ internal static class NotificationConstants
|
|||
|
||||
/// <summary>Gets the scaled size of the icon.</summary>
|
||||
public static float ScaledIconSize => MathF.Round(IconSize * ImGuiHelpers.GlobalScale);
|
||||
|
||||
|
||||
/// <summary>Gets the height of the expiry progress bar.</summary>
|
||||
public static float ScaledExpiryProgressBarHeight => MathF.Round(2 * ImGuiHelpers.GlobalScale);
|
||||
|
||||
|
|
@ -2,7 +2,7 @@ using System.Collections.Concurrent;
|
|||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Interface.GameFonts;
|
||||
using Dalamud.Interface.ImGuiNotification;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.ManagedFontAtlas;
|
||||
using Dalamud.Interface.ManagedFontAtlas.Internals;
|
||||
using Dalamud.Interface.Utility;
|
||||
|
|
@ -11,7 +11,7 @@ using Dalamud.IoC.Internal;
|
|||
using Dalamud.Plugin.Internal.Types;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Notifications;
|
||||
namespace Dalamud.Interface.ImGuiNotification.Internal;
|
||||
|
||||
/// <summary>
|
||||
/// Class handling notifications/toasts in ImGui.
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
|
||||
namespace Dalamud.Interface.ImGuiNotification;
|
||||
|
|
|
|||
|
|
@ -1,22 +1,16 @@
|
|||
namespace Dalamud.Interface.ImGuiNotification;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the reason of dismissal for a notification.
|
||||
/// </summary>
|
||||
/// <summary>Specifies the reason of dismissal for a notification.</summary>
|
||||
public enum NotificationDismissReason
|
||||
{
|
||||
/// <summary>
|
||||
/// The notification is dismissed because the expiry specified from <see cref="INotification.Expiry"/> is met.
|
||||
/// </summary>
|
||||
/// <summary>The notification is dismissed because the expiry specified from <see cref="INotification.Expiry"/> is
|
||||
/// met.</summary>
|
||||
Timeout = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The notification is dismissed because the user clicked on the close button on a notification window.
|
||||
|
||||
/// <summary>The notification is dismissed because the user clicked on the close button on a notification window.
|
||||
/// </summary>
|
||||
Manual = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The notification is dismissed from calling <see cref="IActiveNotification.DismissNow"/>.
|
||||
/// </summary>
|
||||
|
||||
/// <summary>The notification is dismissed from calling <see cref="IActiveNotification.DismissNow"/>.</summary>
|
||||
Programmatical = 3,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
namespace Dalamud.Interface.ImGuiNotification;
|
||||
|
||||
/// <summary>
|
||||
/// Delegate representing the dismissal of an active notification.
|
||||
/// </summary>
|
||||
/// <summary>Delegate representing the dismissal of an active notification.</summary>
|
||||
/// <param name="notification">The notification being dismissed.</param>
|
||||
/// <param name="dismissReason">The reason of dismissal.</param>
|
||||
public delegate void NotificationDismissedDelegate(
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ using Dalamud.Game.ClientState.Keys;
|
|||
using Dalamud.Game.Internal.DXGI;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Hooking.WndProcHook;
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal.ManagedAsserts;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.ManagedFontAtlas;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,23 @@
|
|||
namespace Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// Possible notification types.
|
||||
/// </summary>
|
||||
namespace Dalamud.Interface.Internal.Notifications;
|
||||
|
||||
/// <summary>Possible notification types.</summary>
|
||||
[Api10ToDo(Api10ToDoAttribute.MoveNamespace, nameof(ImGuiNotification.Internal))]
|
||||
public enum NotificationType
|
||||
{
|
||||
/// <summary>
|
||||
/// No special type.
|
||||
/// </summary>
|
||||
/// <summary>No special type.</summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// Type indicating success.
|
||||
/// </summary>
|
||||
/// <summary>Type indicating success.</summary>
|
||||
Success,
|
||||
|
||||
/// <summary>
|
||||
/// Type indicating a warning.
|
||||
/// </summary>
|
||||
/// <summary>Type indicating a warning.</summary>
|
||||
Warning,
|
||||
|
||||
/// <summary>
|
||||
/// Type indicating an error.
|
||||
/// </summary>
|
||||
/// <summary>Type indicating an error.</summary>
|
||||
Error,
|
||||
|
||||
/// <summary>
|
||||
/// Type indicating generic information.
|
||||
/// </summary>
|
||||
/// <summary>Type indicating generic information.</summary>
|
||||
Info,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.Numerics;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.Windowing;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ using Dalamud.Game.Command;
|
|||
using Dalamud.Interface.Animation.EasingFunctions;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using CheapLoc;
|
|||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.Reflection;
|
|||
using Dalamud.Game;
|
||||
using Dalamud.Hooking.Internal;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Plugin.Internal;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using Dalamud.Game.Gui;
|
|||
using Dalamud.Interface.FontIdentifier;
|
||||
using Dalamud.Interface.GameFonts;
|
||||
using Dalamud.Interface.ImGuiNotification;
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Internal.ManagedAsserts;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Logging.Internal;
|
||||
using Dalamud.Plugin.Internal.Types.Manifest;
|
||||
|
|
|
|||
|
|
@ -11,9 +11,19 @@ internal sealed class Api10ToDoAttribute : Attribute
|
|||
/// </summary>
|
||||
public const string DeleteCompatBehavior = "Delete. This is for making API 9 plugins work.";
|
||||
|
||||
/// <summary>
|
||||
/// Marks that this should be moved to an another namespace.
|
||||
/// </summary>
|
||||
public const string MoveNamespace = "Move to another namespace.";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Api10ToDoAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="what">The explanation.</param>
|
||||
public Api10ToDoAttribute(string what) => _ = what;
|
||||
/// <param name="what2">The explanation 2.</param>
|
||||
public Api10ToDoAttribute(string what, string what2 = "")
|
||||
{
|
||||
_ = what;
|
||||
_ = what2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue