mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
fix(uxassist): respect blueprint text and icon bounds
Account for the native background's trimmed border, keep checkbox captions independently sized, and place Auto-fill after the measured title while reserving the native icon. Limit changes to owned controls. Assisted-by: Cindy (https://cindy.app)
This commit is contained in:
1 parent
51af1430bc
commit
19d19ce38d
4 files changed
+108
-40
No files matched your search
@@ -4,7 +4,7 @@
|
||||
## Changlog
|
||||
|
||||
* 1.6.4
|
||||
* `Blueprint descriptions`: Open generation options next to the `Auto-fill` entry and keep them attached while scrolling, with placement adjusted at screen edges. Use a titled panel with a native close button, compact options, and one `Generate` action at the bottom. The production-basis dropdown has correctly sized rows and expands the panel above the action. Close with the X, an outside click, or Esc; Esc first closes an expanded dropdown. Preserve the native inspector layout and fix selector sizing when reopening options or changing language.
|
||||
* `Blueprint descriptions`: Keep `Auto-fill` beside the description title while reserving space for the native icon button. Generation options follow the entry while scrolling and adjust at screen edges; text stays inside the visible panel, the proliferation label remains visible, and rows and buttons fit the localized text. The panel uses a native X, one footer `Generate` action, and an expanding dropdown area. Close with the X, an outside click, or Esc; Esc first closes an expanded list. Preserve the native inspector layout.
|
||||
* `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`:
|
||||
@@ -448,7 +448,7 @@
|
||||
## 更新日志
|
||||
|
||||
* 1.6.4
|
||||
* `蓝图说明`:生成选项在「自动填写」入口旁打开,滚动时跟随入口,并根据屏幕边缘调整位置。面板包含标题、原生关闭按钮、紧凑排列的选项和底部单个「生成说明」按钮;产量基准下拉列表使用正确的行尺寸,展开时面板增高,操作按钮随之下移。可通过叉号、点击外部或 Esc 关闭;下拉列表展开时,Esc 先收起列表。保留原生检查面板布局,并修复重新打开选项或切换语言时的选择框尺寸问题。
|
||||
* `蓝图说明`:「自动填写」入口紧接说明标题,并为原生图标按钮保留空间。生成选项滚动时跟随入口,在屏幕边缘调整位置;文字保留在面板可见背景内,增产标签保持可见,行高和按钮尺寸适应本地化文字。面板使用原生叉号、底部单个「生成说明」按钮和可随下拉列表展开的区域。可通过叉号、点击外部或 Esc 关闭;下拉列表展开时,Esc 先收起列表。保留原生检查面板布局。
|
||||
* `在和平模式下隐藏战斗相关科技`:修复在同一次游戏运行中从和平模式存档切换到战斗模式存档后打开科技树时的数组越界,以及再次加载和平模式存档后关闭选项时的同类问题。
|
||||
* 1.6.3
|
||||
* `快速铺设采矿机`:
|
||||
|
||||
@@ -122,6 +122,8 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
||||
private readonly Vector3[] _corners = new Vector3[4];
|
||||
private readonly Canvas _canvas;
|
||||
private readonly RectTransform _viewport;
|
||||
private readonly Text _descriptionLabel;
|
||||
private readonly RectTransform _descriptionIcon;
|
||||
private bool _optionsOpen;
|
||||
private MyCheckBox _checkbox;
|
||||
private MyCornerComboBox _basisCombo;
|
||||
@@ -135,15 +137,19 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
||||
_inspector = inspector;
|
||||
_canvas = inspector.rectTrans.GetComponentInParent<Canvas>().rootCanvas;
|
||||
_viewport = inspector.descGroupTrans.GetComponentInParent<ScrollRect>()?.viewport;
|
||||
_descriptionLabel = inspector.descGroupTrans.Find("label").GetComponent<Text>();
|
||||
_descriptionIcon = (RectTransform)inspector.descTextInput.transform.Find("sel-icon-btn");
|
||||
try
|
||||
{
|
||||
// The native description has a 22px title row above its editable text.
|
||||
_entry = LayoutHelper.AddButton(0, 0, inspector.descGroupTrans,
|
||||
I18NKeys.BlueprintDescriptionOptions, 13, "blueprint-description-options", ToggleOptions);
|
||||
I18NKeys.BlueprintDescriptionOptions, 12, "blueprint-description-options", ToggleOptions);
|
||||
_entryText = _entry.transform.Find("button-text").GetComponent<Text>();
|
||||
_entry.tips = inspector.tipButton2.tips;
|
||||
_entry.tips.topLevel = true;
|
||||
Util.NormalizeRectWithTopRight(_entry, 0, 0, inspector.descGroupTrans);
|
||||
_entryText.resizeTextForBestFit = false;
|
||||
_entryText.alignment = TextAnchor.MiddleCenter;
|
||||
Util.NormalizeRectWithMargin(_entryText, 1, 8, 1, 8);
|
||||
|
||||
// Reuse the native background, including its blur material, only while options are open.
|
||||
var source = UIRoot.instance.uiGame.inserterWindow.transform.Find("panel-bg").GetComponent<Image>();
|
||||
@@ -171,8 +177,14 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
||||
_button = LayoutHelper.AddButton(0, 0, _panel,
|
||||
I18NKeys.BlueprintGenerateDescription, 15, "blueprint-auto-fill-description", Generate);
|
||||
_buttonText = _button.transform.Find("button-text").GetComponent<Text>();
|
||||
_buttonText.resizeTextForBestFit = false;
|
||||
_buttonText.alignment = TextAnchor.MiddleCenter;
|
||||
Util.NormalizeRectWithMargin(_buttonText, 4, 10, 4, 10);
|
||||
_checkbox = MyCheckBox.CreateCheckBox(Left, 42, _panel, false,
|
||||
I18NKeys.BlueprintProliferation.Translate(), 15).WithSmallerBox(20f);
|
||||
I18NKeys.BlueprintProliferation.Translate(), 15);
|
||||
_checkbox.rectTrans.sizeDelta = new Vector2(20, 20);
|
||||
_checkbox.checkImage.rectTransform.sizeDelta = new Vector2(20, 20);
|
||||
_checkbox.labelText.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
_checkbox.gameObject.name = "blueprint-proliferation";
|
||||
_checkbox.OnChecked += OnProliferationChecked;
|
||||
_basisLabel = LayoutHelper.AddText(Left, 68, _panel, I18NKeys.BlueprintProductionBasis, 14);
|
||||
@@ -187,10 +199,14 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
||||
var combo = _basisCombo.GetComponent<UIComboBox>();
|
||||
combo.CanInput = false;
|
||||
combo.autoWidth = false;
|
||||
combo.ItemHeight = 24;
|
||||
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;
|
||||
combo.m_Text.resizeTextForBestFit = false;
|
||||
Util.NormalizeRectWithMargin(combo.m_Text, 2, 8, 2, 24);
|
||||
var itemText = combo.m_ListItemRes.GetComponentInChildren<Text>();
|
||||
itemText.alignment = TextAnchor.MiddleLeft;
|
||||
itemText.resizeTextForBestFit = false;
|
||||
Util.NormalizeRectWithMargin(itemText, 2, 8, 2, 8);
|
||||
_basisHelp = LayoutHelper.AddTipsButton(Left, 68, _panel,
|
||||
I18NKeys.BlueprintProductionBasis.Translate(), I18NKeys.BlueprintProductionBasisTip.Translate(), "");
|
||||
UpdateLabels();
|
||||
@@ -211,13 +227,13 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
||||
if (_inspector.blueprint != null) SyncDefault();
|
||||
else _checkbox.Checked = false;
|
||||
CloseOptions();
|
||||
_entry.gameObject.SetActive(_inspector.blueprint != null);
|
||||
UpdateLabels();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
SyncDefault();
|
||||
_entry.gameObject.SetActive(_inspector.blueprint != null);
|
||||
PositionEntry();
|
||||
}
|
||||
|
||||
private void ToggleOptions()
|
||||
@@ -243,6 +259,7 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
||||
|
||||
public void HandleInput()
|
||||
{
|
||||
PositionEntry();
|
||||
if (!_optionsOpen) return;
|
||||
var combo = _basisCombo.GetComponent<UIComboBox>();
|
||||
if (VFInput.escape)
|
||||
@@ -265,20 +282,36 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
||||
CloseOptions();
|
||||
}
|
||||
|
||||
private Rect BoundsInPopupParent(RectTransform rect)
|
||||
private Rect BoundsIn(RectTransform rect, Transform parent)
|
||||
{
|
||||
rect.GetWorldCorners(_corners);
|
||||
var min = new Vector2(float.PositiveInfinity, float.PositiveInfinity);
|
||||
var max = new Vector2(float.NegativeInfinity, float.NegativeInfinity);
|
||||
foreach (var corner in _corners)
|
||||
{
|
||||
var point = _panel.parent.InverseTransformPoint(corner);
|
||||
var point = parent.InverseTransformPoint(corner);
|
||||
min = Vector2.Min(min, point);
|
||||
max = Vector2.Max(max, point);
|
||||
}
|
||||
return Rect.MinMaxRect(min.x, min.y, max.x, max.y);
|
||||
}
|
||||
|
||||
private void PositionEntry()
|
||||
{
|
||||
var parent = _inspector.descGroupTrans;
|
||||
var label = BoundsIn(_descriptionLabel.rectTransform, parent);
|
||||
var labelWidth = parent.InverseTransformVector(_descriptionLabel.transform.TransformVector(
|
||||
new Vector3(Util.GetPreferredWidth(_descriptionLabel), 0, 0))).x;
|
||||
var left = label.xMin + labelWidth + 8;
|
||||
var right = Math.Min(parent.rect.xMax, BoundsIn(_descriptionIcon, parent).xMin) - 8;
|
||||
var entryRect = (RectTransform)_entry.transform;
|
||||
var visible = _inspector.blueprint != null && left + entryRect.rect.width <= right;
|
||||
_entry.gameObject.SetActive(visible);
|
||||
if (!visible) return;
|
||||
Util.NormalizeRectWithTopLeft(_entry, left - parent.rect.xMin,
|
||||
parent.rect.yMax - label.yMax, parent);
|
||||
}
|
||||
|
||||
private void PositionOptions()
|
||||
{
|
||||
if (!_optionsOpen) return;
|
||||
@@ -287,18 +320,23 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
||||
CloseOptions();
|
||||
return;
|
||||
}
|
||||
var anchor = BoundsInPopupParent((RectTransform)_entry.transform);
|
||||
var screen = BoundsInPopupParent((RectTransform)_canvas.transform);
|
||||
if (!anchor.Overlaps(screen) || _viewport && !anchor.Overlaps(BoundsInPopupParent(_viewport)))
|
||||
var anchor = BoundsIn((RectTransform)_entry.transform, _panel.parent);
|
||||
var screen = BoundsIn((RectTransform)_canvas.transform, _panel.parent);
|
||||
if (!anchor.Overlaps(screen) || _viewport && !anchor.Overlaps(BoundsIn(_viewport, _panel.parent)))
|
||||
{
|
||||
CloseOptions();
|
||||
return;
|
||||
}
|
||||
var combo = _basisCombo.GetComponent<UIComboBox>();
|
||||
var extra = combo.isDroppedDown ? combo.DropDownCount * combo.ItemHeight + 2 * combo.ItemPadding + 2 : 0;
|
||||
var footerTop = 112 + extra;
|
||||
_panel.sizeDelta = new Vector2(_panel.sizeDelta.x, footerTop + 30 + Left);
|
||||
Util.NormalizeRectWithTopRight(_button, Left, footerTop, _panel);
|
||||
var comboRect = (RectTransform)_basisCombo.transform;
|
||||
var footerTop = -comboRect.anchoredPosition.y + comboRect.rect.height + 16 + extra;
|
||||
var image = _panel.GetComponent<Image>();
|
||||
var padding = UnityEngine.Sprites.DataUtility.GetPadding(image.sprite) / image.pixelsPerUnit;
|
||||
var right = Mathf.Ceil(padding.z) + Left;
|
||||
var bottom = Mathf.Ceil(padding.y) + Left;
|
||||
_panel.sizeDelta = new Vector2(_panel.sizeDelta.x, footerTop + ((RectTransform)_button.transform).rect.height + bottom);
|
||||
Util.NormalizeRectWithTopRight(_button, right, footerTop, _panel);
|
||||
if (!TryGetPopupPosition(anchor, screen, _panel.sizeDelta, out var position))
|
||||
{
|
||||
CloseOptions();
|
||||
@@ -328,7 +366,7 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
||||
{
|
||||
_entryText.text = I18NKeys.BlueprintDescriptionOptions.Translate();
|
||||
((RectTransform)_entry.transform).sizeDelta =
|
||||
new Vector2(Util.GetPreferredWidth(_entryText) + 16, 20);
|
||||
new Vector2(Util.GetPreferredWidth(_entryText) + 20, 22);
|
||||
_entry.tips.tipTitle = I18NKeys.BlueprintAutoFillDescription.Translate();
|
||||
_entry.tips.tipText = I18NKeys.BlueprintDescriptionOptionsTip.Translate();
|
||||
_entry.UpdateTip();
|
||||
@@ -342,27 +380,54 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
||||
_basisHelp.tips.tipTitle = I18NKeys.BlueprintProductionBasis.Translate();
|
||||
_basisHelp.tips.tipText = I18NKeys.BlueprintProductionBasisTip.Translate();
|
||||
_basisHelp.UpdateTip();
|
||||
var width = Math.Max(90f, Util.GetPreferredWidth(_buttonText) + 20f);
|
||||
((RectTransform)_button.transform).sizeDelta = new Vector2(width, 30);
|
||||
var image = _panel.GetComponent<Image>();
|
||||
// Sliced window artwork has transparent borders; content margins start inside its visible fill.
|
||||
var padding = UnityEngine.Sprites.DataUtility.GetPadding(image.sprite) / image.pixelsPerUnit;
|
||||
var left = Mathf.Ceil(padding.x) + Left;
|
||||
var right = Mathf.Ceil(padding.z) + Left;
|
||||
var top = Mathf.Ceil(padding.w) + 10;
|
||||
var titleHeight = Math.Max(30, Mathf.Ceil(_title.preferredHeight) + 4);
|
||||
Util.NormalizeRectWithTopLeft(_title, left, top, _panel);
|
||||
Util.NormalizeRectWithTopRight(_closeButton, right, top, _panel);
|
||||
var rowTop = top + titleHeight + 8;
|
||||
var labelHeight = Math.Max(26, Mathf.Ceil(_checkbox.labelText.preferredHeight) + 4);
|
||||
Util.NormalizeRectWithTopLeft(_checkbox, left, rowTop + (labelHeight - 20) / 2, _panel);
|
||||
var checkLabel = _checkbox.labelText.rectTransform;
|
||||
checkLabel.anchorMin = checkLabel.anchorMax = new Vector2(0, 0.5f);
|
||||
checkLabel.pivot = new Vector2(0, 0.5f);
|
||||
checkLabel.anchoredPosition = new Vector2(28, 0);
|
||||
checkLabel.sizeDelta = new Vector2(Util.GetPreferredWidth(_checkbox.labelText) + 4, labelHeight);
|
||||
rowTop += labelHeight + 8;
|
||||
var labelWidth = Util.GetPreferredWidth(_basisLabel);
|
||||
_basisLabel.rectTransform.sizeDelta = new Vector2(labelWidth, 28);
|
||||
var helpRect = (RectTransform)_basisHelp.transform;
|
||||
Util.NormalizeRectWithTopLeft(_basisHelp, Left + labelWidth + ControlsGap,
|
||||
68 + (28 - helpRect.rect.height) / 2, _panel);
|
||||
var comboLeft = Left + labelWidth + ControlsGap + helpRect.rect.width + ControlsGap;
|
||||
var itemText = combo.m_ListItemRes.GetComponentInChildren<Text>();
|
||||
var comboWidth = 180f;
|
||||
var textHeight = 0f;
|
||||
foreach (var key in new[] { I18NKeys.BlueprintFinalProducts, I18NKeys.BlueprintBottleneckIntermediate })
|
||||
{
|
||||
combo.m_Text.text = key.Translate();
|
||||
itemText.text = key.Translate();
|
||||
comboWidth = Math.Max(comboWidth, Util.GetPreferredWidth(combo.m_Text) + 40);
|
||||
textHeight = Math.Max(textHeight, Math.Max(combo.m_Text.preferredHeight, itemText.preferredHeight));
|
||||
}
|
||||
_basisCombo.SetIndex(index);
|
||||
Util.NormalizeRectWithTopLeft(_basisCombo, comboLeft, 68, _panel);
|
||||
_basisCombo.SetSize(comboWidth, 28);
|
||||
var popupWidth = Math.Max(320, Math.Max(comboLeft + comboWidth + Left,
|
||||
Util.GetPreferredWidth(_title) + Left * 2 + 50));
|
||||
combo.ItemHeight = (int)Math.Max(24, Mathf.Ceil(textHeight) + 4);
|
||||
var rowHeight = Math.Max(28, Math.Max(Mathf.Ceil(_basisLabel.preferredHeight), Mathf.Ceil(textHeight)) + 4);
|
||||
Util.NormalizeRectWithTopLeft(_basisLabel, left, rowTop, _panel);
|
||||
_basisLabel.rectTransform.sizeDelta = new Vector2(labelWidth, rowHeight);
|
||||
var helpRect = (RectTransform)_basisHelp.transform;
|
||||
Util.NormalizeRectWithTopLeft(_basisHelp, left + labelWidth + ControlsGap,
|
||||
rowTop + (rowHeight - helpRect.rect.height) / 2, _panel);
|
||||
var comboLeft = left + labelWidth + ControlsGap + helpRect.rect.width + ControlsGap;
|
||||
Util.NormalizeRectWithTopLeft(_basisCombo, comboLeft, rowTop, _panel);
|
||||
_basisCombo.SetSize(comboWidth, rowHeight);
|
||||
var width = Math.Max(90f, Util.GetPreferredWidth(_buttonText) + 20);
|
||||
((RectTransform)_button.transform).sizeDelta = new Vector2(width,
|
||||
Math.Max(30, Mathf.Ceil(_buttonText.preferredHeight) + 8));
|
||||
var popupWidth = Math.Max(320, Math.Max(comboLeft + comboWidth + right,
|
||||
Util.GetPreferredWidth(_title) + left + right + 50));
|
||||
_panel.sizeDelta = new Vector2(popupWidth, _panel.sizeDelta.y);
|
||||
_title.rectTransform.sizeDelta = new Vector2(popupWidth - Left * 2 - 50, 24);
|
||||
_title.rectTransform.sizeDelta = new Vector2(popupWidth - left - right - 50, titleHeight);
|
||||
PositionEntry();
|
||||
PositionOptions();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ This document records the native layout evidence for the UXAssist description-he
|
||||
Inspected on 2026-11-01 after discovering Steam through `HKCU`'s Steam path 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.
|
||||
|
||||
@@ -22,7 +23,7 @@ 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 occupies the right side of this existing title row. Options open next to the actual entry and follow it after layout and scrolling; only owned popup transforms are positioned. Native labels, inputs, groups, scroll content, and the separate settings panel retain their native layout.
|
||||
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.
|
||||
|
||||
`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.
|
||||
|
||||
@@ -30,9 +31,9 @@ Decompiled methods and extracted rectangle data are development artifacts under
|
||||
|
||||
## Anchored options and native conventions
|
||||
|
||||
The original DLL and `level0` hashes and installed version above were rechecked on 2026-11-04. The supplied screenshot shows why a fixed position at the inspector's top loses its connection to the entry after several custom fields. The options now 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 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 panel has an `Auto-fill description` title and native X, then a 20-pixel proliferation row and a 28-pixel production-basis row with help. A single 30-pixel `Generate` action sits at the lower right. Localized preferred widths determine panel and selector width. The closed-list panel is 154 pixels high; two 24-pixel dropdown rows, 4 pixels of padding, and a 2-pixel gap add 54 pixels when expanded. The background grows to 208 pixels and the footer moves below the list.
|
||||
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 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.
|
||||
|
||||
@@ -47,15 +48,17 @@ The source production-basis combo also carries source-specific behavior. Its roo
|
||||
| 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 persistent task evidence bundle `2026-11-04-UXAssist-BlueprintDescriptionLayout/anchored-options/` retains the current reported screenshot, `native-recommendations.md`, `native-inserter-close-button.json`, `native-combo-row-routing.json`, focused original decompilations, asset captures, and extraction scripts. `layout-preview.png` is a marked schematic using the exported native X artwork; its fonts and background are representative. Calculated geometry, a test harness, and this preview must be distinguished from screenshots of a running game. These checks do not execute Unity event dispatch, measure native font rendering, or establish third-party mod compatibility.
|
||||
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.
|
||||
|
||||
## Recorded placement checks
|
||||
## 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 harness passed 8 exact placement 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 154/208-pixel panel heights. Widths of 320/360/440/520 pixels are supplied test inputs, rather than measured English or Chinese font widths. The expanded-list checks also verify the 16-pixel gap before the moved footer. This is analytical geometry validation; it does not run Unity layout or input events.
|
||||
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.
|
||||
|
||||
Final development checks on 2026-11-04:
|
||||
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 |
|
||||
| --- | --- |
|
||||
@@ -80,7 +83,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 each inspector in English and Simplified Chinese with different custom-field counts. Click its header entry. Confirm the popup opens beside that actual entry, with a title, native X, compact options, and a single 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. 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.
|
||||
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.
|
||||
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.
|
||||
|
||||
@@ -70,9 +70,9 @@ Native research uses the current lab technology's matrix point requirements, wit
|
||||
|
||||
## Blueprint descriptions
|
||||
|
||||
The shared `UIBlueprintInspector` in browser, copy, and paste modes adds a compact `Auto-fill` entry to the existing description header. Its options panel is an owned child of `inspector.rectTrans`, outside the scroll mask. On opening, actual entry corners and root-canvas bounds are converted into that parent's coordinates. The private placement method in `InspectorControls` prefers a position below the entry with their right edges aligned, flips above when needed, and clamps against canvas bounds; a panel too large for those bounds is closed. A `Canvas.willRenderCanvases` subscription follows the entry after native layout and scrolling only while the options are open; hiding the entry or scrolling it completely outside its viewport closes the popup. Native fields, groups, anchors, and scroll height remain owned by the game. Closing, disabling, and destruction unsubscribe the positioning callback and remove only owned controls as appropriate.
|
||||
The shared `UIBlueprintInspector` in browser, copy, and paste modes adds a compact `Auto-fill` entry after the measured native description title, with an 8-pixel gap. Reserve the actual native icon button's bounds and another 8-pixel gap even when that icon is inactive; hide the owned entry if it cannot fit. Its options panel is an owned child of `inspector.rectTrans`, outside the scroll mask. On opening, actual entry corners and root-canvas bounds are converted into that parent's coordinates. The private placement method in `InspectorControls` prefers a position below the entry with their right edges aligned, flips above when needed, and clamps against canvas bounds; a panel too large for those bounds is closed. A `Canvas.willRenderCanvases` subscription follows the entry after native layout and scrolling only while the options are open; hiding the entry or scrolling it completely outside its viewport closes the popup. Native fields, groups, anchors, and scroll height remain owned by the game. Closing, disabling, and destruction unsubscribe the positioning callback and remove only owned controls as appropriate.
|
||||
|
||||
The options use a title and the actual native X subtree, then a 20-pixel proliferation checkbox row, a 28-pixel production-basis row with help, and one 30-pixel `Generate` action at the lower right. Width is measured from the localized labels and choices. The normal 154-pixel panel gains 54 pixels when the two 24-pixel dropdown rows open, moving the footer below the list. The cloned X must receive a new `Button.ButtonClickedEvent`: its source has a persistent callback to the original inserter window that `RemoveAllListeners` does not remove.
|
||||
The options use a title and the actual native X subtree, followed by proliferation, production basis with help, and one `Generate` action at the lower right. Content margins start inside the sliced background's visible fill: add `DataUtility.GetPadding(sprite) / image.pixelsPerUnit` to the desired gaps. Keep the 20-pixel checkbox independent of its label's height, at least 26 pixels or preferred glyph height plus padding, with vertical overflow allowed and an 8-pixel horizontal gap. Owned button and combo captions disable inherited best-fit sizing and have explicit text insets. Localized preferred sizes determine row, item, button, and panel dimensions; the footer follows the selector and its expanded list instead of a fixed panel height. The cloned X must receive a new `Button.ButtonClickedEvent`: its source has a persistent callback to the original inserter window that `RemoveAllListeners` does not remove.
|
||||
|
||||
The production-basis selector clones the star-detail combo. Disable and remove the clone root's inherited `Localizer` before assigning owned dimensions: 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` controls row heights and the native row event selects an item before closing the list. These adjustments belong to this selector rather than the shared combo helper.
|
||||
|
||||
|
||||
Reference in new issue
Block a user