shdwp / UIExtenderLib

Library to extend default Bannerlord UI
GNU Lesser General Public License v3.0
11 stars 5 forks source link

Some widget icons are not loaded immediately #2

Open jwty opened 4 years ago

jwty commented 4 years ago

First of all, thank you for this amazing library. I am really enjoying the compatibility aspect of it and I hope modders more experienced than me will adapt it soon. However, I came upon an issue, which, while not game breaking, is quite annoying and I'm having trouble solving it, namely some of the icons I tried using in <Widget> section of inserted XMLs (in attached example it's Crafting\craft_icon) do not appear in modified GUI until they are loaded by their respective GUIs first (in attached example it's done by opening smithy GUI). I suppose it might be related to this part of the wiki:

Currently I haven't found a way to alter the very initial parsing of the prefabs, since it happens even before any user modules are loaded into the memory. I'm discouraged to modify game files, therefore the only way is to ask WidgetFactory to reload affected movies after hooks has been set up.

If that's the case and it's expected behaviour then please close this issue, if it's not then, well, maybe there's a way to load specific icons/sprites to memory when a module is loaded? I tried looking through various mods and Bannerlord libraries but since I am an utter noob when it comes to C# and Bannerlord modding I couldn't find anything helpful myself.

For what it's worth, you can reproduce this issue with HorseAmountIndicatorMod by changing Sprite attribute of Widget from HorseAmountIndicator.xml to other icon, like one of the Crafting\* icons.

Example video

shdwp commented 4 years ago

I need to review how sprite sheets are actually loaded and if it's something that has to do with XMLs I will make a set of patches to influence it. If it is done from code then it should be done from the code without further assistance from the library.