ScenarioPicker: find the list's ScrollRect while the panel is still inactive (play mode builds it before showing it); verify builds the real list inactive
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9961a0df6d
commit
2fb8e88fcf
3 changed files with 7 additions and 4 deletions
|
|
@ -85,12 +85,14 @@ public static class ScenarioPickerVerify
|
|||
var groups = real ? ScenarioPickerCapture.AllGroups() : oneGroup
|
||||
? new List<(string label, Scenario[] scenarios)> { ("modes", screen.A) }
|
||||
: new List<(string label, Scenario[] scenarios)> { ("modes", screen.A), ("development", screen.B), ("test arenas", screen.C) };
|
||||
// The menu builds a panel while it is inactive and shows it afterwards; the picker must find its scroll all the same.
|
||||
if (real) list.gameObject.SetActive(false);
|
||||
screen.Picker = ScenarioPicker.Show(list, detail, groups, screen.Launched.Add, () => screen.Backs++, menu.Dialog.Confirm);
|
||||
var buttons = list.GetComponentsInChildren<PropertyButton>(false).Where(button => !button.transform.IsChildOf(detail.transform)).Select(button => button.Button).ToArray();
|
||||
screen.Rows = buttons.Take(buttons.Length - 1).ToArray();
|
||||
screen.Back = buttons.Last();
|
||||
screen.Launch = detail.GetComponentsInChildren<Button>(false).Single();
|
||||
if (real) Layout(menu, list, detail);
|
||||
if (real) { list.gameObject.SetActive(true); Layout(menu, list, detail); }
|
||||
return screen;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,8 @@ public sealed class ScenarioPicker
|
|||
_scroll.onValueChanged.AddListener(_fit);
|
||||
}
|
||||
|
||||
private static ScrollRect ScrollOf(PropertiesPanel panel) => (panel.Content ?? panel.transform).GetComponentInParent<ScrollRect>();
|
||||
// The panel is inactive until the menu shows it, which is after Show builds it; an inactive ScrollRect still counts.
|
||||
private static ScrollRect ScrollOf(PropertiesPanel panel) => (panel.Content ?? panel.transform).GetComponentInParent<ScrollRect>(true);
|
||||
|
||||
// Hides every list entry the viewport only partly shows, so the list ends on a whole row instead of slicing text.
|
||||
private void FitViewport()
|
||||
|
|
|
|||
BIN
Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset
(Stored with Git LFS)
BIN
Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset
(Stored with Git LFS)
Binary file not shown.
Loading…
Reference in a new issue