Sample of MoneyStoreWithSale(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
Project Description
Open the project and you will see the above.
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”.
The purchase limit is reduced to 1/2 and the balance becomes 16,000.
Buy again.
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
Gs2LimitCountUpByUserIdEnabler
If Gs2LimitCountUpByUserId is set in ConsumeActions of DisplayItem, EnableLimit is enabled, otherwise DisableLimit is enabled.
Canvas/MoneyStoreWindow/Store/…/DisplayItem/EnableLimit
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.
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
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.