Laurinchen / TextWriterLib

MIT License
0 stars 0 forks source link

Suggest UI.Metrics and more UIElement methods to Warzone devs #1

Open Laurinchen opened 7 months ago

Laurinchen commented 7 months ago

Since it is the easiest to get debug info about font size, position etc. on the Website, the Mod library has been primarily made for the Website Version of Warzone. For example, width of a char, spaces between two Elements in a HorizontalLayoutGroup, extra space needed for every Element down the UI hierarchy chain, etc. are easily to get via the Website with inspect Element. Unfortunately, the same cannot be said about the Standalone and Mobile Client. I'm therefore suggesting following (client only) UI APIs:

Definition of a [UIElement]: Everything that can have a size, which can for example be set via [UIElement].SetPreferredWidth, for example a HorizontalLayoutGroup or Label. API suggestions:

EDIT: Definition of dialogRootParent: the rootParent passed to the callback of ClientGame.CreateDialog(callback).

Edit 2: I think, following function(s) should be enabled:

Reasoning: pcall (and xpcall) are core parts of the exception system of Lua and allow for simple error recovery. This is generally useful for general modding and programming, but it is also useful for this library: If the parsing fails, it could instead

Another reason is that http://lua-users.org/wiki/SandBoxes callspcall and xpcall safe, so there shouldn't be much to worry about except if

Laurinchen commented 7 months ago

appendum: There should also be a [UIElement].GetAncestorCount()

JustMe003 commented 7 months ago

I would like to see methods like GetDialogHeight and GetDialogWidth that would return the size of the dialog.

Using the setMaxSize function sets the window IF the given sizes fit on the device. This would at least allow us to create fixed menu's

appendum: There should also be a [UIElement].GetAncestorCount()

In theory this is already possible. I've written a small UI package, that keeps track of each element created. You can easily track how many children / ancestors an element using something like this

Laurinchen commented 6 months ago

Created suggestion in uservoice forum:

https://warlight.uservoice.com/forums/77051-warzone-features/suggestions/48249116--modding-ui-metrics-and-more-uielement-methods