mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
fix(uxassist): correct blueprint description selector layout
Remove the cloned star-panel Localizer before sizing the production-basis selector so reopening options or changing languages cannot overwrite its stretched width. Fill the main button and left-align selector text while preserving native inspector geometry and production calculations.
This commit is contained in:
1 parent
64a23e9772
commit
8fd449d991
4 files changed
+43
-4
No files matched your search
@@ -4,6 +4,7 @@
|
||||
## Changlog
|
||||
|
||||
* 1.6.4
|
||||
* `Blueprint descriptions`: Fix the misplaced production-basis selector and incorrectly sized dropdown when opening Auto-fill options or changing the language.
|
||||
* `Hide battle-related techs in Peace mode`: Fix an array index error when opening the tech tree after switching from a Peace-mode save to a Combat-mode save in the same game process, including when disabling the option after loading another Peace-mode save.
|
||||
* 1.6.3
|
||||
* `Quick build Mining Machines`:
|
||||
@@ -447,6 +448,7 @@
|
||||
## 更新日志
|
||||
|
||||
* 1.6.4
|
||||
* `蓝图说明`:修复打开自动填写说明选项或切换语言时,「产量基准」选择框错位、下拉列表宽度异常的问题。
|
||||
* `在和平模式下隐藏战斗相关科技`:修复在同一次游戏运行中从和平模式存档切换到战斗模式存档后打开科技树时的数组越界,以及再次加载和平模式存档后关闭选项时的同类问题。
|
||||
* 1.6.3
|
||||
* `快速铺设采矿机`:
|
||||
|
||||
@@ -160,15 +160,25 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
||||
_checkbox.gameObject.name = "blueprint-proliferation";
|
||||
_checkbox.OnChecked += OnProliferationChecked;
|
||||
_basisLabel = LayoutHelper.AddText(Left, 80, _panel, I18NKeys.BlueprintProductionBasis, 14);
|
||||
_basisCombo = MyCornerComboBox.CreateComboBox(Left, 108, _panel).WithFontSize(14)
|
||||
.WithItems(I18NKeys.BlueprintFinalProducts, I18NKeys.BlueprintBottleneckIntermediate)
|
||||
.WithIndex(0);
|
||||
_basisCombo = MyCornerComboBox.CreateComboBox(Left, 108, _panel).WithFontSize(14);
|
||||
// The star-panel localizer would replace the stretched width on every enable or language change.
|
||||
var localizer = _basisCombo.GetComponent<Localizer>();
|
||||
if (localizer)
|
||||
{
|
||||
localizer.enabled = false;
|
||||
UnityEngine.Object.Destroy(localizer);
|
||||
}
|
||||
var combo = _basisCombo.GetComponent<UIComboBox>();
|
||||
combo.CanInput = false;
|
||||
combo.autoWidth = false;
|
||||
var comboRect = (RectTransform)_basisCombo.transform;
|
||||
comboRect.anchorMax = Vector2.one;
|
||||
comboRect.sizeDelta = new Vector2(-Left * 2, 28);
|
||||
Util.NormalizeRectWithMargin(_basisCombo.transform.Find("Main Button"), 0, 0, 0, 0);
|
||||
combo.m_Text.alignment = TextAnchor.MiddleLeft;
|
||||
combo.m_ListItemRes.GetComponentInChildren<Text>().alignment = TextAnchor.MiddleLeft;
|
||||
_basisCombo.SetItems(I18NKeys.BlueprintFinalProducts, I18NKeys.BlueprintBottleneckIntermediate);
|
||||
_basisCombo.SetIndex(0);
|
||||
_basisHelp = LayoutHelper.AddTipsButton(Left, 80, _panel,
|
||||
I18NKeys.BlueprintProductionBasis.Translate(), I18NKeys.BlueprintProductionBasisTip.Translate(), "");
|
||||
UpdateLabels();
|
||||
|
||||
@@ -28,6 +28,31 @@ The native `descGroupTrans` in all three inspectors contains a description label
|
||||
|
||||
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.
|
||||
|
||||
## Options layout correction on 2026-11-04
|
||||
|
||||
The reported screenshot shows the production-basis selector displaced to the right and its expanded list wider than the options panel. The correction applies to this selector in the existing on-demand options.
|
||||
|
||||
The selector is cloned from `UIRoot.instance.uiGame.starDetail.displayCombo`. Its root inherits a `Localizer` with `wParamKey = "恒星信息面板组合框宽度"`, `sizeApplyTrans = null`, and `def_w = 0`. Original `Localizer.OnEnable()` subscribes to language changes and immediately calls `Refresh()`; `OnLanguageChange()` also calls `Refresh()`. With no separate size target, `Refresh()` writes the translated positive width to the combo root's `sizeDelta.x`. The blueprint selector uses horizontal stretch with an intended width delta of `-24`, so this source-specific width assignment expands the root beyond its parent. Reopening the options re-enables the inherited component, explaining why an initial size assignment alone does not hold.
|
||||
|
||||
The original DLL and `level0` hashes and the installed version above were rechecked on 2026-11-04. The native locale parameter is 200 in `Locale/1033/parameters.txt` and 90 in `Locale/2052/parameters.txt`, both at line 28. With the original 392- and 394-pixel inspector variants, the inherited assignment produces combo widths of 568/570 in English or 458/460 in Simplified Chinese. The corrected stretched root is 344/346 pixels wide, and the main button, list, content, row template, and selection share its horizontal bounds.
|
||||
|
||||
The original combo also has a right-anchored, right-pivoted main button with its own fixed width and right-aligned selected and item-template text. The correction disables and removes only the owned clone root's `Localizer` before setting its geometry, disables `autoWidth` before setting items or index, stretches the main button to its owned root, and left-aligns the selected and template text. Source dropdown, content, template, and selection rectangles already use horizontal stretch with zero width delta and are retained. Original `UIComboBox.SetState()` adjusts list and content heights and row positions, preserving their width deltas; it does not repair a source-specific root width.
|
||||
|
||||
The popup remains 152 pixels high, with a 28-pixel selector starting 108 pixels below its top. Native dropdown placement adds a 2-pixel gap and uses two 18-pixel rows with 4 pixels of total padding. The expanded list therefore reaches 178 pixels below the popup top, extending 26 pixels below the background as a native dropdown overlay. Check this overlay in-game at the target UI scale.
|
||||
|
||||
The persistent task evidence bundle `2026-11-04-UXAssist-BlueprintDescriptionLayout` retains `reported-layout.png`, the native combo and background JSON captures, focused `Localizer` and `UIComboBox` decompilations, `inspect_native_layout.py`, `reproduce_geometry.py`, and `geometry-lifecycle-replay.json`. Rectangle calculations or schematic previews derived from these files are evidence of geometry, not screenshots of a repaired running game.
|
||||
|
||||
Recorded checks for this correction:
|
||||
|
||||
| Check | Result |
|
||||
| --- | --- |
|
||||
| Normal Release build, using the command below | Passed with 0 warnings and 0 errors. |
|
||||
| `ProductionCheck` | 569 checks passed. |
|
||||
| Original-asset geometry replay | 64 analytical combinations passed: inspector widths 392/394, English/Simplified Chinese, first opening/two reopenings/language change, and scales 0.75/1/1.25/1.5. |
|
||||
| Focused UI code review and `git diff --check` | Passed. |
|
||||
|
||||
The geometry replay calculates rectangle bounds from captured assets and the original `Localizer` rules. It does not execute Unity enable or language-change events, measure font rendering or preferred text width, or test mouse interaction. The evidence bundle's `test-build/UXAssist.dll` has SHA-256 `3645ebfe03fb5ed7bc50459f25e0e6557d903db852624d640eafbd588e735ef5`.
|
||||
|
||||
## Managed production checks
|
||||
|
||||
Run the production checks and normal UXAssist build from the repository root:
|
||||
@@ -44,7 +69,7 @@ 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 all three inspectors in English and Simplified Chinese. Confirm the header entry is readable without covering the title or editable description. Open and close its options, generate, and close the inspector. The options must not remain over the file grid or survive an inspector close.
|
||||
1. Open all three inspectors in English and Simplified Chinese. Confirm the header entry is readable without covering the title or editable description. Open, close, and reopen its options, and switch languages while they are open. The production-basis selector and both dropdown rows must retain matching widths inside the inspector, with readable left-aligned labels. Generate and close the inspector; options must not remain over the file grid or survive an inspector close.
|
||||
2. Scroll the native description and custom fields and expand native foundation, fill-only, and reform settings. All native fields must retain their positions and sizes, and scrolling must reach every field.
|
||||
3. 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.
|
||||
4. 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.
|
||||
|
||||
@@ -72,6 +72,8 @@ Native research uses the current lab technology's matrix point requirements, wit
|
||||
|
||||
The shared `UIBlueprintInspector` in browser, copy, and paste modes adds a compact `Auto-fill` entry to the existing description header. Its options open on demand within the inspector, rather than occupying the browser file grid. Only UXAssist-owned transforms are positioned: native fields, groups, anchors, and scroll height remain owned by the game. No per-frame layout patch or native-settings tracking is needed. Disable and destruction remove only the UXAssist controls.
|
||||
|
||||
The production-basis selector clones the star-detail combo. Disable and remove the clone root's inherited `Localizer` before applying its horizontal stretch: that source component writes a star-panel-specific width on enable and language changes. Turn off the clone's `UIComboBox.autoWidth` before populating items, stretch its main button within the owned root, and align its selected and template text to the left. Preserve the native dropdown, content, item-template, and selection anchors; native `UIComboBox.SetState` already controls row heights. These adjustments belong to this selector rather than the shared combo helper. The expanded list keeps the native overlay behavior and may extend below the options background while remaining within the inspector.
|
||||
|
||||
The options contain `Auto-fill description`, `Proliferation`, and a `Production basis` selector with a localized help tip. Each inspector open resets the basis to `Final-product output`, retaining existing calculation behavior; selecting `Lowest intermediate throughput` opts into `BottleneckIntermediate` for generation. The checkbox initially reflects the blueprint's Spray Coater prefab capability and tracks content changes until manually changed in the current editing session; changing it does not modify the blueprint. Generation captures only `blueprint.buildings` with `BlueprintSelectionReader.FromBlueprint` on the game thread, then runs `FactoryBlackBoxAnalyzer` against the captured catalog. A successful bottleneck solve supplies classification and steady-state balances directly; the original classifier runs only in final-product mode or after an unavailable bottleneck result. The maximum supported proliferation level applies while each building keeps its acceleration or extra-products mode. Input coating is assumed to be supplied externally; no spray routing or spray consumption is inferred from the Spray Coater.
|
||||
|
||||
`BlueprintDescriptionFormatter` builds replacement multiline `blueprint.desc` text in this order: optional `Missing:` and `Excess:` lines for intermediate shortages and excess classified by the selected production basis; `Input:` for external inputs capped by downstream demand; `Output:` for ordinary final products and necessary coproduct surplus; and `Research:` for positive net matrix production accepted by a selected research-mode lab. Each warning category has one label followed by comma-separated items; warnings do not repeat in Input, and a matrix on Research does not repeat in Output. It uses `SteadyStateExternalSupply` for complete and independently known partial inputs, labeling partial values as known portions. The assumed lab adds no numerical matrix consumption or external input; other buildings' known matrix demand is subtracted from the Research rate. Omit each empty line, including Research when no produced matrix remains. A single optional `Power` custom field separates factory and configured logistics consumption, omitting categories with no demand and removing the field altogether if neither consumes power; a present but unknown category displays `Unknown` rather than zero. Material rates remain items per minute even though the description labels omit the unit. Rates are rounded only for display. Large displayed rates use the largest exact K/M/G suffix with at most one decimal place (for example, 1,234,000 becomes 1,234K); if no suffix preserves that display precision, keep the ordinary number. Numbers with four or more integer digits use comma thousands separators, including coefficients before material or power units. Rates are ordered by item ID within each category, and use native item icon/name tags with comma-separated entries inside each description line. Uncertain final-product, overbuild, or coproduct conclusions are omitted. Veins and other scene objects are not blueprint entries or requested parameters.
|
||||
|
||||
Reference in new issue
Block a user