more tags meow

This commit is contained in:
2025-12-11 16:31:44 +09:00
parent 09b78e1896
commit 0671c46e5d
3 changed files with 58 additions and 67 deletions

View File

@@ -113,7 +113,7 @@ public partial class EditProfileUi
using var panelBorder = ImRaii.PushColor(ImGuiCol.ChildBg, accentBorder); using var panelBorder = ImRaii.PushColor(ImGuiCol.ChildBg, accentBorder);
ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, 4f * scale); ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, 4f * scale);
if (ImGui.BeginChild("##GroupProfileEditorCanvas", -Vector2.One, true, ImGuiWindowFlags.NoScrollbar)) if (ImGui.BeginChild("##GroupProfileEditorCanvas", -Vector2.One, true))
{ {
DrawGroupGuidelinesSection(scale); DrawGroupGuidelinesSection(scale);
ImGui.Dummy(new Vector2(0f, 4f * scale)); ImGui.Dummy(new Vector2(0f, 4f * scale));
@@ -236,31 +236,6 @@ public partial class EditProfileUi
ImGui.EndChild(); ImGui.EndChild();
ImGui.PopStyleVar(); ImGui.PopStyleVar();
ImGui.Dummy(new Vector2(0f, 4f * scale));
ImGui.TextColored(UIColors.Get("LightlessBlue"), "Saved Tags");
var savedTags = ProfileTagService.ResolveTags(_profileTagIds);
if (savedTags.Count == 0)
{
ImGui.TextDisabled("-- No tags set --");
}
else
{
bool first = true;
for (int i = 0; i < savedTags.Count; i++)
{
if (!savedTags[i].HasContent)
continue;
if (!first)
ImGui.SameLine(0f, 6f * scale);
first = false;
using (ImRaii.PushId($"group-snapshot-tag-{i}"))
DrawTagPreview(savedTags[i], scale, "##groupSnapshotTagPreview");
}
if (!first)
ImGui.NewLine();
}
} }
private void DrawGroupProfileImageControls() private void DrawGroupProfileImageControls()

View File

