Add UI 9-slice sprite kit for redesign (T7) - #796
Open
Shombith03 wants to merge 1 commit into
Open
Conversation
26 white+alpha 9-slice sprites under Assets/_Graphics/UI/SpriteKit/ implementing
Style Foundation §5's corner sliver — a 45° diagonal cut on two opposite corners,
flippable — across the §10 components: buttons (two sliver sizes × two
orientations, fill and 1px frame), panel/popup, card, currency pill, hexagon tile,
hexagon slider handle, and the §10.9 angled banner with its triangular end caps.
No colour is baked: every pixel is RGB 255,255,255 with the shape entirely in
alpha, so one asset serves every state under an Image.color tint from UIThemeSO
(T4). No shipping prefab or scene is touched.
The 9-slice border is measured off the rasterised shape, not chosen. A slice is
exact when every column it stretches is identical to its neighbours; the nominal
sliver is the right inset for a filled shape and too small for an outlined one,
because eroding the polygon pushes the mitre past the sliver line by
stroke × (√2 − 1). Authored at the nominal, every outline variant leaked
antialiased pixels into a stretched region.
Assets and the test scene are generated from one table, so --check covers both:
Tools/Build/ui_sprite_kit_geometry.py convex geometry, exact coverage, PNG
codec, measure_border
Tools/Build/author_ui_sprite_kit.py the kit table; --check, --table
Tools/Build/ui_sprite_kit_scene.py test scene YAML
Tools/Build/verify_ui_sprite_kit.py proves the shipped bytes
verify reports 26/26 at maxdiff 0/255: each shipped sprite, 9-sliced to a target
size, is byte-identical to the same geometry rasterised natively at that size —
at the minimum legal size, 1:1, 3× wide, 409 wide, and at double height where the
sprite carries vertical insets.
Test scene: Assets/_Scenes/Game_TestDesign/UISpriteKitTestScene.unity, five pages,
each row one sprite at three widths (plus double height), each sample a different
§2 tint. Declarative UGUI, no new C#. Not in Build Settings.
Reference: Docs/UI_SPRITE_KIT.md. Four design questions filed as queue #10-#13.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H4Lq17kBtCJ2LbQGQ8ikfw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the component sprite kit for the UI redesign (task T7), delivering 26 white+alpha 9-slice sprites with procedurally-generated PNG assets, metadata, and a test scene. All sprites are authored from a declarative geometry table, enabling verification that shipped assets match the specification exactly.
Key Changes
Sprite authoring pipeline: Three Python tools that generate and verify the sprite kit:
author_ui_sprite_kit.py: Main entry point; generates PNG assets and.metafiles from theKITtableui_sprite_kit_geometry.py: Pure-stdlib geometry engine and PNG codec; computes corner slivers (45° diagonal cuts on opposite corners per Style Foundation §5) and encodes RGBA pixelsverify_ui_sprite_kit.py: Post-generation verification; proves each PNG is white+alpha, validatesspriteBordermetadata, and confirms partially-transparent pixels lie strictly inside border corners (the invariant that makes 9-slice scaling preserve diagonals)26 generated sprite assets under
Assets/_Graphics/UI/SpriteKit/:UIThemeSO)Test scene
Assets/_Scenes/Game_TestDesign/UISpriteKitTestScene.unity:Documentation
Docs/UI_SPRITE_KIT.md: Overview, usage, and verification instructionsImplementation Details
KITtable inauthor_ui_sprite_kit.py, so--checkmode can prove committed files are exactly what the table specifies{x=left, y=bottom, z=right, w=top}Button_Flat_*.png)/verify-unitycompile gateSpec References
Docs/UI_REDESIGN_TASKS.mdtask T7https://claude.ai/code/session_01H4Lq17kBtCJ2LbQGQ8ikfw