fix(studio): Character window — selected-row highlight uses retail bar sprite
Replaces the translucent-gold BackgroundColor tint with sprite 0x06001397 (Button state 6 — the retail dark horizontal bars) for the selected-row background. When spriteResolve is provided to Bind(), clicking a row now applies BackgroundSprite=0x06001397 + SpriteResolve on that row and clears it on all others. Falls back to HighlightBg tint when no resolver is passed (tests, or contexts without GL). UiPanel.BackgroundSprite / SpriteResolve added so any panel can host a sprite background in place of the solid BackgroundColor rect. HandleRowClick updated to accept spriteResolve and apply the sprite or tint branch depending on availability. Two new tests verify the sprite / deselect paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a236dc33ac
commit
dfb4c81133
3 changed files with 89 additions and 4 deletions
|
|
@ -433,6 +433,45 @@ public class CharacterStatControllerTests
|
|||
Assert.Equal(0f, rows[2].BackgroundColor.W);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RowClick_WithSpriteResolve_SelectedRowHasHighlightSprite()
|
||||
{
|
||||
// When spriteResolve is provided, the selected row must use sprite 0x06001397
|
||||
// (retail Button-state-6 dark bar) instead of the translucent gold BackgroundColor.
|
||||
var list = new UiPanel();
|
||||
var layout = Fake((CharacterStatController.ListBoxId, list));
|
||||
|
||||
// Minimal sprite resolver — returns a fake non-zero handle so UiPanel draws it.
|
||||
static (uint, int, int) FakeResolve(uint id) => (1u, 32, 8);
|
||||
|
||||
CharacterStatController.Bind(layout, SampleData.SampleCharacter,
|
||||
spriteResolve: FakeResolve);
|
||||
|
||||
var rows = list.Children.OfType<UiClickablePanel>().ToList();
|
||||
rows[2].OnClick!();
|
||||
|
||||
Assert.Equal(0x06001397u, rows[2].BackgroundSprite); // selected → sprite
|
||||
Assert.Equal(0f, rows[2].BackgroundColor.W); // no tint
|
||||
Assert.Equal(0u, rows[0].BackgroundSprite); // others cleared
|
||||
Assert.Equal(0u, rows[1].BackgroundSprite);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RowClick_WithSpriteResolve_Deselect_ClearsSprite()
|
||||
{
|
||||
var list = new UiPanel();
|
||||
var layout = Fake((CharacterStatController.ListBoxId, list));
|
||||
static (uint, int, int) FakeResolve(uint id) => (1u, 32, 8);
|
||||
CharacterStatController.Bind(layout, SampleData.SampleCharacter,
|
||||
spriteResolve: FakeResolve);
|
||||
|
||||
var rows = list.Children.OfType<UiClickablePanel>().ToList();
|
||||
rows[2].OnClick!(); // select
|
||||
rows[2].OnClick!(); // deselect
|
||||
|
||||
Assert.Equal(0u, rows[2].BackgroundSprite);
|
||||
}
|
||||
|
||||
// ── Pass 2: Raise button affordability ───────────────────────────────────
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue