Example #1
0
 public void productsReceived(string json)
 {
     if (productListReceivedEvent != null)
     {
         productListReceivedEvent(StoreKitProduct.productsFromJson(json));
     }
 }
Example #2
0
	public IAPProduct( StoreKitProduct prod )
	{
		productId = prod.productIdentifier;
		title = prod.title;
		price = prod.price;
		description = prod.description;
	}
    public static StoreKitProduct productFromDictionary( Dictionary<string,object> ht )
    {
        StoreKitProduct product = new StoreKitProduct();

		if( ht.ContainsKey( "productIdentifier" ) )
        	product.productIdentifier = ht["productIdentifier"].ToString();

		if( ht.ContainsKey( "localizedTitle" ) )
        	product.title = ht["localizedTitle"].ToString();

		if( ht.ContainsKey( "localizedDescription" ) )
        	product.description = ht["localizedDescription"].ToString();

		if( ht.ContainsKey( "price" ) )
        	product.price = ht["price"].ToString();

		if( ht.ContainsKey( "currencySymbol" ) )
			product.currencySymbol = ht["currencySymbol"].ToString();

		if( ht.ContainsKey( "currencyCode" ) )
			product.currencyCode = ht["currencyCode"].ToString();

		if( ht.ContainsKey( "formattedPrice" ) )
			product.formattedPrice = ht["formattedPrice"].ToString();

        return product;
    }
Example #4
0
 public IAPProduct(StoreKitProduct prod)
 {
     productId   = prod.productIdentifier;
     title       = prod.title;
     price       = prod.price;
     description = prod.description;
 }
Example #5
0
 /// <summary>
 /// create new instance based on OS. iOS version
 /// </summary>
 public IAPArticle(StoreKitProduct prod)
 {
     id = prod.productIdentifier;
     title = prod.title;
     description = prod.description;
     price = prod.price;
 }
Example #6
0
 /// <summary>
 /// create new instance based on OS. iOS version
 /// </summary>
 public IAPArticle(StoreKitProduct prod)
 {
     id          = prod.productIdentifier;
     title       = prod.title;
     description = prod.description;
     price       = prod.price;
 }
//======================================       IOS In app Event             =================================================
#elif UNITY_IOS
    public StoreKitProduct Get_StoreKitPtInfoIOS(ushort shopidx)
    {
        StoreKitProduct storekit = null;

        if (Dic_StorkitProductInfo.ContainsKey(Get_ProductID(shopidx)))
        {
            storekit = Dic_StorkitProductInfo [Get_ProductID(shopidx)];
        }

        return(storekit);
    }
    public void productsReceived(string productString)
    {
        List <StoreKitProduct> productList = new List <StoreKitProduct>();

        // parse out the products
        string[] productParts = productString.Split(new string[] { "||||" }, StringSplitOptions.RemoveEmptyEntries);
        for (int i = 0; i < productParts.Length; i++)
        {
            productList.Add(StoreKitProduct.productFromString(productParts[i]));
        }

        if (productListReceived != null)
        {
            productListReceived(productList);
        }
    }
    public static StoreKitProduct productFromString(string productString)
    {
        StoreKitProduct product = new StoreKitProduct();

        string[] productParts = productString.Split(new string[] { "|||" }, StringSplitOptions.None);
        if (productParts.Length == 5)
        {
            product.productIdentifier = productParts[0];
            product.title             = productParts[1];
            product.description       = productParts[2];
            product.price             = productParts[3];
            product.currencySymbol    = productParts[4];
        }

        return(product);
    }
    public static StoreKitProduct productFromString( string productString )
    {
        StoreKitProduct product = new StoreKitProduct();

        string[] productParts = productString.Split( new string[] { "|||" }, StringSplitOptions.None );
        if( productParts.Length == 5 )
        {
            product.productIdentifier = productParts[0];
            product.title = productParts[1];
            product.description = productParts[2];
            product.price = productParts[3];
            product.currencySymbol = productParts[4];
        }

        return product;
    }
Example #11
0
    public static StoreKitProduct productFromDictionary( Dictionary<string,object> ht )
    {
        StoreKitProduct product = new StoreKitProduct();

		if( ht.ContainsKey( "productIdentifier" ) )
        	product.productIdentifier = ht["productIdentifier"].ToString();

		if( ht.ContainsKey( "localizedTitle" ) )
        	product.title = ht["localizedTitle"].ToString();

		if( ht.ContainsKey( "localizedDescription" ) )
        	product.description = ht["localizedDescription"].ToString();

		if( ht.ContainsKey( "price" ) )
        	product.price = ht["price"].ToString();

		if( ht.ContainsKey( "currencySymbol" ) )
			product.currencySymbol = ht["currencySymbol"].ToString();

		if( ht.ContainsKey( "currencyCode" ) )
			product.currencyCode = ht["currencyCode"].ToString();

		if( ht.ContainsKey( "formattedPrice" ) )
			product.formattedPrice = ht["formattedPrice"].ToString();

		if( ht.ContainsKey( "countryCode" ) )
			product.countryCode = ht["countryCode"].ToString();

		if( ht.ContainsKey( "downloadContentVersion" ) )
			product.downloadContentVersion = ht["downloadContentVersion"].ToString();

		if( ht.ContainsKey( "downloadable" ) )
			product.downloadable = bool.Parse( ht["downloadable"].ToString() );

		if( ht.ContainsKey( "downloadContentLengths" ) && ht["downloadContentLengths"] is IList )
		{
			var tempLengths = ht["downloadContentLengths"] as List<object>;
			foreach( var dlLength in tempLengths )
				product.downloadContentLengths.Add( System.Convert.ToInt64( dlLength ) );
		}

        return product;
    }
