UI reference
The Jiangyu.Game.Ui injection surface, the reusable components, and the UI sounds, generated from the SDK. Components are open wrappers over the game's own controls: each hands back the real elements on .Root, so anything not exposed here is reachable and overridable on them.
Injection and helpers
UI
Adds mod UI into the game's live screens and dialogs. Injected elements join the game's own UI Toolkit panel, so the game's stylesheets cascade to them: give an element the game's USS class names (discover them with the Studio UI inspector, or copy them off a neighbour with MatchStyle) and it is styled like native UI. Author the element as a UXML asset bundled with the mod (an .uxml under Assets/UI/, with its USS linked by a <Style> tag) and pass its name or the loaded VisualTreeAsset, or build it from a callback. A UiTarget says which screen and where. The returned UiInjection is re-applied automatically when the screen is rebuilt, and Refresh rebuilds it on demand after the data behind it changes.
| Member | Description |
|---|---|
BindUxmlResolver(Func) | Resolve a bundled UXML asset by calling assembly and name. Bound by the loader at startup. |
CloseOnOutsideClick(VisualElement, Action, string) | Close element when a pointer goes down anywhere outside it: on another UI element, or on empty space. A transparent, behind-everything catcher makes empty space pickable (UI Toolkit dispatches no event where nothing pickable sits), and a capture-phase handler on the panel root sees every press first. A press inside the element, or on an element named in keepOpenOn (the button that toggles it, for one), is left alone. onClose defaults to hiding the element. Call this once the element is attached to a panel. |
Find(VisualElement, UiSelector) | The first descendant of root matching selector, or null. |
FindAll(VisualElement, UiSelector) | Every descendant of root matching selector. |
Inject(UiTarget, Func, Action) | Inject one element built by build at target. |
Inject(UiTarget, VisualTreeAsset, Action) | Inject a loaded uxml asset at target. |
Inject(UiTarget, string, Action) | Inject the bundled UXML named uxml (from the calling mod's assets) at target. |
InjectEach(UiTarget, Func, Action) | Inject a built element once per scoped match. build and bind get the scope. |
InjectEach(UiTarget, VisualTreeAsset, Action) | Inject a loaded uxml asset once per scoped match. |
InjectEach(UiTarget, string, Action) | Inject the bundled UXML once per scoped match. bind gets the new element and its scope. |
Localise(VisualElement) | Translate every marked label under root for the active language. A label is marked by giving its name a leading @, the rest of the name is its loca key, and the authored text is the English fallback. Injected UXML is localised automatically (on inject and on every rebuild, including an in-game language switch), so a mod calls this only for a tree it builds and manages outside the injection system. Idempotent. |
UiElementExtensions
Helpers for styling and placing injected UI to match the game's own elements.
| Member | Description |
|---|---|
CenterText(VisualElement) | Centre target's text both ways, inline. The game's own .unity-label rule sets a text-align that ties on specificity with a mod's USS class and wins on stylesheet load order, so an inline value is the reliable way to centre an injected label. |
IsVisible(VisualElement) | Whether target currently resolves to displayed. |
MatchStyle(VisualElement, VisualElement) | Copy every USS class off reference onto target, so the target picks up the same game stylesheet rules and lays out like it. Use it to make an injected element match a neighbour, for example a relationship bar matching the health bar beside it. Note: many game elements carry no USS classes and are positioned by name/id selector or in code, in which case there is nothing to copy and StackAfter is the tool to reach for instead. |
SetVisible(VisualElement, bool) | Show or hide target by toggling its display style. |
SetWidthPercent(VisualElement, float) | Set target's width as a percentage of its parent (0 to 100), for bar fills. |
StackAfter(VisualElement, VisualElement, float) | Position target absolutely one row below reference, matching its left edge, width, and height, with an optional gap. This is the way to add a sibling to a game element that has no USS classes and is absolutely positioned (so MatchStyle has nothing to copy), for example stacking a third bar under the health and armour bars. Read from the reference's resolved layout, so call it after the reference has been laid out. |
UiInjection
A live mod-UI injection returned by UI. Hold it to refresh the element after the data behind it changes, or to take it back out. The loader re-applies it automatically when the screen rebuilds, so a mod only needs Refresh when its own state changed.
| Member | Description |
|---|---|
Refresh | Rebuild the injected element(s) against the current tree and data. |
Remove | Remove the injected element(s) and stop maintaining this injection. |
UiSelector
Matches a live VisualElement by name, USS class, or concrete type. Selectors locate anchors and scopes for UI injection. Find the names and classes to match with the Studio UI inspector. Criteria combine with And, and all must hold for a match.
| Member | Description |
|---|---|
And(UiSelector) | A selector that matches only when both this and other match. |
Class(string) | Match an element carrying the USS class className. |
Name(string) | Match the element whose name equals name. |
NameStartsWith(string) | Match an element whose name begins with prefix. |
Type<T> | Match an element whose concrete game type is T (a subclass counts). |
TypeName(string) | Match an element whose concrete game type name equals typeName, for example "ArmoryUnitSelectSlot". This is the type name the UI inspector reports, so it matches even when the type has no compile-time wrapper to use with Type<T>. |
UiTarget
Describes where injected UI lands: which live screen or dialog to inject into, optionally scoped to each element matching a selector, and where within that scope to place the new element. Resolved fresh against the live tree on every inject and refresh, so a target survives the screen being torn down and rebuilt.
| Member | Description |
|---|---|
ActiveScreen | Target whichever screen is currently active. |
After(UiSelector) | Place the injected element immediately after the element matching anchor. |
AppendTo(UiSelector) | Append the injected element to the container matching container. |
Before(UiSelector) | Place the injected element immediately before the element matching anchor. |
Dialog<T> | Target the open dialog when its concrete type is TDialog. |
Each(UiSelector) | Inject once into every element matching selector under the root. |
Overlay | A full-screen overlay on the active screen, for a modal or dialog. The injected element is stretched to cover the screen, so a UXML backdrop styled position: absolute fills it. Hide and show the returned injection's element to open and close it. |
Screen<T> | Target the active screen when its concrete type is TScreen. |
Components
Flyout
A window-framed panel that can dismiss itself on any outside click. Wraps the game's .window / .unit-window-background / .unit-window-border frame. Add rows to Content, inject Root where you want the panel, and show or hide it with Show / Hide. It is an open wrapper: Root and Content are real elements you can restyle or extend.
| Member | Description |
|---|---|
Content | The content area inside the frame. Add your rows here. |
DismissOnOutsideClick(string) | Dismiss the flyout when a pointer goes down outside it. Names in keepOpenOn (the toggle button, say) are left alone. Call this once Root is attached to a panel. |
Hide | Hide the flyout. |
Root | The window frame element. Inject this. |
Show | Show the flyout. |
ItemTile
A native item tile: the game's loot slot rendering an item (icon, stack, trade value), with native hover, the game's .slot-selected-border highlight while chosen, and a chosen-count badge. Left-click and right-click adjust the count through OnAdjust. It is an open wrapper: Root and Badge are real elements to restyle or extend.
| Member | Description |
|---|---|
Badge | The chosen-count badge (hidden at zero). Restyle it if you like. |
OnAdjust(Action) | Left-click calls onDelta with +1, right-click with -1. |
Owned | How many the player owns, the natural clamp ceiling for selection. |
Root | The tile element. Inject this. |
SetChosen(int) | Reflect a chosen count: the selected border and the badge text. |
TextButton
A native-looking text button: the game's .text-button frame with a .text-button-label, the game's UI click sound on press, and the game's native hover glow. It is an open wrapper, not a sealed widget: Root is the real UnityEngine.UIElements.Button, so anything not exposed here is reachable on it (inline styles, extra USS classes, child elements).
| Member | Description |
|---|---|
OnClick(Action) | Run handler on click (in addition to the click sound). |
Root | The underlying button element. Add it to the tree, restyle it, extend it. |
TextButton(string, bool) | Build the button. Pass sound false to suppress the click sound. |
Tooltip
The game's native tooltip: the floating info panel the game shows on hover, built from the game's TooltipData and displayed through UIManager. Build content with the fluent Heading / Paragraph / Stat / Line methods, then Show it anchored to an element (it sticks to the mouse by default, matching the game's own tooltips), or wire it to an element's hover with the static OnHover. Hide takes this tooltip back down. It is an ergonomics wrapper, not a sealed widget: a mod-facing Style maps onto the game's paragraph styles so the Il2Cpp tooltip types stay off the mod's surface, and Data exposes the underlying TooltipData for content this wrapper does not surface. Pass already-localised text (route it through Locale.Text first): each row is registered into the tooltip's own loca store so it renders, and the store falls back to the string as given, so the authored text is what shows.
| Member | Description |
|---|---|
Data | The underlying game tooltip data, for content this wrapper does not surface. |
Heading(string) | Add a heading row. |
Hide | Take this tooltip back down. A no-op unless this tooltip is the one currently on top, so a mod never tears down a different tooltip (a game tooltip, or a nested child opened over this one) that it does not own. |
Icon(Sprite, string) | Add an icon row from sprite (sourced by the mod, e.g. a template's icon). |
Image(Sprite, bool, string) | Add an image row from sprite. With useImageSize the row takes the sprite's native size, otherwise it fits the tooltip width. |
Interactive(Action, Func) | Wrap the rows added by content in an interactive container and reveal nested's tooltip as a child panel when that block is hovered. This is the mechanism the game uses to let you examine an item's skills from its tooltip. Call it as many times as you like for multiple independently-nested blocks; nested runs on each hover so the child reflects current state, and may return null to show nothing. |
Line | Add a horizontal divider. |
Link(string, string) | A rich-text span that renders text as a link to the game's built-in glossary term key (e.g. "hitpoint_damage"); hovering it opens that term's tooltip. Embed the result inside a Paragraph. Only existing game terms resolve. |
OnHover(VisualElement, Func, bool) | Show a freshly-built tooltip while anchor is hovered, and hide it on leave. build runs on every hover, so the tooltip reflects current state. Return null from it to show nothing this time. Idempotent: wiring the same element more than once (e.g. after a screen rebuild) does not stack duplicate handlers. |
Paragraph(string, Style) | Add a paragraph row in the given style. |
ProgressBar(float, string, int) | Add a labelled progress bar. fraction is the 0..1 fill; text is the label drawn on it. Colours follow the game's default bar styling. |
SectionHeading(string) | Add a section heading (a divider-style header that groups the rows beneath it). |
Show(VisualElement, bool) | Show this tooltip, anchored to anchor. With stickToMouse (the default) it follows the cursor like the game's own tooltips, otherwise it pins to the anchor. Call once the anchor is attached to a panel. |
Space | Add vertical spacing. |
Stat(string, string, Func) | Add a name/value stat row (e.g. "RANGE 5"). Pass nested to reveal a child tooltip when the row is hovered, the way the game lets you drill into a stat from an item tooltip. Consecutive stat rows render as one aligned group. |
StatBar(string, float, float, bool, Func) | Add a stat row drawn as a value-vs-maximum bar (e.g. a weapon's RANGE or DAMAGE). With biggerIsBetter the bar colours a high value positively. Pass nested to reveal a child tooltip when the row is hovered. Consecutive stat rows render as one aligned group. |
Subheading(string) | Add a subheading row (a smaller heading). |
Tooltip(string, int, bool) | Start an empty tooltip. width is the content width in pixels. Set canBePinned so the player can pin it in place (the game shows a pin hint); a pinned tooltip stays put, which is what lets the cursor move onto an interactive row to open a Interactive nested child. |
Audio
Sound
The game's standard UI feedback sounds, so a mod's buttons and tiles click like native ones. The default click sound ids live on the game's AudioConfig and are Stem ids that play themselves.
| Member | Description |
|---|---|
Click | Play the game's default UI left-click sound. |
RightClick | Play the game's default UI right-click sound. |