void OnItemInGrid(PaidCurrencyBundleItem item, GameObject obj)
    {
        PremiumBundle creditBundle = obj.GetComponent <PremiumBundle>();

        creditBundle.Amount = item.Amount.ToString();
        creditBundle.Cost   = item.Cost.ToString();

        if (item.CreditPlatformIDs.ContainsKey("Android_Product_ID"))
        {
            creditBundle.ProductID = item.CreditPlatformIDs["Android_Product_ID"];
        }

        if (item.CreditPlatformIDs.ContainsKey("IOS_Product_ID"))
        {
            creditBundle.ProductID = item.CreditPlatformIDs["IOS_Product_ID"].ToString();
        }

        creditBundle.BundleID = item.ID.ToString();

        creditBundle.PremiumCurrencyName = "";
        creditBundle.Description         = item.Description;


        if (!string.IsNullOrEmpty(item.CurrencyIcon))
        {
            CloudGoods.GetItemTexture(item.CurrencyIcon, delegate(ImageStatus imageStatus, Texture2D texture)
            {
                creditBundle.SetIcon(texture);
            });
        }

        creditBundle.SetBundleName(item.BundleName);

        creditBundle.OnPurchaseRequest = OnPurchaseRequest;
    }
 void OnPurchaseRequest(PremiumBundle item)
 {
     if (!isPurchaseRequest)
     {
         isPurchaseRequest = true;
         platformPurchasor.Purchase(item, 1, CloudGoods.user.userID.ToString());
     }
 }
Example #3
0
    public void Purchase(PremiumBundle bundleItem, int amount, string appID)
    {
        string data  = "'{\"id\":\"" + bundleItem.BundleID + "\",\"amount\":\"" + amount + "\",\"type\":\"Premium\",\"appID\":\"" + CloudGoods.AppID + "\"}'";
        string final = "kongregate.mtx.purchaseItemsRemote(" +
                       data +
                       ", KongregateOnPurchaseResult);";

        Application.ExternalEval(final);
    }
    public void Purchase(PremiumBundle bundleItem, int amount, string userID)
    {
        if (Type.GetType("FacebookPurchasing") != null)
        {
            FacebookPurchasing = this.gameObject.AddComponent(Type.GetType("FacebookPurchasing")) as IFacebookPurchase;
        }

        if (FacebookPurchasing == null)
        {
            Debug.LogError("Facebook purchase not found. Please add the FacebookPurchase script from the CloudGoodsFacebookAddon folder to this object and drag it as the public reference to the facebookPurchase variable in the inspector");
            return;
        }

        currentBundleID = int.Parse(bundleItem.BundleID);
        Console.WriteLine("Credit bundle purchase:  ID: " + bundleItem.BundleID + " Amount: " + amount);
        Debug.Log("ID: " + bundleItem.BundleID + "\nAmount: " + amount + "\nUserID: " + userID);
        FacebookPurchasing.Purchase(bundleItem, amount, OnReceivedFacebookCurrencyPurchase);
    }
Example #5
0
    public void Purchase(PremiumBundle bundleItem, int amount, string userID)
    {
#if UNITY_ANDROID
        if (string.IsNullOrEmpty(CloudGoodsSettings.AndroidKey))
        {
            Debug.LogError("No Android key has been set, cannot purchase from premium store");
            return;
        }

        currentBundleID  = int.Parse(bundleItem.BundleID);
        currentProductID = bundleItem.ProductID;

        using (AndroidJavaClass cls = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
        {
            using (AndroidJavaObject obj_Activity = cls.GetStatic <AndroidJavaObject>("currentActivity"))
            {
                Debug.Log("Attempting to purchase Bundle Item: " + bundleItem.ProductID);
                cls_StorePurchaser.CallStatic("makePurchase", obj_Activity, bundleItem.ProductID);
            }
        }
#endif
    }
 public void Purchase(PremiumBundle bundleItem, int amount, string userID)
 {
     Debug.Log("Purchase ios called");
     currentBundleID = int.Parse(bundleItem.BundleID);
     iOSConnect.RequestInAppPurchase(bundleItem.ProductID);
 }