Exemplo n.º 1
0
 ///初始化
 ///註冊回調地址
 public void InitKit(string prefabName)
 {
     Debug.Log("IAPKit:Init");
     if (isAvailable)
     {
         IAPKit.Init(prefabName);
     }
 }
Exemplo n.º 2
0
 public void FinishTransactionByID(string transactionID)
 {
     Debug.Log("IAPKit:FinishTransactionByID " + transactionID);
     if (isAvailable)
     {
         IAPKit.FinishTransaction(transactionID);
     }
 }
Exemplo n.º 3
0
 ///開始一個購買行為
 public void StartPayment(string productId, int num, string username)
 {
     if (isAvailable)
     {
         String str = String.Format("{0}\t{1}\t{2}", productId, num, username);
         Debug.Log("IAPKit:StartPayment " + str);
         IAPKit.BuyProduct(str);
     }
 }
Exemplo n.º 4
0
    ///是否可以有購買行為
    public bool IsProductsAvailable()
    {
        bool ret = false;

        if (isAvailable)
        {
            ret = IAPKit.CanMakePayment();
        }

        Debug.LogFormat("IAPKit:IsProductsAvailable {0}", ret);
        return(ret);
    }
Exemplo n.º 5
0
 ///請求商品信息
 public void StartProductsRequest(List <string> productIDs)
 {
     if (isAvailable)
     {
         string str = "";
         for (int i = 0, n = productIDs.Count; i < n; i++)
         {
             str += productIDs[i] + "\t";
         }
         Debug.Log("IAPKit:StartProductsRequest " + str);
         IAPKit.RequstProductInfo(str);
     }
 }
Exemplo n.º 6
0
 void Start()
 {
     iapKit = GetComponent <IAPKit>();
     iapKit.OnPaymentComplete += (string transactionID, string username, string receipt) =>
     {
         Debug.Log("OnPaymentComplete: " + transactionID);
         iapKit.FinishTransactionByID(transactionID);
     };
     iapKit.OnPaymentFail += (string transactionID, string username) =>
     {
         Debug.Log("OnPaymentFail: " + transactionID);
         iapKit.FinishTransactionByID(transactionID);
     };
     iapKit.OnPaymentRestore += (string transactionID, string username) =>
     {
         iapKit.FinishTransactionByID(transactionID);
     };
     iapKit.OnProductsReqResponse += (string json) =>
     {
         Debug.Log("OnProductsReqResponse: " + json);
     };
     iapKit.InitKit("Main");
 }