diff --git a/Dalamud/Dalamud.cs b/Dalamud/Dalamud.cs index 72659fa05..11cb5202f 100644 --- a/Dalamud/Dalamud.cs +++ b/Dalamud/Dalamud.cs @@ -165,9 +165,11 @@ namespace Dalamud { private bool isImguiDrawLogWindow = false; private bool isImguiDrawDataWindow = false; private bool isImguiDrawPluginWindow = false; + private bool isImguiDrawCreditsWindow = false; private DalamudLogWindow logWindow; private DalamudDataWindow dataWindow; + private DalamudCreditsWindow creditsWindow; private PluginInstallerWindow pluginWindow; private void BuildDalamudUi() @@ -190,6 +192,13 @@ namespace Dalamud { this.dataWindow = new DalamudDataWindow(this.Data); this.isImguiDrawDataWindow = true; } + if (ImGui.MenuItem("Open Credits window")) { + var logoGraphic = + this.InterfaceManager.LoadImage( + Path.Combine(this.StartInfo.WorkingDirectory, "UIRes", "logo.png")); + this.creditsWindow = new DalamudCreditsWindow(logoGraphic, this.Framework); + this.isImguiDrawCreditsWindow = true; + } ImGui.MenuItem("Draw ImGui demo", "", ref this.isImguiDrawDemoWindow); ImGui.Separator(); if (ImGui.MenuItem("Unload Dalamud")) @@ -238,6 +247,7 @@ namespace Dalamud { if (this.isImguiDrawLogWindow == false) { this.logWindow?.Dispose(); + this.logWindow = null; } } @@ -251,6 +261,17 @@ namespace Dalamud { this.isImguiDrawPluginWindow = this.pluginWindow != null && this.pluginWindow.Draw(); } + if (this.isImguiDrawCreditsWindow) + { + this.isImguiDrawCreditsWindow = this.creditsWindow != null && this.creditsWindow.Draw(); + + if (this.isImguiDrawCreditsWindow == false) + { + this.creditsWindow?.Dispose(); + this.creditsWindow = null; + } + } + if (this.isImguiDrawDemoWindow) ImGui.ShowDemoWindow(); } @@ -334,6 +355,11 @@ namespace Dalamud { { HelpMessage = "Open the plugin installer" }); + + this.CommandManager.AddHandler("/xlcredits", new CommandInfo(OnOpenCreditsCommand) { + HelpMessage = "Opens the credits for dalamud.", + ShowInHelp = false + }); } private void OnUnloadCommand(string command, string arguments) { @@ -560,6 +586,15 @@ namespace Dalamud { this.isImguiDrawPluginWindow = true; } + private void OnOpenCreditsCommand(string command, string arguments) + { + var logoGraphic = + this.InterfaceManager.LoadImage( + Path.Combine(this.StartInfo.WorkingDirectory, "UIRes", "logo.png")); + this.creditsWindow = new DalamudCreditsWindow(logoGraphic, this.Framework); + this.isImguiDrawCreditsWindow = true; + } + private int RouletteSlugToKey(string slug) => slug.ToLower() switch { "leveling" => 1, "506070" => 2, diff --git a/Dalamud/Interface/DalamudCreditsWindow.cs b/Dalamud/Interface/DalamudCreditsWindow.cs new file mode 100644 index 000000000..972910247 --- /dev/null +++ b/Dalamud/Interface/DalamudCreditsWindow.cs @@ -0,0 +1,93 @@ +using System; +using System.Numerics; +using Dalamud.Game.Internal; +using ImGuiNET; +using ImGuiScene; + +namespace Dalamud.Interface +{ + class DalamudCreditsWindow : IDisposable { + private string creditsText = @" + Dalamud + A FFXIV Hooking Framework + + + + created by: + + goat + Mino + Meli + attick + Aida-Enna + perchbird + Wintermute + + + + Special thanks: + Adam + karashiiro + Kubera + Truci + Haplo + + Everyone in the XIVLauncher Discord server +"; + + private TextureWrap logoTexture; + private Framework framework; + + public DalamudCreditsWindow(TextureWrap logoTexture, Framework framework) { + this.logoTexture = logoTexture; + this.framework = framework; + + framework.Gui.SetBgm(726); + } + + public void Dispose() { + this.logoTexture.Dispose(); + } + + public bool Draw() { + ImGui.SetNextWindowSize(new Vector2(500, 400), ImGuiCond.FirstUseEver); + + var isOpen = true; + + ImGui.SetNextWindowBgAlpha(0.5f); + + if (!ImGui.Begin("Dalamud Credits", ref isOpen, ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoResize)) + { + ImGui.End(); + return false; + } + + ImGui.BeginChild("scrolling", new Vector2(0, 0), false, ImGuiWindowFlags.NoScrollbar); + + ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0)); + + ImGui.Dummy(new Vector2(0, 60f)); + ImGui.Text(""); + + ImGui.SameLine(150f); + ImGui.Image(this.logoTexture.ImGuiHandle, new Vector2(150f, 150f)); + + ImGui.Dummy(new Vector2(0, 20f)); + + ImGui.TextUnformatted(this.creditsText); + + ImGui.PopStyleVar(); + + if (ImGui.GetScrollY() < ImGui.GetScrollMaxY()) + ImGui.SetScrollY(ImGui.GetScrollY() + 0.2f); + + ImGui.EndChild(); + ImGui.End(); + + if (!isOpen) + this.framework.Gui.SetBgm(9999); + + return isOpen; + } + } +} diff --git a/Dalamud/UIRes/logo.png b/Dalamud/UIRes/logo.png index 34b9f0b4f..1a7a1b7e8 100644 Binary files a/Dalamud/UIRes/logo.png and b/Dalamud/UIRes/logo.png differ