fix(uxassist): use standard blueprint option controls

Match the native description title baseline, add clearance from the popup corner, and use the rectangular settings selector. Let its list overlay the footer without resizing the popup, and reduce checkbox spacing. Reset cloned resolution rows and external events locally.

Assisted-by: Cindy (https://cindy.app)
This commit is contained in:
soarqin committed 2026-11-05 21:43:21 +08:00
1 parent 19d19ce38d
commit 58d08cbcd7
5 files changed
+81 -71

No files matched your search

+12 -24
View File
@@ -4,14 +4,14 @@ This document records the native layout evidence for the UXAssist description-he
## Native evidence
Inspected on 2026-11-01 after discovering Steam through `HKCU`'s Steam path and `steamapps/libraryfolders.vdf`:
Original installed DSP sources, rechecked on 2026-11-05 after discovery through the Steam registry and `steamapps/libraryfolders.vdf`:
- Original assembly: `D:/Steam/steamapps/common/Dyson Sphere Program/DSPGAME_Data/Managed/Assembly-CSharp.dll`, SHA-256 `EF314425DADE51F529F184F07BE136CD3C2660A6A81515603C7226FBE7AB1D8C`.
- Original `UnityEngine.UI.dll`, SHA-256 `C5ACC25EBD597B586D323AF506FB88E760322550940F1A3B0EA4FC8143FCB26C`.
- Native UI assets: `DSPGAME_Data/level0`, SHA-256 `04655A46BBEB113113688BCDC0E0EA8EC5F128B348E32194FC9743ADB48C8E91`.
- The installed version history ends at `0.10.35.29151`; the Steam manifest reports build ID `25955035`. Assembly file version `0.0.0.0` alone does not identify this game build.
The original `UIBlueprintInspector.Refresh` sizes the description and native groups, places groups 2 through 4, and updates the scroll content height. It does not restore group 1's position. The previous UXAssist layout shifted group 1 and repeatedly offset the later groups and content height, making both the native refresh and other layout patches share ownership of those transforms.
Native `UIBlueprintInspector.Refresh` owns description and group sizes, later group positions, and scroll content height. UXAssist positions only its own entry and popup.
The relevant original methods can be reproduced by decompiling the following types from the original assembly:
@@ -23,21 +23,21 @@ The relevant original methods can be reproduced by decompiling the following typ
| `UIBlueprintInspector.OnCustomFieldEndEdit(string str)` and `CollectExternalFields(int excludeTargetId = -1)` | Collect, escape, and validate pending custom-field edits through the native path. |
| `UIBlueprintInspector.OnCopyClick()`, `OnSaveChangesClick()`, and `OnSaveClick()` | Serialize or save the current blueprint with the game's native workflow. |
The native `descGroupTrans` in all three inspectors contains a description label at the top and an input beginning 22 pixels below it. The compact UXAssist entry follows the native title's measured text width plus 8 pixels and reserves 8 pixels before the actual icon button's left edge, including when the icon is inactive. It hides if there is insufficient room. Options open next to the actual entry and follow it after layout and scrolling; only owned transforms are positioned. Native labels, inputs, groups, scroll content, and the separate settings panel retain their native layout.
The native description input starts 22 pixels below its title. The entry copies the title's font, size, style, line spacing, and alignment, with zero top text inset, while its hit rectangle stays 22 pixels high. It follows the title's measured text width plus 8 pixels and reserves 8 pixels before the actual native icon, including when the icon is inactive. It hides if it cannot fit. The title's 30-pixel Text rectangle must not become the button's hit rectangle, which would extend into the input below. Native labels, inputs, groups, scroll content, and settings retain their layout.
`UIBlueprintInspector.Refresh(forModify: true)` does not reload `descTextInput`. Successful generation must assign both the blueprint description and its input before using the native modification refresh. Pending custom fields must first pass through the native field collection and escaping rules. Native copy and save handlers serialize the current blueprint, so they remain the actions used to share or persist a generated description.
Decompiled methods and extracted rectangle data are development artifacts under `UXAssist/obj/native-inspector/`. Reinspect the installed original assembly and assets after a game update; the publicized compile-time references omit method bodies.
Reinspect the installed original assemblies and assets after a game update; the publicized compile-time references omit method bodies.
## Anchored options and native conventions
The original DLL and `level0` hashes and installed version above were rechecked on 2026-11-05. The options use the entry's world corners, transformed into the popup parent's coordinates, and actual root-canvas bounds. Placement prefers below the entry with a 6-pixel gap and aligned right edges, flips above when needed, and clamps against an 8-pixel canvas inset. A panel too large for that area is closed. `Canvas.willRenderCanvases` reconciles placement after native layout only while open. An inactive or fully clipped entry closes its popup.
The popup uses the entry's world corners, transformed into its parent's coordinates, and actual root-canvas bounds. Placement prefers below the entry with a 6-pixel gap and aligned right edges, flips above when needed, and clamps against an 8-pixel canvas inset. A panel too large for that area is closed. `Canvas.willRenderCanvases` reconciles placement while open. An inactive or fully clipped entry closes its popup.
The panel has an `Auto-fill description` title and native X, proliferation, production basis with help, and one footer `Generate` action. Content insets include the actual sliced sprite's transparent trim before adding the desired visible gaps. Preferred glyph sizes determine label, row, item, and button heights; the 20-pixel checkbox keeps an independently sized label with an 8-pixel gap. Panel and footer height follow the measured rows and expanded list.
The panel has a title and native X, proliferation, production basis with help, and one footer `Generate` action. Content insets include the sliced sprite's approximately 13-pixel horizontal and 11-pixel vertical trim before pixels-per-unit conversion. The title has extra left and top clearance from the visible border. The 20-pixel checkbox has an independently sized label with a 4-pixel gap and vertical overflow allowed; label height remains at least 26 pixels or preferred glyph height plus padding. The panel and footer are sized from the form alone. Opening the dropdown overlays the footer without resizing the popup or moving the action.
The X comes from `inserterWindow/panel-bg/btn-box/close-wnd-btn`: a 40-by-30 native button with a centered 16-by-16 icon and a transparent 30-by-19 raycast child. Its original serialized `Button.onClick` targets the original inserter window's `_Close`. The owned clone replaces the entire `Button.ButtonClickedEvent` before adding its popup callback; removing runtime listeners alone would leave that persistent callback active.
The source production-basis combo also carries source-specific behavior. Its root `Localizer` uses `wParamKey = "恒星信息面板组合框宽度"`, `sizeApplyTrans = null`, and `def_w = 0`. `OnEnable()` and `OnLanguageChange()` call `Refresh()`, which writes the root's width. Native locale parameters are 200 in `Locale/1033/parameters.txt` and 90 in `Locale/2052/parameters.txt`, both at line 28. The owned clone disables and removes this component before assigning dimensions, and disables `autoWidth` before setting items and index. Its main button fills the owned root, with selected and row-template text aligned left. Correct native horizontal anchors are retained. Native combo row `PointerDown` first selects the item, then closes the list; no extra submit-close callback is added.
The production-basis selector directly clones the standard rectangular `optionWindow.resolutionComp`. Cloned runtime resolution rows are removed and submit/change events are replaced before the two production choices are assigned, so changing the owned selection cannot change native resolution settings. The main caption uses 8-pixel left and 30-pixel right insets; row text uses 8-pixel horizontal insets. Native row selection closes the list, with no extra submit-close handler. The shared combo helper is unchanged.
| Original source | Behavior used by the popup |
| --- | --- |
@@ -45,27 +45,15 @@ The source production-basis combo also carries source-specific behavior. Its roo
| `UIGame._OnUpdate()` | Updates blueprint inspectors before later native picker and function-window Escape handlers. The owned inspector postfix consumes Escape after closing an expanded dropdown or its popup. |
| `UIItemPicker._OnUpdate()` | Tests left, right, and middle clicks outside a screen rectangle using the overlay canvas camera. The owned test also accepts the entry and an open dropdown. |
| `UIPopupMenu.SetState()` | Constrains popup placement to game UI bounds and brings it to the front. |
| Native blueprint settings, color-palette input rows, and inspector footer | Supply 20-pixel checkbox, 28-pixel input-row, and 30-pixel primary-action conventions. |
| Native inserter close-button subtree and combo row event routing | Supply the actual X artwork/hit area and the select-then-close event order. |
The evidence bundle `2026-11-04-UXAssist-BlueprintDescriptionLayout/anchored-options/` retains the native close-button and event-routing captures. The current `2026-11-05-UXAssist-BlueprintTextLayout/` bundle contains the actual reported screenshots, `native-text-layout-evidence.md`, focused font/locale/header captures, original UI and text-generator decompilations, and sprite analysis. The sliced background has approximately 13-pixel horizontal and 11-pixel vertical trim before pixels-per-unit conversion. The original checkbox's 26-pixel label was shortened to 20 while retaining `Truncate`; native font metrics and generator rules explain the discarded first line. Native header captures also confirm the description input's icon occupies the rightmost 20 pixels of its title row. These are original-asset and managed-rule findings, not an executed Unity rendering test. Investigation reports and the headless-test feasibility assessment remain outside the repository.
Original font, sprite, header, standard-resolution-control, and close-button captures and focused decompilations are retained in the external task evidence under `2026-11-05-UXAssist-BlueprintTextLayout/`, including `standard-controls/`. Native generator rules support keeping glyph height independent of checkbox size; native header captures identify the icon's actual 20-pixel slot. Source analysis and embedded-font calculations do not execute Unity's runtime preferred-size calculation, rasterization, or interaction. Investigation reports remain outside the repository.
## Recorded checks
The temporary placement harness extracts the actual private `TryGetPopupPosition` method body from `BlueprintDescriptionPatch.cs` and compiles it with data-only `Rect` and `Vector2` substitutes. It does not mirror the placement algorithm in a second implementation. Sources and results are preserved under `anchored-options/actual-placement-check/` and `actual-placement-check.json`.
The placement harness extracts the actual private `TryGetPopupPosition` method and compiles it with data-only `Rect` and `Vector2` substitutes. It checks supplied bounds, including parent transforms, canvas edges, below/above placement, and oversized-panel rejection. This validates the placement calculation, not current text rendering. Run font and sprite analysis against the current source and captured standard control.
The placement harness passed 8 exact cases, 3 oversized-panel rejection cases, and 1,920 native-parent fixtures, totaling 20,191 assertions. Fixtures cover the 392- and 394-pixel native inspector frames, translated and scaled parent coordinates, scales 0.75/1/1.25/1.5, scrolling, below/above placement, canvas edges, and supplied panel sizes. Widths of 320/360/440/520 pixels are test inputs, rather than measured English or Chinese font widths. The footer checks verify a 16-pixel gap after the list. These checks validate placement for supplied bounds, not current text sizing or Unity rendering.
On 2026-11-05, `native-text-regression-results.json` recorded 48 passing analytical cases using the original embedded fonts, sprite data, and native header bounds. They reproduced the old transparent-margin overflow, 20-pixel checkbox truncation, and native icon overlap, then checked the updated geometry. Embedded glyph outlines and metrics do not reproduce Unity's runtime preferred-size calculation, rasterization, or interaction. The Release build also passed with 0 warnings and 0 errors, and all 569 `ProductionCheck` cases passed again.
Development checks recorded on 2026-11-04:
| Check | Result |
| --- | --- |
| Normal Release build, using the command below | Passed with 0 warnings and 0 errors. |
| `ProductionCheck` | 569 checks passed. |
| Actual-source placement harness | All cases and assertions above passed on the final source. |
| Whole-diff code review and `git diff --check` | Passed. |
For this revision, the normal Release build passed with 0 warnings and 0 errors, and `git diff --check` passed. These checks do not execute Unity rendering or interaction.
## Managed production checks
@@ -83,9 +71,9 @@ The production-basis cases check an undersupplied chain, recipe-ratio conversion
No in-game, Unity event-loop, or third-party mod integration test has been performed for this change. Repeat these checks at the target profile's resolutions and UI scales, with each installed blueprint UI mod. The header entry avoids native layout writes but another mod may use the same extension space.
1. Open each inspector in English and Simplified Chinese with different custom-field counts. Focus the description input so its native icon button appears; the Auto-fill entry must remain after the title and before that icon. Open the options and confirm the proliferation label, button captions, and dropdown text are visible inside the background's visible fill, with a title, native X, and one footer action. At screen edges, confirm it flips or shifts into available canvas space.
1. Open each inspector in English and Simplified Chinese with different custom-field counts. Confirm the entry text shares the native title's baseline. Focus the description input so its icon appears; the entry must remain before that icon and its clickable area must not cover the input below. Open the options and check title clearance, compact checkbox spacing, visible captions, native X, and one footer action. At screen edges, confirm it flips or shifts into available canvas space.
2. Scroll while the popup is open. Confirm it follows the entry after native layout and closes when the entry is fully clipped. Expand native foundation, fill-only, and reform settings; all native fields must retain their positions and sizes, and scrolling must reach every field.
3. Open the production-basis list. Confirm both readable, left-aligned rows fit within the expanded background above the footer. Select each item and confirm it closes the list without generating text. Reopen the popup and change language; selector dimensions and footer spacing must remain valid.
3. Open the rectangular production-basis list. Confirm text has clear left padding and space for the arrow. The list must overlay the footer without changing panel size or footer position. Select each item and confirm it closes the list without generating text or changing the native resolution setting. Reopen the popup and change language; selector dimensions and text spacing must remain valid.
4. Close the popup with its X; the inspector and an open inserter window must remain open. Reopen and click outside with the left, right, and middle mouse buttons: the popup should close, and the clicked native control or world target should retain its normal behavior. Press Esc with the list expanded: only the list should close. Press Esc again: the popup should close while the inspector stays open. With a native message box present, its Escape handler must retain priority.
5. Reopen each inspector and repeatedly refresh or change the blueprint selection. Confirm there is one entry, options are initially closed, the production basis resets to final-product output on opening, Spray Coaters set the automatic proliferation default, and a manual checkbox choice survives content refreshes in the current session. Successful generation, a replacement blueprint, and inspector closure must dismiss the popup.
6. Generate both production bases for an unbalanced chain. Final-product output should retain rated final capacity and show the missing intermediate; lowest intermediate throughput should reduce the common final-output mix, use correspondingly reduced external inputs, and show no internal shortage when the chain is complete and balanceable. Power should remain the same full-load estimate. Check necessary coproduct output separately from unused intermediate capacity.