public void OnConsumeFinishedCallBack(string data)
    {
        string[] storeData;
        storeData = data.Split(AndroidNative.DATA_SPLITTER [0]);

        int resp = System.Convert.ToInt32(storeData[0]);
        GooglePurchaseTemplate purchase = null;


        if (resp == BillingResponseCodes.BILLING_RESPONSE_RESULT_OK)
        {
            purchase                  = new GooglePurchaseTemplate();
            purchase.SKU              = storeData[2];
            purchase.packageName      = storeData[3];
            purchase.developerPayload = storeData[4];
            purchase.orderId          = storeData[5];
            purchase.SetState(storeData[6]);
            purchase.token        = storeData[7];
            purchase.signature    = storeData[8];
            purchase.originalJson = storeData[9];

            if (_inventory != null)
            {
                _inventory.removePurchase(purchase);
            }
        }

        BillingResult result = new BillingResult(resp, storeData [1], purchase);

        ActionProductConsumed(result);
        dispatch(ON_PRODUCT_CONSUMED, result);
    }
示例#2
0
	//--------------------------------------
	// PUBLIC METHODS
	//--------------------------------------

	

	public void addPurchase(GooglePurchaseTemplate purchase) {
		if(_purchases.ContainsKey(purchase.SKU)) {
			_purchases [purchase.SKU] = purchase;
		} else {
			_purchases.Add (purchase.SKU, purchase);
		}
	}
    public void OnPurchasesRecive(string data)
    {
        if (data.Equals(string.Empty))
        {
            Debug.Log("InAppPurchaseManager, no purchases avaiable");
            return;
        }

        string[] storeData;
        storeData = data.Split(AndroidNative.DATA_SPLITTER [0]);



        for (int i = 0; i < storeData.Length; i += 9)
        {
            GooglePurchaseTemplate tpl = new GooglePurchaseTemplate();
            tpl.SKU              = storeData[i];
            tpl.packageName      = storeData[i + 1];
            tpl.developerPayload = storeData[i + 2];
            tpl.orderId          = storeData[i + 3];
            tpl.SetState(storeData[i + 4]);
            tpl.token        = storeData[i + 5];
            tpl.signature    = storeData[i + 6];
            tpl.time         = System.Convert.ToInt64(storeData[i + 7]);
            tpl.originalJson = storeData[i + 8];

            _inventory.addPurchase(tpl);
        }

        Debug.Log("InAppPurchaseManager, tottal purchases loaded: " + _inventory.purchases.Count);
    }
示例#4
0
    private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase)
    {
        if (purchase.SKU == SKU_NoAds)
        {
            PlayerPrefs.SetInt("NoAds", 1);
            Debug.Log("NoAds = 1");
        }
        else if (purchase.SKU == SKU_UnlimFreeze)
        {
            PlayerPrefs.SetInt("UnlimFreeze", 1);

            Debug.Log("UnlimFreeze = 1");
        }
        else if (purchase.SKU == SKU_MoneyPack_1)
        {
            AndroidInAppPurchaseManager.Client.Consume(SKU_MoneyPack_1);
        }
        else if (purchase.SKU == SKU_MoneyPack_2)
        {
            AndroidInAppPurchaseManager.Client.Consume(SKU_MoneyPack_2);
        }
        else if (purchase.SKU == SKU_MoneyPack_3)
        {
            AndroidInAppPurchaseManager.Client.Consume(SKU_MoneyPack_3);
        }
    }
示例#5
0
 public void removePurchase(GooglePurchaseTemplate purchase)
 {
     if (_purchases.ContainsKey(purchase.SKU))
     {
         _purchases.Remove(purchase.SKU);
     }
 }
