빌링서비스 API를 사용하여 PC SDK와 커뮤니케이션 하기 위하여, 게임에서는 아래 StovePCCallback
클래스의 콜백에 연결할 델리게이트 함수를 정의해야 합니다.
public class StovePCCallback
{
public StovePCErrorDelegate OnError;
public StovePCInitializationCompleteDelegate OnInitializationComplete;
public StovePCTokenDelegate OnToken;
public StovePCUserDelegate OnUser;
public StovePCOwnershipDelegate OnOwnership;
// FetchShopCategories 처리가 완료됐을 때 호출되는 콜백
public StovePCFetchShopCategoriesDelegate OnFetchShopCategories;
// FetchProducts 처리가 완료됐을 때 호출되는 콜백
public StovePCFetchProductsDelegate OnFetchProducts;
// StartPurchase 처리가 완료됐을 때 호출되는 콜백
public StovePCStartPurchaseDelegate OnStartPurchase;
// ConfirmPurchase 처리가 완료됐을 때 호출되는 콜백
public StovePCConfirmPurchaseDelegate OnConfirmPurchase;
// FetchInventory 처리가 완료됐을 때 호출되는 콜백
public StovePCFetchInventoryDelegate OnFetchInventory;
}
Config, Callback 설정 에서와 같이 StovePCCallback
클래스의 콜백에 델리게이트를 연결합니다..
// StovePCCallback 클래스 instance 생성
this.callback = new StovePCCallback
{
OnError = new StovePCErrorDelegate(this.OnError),
OnInitializationComplete = new StovePCInitializationCompleteDelegate(this.OnInitializationComplete),
OnToken = new StovePCTokenDelegate(this.OnToken),
OnUser = new StovePCUserDelegate(this.OnUser),
OnOwnership = new StovePCOwnershipDelegate(this.OnOwnership),
// 서비스 이용 약관
OnFetchTermAgreement = new StovePCFetchTermsAgreementDelegate(this.OnFetchTermsAgreement),
// 빌링서비스
OnFetchShopCategories = new StovePCFetchShopCategoriesDelegate(this.OnFetchShopCategories),
OnFetchProducts = new StovePCFetchProductsDelegate(this.OnFetchProducts),
OnStartPurchase = new StovePCStartPurchaseDelegate(this.OnStartPurchase),
OnConfirmPurchase = new StovePCConfirmPurchaseDelegate(this.OnConfirmPurchase),
OnFetchInventory = new StovePCFetchInventoryDelegate(this.OnFetchInventory)
};
OnFetchShopCategories
, OnFetchProducts
, OnStartPurchase
, OnConfirmPurchase
, OnFetchInventory
콜백을 반드시 구현할 필요는 없습니다. 게임에서 상점이 필요한 경우만 연결하면 되며, 단 기능을 구현하려면 5개의 콜백을 모두 구현하여 연결하여야 합니다.