feat: add plugin authors to credits

This commit is contained in:
goat 2020-04-29 16:03:58 +02:00
parent 274148361e
commit 143b8a15fc
2 changed files with 20 additions and 9 deletions

View file

@ -238,11 +238,7 @@ namespace Dalamud {
this.isImguiDrawDataWindow = true; this.isImguiDrawDataWindow = true;
} }
if (ImGui.MenuItem("Open Credits window")) { if (ImGui.MenuItem("Open Credits window")) {
var logoGraphic = OnOpenCreditsCommand(null, null);
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.MenuItem("Draw ImGui demo", "", ref this.isImguiDrawDemoWindow);
if (ImGui.MenuItem("Dump ImGui info")) if (ImGui.MenuItem("Dump ImGui info"))
@ -671,7 +667,7 @@ namespace Dalamud {
var logoGraphic = var logoGraphic =
this.InterfaceManager.LoadImage( this.InterfaceManager.LoadImage(
Path.Combine(this.StartInfo.WorkingDirectory, "UIRes", "logo.png")); Path.Combine(this.StartInfo.WorkingDirectory, "UIRes", "logo.png"));
this.creditsWindow = new DalamudCreditsWindow(logoGraphic, this.Framework); this.creditsWindow = new DalamudCreditsWindow(this, logoGraphic, this.Framework);
this.isImguiDrawCreditsWindow = true; this.isImguiDrawCreditsWindow = true;
} }

View file

@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using System.Numerics; using System.Numerics;
using Dalamud.Game.Internal; using Dalamud.Game.Internal;
using ImGuiNET; using ImGuiNET;
@ -7,10 +8,10 @@ using ImGuiScene;
namespace Dalamud.Interface namespace Dalamud.Interface
{ {
class DalamudCreditsWindow : IDisposable { class DalamudCreditsWindow : IDisposable {
private string creditsText = @$" private const string CreditsTextTempl = @"
Dalamud Dalamud
A FFXIV Hooking Framework A FFXIV Hooking Framework
Version {typeof(Dalamud).Assembly.GetName().Version} Version {0}
created by: created by:
@ -44,6 +45,11 @@ gucciBane
Your plugins were made by:
{1}
Special thanks: Special thanks:
Adam Adam
@ -64,14 +70,23 @@ Contribute at: https://github.com/goaaats/Dalamud
Thank you for using XIVLauncher! Thank you for using XIVLauncher!
"; ";
private readonly Dalamud dalamud;
private TextureWrap logoTexture; private TextureWrap logoTexture;
private Framework framework; private Framework framework;
public DalamudCreditsWindow(TextureWrap logoTexture, Framework framework) { private string creditsText;
public DalamudCreditsWindow(Dalamud dalamud, TextureWrap logoTexture, Framework framework) {
this.dalamud = dalamud;
this.logoTexture = logoTexture; this.logoTexture = logoTexture;
this.framework = framework; this.framework = framework;
framework.Gui.SetBgm(132); framework.Gui.SetBgm(132);
var pluginCredits = dalamud.PluginManager.Plugins.Where(x => x.Definition != null).Aggregate(string.Empty, (current, plugin) => current + $"{plugin.Definition.Name} by {plugin.Definition.Author}\n");
this.creditsText =
string.Format(CreditsTextTempl, typeof(Dalamud).Assembly.GetName().Version, pluginCredits);
} }
public void Dispose() { public void Dispose() {