示例#6
0
    private static void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase)
    {
        switch (purchase.SKU)
        {
        case coins1:
            initClass.progress["coins"]         += 250;
            marketClass.instance.coinsLabel.text = initClass.progress["coins"].ToString();
            Debug.Log("added 250 coins");
            initClass.saveProgress();
            break;

        case coins2:
            initClass.progress["coins"]         += 500;
            marketClass.instance.coinsLabel.text = initClass.progress["coins"].ToString();
            Debug.Log("added 500 coins");
            initClass.saveProgress();
            break;

        //если комплект
        case complect:
            //купили комплект
            instance.thanksMenu.SetActive(true);
            Transform item = instance.specialMenu.transform.GetChild(0).GetChild(0);
            //убираем label price и label currency [0] и [1]
            item.GetChild(0).gameObject.SetActive(false);
            item.GetChild(1).gameObject.SetActive(false);
            //добавляем accept [2]
            item.GetChild(2).gameObject.SetActive(true);
            initClass.progress["complect"] = 1;
            initClass.saveProgress();
            break;
        }
    }
	private static void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase) {
		switch(purchase.SKU) {
		case COINS_ITEM:
			GameDataExample.AddCoins(100);
			break;
		}
	}
示例#8
0
    private void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase)
    {
                #if DEBUG_INFO
        Debug.Log("AndroidManager: in app purchase id: " + purchase.SKU + " processed successfully");
                #endif

        AndroidInAppPurchaseManager.Client.Consume(purchase.SKU);
    }
示例#9
0
    public void Consume(string SKU)
    {
        GooglePurchaseTemplate purchase = null;

        purchase     = new GooglePurchaseTemplate();
        purchase.SKU = SKU;
        BillingResult result = new BillingResult(BillingResponseCodes.BILLING_RESPONSE_RESULT_OK, "BILLING_RESPONSE_RESULT_OK", purchase);

        ActionProductConsumed(result);
    }
示例#10
0
    //--------------------------------------
    // PUBLIC METHODS
    //--------------------------------------



    public void addPurchase(GooglePurchaseTemplate purchase)
    {
        if (_purchases.ContainsKey(purchase.SKU))
        {
            _purchases [purchase.SKU] = purchase;
        }
        else
        {
            _purchases.Add(purchase.SKU, purchase);
        }
    }
	//--------------------------------------
	//  EVENTS
	//--------------------------------------
	
	private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase) {
		//some stuff for processing product purchse. Add coins, unlock track, etc

		switch(purchase.SKU) {
		case COINS_ITEM:
			consume(COINS_ITEM);
			break;
		case COINS_BOOST:
			GameDataExample.EnableCoinsBoost();
			break;
		}
	}
	//--------------------------------------
	//  EVENTS
	//--------------------------------------
	
	private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase) {
		//some stuff for processing product purchse. Add coins, unlock track, etc

		switch(purchase.SKU) {
		case COINS_ITEM:
			consume(COINS_ITEM);
			break;
		case COINS_BOOST:
			GameDataExample.EnableCoinsBoost();
			break;
		}
	}
示例#13
0
    private static void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase)
    {
        //AndroidMessage.Create("OnProcessingConsumeProduct", "This purchase funcition was called");

        switch (purchase.SKU)
        {
        case coin_package_one:
            PlayerPrefs.SetString("android_package_1", "consumed");
            break;

        case coin_package_two:
            PlayerPrefs.SetString("android_package_2", "consumed");;
            break;

        case coin_package_three:
            PlayerPrefs.SetString("android_package_3", "consumed");;
            break;

        case coin_package_four:
            PlayerPrefs.SetString("android_package_4", "consumed");;
            break;

        case coin_package_five:
            PlayerPrefs.SetString("android_package_5", "consumed");;
            break;

        case coin_package_six:
            PlayerPrefs.SetString("android_package_6", "consumed");;
            break;

        case coin_package_offer_one:
            PlayerPrefs.SetString("android_package_7", "consumed");;
            break;

        case coin_package_offer_two:
            PlayerPrefs.SetString("android_package_8", "consumed");;
            break;

        case coin_package_offer_three:
            PlayerPrefs.SetString("android_package_9", "consumed");;
            break;
        }

        if (SuccessfullPurchase != null)
        {
            SuccessfullPurchase();
        }
        else
        {
            Debug.LogWarning("NOTHING IS SUBSCRIBED TO SuccessfullPurchase DELEGATE");
        }
    }
