-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugin.cs
80 lines (65 loc) · 2.38 KB
/
Plugin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using Dalamud.Game.Command;
using Dalamud.IoC;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using CeeLoPlugin.Windows;
using CeeLoPlugin.Logic;
using Dalamud.Game.Gui; // Make sure this is here
namespace CeeLoPlugin;
public sealed class Plugin : IDalamudPlugin
{
[PluginService] internal static IDalamudPluginInterface PluginInterface { get; private set; } = null!;
[PluginService] internal static ICommandManager CommandManager { get; private set; } = null!;
[PluginService] internal static IChatGui ChatGui { get; private set; } = null!; // Make sure this is available
public string Name => "CeeLoPlugin";
public Configuration Configuration { get; private set; }
public CeeLoGameLogic GameLogic { get; private set; }
private readonly MainWindow _mainWindow;
private readonly ConfigWindow _configWindow;
private readonly BetWindow _betWindow; // Instantiate BetWindow here
public Plugin()
{
// Initialize configuration
Configuration = PluginInterface.GetPluginConfig() as Configuration ?? new Configuration();
// Initialize game logic
GameLogic = new CeeLoGameLogic();
// Initialize windows
_mainWindow = new MainWindow(this);
_configWindow = new ConfigWindow(this);
_betWindow = new BetWindow(ChatGui); // Pass ChatGui to BetWindow constructor
// Register the /ceelo command
CommandManager.AddHandler("/ceelo", new CommandInfo(OnCommand)
{
HelpMessage = "Open the CeeLo plugin main window."
});
// Register UI event handlers
PluginInterface.UiBuilder.Draw += DrawUI;
PluginInterface.UiBuilder.OpenMainUi += OpenMainUI;
PluginInterface.UiBuilder.OpenConfigUi += OpenConfigUI;
}
private void OnCommand(string command, string args)
{
OpenMainUI();
}
public void OpenMainUI()
{
_mainWindow.Toggle();
}
public void OpenConfigUI()
{
_configWindow.Toggle();
}
private void DrawUI()
{
_mainWindow.Draw();
_configWindow.Draw();
_betWindow.Draw(); // Draw BetWindow here
}
public void Dispose()
{
CommandManager.RemoveHandler("/ceelo");
PluginInterface.UiBuilder.Draw -= DrawUI;
PluginInterface.UiBuilder.OpenMainUi -= OpenMainUI;
PluginInterface.UiBuilder.OpenConfigUi -= OpenConfigUI;
}
}