feat: add changelog window

This commit is contained in:
goat 2020-08-14 15:47:56 +02:00
parent 196217f1d5
commit 6a539ee46c
3 changed files with 127 additions and 3 deletions

View file

@ -237,6 +237,7 @@ namespace Dalamud {
private bool isImguiDrawCreditsWindow = false;
private bool isImguiDrawSettingsWindow = false;
private bool isImguiDrawPluginStatWindow = false;
private bool isImguiDrawChangelogWindow = false;
private DalamudLogWindow logWindow;
private DalamudDataWindow dataWindow;
@ -244,6 +245,7 @@ namespace Dalamud {
private DalamudSettingsWindow settingsWindow;
private PluginInstallerWindow pluginWindow;
private DalamudPluginStatWindow pluginStatWindow;
private DalamudChangelogWindow changelogWindow;
private void BuildDalamudUi()
{
@ -284,6 +286,10 @@ namespace Dalamud {
{
OnOpenSettingsCommand(null, null);
}
if (ImGui.MenuItem("Open Changelog window"))
{
OpenChangelog();
}
ImGui.MenuItem("Draw ImGui demo", "", ref this.isImguiDrawDemoWindow);
if (ImGui.MenuItem("Dump ImGui info"))
OnDebugImInfoCommand(null, null);
@ -431,6 +437,20 @@ namespace Dalamud {
this.pluginStatWindow = null;
}
}
if (this.isImguiDrawChangelogWindow)
{
this.isImguiDrawChangelogWindow = this.changelogWindow != null && this.changelogWindow.Draw();
}
}
internal void OpenPluginInstaller() {
this.pluginWindow = new PluginInstallerWindow(this, this.StartInfo.GameVersion);
this.isImguiDrawPluginWindow = true;
}
internal void OpenChangelog() {
this.changelogWindow = new DalamudChangelogWindow(this);
this.isImguiDrawChangelogWindow = true;
}
private void ReplaceExceptionHandler() {
@ -442,7 +462,7 @@ namespace Dalamud {
Log.Debug("Reset ExceptionFilter, old: {0}", oldFilter);
}
#endregion
#endregion
private void SetupCommands() {
CommandManager.AddHandler("/xldclose", new CommandInfo(OnUnloadCommand) {
@ -716,8 +736,7 @@ namespace Dalamud {
}
private void OnOpenInstallerCommand(string command, string arguments) {
this.pluginWindow = new PluginInstallerWindow(this, this.StartInfo.GameVersion);
this.isImguiDrawPluginWindow = true;
OpenPluginInstaller();
}
private void OnOpenCreditsCommand(string command, string arguments)

View file

@ -11,6 +11,7 @@ using Dalamud.Game.Chat;
using Dalamud.Game.Chat.SeStringHandling;
using Dalamud.Game.Chat.SeStringHandling.Payloads;
using Dalamud.Game.Internal.Libc;
using Dalamud.Interface;
using Dalamud.Plugin;
using Serilog;
@ -225,6 +226,8 @@ namespace Dalamud.Game {
Type = XivChatType.Notice
});
this.dalamud.OpenChangelog();
this.dalamud.Configuration.LastVersion = assemblyVersion;
this.dalamud.Configuration.Save();
}

View file

@ -0,0 +1,102 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Numerics;
using Dalamud.Plugin;
using ImGuiNET;
using Lumina.Data.Parsing.Layer;
namespace Dalamud.Interface {
class DalamudChangelogWindow : IDisposable {
private readonly Dalamud dalamud;
private string assemblyVersion = Util.AssemblyVersion;
private const bool WarrantsChangelog = true;
private const string ChangeLog =
@"* All plugin windows now hide together with the in-game UI when you toggle it.
You can change this behaviour with /xlsettings under the ""Look&Feel"" tab.
* The ""Item hovering"" feature, which was previously broken due to patch 5.3 is now working again.
* Added some extra infos about the state of the addon to the log, so we can help you better in case you encounter crashes.
* Added this changelog window.";
public DalamudChangelogWindow(Dalamud dalamud) {
this.dalamud = dalamud;
}
public bool Draw() {
var doDraw = true;
if (!WarrantsChangelog)
return false;
ImGui.PushID("DalamudChangelogWindow");
ImGui.Begin("What's new in XIVLauncher?", ref doDraw, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoResize);
ImGui.Text($"The in-game addon has been updated to version D{this.assemblyVersion}.");
ImGui.Dummy(new Vector2(10, 10));
ImGui.Text("The following changes were introduced:");
ImGui.Text(ChangeLog);
ImGui.Dummy(new Vector2(10, 10));
ImGui.Text("Thank you for using our tools!");
ImGui.Dummy(new Vector2(10, 10));
ImGui.PushFont(InterfaceManager.IconFont);
if (ImGui.Button(FontAwesomeIcon.Download.ToIconString()))
this.dalamud.OpenPluginInstaller();
if (ImGui.IsItemHovered()) {
ImGui.PopFont();
ImGui.SetTooltip("Open Plugin Installer");
ImGui.PushFont(InterfaceManager.IconFont);
}
ImGui.SameLine();
if (ImGui.Button(FontAwesomeIcon.LaughBeam.ToIconString()))
Process.Start("https://discord.gg/3NMcUV5");
if (ImGui.IsItemHovered()) {
ImGui.PopFont();
ImGui.SetTooltip("Join our Discord server");
ImGui.PushFont(InterfaceManager.IconFont);
}
ImGui.SameLine();
if (ImGui.Button(FontAwesomeIcon.Globe.ToIconString()))
Process.Start("https://github.com/goatcorp/FFXIVQuickLauncher");
if (ImGui.IsItemHovered()) {
ImGui.PopFont();
ImGui.SetTooltip("See our GitHub repository");
ImGui.PushFont(InterfaceManager.IconFont);
}
ImGui.PopFont();
ImGui.SameLine();
ImGui.Dummy(new Vector2(20, 0));
ImGui.SameLine();
if (ImGui.Button("Close")) {
doDraw = false;
}
ImGui.End();
ImGui.PopID();
return doDraw;
}
public void Dispose() {
}
}
}