示例#14
0
    private void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase)
    {
        switch (purchase.SKU)
        {
        case PRODUCT_LIVEX5:
            AndroidInAppPurchaseManager.Client.Consume(PRODUCT_LIVEX5);
            break;

        case PRODUCT_LIVEX10:
            AndroidInAppPurchaseManager.Client.Consume(PRODUCT_LIVEX10);
            break;

        case PRODUCT_LIVEX20:
            AndroidInAppPurchaseManager.Client.Consume(PRODUCT_LIVEX10);
            break;
        }
    }
示例#15
0
    private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase)
    {
        switch(purchase.SKU)
        {
        case "panda":
            SingletonSaveData.instance.PandaLocked = false;
            break;

        case "lugg":
            SingletonSaveData.instance.JuggLocked = false;
            break;

        case "demon":
            SingletonSaveData.instance.DemonLocked = false;
            break;
        }
    }
示例#16
0
 private static void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase)
 {
     switch (purchase.SKU)
     {
         case SMALL_COINS_ITEM:
         {
             //GameManager.User.Gold += 1000;
             Debug.Log("Brought Small Coint Item");
         }
             break;
         case BIG_COINS_ITEM:
         {
             //GameManager.User.Gold += 10000;
             Debug.Log("Brought Big Coint Item");
         }
             break;
     }
 }
示例#17
0
 private static void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase)
 {
     if (purchase.SKU == SKU_MoneyPack_1)
     {
         FindObjectOfType <AllPrefsScript>().moneyCount += 500000;
         FindObjectOfType <AllPrefsScript>().setMoney    = true;
     }
     else if (purchase.SKU == SKU_MoneyPack_2)
     {
         FindObjectOfType <AllPrefsScript>().moneyCount += 2000000;
         FindObjectOfType <AllPrefsScript>().setMoney    = true;
     }
     else if (purchase.SKU == SKU_MoneyPack_3)
     {
         FindObjectOfType <AllPrefsScript>().moneyCount += 10000000;
         FindObjectOfType <AllPrefsScript>().setMoney    = true;
     }
 }
示例#18
0
    //--------------------------------------
    //  EVENTS
    //--------------------------------------

    private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase)
    {
        //some stuff for processing product purchse. Add coins, unlock track, etc

        switch (purchase.SKU)
        {
        /*case COINS_ITEM:
         *  consume(COINS_ITEM);
         *  break;
         * case COINS_BOOST:
         *  GameDataExample.EnableCoinsBoost();
         *  break;*/
        case NO_ADS_VERSION_PRODUCT_ID:
            GameObject.Find("HomeScript").GetComponent <Home>().setting.adsOn = false;
            GameObject.Find("HomeScript").GetComponent <Home>().fileData.SaveSetting(GameObject.Find("HomeScript").GetComponent <Home>().setting);
            GameObject.Find("HomeScript").GetComponent <Home>().DisablePurchaseButton();
            break;
        }
    }
