feat: add update window

This commit is contained in:
goaaats 2022-04-01 20:51:43 +02:00
parent d0907df5d2
commit 4ae45492e6
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
5 changed files with 129 additions and 5 deletions

View file

@ -53,6 +53,7 @@ namespace Dalamud.Interface.Internal
private readonly SelfTestWindow selfTestWindow;
private readonly StyleEditorWindow styleEditorWindow;
private readonly TitleScreenMenuWindow titleScreenMenuWindow;
private readonly FoolsAskWindow faWindow;
private readonly TextureWrap logoTexture;
private readonly TextureWrap tsmLogoTexture;
@ -91,6 +92,7 @@ namespace Dalamud.Interface.Internal
this.selfTestWindow = new SelfTestWindow() { IsOpen = false };
this.styleEditorWindow = new StyleEditorWindow() { IsOpen = false };
this.titleScreenMenuWindow = new TitleScreenMenuWindow() { IsOpen = false };
this.faWindow = new FoolsAskWindow() { IsOpen = false };
this.WindowSystem.AddWindow(this.changelogWindow);
this.WindowSystem.AddWindow(this.colorDemoWindow);
@ -106,6 +108,7 @@ namespace Dalamud.Interface.Internal
this.WindowSystem.AddWindow(this.selfTestWindow);
this.WindowSystem.AddWindow(this.styleEditorWindow);
this.WindowSystem.AddWindow(this.titleScreenMenuWindow);
this.WindowSystem.AddWindow(this.faWindow);
ImGuiManagedAsserts.AssertsEnabled = configuration.AssertsEnabledAtStartup;
@ -247,6 +250,8 @@ namespace Dalamud.Interface.Internal
/// </summary>
public void OpenStyleEditor() => this.styleEditorWindow.IsOpen = true;
public void OpenFaWindow() => this.faWindow.IsOpen = true;
#endregion
#region Close

View file

@ -0,0 +1,100 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Numerics;
using Dalamud.Configuration.Internal;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing;
using Dalamud.Utility;
using ImGuiNET;
using ImGuiScene;
namespace Dalamud.Interface.Internal.Windows
{
/// <summary>
/// For major updates, an in-game Changelog window.
/// </summary>
internal sealed class FoolsAskWindow : Window, IDisposable
{
private readonly string assemblyVersion = Util.AssemblyVersion;
private readonly TextureWrap logoTexture;
/// <summary>
/// Initializes a new instance of the <see cref="FoolsAskWindow"/> class.
/// </summary>
public FoolsAskWindow()
: base("New in Dalamud!", ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)
{
this.Namespace = "DalamudChangelogWindow";
var interfaceManager = Service<InterfaceManager>.Get();
var dalamud = Service<Dalamud>.Get();
this.logoTexture =
interfaceManager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "logo.png"))!;
}
/// <inheritdoc/>
public override void Draw()
{
this.Size = new Vector2(885, 250);
this.SizeCondition = ImGuiCond.Always;
this.Flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse;
ImGui.TextWrapped("Today, we are proud to announce \"Dalamud: Prepare To Die Edition\".\nIt's a new initiative intended to improve your immersion when playing FFXIV, featuring all new and unintrusive visual and sound effects.\nIt's only available today, so join while you can.");
ImGuiHelpers.ScaledDummy(10);
ImGui.TextWrapped("You can choose to opt-in here - thank you for your support!");
ImGui.SameLine();
ImGuiHelpers.ScaledDummy(0);
var imgCursor = ImGui.GetCursorPos();
ImGuiHelpers.ScaledDummy(40);
ImGuiHelpers.ScaledDummy(240);
ImGui.SameLine();
var btnSize = new Vector2(140, 40);
var config = Service<DalamudConfiguration>.Get();
if (ImGui.Button("No, don't ask again", btnSize))
{
config.AskedFools22 = true;
config.Fools22Newer = false;
config.Save();
this.IsOpen = false;
}
ImGui.SameLine();
if (ImGui.Button("Yes!", btnSize))
{
config.AskedFools22 = true;
config.Fools22Newer = true;
config.Save();
this.IsOpen = false;
}
imgCursor.X += 750;
imgCursor.Y -= 30;
ImGui.SetCursorPos(imgCursor);
ImGui.Image(this.logoTexture.ImGuiHandle, new Vector2(100));
}
/// <summary>
/// Dispose this window.
/// </summary>
public void Dispose()
{
this.logoTexture.Dispose();
}
}
}

View file

@ -175,7 +175,7 @@ namespace Dalamud.Interface.Internal.Windows
this.dtrOrder = configuration.DtrOrder;
this.dtrIgnore = configuration.DtrIgnore;
this.doFools22 = configuration.Fools22Newer ?? true;
this.doFools22 = configuration.Fools22Newer;
}
/// <inheritdoc/>