changelog cleanup, credits tab
This commit is contained in:
@@ -22,6 +22,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
private readonly UiSharedService _uiShared;
|
||||
|
||||
private ChangelogFile _changelog = new();
|
||||
private CreditsFile _credits = new();
|
||||
private bool _scrollToTop;
|
||||
private int _selectedTab;
|
||||
|
||||
@@ -492,7 +493,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
if (!tabBar)
|
||||
return;
|
||||
|
||||
using (var changelogTab = ImRaii.TabItem("What's New"))
|
||||
using (var changelogTab = ImRaii.TabItem("Changelog"))
|
||||
{
|
||||
if (changelogTab)
|
||||
{
|
||||
@@ -501,7 +502,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
}
|
||||
|
||||
if (_changelog.Credits != null && _changelog.Credits.Count > 0)
|
||||
if (_credits.Credits != null && _credits.Credits.Count > 0)
|
||||
{
|
||||
using (var creditsTab = ImRaii.TabItem("Credits"))
|
||||
{
|
||||
@@ -527,9 +528,9 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
|
||||
ImGui.PushTextWrapPos();
|
||||
|
||||
if (_changelog.Credits != null)
|
||||
if (_credits.Credits != null)
|
||||
{
|
||||
foreach (var category in _changelog.Credits)
|
||||
foreach (var category in _credits.Credits)
|
||||
{
|
||||
DrawCreditCategory(category);
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
@@ -545,25 +546,19 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
DrawFeatureSection(category.Category, UIColors.Get("LightlessBlue"));
|
||||
|
||||
ImGui.Indent(15f);
|
||||
|
||||
foreach (var item in category.Items)
|
||||
{
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, new Vector4(0.95f, 0.95f, 1.0f, 1.0f)))
|
||||
{
|
||||
ImGui.TextWrapped($"• {item.Name}");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(item.Role))
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.7f, 0.7f, 0.8f, 1.0f), $" — {item.Role}");
|
||||
ImGui.BulletText($"{item.Name} — {item.Role}");
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.BulletText(item.Name);
|
||||
}
|
||||
|
||||
ImGuiHelpers.ScaledDummy(3);
|
||||
}
|
||||
|
||||
ImGui.Unindent(15f);
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
}
|
||||
|
||||
private void DrawCloseButton()
|
||||
@@ -604,7 +599,9 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
ImGui.PushTextWrapPos();
|
||||
|
||||
foreach (var entry in _changelog.Changelog)
|
||||
{
|
||||
DrawChangelogEntry(entry);
|
||||
}
|
||||
|
||||
ImGui.PopTextWrapPos();
|
||||
ImGui.Spacing();
|
||||
@@ -617,7 +614,6 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
? UIColors.Get("LightlessGreen")
|
||||
: new Vector4(0.95f, 0.95f, 1.0f, 1.0f);
|
||||
|
||||
bool isOpen;
|
||||
var flags = entry.IsCurrent == true
|
||||
? ImGuiTreeNodeFlags.DefaultOpen
|
||||
: ImGuiTreeNodeFlags.None;
|
||||
@@ -628,15 +624,15 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
using (ImRaii.PushColor(ImGuiCol.HeaderActive, UIColors.Get("LightlessPurpleActive")))
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, currentColor))
|
||||
{
|
||||
isOpen = ImGui.CollapsingHeader($" {entry.Name} — {entry.Date} ", flags);
|
||||
var isOpen = ImGui.CollapsingHeader($" {entry.Name} — {entry.Date} ", flags);
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.85f, 0.85f, 0.95f, 1.0f), $" — {entry.Tagline}");
|
||||
|
||||
if (!isOpen)
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.85f, 0.85f, 0.95f, 1.0f), $" — {entry.Tagline}");
|
||||
|
||||
if (!isOpen)
|
||||
return;
|
||||
|
||||
ImGuiHelpers.ScaledDummy(8);
|
||||
|
||||
if (!string.IsNullOrEmpty(entry.Message))
|
||||
@@ -660,8 +656,6 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiHelpers.ScaledDummy(8);
|
||||
}
|
||||
|
||||
private static void DrawFeatureSection(string title, Vector4 accentColor)
|
||||
@@ -693,10 +687,15 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
1.5f
|
||||
);
|
||||
|
||||
// Calculate vertical centering
|
||||
var textSize = ImGui.CalcTextSize(title);
|
||||
var boxHeight = backgroundMax.Y - backgroundMin.Y;
|
||||
var verticalOffset = (boxHeight - textSize.Y) / 5f;
|
||||
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + 8);
|
||||
ImGui.Spacing();
|
||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + verticalOffset);
|
||||
ImGui.TextColored(accentColor, title);
|
||||
ImGui.Spacing();
|
||||
ImGui.SetCursorPosY(backgroundMax.Y - startPos.Y + ImGui.GetCursorPosY());
|
||||
}
|
||||
|
||||
private void LoadEmbeddedResources()
|
||||
@@ -704,17 +703,28 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
|
||||
try
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
using var changelogStream = assembly.GetManifestResourceStream("LightlessSync.UI.Changelog.changelog.yaml");
|
||||
var deserializer = new DeserializerBuilder()
|
||||
.WithNamingConvention(CamelCaseNamingConvention.Instance)
|
||||
.IgnoreUnmatchedProperties()
|
||||
.Build();
|
||||
|
||||
// Load changelog
|
||||
using var changelogStream = assembly.GetManifestResourceStream("LightlessSync.Changelog.changelog.yaml");
|
||||
if (changelogStream != null)
|
||||
{
|
||||
using var reader = new StreamReader(changelogStream, Encoding.UTF8, true, 128);
|
||||
var yaml = reader.ReadToEnd();
|
||||
var deserializer = new DeserializerBuilder()
|
||||
.WithNamingConvention(CamelCaseNamingConvention.Instance)
|
||||
.IgnoreUnmatchedProperties()
|
||||
.Build();
|
||||
_changelog = deserializer.Deserialize<ChangelogFile>(yaml) ?? new();
|
||||
}
|
||||
|
||||
// Load credits
|
||||
using var creditsStream = assembly.GetManifestResourceStream("LightlessSync.Changelog.credits.yaml");
|
||||
if (creditsStream != null)
|
||||
{
|
||||
using var reader = new StreamReader(creditsStream, Encoding.UTF8, true, 128);
|
||||
var yaml = reader.ReadToEnd();
|
||||
_credits = deserializer.Deserialize<CreditsFile>(yaml) ?? new();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user