示例#19
0
 public bool IsProductPurchased(string SKU)
 {
     if (_purchases.ContainsKey(SKU))
     {
         GooglePurchaseTemplate tpl = GetPurchaseDetails(SKU);
         if (tpl.State == GooglePurchaseState.PURCHASED)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
示例#20
0
    //--------------------------------------
    //  EVENTS
    //--------------------------------------

    private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase)
    {
        //some stuff for processing product purchse. Add coins, unlock track, etc

        switch (purchase.SKU)
        {
        case coins1:
            consume(coins1);
            break;

        case coins2:
            consume(coins2);
            break;

        case complect:
            consume(complect);
            //GameDataExample.EnableCoinsBoost();
            break;
        }
    }
示例#21
0
    private void OnPurchaseComplete(bool IsSucceeded)
    {
        GooglePurchaseTemplate purchase = null;

        BillingResult result;

        if (IsSucceeded)
        {
            purchase     = new GooglePurchaseTemplate();
            purchase.SKU = _CurrentSKU;

            result = new BillingResult(BillingResponseCodes.BILLING_RESPONSE_RESULT_OK, "BILLING_RESPONSE_RESULT_OK", purchase);
        }
        else
        {
            result = new BillingResult(BillingResponseCodes.BILLINGHELPERR_USER_CANCELLED, "BILLINGHELPERR_USER_CANCELLED");
        }

        ActionProductPurchased(result);
    }
示例#22
0
    private void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase)
    {
                #if DEBUG_INFO
        Debug.Log("AndroidManager: in app consumition id: " + purchase.SKU + " processed successfully");
                #endif

        switch (purchase.SKU)
        {
        case "coins_pack_1": GameManager.Instance.Coins += ProjectManager.coinsPackCoins[0]; break;

        case "coins_pack_2": GameManager.Instance.Coins += ProjectManager.coinsPackCoins[1]; break;

        case "coins_pack_3": GameManager.Instance.Coins += ProjectManager.coinsPackCoins[2]; break;

        case "no_ads": GameManager.Instance.NoAds = 1; break;

        default: break;
        }

        GameManager.Instance.SaveData();
    }
    //--------------------------------------
    // EVENTS
    //--------------------------------------



    public void OnPurchaseFinishedCallback(string data)
    {
        Debug.Log(data);
        string[] storeData;
        storeData = data.Split(AndroidNative.DATA_SPLITTER [0]);

        int resp = System.Convert.ToInt32(storeData[0]);
        GooglePurchaseTemplate purchase = new GooglePurchaseTemplate();


        if (resp == BillingResponseCodes.BILLING_RESPONSE_RESULT_OK)
        {
            purchase.SKU              = storeData[2];
            purchase.packageName      = storeData[3];
            purchase.developerPayload = storeData[4];
            purchase.orderId          = storeData[5];
            purchase.SetState(storeData[6]);
            purchase.token        = storeData[7];
            purchase.signature    = storeData[8];
            purchase.time         = System.Convert.ToInt64(storeData[9]);
            purchase.originalJson = storeData[10];

            if (_inventory != null)
            {
                _inventory.addPurchase(purchase);
            }
        }
        else
        {
            purchase.SKU = _processedSKU;
        }


        BillingResult result = new BillingResult(resp, storeData [1], purchase);

        ActionProductPurchased(result);
        dispatch(ON_PRODUCT_PURCHASED, result);
    }
示例#24
0
        //--------------------------------------
        //  EVENTS
        //--------------------------------------

        private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase)
        {
            //some stuff for processing product purchse. Add coins, unlock track, etc

            switch (purchase.SKU)
            {
            case ONE_DOLLAR_PRODUCT_ID:
                GameObject.Find("ThemeScript").GetComponent <Theme>().BuyCoin(1000);
                break;

            case FIVE_DOLLAR_PRODUCT_ID:
                GameObject.Find("ThemeScript").GetComponent <Theme>().BuyCoin(7000);
                break;

            case TEN_DOLLAR_PRODUCT_ID:
                GameObject.Find("ThemeScript").GetComponent <Theme>().BuyCoin(18000);
                break;

            case NO_ADS_PRODUCT_ID:
                GameObject.Find("SelectModeScript").GetComponent <SelectMode>().BuyNoAds();
                break;
            }
        }
示例#25
0
    private static void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase) {
        switch (purchase.SKU) {
            case coins1:
                initClass.progress["coins"] += 250;
                marketClass.instance.coinsLabel.text = initClass.progress["coins"].ToString();
                Debug.Log("added 250 coins");
                initClass.saveProgress();
                break;
            case coins2:
                initClass.progress["coins"] += 500;
                marketClass.instance.coinsLabel.text = initClass.progress["coins"].ToString();
                Debug.Log("added 500 coins");
                initClass.saveProgress();
                break;
            //если комплект
            case complect:
                //купили комплект
                instance.thanksMenu.SetActive(true);
                Transform item = instance.specialMenu.transform.GetChild(0).GetChild(0);
                //убираем label price и label currency [0] и [1]
                item.GetChild(0).gameObject.SetActive(false);
                item.GetChild(1).gameObject.SetActive(false);
                //добавляем accept [2]
                item.GetChild(2).gameObject.SetActive(true);
                initClass.progress["complect"] = 1;
                initClass.saveProgress();
                break;

        }
    }