Example #12
0
    public static StoreKitProduct productFromHashtable(Hashtable ht)
    {
        StoreKitProduct product = new StoreKitProduct();

        if (ht.ContainsKey("productIdentifier"))
        {
            product.productIdentifier = ht["productIdentifier"].ToString();
        }

        if (ht.ContainsKey("localizedTitle"))
        {
            product.title = ht["localizedTitle"].ToString();
        }

        if (ht.ContainsKey("localizedDescription"))
        {
            product.description = ht["localizedDescription"].ToString();
        }

        if (ht.ContainsKey("price"))
        {
            product.price = ht["price"].ToString();
        }

        if (ht.ContainsKey("currencySymbol"))
        {
            product.currencySymbol = ht["currencySymbol"].ToString();
        }

        if (ht.ContainsKey("currencyCode"))
        {
            product.currencyCode = ht["currencyCode"].ToString();
        }

        if (ht.ContainsKey("formattedPrice"))
        {
            product.formattedPrice = ht["formattedPrice"].ToString();
        }

        return(product);
    }
Example #13
0
    public static string[] GetPreciosOrdenados()
    {
        if (InventarioTienda == null)
        {
            string[] res = { "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?" };
            return(res);
        }

        StoreKitProduct[] aux = new StoreKitProduct[skus.Length];

        for (int i = 0; i < skus.Length; i++)
        {
            string id = skus[i];
            foreach (StoreKitProduct info in InventarioTienda)
            {
                if (info.productIdentifier == id)
                {
                    aux[i] = info;
                    break;
                }
            }
        }

        string[] results = new string[skus.Length];
        for (int j = 0; j < aux.Length; j++)
        {
            if (aux[j] != null)
            {
                results[j]  = aux[j].price;
                results[j] += " " + aux[j].currencySymbol;
            }
            else
            {
                results[j] = "?";
            }
        }

        return(results);
    }
Example #14
0
    public static void LoadProducts()
    {
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            loadProducts();
        }
        else
        {
            PrintPlatformNotSupportedMessage();
            //raise event with a dummy product
            StoreKitProduct[] products = new StoreKitProduct[1];
            products[0].localizedTitle       = "Dummy product";
            products[0].localizedDescription = "Dummy product description in non-iOS environment";
            products[0].localPrice           = "0.00";
            products[0].priceSymbol          = "$";
            products[0].identifier           = "dummy";

            if (productsLoadedEvent != null)
            {
                productsLoadedEvent(products);
            }
        }
    }
Example #15
0
/*--- Callbacks from the plugin ---*/
    /// <summary>
    /// Products loaded.
    /// </summary>
    /// <param name='productIdentifiers'>
    /// Product identifiers. Semicolon separated list
    /// </param>
    public void productsLoaded(string productIdentifierString)
    {
        Debug.Log("Products loaded: " + productIdentifierString);

        string[] delimiters = new string[1];
        delimiters[0] = ";";
        string[] identifiers = productIdentifierString.Split(delimiters, System.StringSplitOptions.RemoveEmptyEntries);

        StoreKitProduct[] productArray = new StoreKitProduct[identifiers.Length];

        int index = 0;

        foreach (string identifier in identifiers)
        {
            productArray[index] = detailsForProductWithIdentifier(identifier);
            index++;
        }

        //raise an event
        if (productsLoadedEvent != null)
        {
            productsLoadedEvent(productArray);
        }
    }
    public static StoreKitProduct productFromDictionary(Dictionary <string, object> ht)
    {
        StoreKitProduct product = new StoreKitProduct();

        if (ht.ContainsKey("productIdentifier"))
        {
            product.productIdentifier = ht["productIdentifier"].ToString();
        }

        if (ht.ContainsKey("localizedTitle"))
        {
            product.title = ht["localizedTitle"].ToString();
        }

        if (ht.ContainsKey("localizedDescription"))
        {
            product.description = ht["localizedDescription"].ToString();
        }

        if (ht.ContainsKey("price"))
        {
            product.price = ht["price"].ToString();
        }

        if (ht.ContainsKey("currencySymbol"))
        {
            product.currencySymbol = ht["currencySymbol"].ToString();
        }

        if (ht.ContainsKey("currencyCode"))
        {
            product.currencyCode = ht["currencyCode"].ToString();
        }

        if (ht.ContainsKey("formattedPrice"))
        {
            product.formattedPrice = ht["formattedPrice"].ToString();
        }

        if (ht.ContainsKey("countryCode"))
        {
            product.countryCode = ht["countryCode"].ToString();
        }

        if (ht.ContainsKey("downloadContentVersion"))
        {
            product.downloadContentVersion = ht["downloadContentVersion"].ToString();
        }

        if (ht.ContainsKey("downloadable"))
        {
            product.downloadable = bool.Parse(ht["downloadable"].ToString());
        }

        if (ht.ContainsKey("downloadContentLengths") && ht["downloadContentLengths"] is IList)
        {
            var tempLengths = ht["downloadContentLengths"] as List <object>;
            foreach (var dlLength in tempLengths)
            {
                product.downloadContentLengths.Add(System.Convert.ToInt64(dlLength));
            }
        }

        return(product);
    }