added changelog model and update notes UI with particle effects

This commit is contained in:
choco
2025-10-16 10:37:00 +02:00
parent 823dd39a9b
commit f77d109d00
2 changed files with 156 additions and 115 deletions

View File

@@ -0,0 +1,25 @@
namespace LightlessSync.UI.Models
{
public class ChangelogFile
{
public string Tagline { get; init; } = string.Empty;
public string Subline { get; init; } = string.Empty;
public List<ChangelogEntry> Changelog { get; init; } = new();
}
public class ChangelogEntry
{
public string Name { get; init; } = string.Empty;
public string Date { get; init; } = string.Empty;
public string Tagline { get; init; } = string.Empty;
public bool? IsCurrent { get; init; }
public string? Message { get; init; }
public List<ChangelogVersion>? Versions { get; init; }
}
public class ChangelogVersion
{
public string Number { get; init; } = string.Empty;
public List<string> Items { get; init; } = new();
}
}

View File

@@ -12,6 +12,7 @@ using System.Text;
using YamlDotNet.Serialization; using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NamingConventions;
using Dalamud.Interface; using Dalamud.Interface;
using LightlessSync.UI.Models;
namespace LightlessSync.UI; namespace LightlessSync.UI;
@@ -69,12 +70,12 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
RespectCloseHotkey = true; RespectCloseHotkey = true;
ShowCloseButton = true; ShowCloseButton = true;
Flags = ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoTitleBar; Flags = ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse |
ImGuiWindowFlags.NoTitleBar;
SizeConstraints = new WindowSizeConstraints() SizeConstraints = new WindowSizeConstraints()
{ {
MinimumSize = new Vector2(800, 700), MinimumSize = new Vector2(800, 700), MaximumSize = new Vector2(800, 700),
MaximumSize = new Vector2(800, 700),
}; };
LoadEmbeddedResources(); LoadEmbeddedResources();
@@ -119,6 +120,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
{ {
ImGui.TextColored(UIColors.Get("LightlessGreen"), FontAwesomeIcon.Star.ToIconString()); ImGui.TextColored(UIColors.Get("LightlessGreen"), FontAwesomeIcon.Star.ToIconString());
} }
ImGui.SameLine(); ImGui.SameLine();
ImGui.TextColored(UIColors.Get("LightlessGreen"), "What's New"); ImGui.TextColored(UIColors.Get("LightlessGreen"), "What's New");
@@ -135,6 +137,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
ImGui.TextColored(new Vector4(0.65f, 0.65f, 0.75f, 1.0f), $" {_changelog.Subline}"); ImGui.TextColored(new Vector4(0.65f, 0.65f, 0.75f, 1.0f), $" {_changelog.Subline}");
} }
} }
ImGuiHelpers.ScaledDummy(3); ImGuiHelpers.ScaledDummy(3);
DrawParticleEffects(headerStart, extendedParticleSize); DrawParticleEffects(headerStart, extendedParticleSize);
@@ -227,6 +230,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
{ {
Util.OpenLink("https://discord.gg/dsbjcXMnhA"); Util.OpenLink("https://discord.gg/dsbjcXMnhA");
} }
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
{ {
ImGui.SetTooltip("Join our Discord"); ImGui.SetTooltip("Join our Discord");
@@ -237,6 +241,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
{ {
Util.OpenLink("https://git.lightless-sync.org/Lightless-Sync"); Util.OpenLink("https://git.lightless-sync.org/Lightless-Sync");
} }
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
{ {
ImGui.SetTooltip("View on Git"); ImGui.SetTooltip("View on Git");
@@ -354,7 +359,8 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
} }
} }
private void DrawTwinklingStar(ImDrawListPtr drawList, Vector2 position, float size, float hue, float alpha, float depth) private void DrawTwinklingStar(ImDrawListPtr drawList, Vector2 position, float size, float hue, float alpha,
float depth)
{ {
var color = HslToRgb(hue, 1.0f, 0.85f); var color = HslToRgb(hue, 1.0f, 0.85f);
color.W = alpha; color.W = alpha;
@@ -373,12 +379,42 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
float m = l - c / 2; float m = l - c / 2;
float r, g, b; float r, g, b;
if (h < 1f / 6f) { r = c; g = x; b = 0; } if (h < 1f / 6f)
else if (h < 2f / 6f) { r = x; g = c; b = 0; } {
else if (h < 3f / 6f) { r = 0; g = c; b = x; } r = c;
else if (h < 4f / 6f) { r = 0; g = x; b = c; } g = x;
else if (h < 5f / 6f) { r = x; g = 0; b = c; } b = 0;
else { r = c; g = 0; b = x; } }
else if (h < 2f / 6f)
{
r = x;
g = c;
b = 0;
}
else if (h < 3f / 6f)
{
r = 0;
g = c;
b = x;
}
else if (h < 4f / 6f)
{
r = 0;
g = x;
b = c;
}
else if (h < 5f / 6f)
{
r = x;
g = 0;
b = c;
}
else
{
r = c;
g = 0;
b = x;
}
return new Vector4(r + m, g + m, b + m, 1.0f); return new Vector4(r + m, g + m, b + m, 1.0f);
} }
@@ -463,10 +499,12 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
} }
} }
} }
private void DrawChangelog() private void DrawChangelog()
{ {
using (ImRaii.PushStyle(ImGuiStyleVar.ChildRounding, 6f)) using (ImRaii.PushStyle(ImGuiStyleVar.ChildRounding, 6f))
using (var child = ImRaii.Child("###ll_changelog", new Vector2(0, ImGui.GetContentRegionAvail().Y - 60), false, ImGuiWindowFlags.AlwaysVerticalScrollbar)) using (var child = ImRaii.Child("###ll_changelog", new Vector2(0, ImGui.GetContentRegionAvail().Y - 60), false,
ImGuiWindowFlags.AlwaysVerticalScrollbar))
{ {
if (!child) if (!child)
return; return;
@@ -597,26 +635,4 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
// Ignore - window will gracefully render with defaults // Ignore - window will gracefully render with defaults
} }
} }
private sealed record ChangelogFile
{
public string Tagline { get; init; } = string.Empty;
public string Subline { get; init; } = string.Empty;
public List<ChangelogEntry> Changelog { get; init; } = new();
}
private sealed record ChangelogEntry
{
public string Name { get; init; } = string.Empty;
public string Date { get; init; } = string.Empty;
public string Tagline { get; init; } = string.Empty;
public bool? IsCurrent { get; init; }
public string? Message { get; init; }
public List<ChangelogVersion>? Versions { get; init; }
}
private sealed record ChangelogVersion
{
public string Number { get; init; } = string.Empty;
public List<string> Items { get; init; } = new();
}
} }