mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-27 19:09:18 +01:00
testing this shit is nightmare fuel
This commit is contained in:
parent
7d50ab3049
commit
d6ffe6fcdc
5 changed files with 65 additions and 8 deletions
|
|
@ -31,6 +31,8 @@ internal class FoolsManager : IDisposable, IServiceType
|
|||
this.FoolsPlugins = new List<FoolsPluginMetadata>
|
||||
{
|
||||
new("Test Fool Plugin", "TestFoolPlugin", "this is a test", "NotNite", typeof(TestFoolPlugin)),
|
||||
new("Pixel Imperfect", "PixelImperfectPlugin", "Whoops... we messed up the math on that one.", "Halpo",
|
||||
typeof(PixelImperfectPlugin)),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +89,7 @@ internal class FoolsManager : IDisposable, IServiceType
|
|||
{
|
||||
foreach (var plugin in this.ActivatedPlugins.Values)
|
||||
{
|
||||
plugin.DrawUI();
|
||||
plugin.DrawUi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using Dalamud.Plugin;
|
||||
using System;
|
||||
|
||||
namespace Dalamud.Fools;
|
||||
|
||||
public interface IFoolsPlugin : IDalamudPlugin
|
||||
public interface IFoolsPlugin : IDisposable
|
||||
{
|
||||
public void DrawUI() { }
|
||||
public void DrawUi() { }
|
||||
}
|
||||
|
|
|
|||
53
Dalamud/Fools/Plugins/PixelImperfectPlugin.cs
Normal file
53
Dalamud/Fools/Plugins/PixelImperfectPlugin.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Interface;
|
||||
using ImGuiNET;
|
||||
using static ImGuiNET.ImGuiWindowFlags;
|
||||
|
||||
namespace Dalamud.Fools.Plugins;
|
||||
|
||||
public class PixelImperfectPlugin : IFoolsPlugin
|
||||
{
|
||||
private ClientState clientState;
|
||||
private GameGui gameGui;
|
||||
|
||||
public PixelImperfectPlugin()
|
||||
{
|
||||
this.clientState = Service<ClientState>.Get();
|
||||
this.gameGui = Service<GameGui>.Get();
|
||||
}
|
||||
|
||||
public void DrawUi()
|
||||
{
|
||||
if (this.clientState.LocalPlayer == null) return;
|
||||
|
||||
// Copied directly from PixelPerfect
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(0, 0));
|
||||
ImGuiHelpers.ForceNextWindowMainViewport();
|
||||
ImGuiHelpers.SetNextWindowPosRelativeMainViewport(new Vector2(0, 0));
|
||||
ImGui.Begin("Canvas", NoInputs | NoNav | NoTitleBar | NoScrollbar | NoBackground);
|
||||
ImGui.SetWindowSize(ImGui.GetIO().DisplaySize);
|
||||
|
||||
var xOffset = Math.Sin(Environment.TickCount / 500.0);
|
||||
var yOffset = Math.Sin(Environment.TickCount / 1500.0);
|
||||
var actorPos = this.clientState.LocalPlayer.Position;
|
||||
|
||||
this.gameGui.WorldToScreen(
|
||||
new Vector3(actorPos.X + (float)xOffset, actorPos.Y, actorPos.Z + (float)yOffset),
|
||||
out var pos);
|
||||
|
||||
ImGui.GetWindowDrawList().AddCircle(
|
||||
new Vector2(pos.X, pos.Y),
|
||||
2,
|
||||
ImGui.GetColorU32(new Vector4(255, 255, 255, 255)),
|
||||
100,
|
||||
10);
|
||||
|
||||
ImGui.End();
|
||||
ImGui.PopStyleVar();
|
||||
}
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ public class TestFoolPlugin : IFoolsPlugin
|
|||
|
||||
public TestFoolPlugin() { }
|
||||
|
||||
public void DrawUI()
|
||||
public void DrawUi()
|
||||
{
|
||||
if (ImGui.Begin("Nuts"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1257,7 +1257,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
foreach (var plugin in manager.FoolsPlugins)
|
||||
{
|
||||
// dropdown
|
||||
if (ImGui.CollapsingHeader($"{plugin.Name}##AprilFools_{plugin.Name}"))
|
||||
if (ImGui.CollapsingHeader($"{plugin.Name}##AprilFools_Header_{plugin.Name}"))
|
||||
{
|
||||
ImGui.Indent();
|
||||
ImGui.Text(plugin.Name);
|
||||
|
|
@ -1269,18 +1269,20 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
if (manager.IsPluginActivated(plugin.InternalName))
|
||||
{
|
||||
if (ImGui.Button("Disable"))
|
||||
if (ImGui.Button($"Disable##AprilFools_Disable_{plugin.Name}"))
|
||||
{
|
||||
manager.DeactivatePlugin(plugin.InternalName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ImGui.Button("Install"))
|
||||
if (ImGui.Button($"Install##AprilFools_Enable_{plugin.Name}"))
|
||||
{
|
||||
manager.ActivatePlugin(plugin.InternalName);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.Unindent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue