public static string GetItemPrice(this StoreItemPack itemPack) { #if UNITY_IOS var price = Iap.GetItemPrice(itemPack.SKU); return(string.IsNullOrEmpty(price) ? "USD " + (itemPack.USDPrice - 0.01f) : price); #else return("$" + (itemPack.USDPrice - 0.01f)); #endif }
public static void BuyItem(StoreItemPack itemPack, string placement = "Default") { //if (!isInitialized) //{ // throw new Exception("Trying to call BuyItem without initializing the StoreSystem!"); //} //#if UNITY_IOS && !UNITY_EDITOR // Iap.Buy(itemPack.SKU, placement); //#elif UNITY_EDITOR // var t = new Iap.Transaction(); // t.Success = true; // t.IsSubscription = false; // t.ProductSku = itemPack.SKU; // FakeOnPurchaseEvent(t); //#endif // } // public static void RestorePurchase() // { //#if UNITY_IOS // Iap.UpdateItems(); //#endif // } // void OnPurchaseEvent(Iap.Transaction transaction) // { // Debug.Log("SM-IAP: PurchaseEvent " + transaction.Success); // if (!transaction.Success) // { // Debug.LogError(transaction.Error + " | Message: " + transaction.ErrorMessage); // } // var pack = storeItems.itemsList.FirstOrDefault(i => // string.Compare(i.SKU, transaction.ProductSku) == 0); // pack.OnBuyResult(transaction.Success); // if (OnIapTransactionReceived != null) // { // OnIapTransactionReceived(transaction); // } }