示例#26
0
 //--------------------------------------
 //  EVENTS
 //--------------------------------------
 private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase)
 {
     //some stuff for processing product purchse. Add coins, unlock track, etc
 }
示例#27
0
 private static void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase)
 {
     //some stuff for processing product consume. Reduse tip anount, reduse gold token, etc
 }
示例#28
0
    private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase)
    {
        //AndroidMessage.Create("OnProcessingPurchasedProduct", "This purchase funcition was called");
        //some stuff for processing consumable product purchse. Add coins, unlock track, etc

        switch (purchase.SKU)
        {
        case coin_package_one:
            Coin_package_one_purchased();
            consume(coin_package_one);
            break;

        case coin_package_two:
            Coin_package_two_purchased();
            consume(coin_package_two);
            break;

        case coin_package_three:
            Coin_package_four_purchased();
            consume(coin_package_three);
            break;

        case coin_package_four:
            Coin_package_four_purchased();
            consume(coin_package_four);
            break;

        case coin_package_five:
            Coin_package_five_purchased();
            consume(coin_package_five);
            break;

        case coin_package_six:
            Coin_package_six_purchased();
            consume(coin_package_six);
            break;

        case coin_package_offer_one:
            Coin_package_offerOne_purchased();
            consume(coin_package_offer_one);
            break;

        case coin_package_offer_two:
            Coin_package_offerTwo_purchased();
            consume(coin_package_offer_two);
            break;

        case coin_package_offer_three:
            Coin_package_offerThree_purchased();
            consume(coin_package_offer_three);
            break;
        }

        if (SuccessfullPurchase != null)
        {
            SuccessfullPurchase();
        }
        else
        {
            Debug.LogWarning("NOTHING IS SUBSCRIBED TO SuccessfullPurchase DELEGATE");
        }
    }
