mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 13:14:17 +01:00
Revert CorePlugin commits
This commit is contained in:
parent
3a6aa13c3b
commit
06bbc558a8
2 changed files with 3 additions and 78 deletions
|
|
@ -56,16 +56,15 @@ namespace Dalamud.CorePlugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pluginInterface">Dalamud plugin interface.</param>
|
/// <param name="pluginInterface">Dalamud plugin interface.</param>
|
||||||
/// <param name="log">Logging service.</param>
|
/// <param name="log">Logging service.</param>
|
||||||
public PluginImpl(DalamudPluginInterface pluginInterface, IPluginLog log, INotificationManager notificationManager)
|
public PluginImpl(DalamudPluginInterface pluginInterface, IPluginLog log)
|
||||||
{
|
{
|
||||||
this.NotificationManager = notificationManager;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// this.InitLoc();
|
// this.InitLoc();
|
||||||
this.Interface = pluginInterface;
|
this.Interface = pluginInterface;
|
||||||
this.pluginLog = log;
|
this.pluginLog = log;
|
||||||
|
|
||||||
this.windowSystem.AddWindow(new PluginWindow(this));
|
this.windowSystem.AddWindow(new PluginWindow());
|
||||||
|
|
||||||
this.Interface.UiBuilder.Draw += this.OnDraw;
|
this.Interface.UiBuilder.Draw += this.OnDraw;
|
||||||
this.Interface.UiBuilder.OpenConfigUi += this.OnOpenConfigUi;
|
this.Interface.UiBuilder.OpenConfigUi += this.OnOpenConfigUi;
|
||||||
|
|
@ -85,8 +84,6 @@ namespace Dalamud.CorePlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public INotificationManager NotificationManager { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the plugin interface.
|
/// Gets the plugin interface.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
using Dalamud.Interface.Internal.Notifications;
|
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
|
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
||||||
namespace Dalamud.CorePlugin
|
namespace Dalamud.CorePlugin
|
||||||
|
|
@ -16,19 +14,15 @@ namespace Dalamud.CorePlugin
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="PluginWindow"/> class.
|
/// Initializes a new instance of the <see cref="PluginWindow"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pluginImpl"></param>
|
public PluginWindow()
|
||||||
public PluginWindow(PluginImpl pluginImpl)
|
|
||||||
: base("CorePlugin")
|
: base("CorePlugin")
|
||||||
{
|
{
|
||||||
this.PluginImpl = pluginImpl;
|
|
||||||
this.IsOpen = true;
|
this.IsOpen = true;
|
||||||
|
|
||||||
this.Size = new Vector2(810, 520);
|
this.Size = new Vector2(810, 520);
|
||||||
this.SizeCondition = ImGuiCond.FirstUseEver;
|
this.SizeCondition = ImGuiCond.FirstUseEver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PluginImpl PluginImpl { get; }
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
|
@ -42,72 +36,6 @@ namespace Dalamud.CorePlugin
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Draw()
|
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,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue