Unity UI Tutorial Pt. 4 - Store Demo Live Build w/ ScriptableObjects

preview_player
Показать описание
Unity UI Tutorial Pt. 4

Scriptable Objects
- overview
- creating a class
- creating an instance

Sample Project
- overview
- requirements
- item
- data
- name
- description
- image
- price
- display
- user selection
- store
- items list
- items display
- cart
- data
- display

Scripts
1. Store:MonoBehaviour - acts as entry point for application. holds the list of available items. responsible for application setup
2. Item:ScriptableObject - holds item data (name, description, image, price)
3. ItemView:MonoBehaviour - placed on the item view gameobject prefab, populates the "view" from the item's data and listens for clicks
4. Cart:MonoBehaviour - placed on our cart view gameobject. listens for requests to change the cart contents
5. CartItemView:MonoBehaviour - placed on the cart item view gameobject prefab, populates the "cart" from the item's data

Prefabs
1. ItemViewPrefab - has appropriate components for displaying Item data. has "plus" and "minus" buttons for requesting an increase/decrease in item quantity
2. CartItemViewPrefab - has appropirate components for displaying CartItem data

Process
1. Iterate over the Store's item list
2. For each Item, clone the item display prefab
3. Populate the clone with the data from the current Item
4. On click, the "plus" and "minus" buttons on the StoreItemViewPrefab clone pass +1 and -1 respectively to the StoreItemView.UpdateRelativeQuantityListener(int amount) listener
5. StoreItemView.UpdateRelativeQuantityListener invokes the StoreItem's static event Func MenuItem, int, int RelativeQuantityUpdate, passing the StoreItem and amount, and expecting to receive the current total quantity from the assigned Func, if any
6. Cart has a RelativeQuantityUpdateRequestListener(StoreItem item, int amount) subscribed to StoreItem.RelativeQuantityUpdateRequest. RelativeQuantityUpdateRequestListener validates the request to increase/decrease the quantity and returns the new quantity. holds items and counts in a dictionary

Notes
This system allows for adding new menu items via the Unity editor such that a non-programmer can add content
Рекомендации по теме
Комментарии
Автор

I don't know what is a script and what language should i use

inflamix
join shbcf.ru