credits integration into the yaml and ui

This commit is contained in:
choco
2025-10-16 14:35:30 +02:00
parent f77d109d00
commit 92b8d4a1cd
3 changed files with 137 additions and 2 deletions

View File

@@ -93,7 +93,7 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
DrawHeader();
ImGuiHelpers.ScaledDummy(6);
DrawChangelog();
DrawTabs();
DrawCloseButton();
}
@@ -480,6 +480,92 @@ public class UpdateNotesUi : WindowMediatorSubscriberBase
}
private void DrawTabs()
{
using (ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 6f))
using (ImRaii.PushColor(ImGuiCol.Tab, UIColors.Get("ButtonDefault")))
using (ImRaii.PushColor(ImGuiCol.TabHovered, UIColors.Get("LightlessPurple")))
using (ImRaii.PushColor(ImGuiCol.TabActive, UIColors.Get("LightlessPurpleActive")))
{
using (var tabBar = ImRaii.TabBar("###ll_tabs", ImGuiTabBarFlags.None))
{
if (!tabBar)
return;
using (var changelogTab = ImRaii.TabItem("What's New"))
{
if (changelogTab)
{
_selectedTab = 0;
DrawChangelog();
}
}
if (_changelog.Credits != null && _changelog.Credits.Count > 0)
{
using (var creditsTab = ImRaii.TabItem("Credits"))
{
if (creditsTab)
{
_selectedTab = 1;
DrawCredits();
}
}
}
}
}
}
private void DrawCredits()
{
using (ImRaii.PushStyle(ImGuiStyleVar.ChildRounding, 6f))
using (var child = ImRaii.Child("###ll_credits", new Vector2(0, ImGui.GetContentRegionAvail().Y - 60), false,
ImGuiWindowFlags.AlwaysVerticalScrollbar))
{
if (!child)
return;
ImGui.PushTextWrapPos();
if (_changelog.Credits != null)
{
foreach (var category in _changelog.Credits)
{
DrawCreditCategory(category);
ImGuiHelpers.ScaledDummy(10);
}
}
ImGui.PopTextWrapPos();
ImGui.Spacing();
}
}
private void DrawCreditCategory(CreditCategory category)
{
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}");
}
ImGuiHelpers.ScaledDummy(3);
}
ImGui.Unindent(15f);
}
private void DrawCloseButton()
{
ImGuiHelpers.ScaledDummy(5);