fix(studio): match skill row selection layout
This commit is contained in:
parent
ffaf593c76
commit
e3fc7ac5ba
3 changed files with 15 additions and 14 deletions
|
|
@ -138,7 +138,6 @@ public static class CharacterStatController
|
|||
/// <summary>Row highlight color — semi-translucent gold, matches retail
|
||||
/// UIStateId.Highlight (0x06) sprite 0x06001397 visual intent.</summary>
|
||||
private static readonly Vector4 HighlightBg = new(1f, 0.75f, 0.2f, 0.25f);
|
||||
private static readonly Vector4 SkillRowBackground = new(0f, 0f, 0f, 1f);
|
||||
private static readonly Vector4 BuffedSkillGreen = new(0.55f, 1f, 0.55f, 1f);
|
||||
|
||||
// ── Row layout constants ─────────────────────────────────────────────────
|
||||
|
|
@ -608,9 +607,7 @@ public static class CharacterStatController
|
|||
nameText: skill.Name,
|
||||
valueProvider: () => skill.CurrentLevel.ToString(),
|
||||
valueColorProvider: () => SkillValueColor(skill),
|
||||
nameColor: Vector4.One,
|
||||
backgroundColor: SkillRowBackground,
|
||||
useSelectionBars: false);
|
||||
nameColor: Vector4.One);
|
||||
row.OnClick = () => HandleSkillRowClick(rowIndex, sel, bindings, spriteResolve, data, allRaise1, allRaise10);
|
||||
bindings.Add(new SkillRowBinding(row, skill));
|
||||
entries.Add(row);
|
||||
|
|
@ -784,7 +781,7 @@ public static class CharacterStatController
|
|||
{
|
||||
if (spriteResolve is not null)
|
||||
{
|
||||
row.BackgroundColor = SkillRowBackground;
|
||||
row.BackgroundColor = Vector4.Zero;
|
||||
row.BackgroundSprite = RowHighlightSprite;
|
||||
row.SpriteResolve = id => { var (h, w, ht) = spriteResolve(id); return (h, w, ht); };
|
||||
row.UseSelectionBars = true;
|
||||
|
|
@ -799,10 +796,10 @@ public static class CharacterStatController
|
|||
}
|
||||
else
|
||||
{
|
||||
row.BackgroundColor = SkillRowBackground;
|
||||
row.BackgroundColor = Vector4.Zero;
|
||||
row.BackgroundSprite = 0u;
|
||||
row.SpriteResolve = null;
|
||||
row.UseSelectionBars = false;
|
||||
row.UseSelectionBars = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -933,7 +930,6 @@ public static class CharacterStatController
|
|||
Func<string> valueProvider,
|
||||
Func<Vector4>? valueColorProvider = null,
|
||||
Vector4? nameColor = null,
|
||||
Vector4? backgroundColor = null,
|
||||
uint backgroundSprite = 0u,
|
||||
bool useSelectionBars = true)
|
||||
{
|
||||
|
|
@ -943,7 +939,7 @@ public static class CharacterStatController
|
|||
Top = top,
|
||||
Width = width,
|
||||
Height = height,
|
||||
BackgroundColor = backgroundColor ?? Vector4.Zero,
|
||||
BackgroundColor = Vector4.Zero, // transparent until selected
|
||||
BackgroundSprite = spriteResolve is not null ? backgroundSprite : 0u,
|
||||
SpriteResolve = spriteResolve is not null && backgroundSprite != 0u
|
||||
? id => { var (h, w, ht) = spriteResolve(id); return (h, w, ht); }
|
||||
|
|
|
|||
|
|
@ -175,9 +175,6 @@ public class UiClickablePanel : UiPanel
|
|||
{
|
||||
if (UseSelectionBars && BackgroundSprite != 0 && SpriteResolve is { } sr)
|
||||
{
|
||||
if (BackgroundColor.W > 0f)
|
||||
ctx.DrawRect(0, 0, Width, Height, BackgroundColor);
|
||||
|
||||
// Draw the selection highlight as a thin bar at the TOP and BOTTOM of the row.
|
||||
// The sprite (0x06001397) is 300×32 px — we draw it as horizontal strips at
|
||||
// native height (SelectionBarHeight), stretched to full panel width (UV tile
|
||||
|
|
|
|||
|
|
@ -658,8 +658,9 @@ public class CharacterStatControllerTests
|
|||
Assert.Equal(12, rows.Count);
|
||||
Assert.All(rows, row =>
|
||||
{
|
||||
Assert.Equal(new Vector4(0f, 0f, 0f, 1f), row.BackgroundColor);
|
||||
Assert.Equal(Vector4.Zero, row.BackgroundColor);
|
||||
Assert.Equal(0u, row.BackgroundSprite);
|
||||
Assert.True(row.UseSelectionBars);
|
||||
});
|
||||
var rowNames = rows
|
||||
.Select(r => r.Children.OfType<UiText>().ToList()[1].LinesProvider()[0].Text)
|
||||
|
|
@ -760,13 +761,20 @@ public class CharacterStatControllerTests
|
|||
spriteResolve: id => (id, 16, 16));
|
||||
|
||||
ClickTab(layout, left: 92f);
|
||||
list.Children.OfType<UiClickablePanel>().ToList()[1].OnClick!();
|
||||
var rows = list.Children.OfType<UiClickablePanel>().ToList();
|
||||
rows[1].OnClick!();
|
||||
|
||||
Assert.Equal("War Magic: 285", title.LinesProvider()[0].Text);
|
||||
Assert.Equal("Experience To Raise:", l1Label.LinesProvider()[0].Text);
|
||||
Assert.Equal((11_100_000L).ToString("N0"), l1Value.LinesProvider()[0].Text);
|
||||
Assert.Equal("Unassigned Experience:", l2Label.LinesProvider()[0].Text);
|
||||
Assert.Equal((87_757_321_741L).ToString("N0"), l2Value.LinesProvider()[0].Text);
|
||||
Assert.Equal(0x06001397u, rows[1].BackgroundSprite);
|
||||
Assert.True(rows[1].UseSelectionBars);
|
||||
Assert.Equal(Vector4.Zero, rows[1].BackgroundColor);
|
||||
Assert.Equal(0u, rows[0].BackgroundSprite);
|
||||
Assert.True(rows[0].UseSelectionBars);
|
||||
Assert.Equal(Vector4.Zero, rows[0].BackgroundColor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue