mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
feat: use new UiBuilder class for plugins, DalamudPluginInterface is now IDisposable
This commit is contained in:
parent
72a4e6278d
commit
24450cf830
3 changed files with 45 additions and 13 deletions
35
Dalamud/Interface/UiBuilder.cs
Normal file
35
Dalamud/Interface/UiBuilder.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ImGuiNET;
|
||||
using ImGuiScene;
|
||||
|
||||
namespace Dalamud.Interface
|
||||
{
|
||||
public class UiBuilder : IDisposable {
|
||||
private readonly string namespaceName;
|
||||
|
||||
public event RawDX11Scene.BuildUIDelegate OnBuildUi;
|
||||
|
||||
private InterfaceManager interfaceManager;
|
||||
|
||||
public UiBuilder(InterfaceManager interfaceManager, string namespaceName) {
|
||||
this.namespaceName = namespaceName;
|
||||
|
||||
this.interfaceManager = interfaceManager;
|
||||
this.interfaceManager.OnDraw += OnDraw;
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
this.interfaceManager.OnDraw -= OnDraw;
|
||||
}
|
||||
|
||||
private void OnDraw() {
|
||||
ImGui.PushID(this.namespaceName);
|
||||
OnBuildUi?.Invoke();
|
||||
ImGui.PopID();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue