-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for longer names in location picker #2685
base: master
Are you sure you want to change the base?
Conversation
I'm not sure public is the right accessibility yet. Usually, we would make this protected, so that a mod providing a window override can use a custom value. |
I'm not sure I like the explicit check for SDF vs non-SDF. Is that what we do for books and other auto-formatted text boxes? I know quest text is manually formatted to support non-SDF, but I think books are handled in code |
Okay, if simplest/most convenient way is subclassing, making it a |
I tried diff --git a/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallListPickerWindow.cs b/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallListPickerWindow.cs
index 714a084dc..05b46792a 100644
--- a/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallListPickerWindow.cs
b/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallListPickerWindow.cs
@@ -81,6 81,8 @@ namespace DaggerfallWorkshop.Game.UserInterfaceWindows
// Create list box
listBox.Position = new Vector2(26, 27);
listBox.Size = new Vector2(138, 72);
listBox.RectRestrictedRenderArea = new Rect(listBox.Position, listBox.Size);
listBox.RestrictedRenderAreaCoordinateType = BaseScreenComponent.RestrictedRenderArea_CoordinateType.ParentCoordinates;
listBox.OnUseSelectedItem = ListBox_OnUseSelectedItem;
pickerPanel.Components.Add(listBox);
diff --git a/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallTravelMapWindow.cs b/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallTravelMapWindow.cs
index 4e4cf5d79..77d61d045 100644
--- a/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallTravelMapWindow.cs
b/Assets/Scripts/Game/UserInterfaceWindows/DaggerfallTravelMapWindow.cs
@@ -1565,7 1565,6 @@ namespace DaggerfallWorkshop.Game.UserInterfaceWindows
{
DaggerfallListPickerWindow locationPicker = new DaggerfallListPickerWindow(uiManager, this);
locationPicker.OnItemPicked = HandleLocationPickEvent;
- locationPicker.ListBox.MaxCharacters = LocationPickerMaxCharacters;
for (int i = 0; i < locations.Length; i )
{ but somehow it didn't work (text not clipped inside the ListBox. I'm not sure what I'm missing |
Also, the same issue happens with the list of spells (spell merchant, spellbook) |
My current hypothesis is that ShowLocationPicker is calling AddItem() of the ListBox before its parent DaggerfallListPickerWindow has been SetUp(), which is a problem because it's AddItem() that propagates the RestrictedArea of the ListBox to its elements |
My analysis was correct, and simplest fix I could think of was to subclass DaggerfallListPickerWindow to delay calls to listBox.AddItem(s) to the end of Setup() |
Could be factorized further if we decide DaggerfallListPickerWindow should always use restricted area, or would benefit from a constructor with a List to initialize its content; I just tried to keep changes as local as possible. |
Answer to request #2684