Hello all. Tonight I was tasked with creating an in-game shop UI and I’m also responsible for scripting it. This system will use a combination of asset IDs and dev product IDs and I was curious as to how others would set this up.
The issue I’m facing is, how can I program this with expansion in mind. For example, I could just go and create a folder under the server script for the shop, and include asset ID’s with attributes, or I could create values in folders under the script. One thing that’s important to me is maintaining the same loading order each time which isn’t really reliable if I use values as things in Explorer are ordered alphabetically. I’ve thought of using attributes, but if you want to order those you’d need to shift each one down. Another solution I’ve thought of is simply writing into the script, but at the same time, I feel this could get complicated fast.
The reason I look for these abilities is because I’m attempting to have each “frame” (Passes, Items, and buy coins) to load with it’s appropriate selections, but due to them needing to be ordered and each frame holding different types of store items it’s hard for me to come up with a solution.
If anyone has any insight, it’d be greatly appreciated, especially for the future.
What I have done for previous projects is to first, create a dictionary on the server with all the necessary shop info, things like price, name, display order, etc, and send it to the player when they join.
On the client, they can use the data retrieved from the server to create item cells and customize them as needed using the relevant prices, display order, and name. This makes it easier for you to handle events like buying items, inventories, etc.