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;
}
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;
OnOpenCreditsCommand(null, null);
}
ImGui.MenuItem("Draw ImGui demo", "", ref this.isImguiDrawDemoWindow);
if (ImGui.MenuItem("Dump ImGui info"))
@ -671,7 +667,7 @@ namespace Dalamud {
var logoGraphic =
this.InterfaceManager.LoadImage(
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;
}

View file

@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Numerics;
using Dalamud.Game.Internal;
using ImGuiNET;
@ -7,10 +8,10 @@ using ImGuiScene;
namespace Dalamud.Interface
{
class DalamudCreditsWindow : IDisposable {
private string creditsText = @$"
private const string CreditsTextTempl = @"
Dalamud
A FFXIV Hooking Framework
Version {typeof(Dalamud).Assembly.GetName().Version}
Version {0}
created by:
@ -44,6 +45,11 @@ gucciBane
Your plugins were made by:
{1}
Special thanks:
Adam
@ -64,14 +70,23 @@ Contribute at: https://github.com/goaaats/Dalamud
Thank you for using XIVLauncher!
";
private readonly Dalamud dalamud;
private TextureWrap logoTexture;
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.framework = framework;
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() {