feat: add credits

This commit is contained in:
goat 2020-03-22 00:48:42 +09:00
parent 3503299fff
commit 50e1e30b2a
3 changed files with 128 additions and 0 deletions

View file

@ -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,

View file

@ -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;
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 186 KiB

Before After
Before After