Sample of MoneyStoreWithSale(GS2 UIKit for Unity)

sample implementation of GS2-Money + GS2-Showcase + GS2-Limit functionality using GS2 UIKit for Unity

This sample implements a function to sell a charged currency with a sale weight with a limit on the number of purchases.

Repository

https://github.com/gs2io/gs2-uikit-for-unity-sample/tree/main/MoneyStoreWithSale

GS2-Deploy template

https://github.com/gs2io/gs2-uikit-for-unity-sample/blob/main/MoneyStoreWithSale/initialize_money_store_with_sale_template.yaml

Project Description

img.png

Open the project and you will see the above.

img_1.png

When executed, the project shows a display of products with a limited number of purchases, unlike the MoneyStore sample.

Click on “Buy” for “¥10000 x 16000”.

img_2.png

The purchase limit is reduced to 1/2 and the balance becomes 16,000.

Buy again.

img_3.png

The purchase limit is reduced to 2/2 and the balance becomes 32,000.

The “Buy” button will be disabled because the maximum number of purchases has been reached.

Project Description

Notice the hierarchy of the scene.

Canvas/MoneyStoreWindow/Wallet

The balance of the billed currency is displayed.

Money sample, please refer to the explanation there.

Canvas/MoneyStoreWindow/Store

Displays a display shelf for charged currency.

The basic implementation is shown in MoneyStore sample. From here on, only the differences from the MoneyStore sample are explained.

Canvas/MoneyStoreWindow/Store/…/DisplayItem

img_4.png

Gs2LimitCountUpByUserIdEnabler

If Gs2LimitCountUpByUserId is set in ConsumeActions of DisplayItem, EnableLimit is enabled, otherwise DisableLimit is enabled.

Canvas/MoneyStoreWindow/Store/…/DisplayItem/EnableLimit

img_5.png

Gs2LimitCountUpByUserIdFetcher.

Gets the Gs2LimitCountUpByUserId set in ConsumeActions of DisplayItem.

Gs2MoneyDepositByUserIdFetcher.

Gets Gs2MoneyDepositByUserId set in AcquireActions of DisplayItem.

Canvas/MoneyStoreWindow/Store/…/DisplayItem/EnableLimit/PriceAndRemain/Remain

Displays the number of remaining purchases available.

img_7.png

Gs2LimitOwnCounterFetcher.

Gets the value of the counter for the consumption action obtained by Gs2LimitCountUpByUserIdFetcher.

Gs2LimitCounterEnabler

Enables CounterLoadingText or CounterLoadedText depending on whether the counter has been retrieved by Gs2LimitOwnCounterFetcher.

Canvas/MoneyStoreWindow/Store/…/DisplayItem/EnableLimit/Buy

img_8.png

ConsumeActionsEnabler.

Enables Active or InActive depending on whether the consume actions set in the DisplayItem’s ConsumeActions meet the execution conditions. This component disables the Buy button when the maximum number of purchases is reached.

Process/Gs2AutoLogin

A prefab is set up to perform the login process.

sample of Account, please refer to the explanation there.