@@ -281,7 +281,7 @@ public partial class EditProfileUi : WindowMediatorSubscriberBase
using var panelBorder = ImRaii.PushColor(ImGuiCol.ChildBg, accentBorder); using var panelBorder = ImRaii.PushColor(ImGuiCol.ChildBg, accentBorder);
ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, 4f * scale); ImGui.PushStyleVar(ImGuiStyleVar.ChildRounding, 4f * scale);
if (ImGui.BeginChild("##ProfileEditorCanvas", -Vector2.One, true, ImGuiWindowFlags.NoScrollbar)) if (ImGui.BeginChild("##ProfileEditorCanvas", -Vector2.One, true))
{ {
DrawGuidelinesSection(scale); DrawGuidelinesSection(scale);
ImGui.Dummy(new Vector2(0f, 4f * scale)); ImGui.Dummy(new Vector2(0f, 4f * scale));
@@ -432,30 +432,6 @@ public partial class EditProfileUi : WindowMediatorSubscriberBase
ImGui.PopStyleVar(); ImGui.PopStyleVar();
} }
ImGui.Dummy(new Vector2(0f, 4f * scale));
ImGui.TextColored(UIColors.Get("LightlessBlue"), "Saved Tags");
var savedTags = ProfileTagService.ResolveTags(_profileTagIds);
if (savedTags.Count == 0)
{
ImGui.TextDisabled("-- No tags set --");
}
else
{
bool first = true;
for (int i = 0; i < savedTags.Count; i++)
{
if (!savedTags[i].HasContent)
continue;
if (!first)
ImGui.SameLine(0f, 6f * scale);
first = false;
using (ImRaii.PushId($"snapshot-tag-{i}"))
DrawTagPreview(savedTags[i], scale, "##snapshotTagPreview");
}
if (!first)
ImGui.NewLine();
}
} }
private void DrawProfileImageControls(LightlessUserProfileData profile, float scale) private void DrawProfileImageControls(LightlessUserProfileData profile, float scale)
@@ -943,17 +919,6 @@ public partial class EditProfileUi : WindowMediatorSubscriberBase
return _bannerImage.Length > 0 ? Convert.ToBase64String(_bannerImage) : null; return _bannerImage.Length > 0 ? Convert.ToBase64String(_bannerImage) : null;
} }
private void DrawTagPreview(ProfileTagDefinition tag, float scale, string id)
{
var style = ImGui.GetStyle();
var defaultTextColorU32 = ImGui.GetColorU32(ImGuiCol.Text);
var tagSize = ProfileTagRenderer.MeasureTag(tag, scale, style, _tagBackgroundColor, _tagBorderColor, defaultTextColorU32, _tagPreviewSegments, ResolveIconWrap, _logger);
ImGui.InvisibleButton(id, tagSize);
var rectMin = ImGui.GetItemRectMin();
var drawList = ImGui.GetWindowDrawList();
ProfileTagRenderer.RenderTag(tag, rectMin, scale, drawList, style, _tagBackgroundColor, _tagBorderColor, defaultTextColorU32, _tagPreviewSegments, ResolveIconWrap, _logger);
}
private static bool IsSupportedImageFormat(IImageFormat? format) private static bool IsSupportedImageFormat(IImageFormat? format)
{ {
@@ -1150,12 +1115,18 @@ public partial class EditProfileUi : WindowMediatorSubscriberBase
var drawList = ImGui.GetWindowDrawList(); var drawList = ImGui.GetWindowDrawList();
var textSize = ImGui.CalcTextSize(seString.TextValue); var textSize = ImGui.CalcTextSize(seString.TextValue);
float minWidth = 160f * ImGuiHelpers.GlobalScale; float minWidth = 160f * ImGuiHelpers.GlobalScale;
float bgWidth = Math.Max(textSize.X + 20f * ImGuiHelpers.GlobalScale, minWidth);
float paddingY = 5f * ImGuiHelpers.GlobalScale; float paddingY = 5f * ImGuiHelpers.GlobalScale;
float paddingX = 10f * ImGuiHelpers.GlobalScale;
float bgWidth = Math.Max(textSize.X + paddingX * 2f, minWidth);
var style = ImGui.GetStyle();
var fontHeight = monoFont.FontSize > 0f ? monoFont.FontSize : ImGui.GetFontSize();
float frameHeight = fontHeight + style.FramePadding.Y * 2f;
float textBlockHeight = MathF.Max(frameHeight, textSize.Y);
var cursor = ImGui.GetCursorScreenPos(); var cursor = ImGui.GetCursorScreenPos();
var rectMin = cursor; var rectMin = cursor;
var rectMax = rectMin + new Vector2(bgWidth, textSize.Y + paddingY * 2f); var rectMax = rectMin + new Vector2(bgWidth, textBlockHeight + paddingY * 2f);
float boost = Luminance.ComputeHighlight(previewTextColor, previewGlowColor); float boost = Luminance.ComputeHighlight(previewTextColor, previewGlowColor);
@@ -1166,8 +1137,8 @@ public partial class EditProfileUi : WindowMediatorSubscriberBase
drawList.AddRectFilled(rectMin, rectMax, ImGui.GetColorU32(bgColor), 5f); drawList.AddRectFilled(rectMin, rectMax, ImGui.GetColorU32(bgColor), 5f);
drawList.AddRect(rectMin, rectMax, ImGui.GetColorU32(borderColor), 5f, ImDrawFlags.None, 1.2f); drawList.AddRect(rectMin, rectMax, ImGui.GetColorU32(borderColor), 5f, ImDrawFlags.None, 1.2f);
var textPos = new Vector2(rectMin.X + (bgWidth - textSize.X) * 0.5f, rectMin.Y + paddingY); var textOrigin = new Vector2(rectMin.X + (bgWidth - textSize.X) * 0.5f, rectMin.Y + paddingY);
SeStringUtils.RenderSeStringWithHitbox(seString, textPos, monoFont); SeStringUtils.RenderSeStringWithHitbox(seString, textOrigin, monoFont);
ImGui.Dummy(new Vector2(0f, 1.5f)); ImGui.Dummy(new Vector2(0f, 1.5f));
} }

