Exemple #1
0
        // Refresh information about displayed asset by quering the
        // asset store server. This is typically after the user has
        // logged in because we need to know if he already owns the
        // displayed asset.
        public static void RefreshFromServer(AssetsRefreshed callback)
        {
            if (s_SelectedAssets.Count == 0)
            {
                return;
            }

            // Refetch assetInfo
            // Query the asset store for more info
            List <AssetStoreAsset> queryAssets = new List <AssetStoreAsset>();

            foreach (KeyValuePair <int, AssetStoreAsset> qasset in s_SelectedAssets)
            {
                queryAssets.Add(qasset.Value);
            }

            // This will fill the queryAssets with extra preview data
            AssetStoreClient.AssetsInfo(queryAssets,
                                        delegate(AssetStoreAssetsInfo results) {
                AssetStoreAssetInspector.paymentAvailability = AssetStoreAssetInspector.PaymentAvailability.ServiceDisabled;
                if (!string.IsNullOrEmpty(results.error))
                {
                    System.Console.WriteLine("Error performing Asset Store Info search: " + results.error);
                    AssetStoreAssetInspector.OfflineNoticeEnabled = true;
                    //Debug.LogError("Error performing Asset Store Info search: " + results.error);
                    if (callback != null)
                    {
                        callback();
                    }
                    return;
                }
                AssetStoreAssetInspector.OfflineNoticeEnabled = false;

                if (results.status == AssetStoreAssetsInfo.Status.Ok)
                {
                    AssetStoreAssetInspector.paymentAvailability = AssetStoreAssetInspector.PaymentAvailability.Ok;
                }
                else if (results.status == AssetStoreAssetsInfo.Status.BasketNotEmpty)
                {
                    AssetStoreAssetInspector.paymentAvailability = AssetStoreAssetInspector.PaymentAvailability.BasketNotEmpty;
                }
                else if (results.status == AssetStoreAssetsInfo.Status.AnonymousUser)
                {
                    AssetStoreAssetInspector.paymentAvailability = AssetStoreAssetInspector.PaymentAvailability.AnonymousUser;
                }

                AssetStoreAssetInspector.s_PurchaseMessage     = results.message;
                AssetStoreAssetInspector.s_PaymentMethodCard   = results.paymentMethodCard;
                AssetStoreAssetInspector.s_PaymentMethodExpire = results.paymentMethodExpire;
                AssetStoreAssetInspector.s_PriceText           = results.priceText;

                AssetStoreAssetInspector.Instance.Repaint();
                if (callback != null)
                {
                    callback();
                }
            });
        }
        public static void RefreshFromServer(AssetStoreAssetSelection.AssetsRefreshed callback)
        {
            if (AssetStoreAssetSelection.s_SelectedAssets.Count == 0)
            {
                return;
            }
            List <AssetStoreAsset> list = new List <AssetStoreAsset>();

            foreach (KeyValuePair <int, AssetStoreAsset> current in AssetStoreAssetSelection.s_SelectedAssets)
            {
                list.Add(current.Value);
            }
            AssetStoreClient.AssetsInfo(list, delegate(AssetStoreAssetsInfo results)
            {
                AssetStoreAssetInspector.paymentAvailability = AssetStoreAssetInspector.PaymentAvailability.ServiceDisabled;
                if (results.error != null && results.error != string.Empty)
                {
                    Console.WriteLine("Error performing Asset Store Info search: " + results.error);
                    AssetStoreAssetInspector.OfflineNoticeEnabled = true;
                    if (callback != null)
                    {
                        callback();
                    }
                    return;
                }
                AssetStoreAssetInspector.OfflineNoticeEnabled = false;
                if (results.status == AssetStoreAssetsInfo.Status.Ok)
                {
                    AssetStoreAssetInspector.paymentAvailability = AssetStoreAssetInspector.PaymentAvailability.Ok;
                }
                else
                {
                    if (results.status == AssetStoreAssetsInfo.Status.BasketNotEmpty)
                    {
                        AssetStoreAssetInspector.paymentAvailability = AssetStoreAssetInspector.PaymentAvailability.BasketNotEmpty;
                    }
                    else
                    {
                        if (results.status == AssetStoreAssetsInfo.Status.AnonymousUser)
                        {
                            AssetStoreAssetInspector.paymentAvailability = AssetStoreAssetInspector.PaymentAvailability.AnonymousUser;
                        }
                    }
                }
                AssetStoreAssetInspector.s_PurchaseMessage     = results.message;
                AssetStoreAssetInspector.s_PaymentMethodCard   = results.paymentMethodCard;
                AssetStoreAssetInspector.s_PaymentMethodExpire = results.paymentMethodExpire;
                AssetStoreAssetInspector.s_PriceText           = results.priceText;
                AssetStoreAssetInspector.Instance.Repaint();
                if (callback != null)
                {
                    callback();
                }
            });
        }
Exemple #3
0
        public static void RefreshFromServer(AssetStoreAssetSelection.AssetsRefreshed callback)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            AssetStoreAssetSelection.\u003CRefreshFromServer\u003Ec__AnonStorey51 serverCAnonStorey51 = new AssetStoreAssetSelection.\u003CRefreshFromServer\u003Ec__AnonStorey51();
            // ISSUE: reference to a compiler-generated field
            serverCAnonStorey51.callback = callback;
            if (AssetStoreAssetSelection.s_SelectedAssets.Count == 0)
            {
                return;
            }
            List <AssetStoreAsset> assets = new List <AssetStoreAsset>();

            using (Dictionary <int, AssetStoreAsset> .Enumerator enumerator = AssetStoreAssetSelection.s_SelectedAssets.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <int, AssetStoreAsset> current = enumerator.Current;
                    assets.Add(current.Value);
                }
            }
            // ISSUE: reference to a compiler-generated method
            AssetStoreClient.AssetsInfo(assets, new AssetStoreResultBase <AssetStoreAssetsInfo> .Callback(serverCAnonStorey51.\u003C\u003Em__8C));
        }