You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 lines
1.8 KiB

using UnityEngine;
#if !VER_CASH_ENABLE
public class IapMgr : MonoBehaviour
#elif VER_ONESTORE
public class IapMgr : MonoBehaviour, IPurchaseCallback
#else
public class IapMgr : MonoBehaviour, IStoreListener
#endif
{
#region Variables
private static IapMgr curMgr = null;
private static int rewardId = -1;
#endregion Variables
#region Base
private void Awake()
{
if (curMgr != null)
{
Destroy(this.gameObject);
return;
}
curMgr = this;
DontDestroyOnLoad(this.gameObject);
}
public static void SForceStopCoroutines()
{
if (curMgr != null)
curMgr.StopAllCoroutines();
}
public static void SInit()
{
if (curMgr != null)
curMgr.Init();
}
private void Init()
{
#if VER_CASH_ENABLE
#if VER_ONESTORE
#else
#endif
#endif
}
#endregion Base
#region Custom Method
/// <summary>
/// 인앱 가격 가져오기.
/// </summary>
/// <param name="productid">상품 SKU.</param>
/// <returns>현재화된 인앱 가격.</returns>
public static string SGetPrice(string productid)
{
//@ 추후 인앱 결제 작업 시 현지화된 가격 리턴하도록 수정. 현재는 null 리턴.
return null;
}
/// <summary>
/// 구매 시도.
/// </summary>
/// <param name="key">상점 ID.</param>
/// <param name="productid">상품 SKU.</param>
/// <returns></returns>
public static void STryPurchase(int key, string productid)
{
curMgr.TryPurchase(key);
}
// 구매 시도.
private void TryPurchase(int key)
{
rewardId = key;
//@ 추후 인앱 결제 작업 시 코드 수정. 현재는 바로 성공 처리.
ShopMgr.SSubProcessSucc(rewardId);
}
#endregion Custom Method
}