View File

@@ -119,7 +119,52 @@ public sealed class ProfileTagService
[1006] = ProfileTagDefinition.FromIcon(61753), // Casual [1006] = ProfileTagDefinition.FromIcon(61753), // Casual
[1007] = ProfileTagDefinition.FromIcon(61754), // Hardcore [1007] = ProfileTagDefinition.FromIcon(61754), // Hardcore
[1008] = ProfileTagDefinition.FromIcon(61759), // Glamour [1008] = ProfileTagDefinition.FromIcon(61759), // Glamour
[1009] = ProfileTagDefinition.FromIcon(61760) // Mentor [1009] = ProfileTagDefinition.FromIcon(61760), // Mentor
// Role Tags
[2001] = ProfileTagDefinition.FromIconAndText(62581, "Tank"),
[2002] = ProfileTagDefinition.FromIconAndText(62582, "Healer"),
[2003] = ProfileTagDefinition.FromIconAndText(62583, "DPS"),
[2004] = ProfileTagDefinition.FromIconAndText(62584, "Melee DPS"),
[2005] = ProfileTagDefinition.FromIconAndText(62585, "Ranged DPS"),
[2006] = ProfileTagDefinition.FromIconAndText(62586, "Physical Ranged DPS"),
[2007] = ProfileTagDefinition.FromIconAndText(62587, "Magical Ranged DPS"),
// Misc Role Tags
[2101] = ProfileTagDefinition.FromIconAndText(62146, "All-Rounder"),
// Tank Job Tags
[2201] = ProfileTagDefinition.FromIconAndText(62119, "Paladin"),
[2202] = ProfileTagDefinition.FromIconAndText(62121, "Warrior"),
[2203] = ProfileTagDefinition.FromIconAndText(62132, "Dark Knight"),
[2204] = ProfileTagDefinition.FromIconAndText(62137, "Gunbreaker"),
// Healer Job Tags
[2301] = ProfileTagDefinition.FromIconAndText(62124, "White Mage"),
[2302] = ProfileTagDefinition.FromIconAndText(62128, "Scholar"),
[2303] = ProfileTagDefinition.FromIconAndText(62133, "Astrologian"),
[2304] = ProfileTagDefinition.FromIconAndText(62140, "Sage"),
// Melee DPS Job Tags
[2401] = ProfileTagDefinition.FromIconAndText(62120, "Monk"),
[2402] = ProfileTagDefinition.FromIconAndText(62122, "Dragoon"),
[2403] = ProfileTagDefinition.FromIconAndText(62130, "Ninja"),
[2404] = ProfileTagDefinition.FromIconAndText(62134, "Samurai"),
[2405] = ProfileTagDefinition.FromIconAndText(62139, "Reaper"),
[2406] = ProfileTagDefinition.FromIconAndText(62141, "Viper"),
// PRanged DPS Job Tags
[2501] = ProfileTagDefinition.FromIconAndText(62123, "Bard"),
[2502] = ProfileTagDefinition.FromIconAndText(62131, "Machinist"),
[2503] = ProfileTagDefinition.FromIconAndText(62138, "Dancer"),
// MRanged DPS Job Tags
[2601] = ProfileTagDefinition.FromIconAndText(62125, "Black Mage"),
[2602] = ProfileTagDefinition.FromIconAndText(62127, "Summoner"),
[2603] = ProfileTagDefinition.FromIconAndText(62135, "Red Mage"),
[2604] = ProfileTagDefinition.FromIconAndText(62142, "Pictomancer"),
[2605] = ProfileTagDefinition.FromIconAndText(62136, "Blue Mage") // this job sucks xd
}; };
} }
} }