示例#29
0
	public void removePurchase(GooglePurchaseTemplate purchase) {
		if(_purchases.ContainsKey(purchase.SKU)) {
			_purchases.Remove (purchase.SKU);
		}
	}
	public void OnPurchasesRecive(string data) {
		if(data.Equals(string.Empty)) {
			Debug.Log("InAppPurchaseManager, no purchases avaiable");
			return;
		}
		
		string[] storeData;
		storeData = data.Split(AndroidNative.DATA_SPLITTER [0]);
		
		for(int i = 0; i < storeData.Length; i+=9) {
			GooglePurchaseTemplate tpl =  new GooglePurchaseTemplate();
			tpl.SKU 				= storeData[i];
			tpl.packageName 		= storeData[i + 1];
			tpl.developerPayload 	= storeData[i + 2];
			tpl.orderId 	        = storeData[i + 3];
			tpl.SetState(storeData[i + 4]);
			tpl.token 	        	= storeData[i + 5];
			tpl.signature 	        = storeData[i + 6];
			tpl.time 	        	= System.Convert.ToInt64(storeData[i + 7]); 
			tpl.originalJson 	    = storeData[i + 8];
			
			_inventory.addPurchase (tpl);
		}
		
		Debug.Log("InAppPurchaseManager, total purchases loaded: " + _inventory.Purchases.Count);
		
	}
	public void OnConsumeFinishedCallBack(string data) {
		string[] storeData;
		storeData = data.Split(AndroidNative.DATA_SPLITTER [0]);
		
		int resp = System.Convert.ToInt32 (storeData[0]);
		GooglePurchaseTemplate purchase = null;
		
		
		if(resp == BillingResponseCodes.BILLING_RESPONSE_RESULT_OK) {
			purchase = new GooglePurchaseTemplate ();
			purchase.SKU 				= storeData[2];
			purchase.packageName 		= storeData[3];
			purchase.developerPayload 	= storeData[4];
			purchase.orderId 	        = storeData[5];
			purchase.SetState(storeData[6]);
			purchase.token 	        		= storeData[7];
			purchase.signature 	        	= storeData[8];
			purchase.time					= System.Convert.ToInt64(storeData[9]);
			purchase.originalJson 	        = storeData[10];
			
			if(_inventory != null) {
				_inventory.removePurchase (purchase);
			}
			
		}
		
		BillingResult result = new BillingResult (resp, storeData [1], purchase);
		
		ActionProductConsumed(result);
	}
	private void OnPurchaseComplete(bool IsSucceeded) {

		GooglePurchaseTemplate purchase = null;
		
		BillingResult result;

		if(IsSucceeded) {
			purchase = new GooglePurchaseTemplate ();
			purchase.SKU = _CurrentSKU;

			result = new BillingResult(BillingResponseCodes.BILLING_RESPONSE_RESULT_OK, "BILLING_RESPONSE_RESULT_OK", purchase);
		} else {
			result = new BillingResult(BillingResponseCodes.BILLINGHELPERR_USER_CANCELLED, "BILLINGHELPERR_USER_CANCELLED");
		}

		ActionProductPurchased(result);
	}
	public void Consume(string SKU) {

		GooglePurchaseTemplate purchase = null;
		purchase = new GooglePurchaseTemplate ();
		purchase.SKU = _CurrentSKU;
		BillingResult result = new BillingResult(BillingResponseCodes.BILLING_RESPONSE_RESULT_OK, "BILLING_RESPONSE_RESULT_OK", purchase);

		ActionProductConsumed(result);
	}
示例#34
0
	private static void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase) {
		int addedGold = 0;
		if (values.TryGetValue (purchase.SKU, out addedGold)) {
			GameGlobalVariables.Stats.METAL_IN_CONTAINERS += addedGold;
			SaveDataManager.save (SaveDataManager.METAL_IN_CONTAINERS, GameGlobalVariables.Stats.METAL_IN_CONTAINERS);
		}
	}
    //--------------------------------------
    // EVENTS
    //--------------------------------------



    public void OnPurchaseFinishedCallback(string data)
    {
        Debug.Log(data);
        string[] storeData;
        storeData = data.Split(AndroidNative.DATA_SPLITTER [0]);

        int resp = System.Convert.ToInt32(storeData[0]);
        GooglePurchaseTemplate purchase = new GooglePurchaseTemplate();


        if (resp == BillingResponseCodes.BILLING_RESPONSE_RESULT_OK)
        {
            purchase.SKU              = storeData[2];
            purchase.packageName      = storeData[3];
            purchase.developerPayload = storeData[4];
            purchase.orderId          = storeData[5];
            purchase.SetState(storeData[6]);
            purchase.token        = storeData[7];
            purchase.signature    = storeData[8];
            purchase.time         = System.Convert.ToInt64(storeData[9]);
            purchase.originalJson = storeData[10];

            if (_inventory != null)
            {
                _inventory.addPurchase(purchase);
            }
        }
        else
        {
            purchase.SKU = _processedSKU;
        }


        //Soomla Analytics
        if (resp == BillingResponseCodes.BILLING_RESPONSE_RESULT_OK)
        {
            GoogleProductTemplate tpl = Inventory.GetProductDetails(purchase.SKU);
            if (tpl != null)
            {
                AN_SoomlaGrow.PurchaseFinished(tpl.SKU, tpl.PriceAmountMicros, tpl.PriceCurrencyCode);
            }
            else
            {
                AN_SoomlaGrow.PurchaseFinished(purchase.SKU, 0, "USD");
            }
        }
        else
        {
            if (resp == BillingResponseCodes.BILLINGHELPERR_USER_CANCELLED)
            {
                AN_SoomlaGrow.PurchaseCanceled(purchase.SKU);
            }
            else
            {
                AN_SoomlaGrow.PurchaseError();
            }
        }

        BillingResult result = new BillingResult(resp, storeData [1], purchase);


        ActionProductPurchased(result);
    }
