NAV
Unity

UIKit GS2-Showcase sample

This sample reflects the in-game store managed by GS2-Showcase in the UI.

Folder structure

Sample folder :

(Unity Project)/Assets/Game Server Services/Samples/UIKit/Gs2Showcase/.

Sample scene :

(sample folder)/Scenes/Showcase.unity.

The prefab on which this sample depends is The prefab must be placed in the scene.
- Gs2
- Gs2AccountAutoLogin

GS2-Deploy Sample Template:

(sample folder)/Settings/initialize_showcase_template.yaml.

Explanation

Gs2ShowcaseShowcase

This component reflects the products displayed on the shelves in the UI.
It retrieves a list of items displayed on the specified display shelf, materializes the Prefab specified in DisplayItemPrefab for each item, and displays it in the UI.
Registers as a child of the Transform specified by PopulateNode.

Gs2ShowcaseDisplayItem

This component is specified in the root hierarchy of Prefab, which is created for each product registered on the display shelf.
This component implements the void Buy() method, which can be called to purchase products.
In this sample, this method is called in the OnClick event of the Button.

Since the Buy method invokes a coroutine to execute the product purchase process, the button must be disabled after it is pressed to prevent multiple invocations of the coroutine.
This component can register an OnBuyComplete event that will fire an event when the purchase process is complete.
This event can be handled to transition to the post-purchase sequence or to re-activate the button.