Representation of an item that the user is able to purchase from the App Store. IOS ONLY.
Ejemplo n.º 1
0
 private void onProductUpdated(List<MarketItem> items)
 {
     #if UNITY_IOS
     FuseMisc.Product[] products = new FuseMisc.Product[items.Count];
     for(int i = 0; i < products.Length; i++)
     {
         products[i] = new FuseMisc.Product() { ProductId = items[i].ProductId, Price = (float)items[i].Price, PriceLocale = items[i].MarketCurrencyCode};
     }
     FuseSDK.RegisterIOSInAppPurchaseList(products);
     #endif
 }
Ejemplo n.º 2
0
    private void onProductUpdated(List <MarketItem> items)
    {
#if UNITY_IOS
        FuseMisc.Product[] products = new FuseMisc.Product[items.Count];
        for (int i = 0; i < products.Length; i++)
        {
            products[i] = new FuseMisc.Product()
            {
                ProductId = items[i].ProductId, Price = (float)items[i].Price, PriceLocale = items[i].MarketCurrencyCode
            };
        }
        FuseSDK.RegisterIOSInAppPurchaseList(products);
#endif
    }
    void productListReceivedEvent( List<StoreKitProduct> productList )
    {
        FuseLog( "productListReceivedEvent. total products received: " + productList.Count );

        // create an array of product info to pass into the Fuse API
        FuseMisc.Product[] products = new FuseMisc.Product[productList.Count];
        int numItems = 0;
        foreach( StoreKitProduct product in productList )
        {
            FuseMisc.Product currentProduct = new FuseMisc.Product();
            currentProduct.ProductId = product.productIdentifier;
            currentProduct.PriceLocale = product.currencyCode;
            currentProduct.Price = float.Parse(product.price);
            products.SetValue(currentProduct, numItems++);
            FuseLog( product.ToString() + "\n" );
        }
        FuseSDK.RegisterIOSInAppPurchaseList(products);
    }
    void productListReceivedEvent(List <StoreKitProduct> productList)
    {
        FuseLog("productListReceivedEvent. total products received: " + productList.Count);

        // create an array of product info to pass into the Fuse API
        FuseMisc.Product[] products = new FuseMisc.Product[productList.Count];
        int numItems = 0;

        foreach (StoreKitProduct product in productList)
        {
            FuseMisc.Product currentProduct = new FuseMisc.Product();
            currentProduct.ProductId   = product.productIdentifier;
            currentProduct.PriceLocale = product.currencyCode;
            currentProduct.Price       = float.Parse(product.price);
            products.SetValue(currentProduct, numItems++);
            FuseLog(product.ToString() + "\n");
        }
        FuseSDK.RegisterIOSInAppPurchaseList(products);
    }
Ejemplo n.º 5
0
    /// <summary>Register the price and currency that a user is using to make iOS in-app purchases.</summary>
    /// <remarks>
    /// After receiving the list of in-app purchases from Apple, this method can be called to record the localized item information.
    /// This overload is meant to be called from Unity's IStoreListener.OnInitialized callback passing in the
    /// ProductCollection which you can get from the IStoreListener using the products property.
    /// </remarks>
    /// <param name="unityProducts">A collection containing all the products registered with Unity.</param>
    public static void RegisterIOSInAppPurchaseList(ProductCollection unityProducts)
    {
        if (unityProducts == null || unityProducts.all == null || unityProducts.all.Length == 0)
        {
            return;
        }

        Product[] products = unityProducts.all;

        FuseMisc.Product[] fuseProducts = new FuseMisc.Product[products.Length];
        for (int i = 0; i < products.Length; i++)
        {
            fuseProducts[i] = new FuseMisc.Product()
            {
                ProductId   = products[i].definition.storeSpecificId,
                Price       = (float)products[i].metadata.localizedPrice,
                PriceLocale = products[i].metadata.isoCurrencyCode
            };
        }

        RegisterIOSInAppPurchaseList(fuseProducts);
    }