示例#36
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------



    public BillingResult(int code, string msg, GooglePurchaseTemplate p) : this(code, msg)
    {
        _purchase = p;
    }
示例#37
0
    //--------------------------------------
    //  EVENTS
    //--------------------------------------

    private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase) {
        //some stuff for processing product purchse. Add coins, unlock track, etc

        switch (purchase.SKU) {
            case coins1:
                consume(coins1);
                break;
            case coins2:
                consume(coins2);
                break;
            case complect:
                consume(complect);
                //GameDataExample.EnableCoinsBoost();
                break;
        }
    }
示例#38
0
	private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase) {
		AndroidInAppPurchaseManager.instance.consume (purchase.SKU);
	}
示例#39
0
    //--------------------------------------
    //  EVENTS
    //--------------------------------------

    private static void OnProcessingPurchasedProduct(GooglePurchaseTemplate purchase)
    {
        //some stuff for processing product purchse. Add coins, unlock track, etc
    }
	private static void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase) {
		switch(purchase.SKU) {
		case COINS_ITEM:
			GameDataExample.AddCoins(100);
			break;
		}
	}
示例#41
0
 private static void OnProcessingConsumeProduct(GooglePurchaseTemplate purchase)
 {
     //some stuff for processing product consume. Reduse tip anount, reduse gold token, etc
 }
示例#42
0
	//--------------------------------------
	// INITIALIZE
	//--------------------------------------



	public BillingResult(int code, string msg, GooglePurchaseTemplate p) : this(code, msg) {
		_purchase = p;
	}
	//--------------------------------------
	// EVENTS
	//--------------------------------------
	
	
	
	public void OnPurchaseFinishedCallback(string data) {
		Debug.Log(data);
		string[] storeData;
		storeData = data.Split(AndroidNative.DATA_SPLITTER [0]);
		
		int resp = System.Convert.ToInt32 (storeData[0]);
		GooglePurchaseTemplate purchase = new GooglePurchaseTemplate ();
		
		
		if(resp == BillingResponseCodes.BILLING_RESPONSE_RESULT_OK) {
			
			purchase.SKU 						= storeData[2];
			purchase.packageName 				= storeData[3];
			purchase.developerPayload 			= storeData[4];
			purchase.orderId 	       			= storeData[5];
			purchase.SetState(storeData[6]);
			purchase.token 	        			= storeData[7];
			purchase.signature 	        		= storeData[8];
			purchase.time						= System.Convert.ToInt64(storeData[9]);
			purchase.originalJson 				= storeData[10];
			
			if(_inventory != null) {
				_inventory.addPurchase (purchase);
			}
			
		} else {
			purchase.SKU 						= _processedSKU;
		}
		
		
		//Soomla Analytics
		if(resp == BillingResponseCodes.BILLING_RESPONSE_RESULT_OK) {
			GoogleProductTemplate tpl = Inventory.GetProductDetails(purchase.SKU);
			if(tpl != null) {
				AN_SoomlaGrow.PurchaseFinished(tpl.SKU, tpl.PriceAmountMicros, tpl.PriceCurrencyCode);
			} else {
				AN_SoomlaGrow.PurchaseFinished(purchase.SKU, 0, "USD");
			}
		} else {
			
			
			if(resp == BillingResponseCodes.BILLINGHELPERR_USER_CANCELLED) {
				AN_SoomlaGrow.PurchaseCanceled(purchase.SKU);
			} else {
				AN_SoomlaGrow.PurchaseError();
			}
		}
		
		BillingResult result = new BillingResult (resp, storeData [1], purchase);
		
		
		ActionProductPurchased(result);
	}