What is the best way to custom initialize item data?

WeiYiHua

Member
Hello, due to functional needs, I may need to perform some custom initialization behaviors for verifying and calculating item attributes when creating items globally.

In this way, if you only do custom initialization of items in Inventory, there may be many uninitialized exceptions.

So I think I need an initializer like InventorySystemRegister. I need to implement the corresponding ItemInitializer and call some Binding initialization modules, or make some modular extensions to InventorySystemRegister.

Which of these two methods is more appropriate? Or is there a better way to do it? Please let me know, thanks!
 
I think the best way would be the InventorySystemFactory within the InventorySystemManager.

You can make a customize the functionality of the InventorySystemManager by inheriting the IInventorySystemManager interface and then setting that in the InventorySystemManager singleton using the Manager property. This will re-route all the functions back to your own factories.
Then you can make a custom InventorySystemRegister and InventorySystemFactory. and override the functions you want. such as "CreateItem".

Some functions are internal to protect people from using them directly rather than using those factories.
And this is something not many people have shown interest in (creating their own item creation function), so if you find any difficulties do let us know and we can modify the source code accordingly.
 
Before customizing InventorySystemFactory, I found that some Create Item call chains seem to have some problems or can be improved. Are these problems in line with your expectations? My principle is that all items created at runtime call the InventorySystemManager.CreateItem method.

1681634694996.png
1681634723256.png1681634746934.png
 
Ah, good find.
When I started UIS I wasn't sure I wanted to depend on singleton because I thought some people might not like it.
But after a year or two I made it such that the InventorySystemManager functionality can be completely modified. Like you are doing now.

So these things must have been remains from before that time.
I'll make the changes in my project too.
 
Top