> For the complete documentation index, see [llms.txt](/llms.txt)

# MoneyStoreWithSale(GS2 UIKit for Unity) 샘플

GS2 UIKit for Unity를 사용한 GS2-Money + GS2-Showcase + GS2-Limit 기능 구현 샘플 소개



구매 횟수 제한이 있는 세일 판매 기능이 포함된 과금 통화 판매 기능을 구현합니다.

## 리포지토리

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

## GS2-Deploy 템플릿

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

## 프로젝트 내용

![img.png](img.png)

프로젝트를 열면 위와 같은 화면이 나타납니다.

![img_1.png](img_1.png)

실행하면 MoneyStore 샘플과 달리 구매 횟수 제한이 있는 상품이 진열되어 있습니다.

"¥10000 x 16000"의 "Buy"를 클릭합니다.

![img_2.png](img_2.png)

구매 횟수 제한 표기가 1/2가 되고, 잔액이 16000이 됩니다.

한 번 더 구매합니다.

![img_3.png](img_3.png)

구매 횟수 제한 표기가 2/2가 되고, 잔액이 32000이 됩니다.

구매 횟수 상한에 도달했으므로 "Buy" 버튼이 비활성화됩니다.

## 프로젝트 설명

씬의 계층 구조에 주목해 주세요.

### Canvas/MoneyStoreWindow/Wallet

과금 통화의 잔액을 표시하고 있습니다.

[Money 샘플]()에서 설명하고 있으니 그쪽을 참조해 주세요.

### Canvas/MoneyStoreWindow/Store

과금 통화의 진열대를 표시하고 있습니다.

기본적인 구현은 [MoneyStore 샘플]()에서 설명하고 있으니 그쪽을 참조해 주세요.
여기서부터는 MoneyStore 샘플과의 차이점에 대해서만 설명합니다.

### Canvas/MoneyStoreWindow/Store/.../DisplayItem

![img_4.png](img_4.png)

**Gs2LimitCountUpByUserIdEnabler**

DisplayItem의 ConsumeActions에 Gs2LimitCountUpByUserId가 설정되어 있는 경우 EnableLimit이 활성화되고, 설정되어 있지 않은 경우에는 DisableLimit이 활성화됩니다.

### Canvas/MoneyStoreWindow/Store/.../DisplayItem/EnableLimit

![img_5.png](img_5.png)

**Gs2LimitCountUpByUserIdFetcher**

DisplayItem의 ConsumeActions에 설정된 Gs2LimitCountUpByUserId를 취득합니다.

**Gs2MoneyDepositByUserIdFetcher**

DisplayItem의 AcquireActions에 설정된 Gs2MoneyDepositByUserId를 취득합니다.

### Canvas/MoneyStoreWindow/Store/.../DisplayItem/EnableLimit/PriceAndRemain/Remain

남은 구매 가능 횟수를 표시합니다.

![img_7.png](img_7.png)

**Gs2LimitOwnCounterFetcher**

Gs2LimitCountUpByUserIdFetcher로 취득한 소비 액션의 카운터 값을 취득합니다.

**Gs2LimitOwnCounterEnabler**

Gs2LimitOwnCounterFetcher로 카운터 취득이 끝났는지 여부에 따라 CounterLoadingText 또는 CounterLoadedText를 활성화합니다.

### Canvas/MoneyStoreWindow/Store/.../DisplayItem/EnableLimit/Buy

![img_8.png](img_8.png)

**ConsumeActionsEnabler**

DisplayItem의 ConsumeActions에 설정된 소비 액션이 실행 조건을 충족하는지에 따라 Active 또는 InActive를 활성화합니다.
이 컴포넌트에 의해 구매 횟수 상한에 도달하면 Buy 버튼이 비활성화됩니다.

### Process/Gs2AutoLogin

로그인 처리를 실행하는 프리팹이 설정되어 있습니다.

[Account 샘플]()에서 설명하고 있으니 그쪽을 참조해 주세요.




