public static bool PreviewAssetStoreAssetBundleInInspector(AssetBundle bundle, AssetStoreAsset info)
 {
   info.id = 0;
   info.previewAsset = bundle.mainAsset;
   AssetStoreAssetSelection.Clear();
   AssetStoreAssetSelection.AddAssetInternal(info);
   Selection.activeObject = (Object) AssetStoreAssetInspector.Instance;
   AssetStoreAssetInspector.Instance.Repaint();
   return true;
 }
		public static void ShowAssetStoreInstaBuyWindowBuilding(AssetStoreAsset asset)
		{
			AssetStoreInstaBuyWindow assetStoreInstaBuyWindow = AssetStoreInstaBuyWindow.ShowAssetStoreInstaBuyWindow(asset, string.Empty, string.Empty, string.Empty, string.Empty);
			if (assetStoreInstaBuyWindow.m_Purchasing != AssetStoreInstaBuyWindow.PurchaseStatus.Init)
			{
				EditorUtility.DisplayDialog("Download in progress", "There is already a package download in progress. You can only have one download running at a time", "Close");
				return;
			}
			assetStoreInstaBuyWindow.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.StartBuild;
			assetStoreInstaBuyWindow.m_BuildAttempts = 1;
			asset.previewInfo.buildProgress = 0f;
			Analytics.Track(string.Format("/AssetStore/ShowInstaFree/{0}/{1}", assetStoreInstaBuyWindow.m_Asset.packageID, assetStoreInstaBuyWindow.m_Asset.id));
		}
Exemple #3
0
        public override void OnPreviewSettings()
        {
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();

            if (firstAsset != null)
            {
                EditorWrapper previewEditor = this.previewEditor;
                if (previewEditor != null && firstAsset.HasLivePreview)
                {
                    previewEditor.OnPreviewSettings();
                }
            }
        }
Exemple #4
0
        private void InitiateBuySelected(bool firstAttempt)
        {
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();

            if (firstAsset == null)
            {
                EditorUtility.DisplayDialog("No asset selected", "Please select asset before buying a package", "ok");
            }
            else if (AssetStoreAssetInspector.paymentAvailability == AssetStoreAssetInspector.PaymentAvailability.AnonymousUser)
            {
                if (AssetStoreClient.LoggedIn())
                {
                    AssetStoreAssetSelection.RefreshFromServer(delegate
                    {
                        this.InitiateBuySelected(false);
                    });
                }
                else if (firstAttempt)
                {
                    this.LoginAndInitiateBuySelected();
                }
            }
            else if (AssetStoreAssetInspector.paymentAvailability == AssetStoreAssetInspector.PaymentAvailability.ServiceDisabled)
            {
                if (firstAsset.previewInfo != null)
                {
                    AssetStore.Open(string.Format("content/{0}/directpurchase", firstAsset.packageID));
                }
            }
            else if (AssetStoreAssetInspector.paymentAvailability == AssetStoreAssetInspector.PaymentAvailability.BasketNotEmpty)
            {
                if (firstAsset.previewInfo != null)
                {
                    if (firstAttempt)
                    {
                        AssetStoreAssetSelection.RefreshFromServer(delegate
                        {
                            this.InitiateBuySelected(false);
                        });
                    }
                    else
                    {
                        AssetStore.Open(string.Format("content/{0}/basketpurchase", firstAsset.packageID));
                    }
                }
            }
            else
            {
                AssetStoreInstaBuyWindow.ShowAssetStoreInstaBuyWindow(firstAsset, AssetStoreAssetInspector.s_PurchaseMessage, AssetStoreAssetInspector.s_PaymentMethodCard, AssetStoreAssetInspector.s_PaymentMethodExpire, AssetStoreAssetInspector.s_PriceText);
            }
        }
 private void LoginAndImport(AssetStoreAsset asset)
 {
     AssetStoreLoginWindow.Login("Please login to the Asset Store in order to get download information for the package.", delegate(string errorMessage)
     {
         if (errorMessage != null)
         {
             return;
         }
         AssetStoreAssetSelection.RefreshFromServer(delegate
         {
             AssetStoreInstaBuyWindow.ShowAssetStoreInstaBuyWindowBuilding(asset);
         });
     });
 }
Exemple #6
0
        public static void ShowAssetStoreInstaBuyWindowBuilding(AssetStoreAsset asset)
        {
            AssetStoreInstaBuyWindow assetStoreInstaBuyWindow = AssetStoreInstaBuyWindow.ShowAssetStoreInstaBuyWindow(asset, string.Empty, string.Empty, string.Empty, string.Empty);

            if (assetStoreInstaBuyWindow.m_Purchasing != AssetStoreInstaBuyWindow.PurchaseStatus.Init)
            {
                EditorUtility.DisplayDialog("Download in progress", "There is already a package download in progress. You can only have one download running at a time", "Close");
                return;
            }
            assetStoreInstaBuyWindow.m_Purchasing    = AssetStoreInstaBuyWindow.PurchaseStatus.StartBuild;
            assetStoreInstaBuyWindow.m_BuildAttempts = 1;
            asset.previewInfo.buildProgress          = 0f;
            Analytics.Track(string.Format("/AssetStore/ShowInstaFree/{0}/{1}", assetStoreInstaBuyWindow.m_Asset.packageID, assetStoreInstaBuyWindow.m_Asset.id));
        }
Exemple #7
0
 public static void AddAsset(AssetStoreAsset searchResult, Texture2D placeholderPreviewImage)
 {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     AssetStoreAssetSelection.\u003CAddAsset\u003Ec__AnonStorey4E assetCAnonStorey4E = new AssetStoreAssetSelection.\u003CAddAsset\u003Ec__AnonStorey4E();
     // ISSUE: reference to a compiler-generated field
     assetCAnonStorey4E.searchResult = searchResult;
     if ((Object)placeholderPreviewImage != (Object)null)
     {
         // ISSUE: reference to a compiler-generated field
         assetCAnonStorey4E.searchResult.previewImage = AssetStoreAssetSelection.ScaleImage(placeholderPreviewImage, 256, 256);
     }
     // ISSUE: reference to a compiler-generated field
     assetCAnonStorey4E.searchResult.previewInfo = (AssetStoreAsset.PreviewInfo)null;
     // ISSUE: reference to a compiler-generated field
     assetCAnonStorey4E.searchResult.previewBundleRequest = (AssetBundleCreateRequest)null;
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     if (!string.IsNullOrEmpty(assetCAnonStorey4E.searchResult.dynamicPreviewURL) && (Object)assetCAnonStorey4E.searchResult.previewBundle == (Object)null)
     {
         // ISSUE: object of a compiler-generated type is created
         // ISSUE: variable of a compiler-generated type
         AssetStoreAssetSelection.\u003CAddAsset\u003Ec__AnonStorey4D assetCAnonStorey4D = new AssetStoreAssetSelection.\u003CAddAsset\u003Ec__AnonStorey4D();
         // ISSUE: reference to a compiler-generated field
         assetCAnonStorey4D.\u003C\u003Ef__ref\u002478 = assetCAnonStorey4E;
         // ISSUE: reference to a compiler-generated field
         assetCAnonStorey4E.searchResult.disposed = false;
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated field
         assetCAnonStorey4D.client = new AsyncHTTPClient(assetCAnonStorey4E.searchResult.dynamicPreviewURL);
         // ISSUE: reference to a compiler-generated field
         // ISSUE: reference to a compiler-generated method
         assetCAnonStorey4D.client.doneCallback = new AsyncHTTPClient.DoneCallback(assetCAnonStorey4D.\u003C\u003Em__8A);
         // ISSUE: reference to a compiler-generated field
         assetCAnonStorey4D.client.Begin();
     }
     else
     {
         // ISSUE: reference to a compiler-generated field
         if (!string.IsNullOrEmpty(assetCAnonStorey4E.searchResult.staticPreviewURL))
         {
             // ISSUE: reference to a compiler-generated field
             AssetStoreAssetSelection.DownloadStaticPreview(assetCAnonStorey4E.searchResult);
         }
     }
     // ISSUE: reference to a compiler-generated field
     AssetStoreAssetSelection.AddAssetInternal(assetCAnonStorey4E.searchResult);
     AssetStoreAssetSelection.RefreshFromServer((AssetStoreAssetSelection.AssetsRefreshed)null);
 }
Exemple #8
0
        private void PurchaseSuccessGUI()
        {
            AssetStoreAsset.PreviewInfo previewInfo = this.m_Asset.previewInfo;
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(5f);
            GUILayout.Label(AssetStoreInstaBuyWindow.s_AssetStoreLogo, GUIStyle.none, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            });
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Label("Purchase completed succesfully", EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUILayout.Label("You will receive a receipt in your email soon.", new GUILayoutOption[0]);
            bool  flag = this.m_Message != null && this.m_Message != string.Empty;
            float num  = (float)(160 + ((!flag) ? 0 : 20));

            if (num != base.position.height)
            {
                base.position = new Rect(base.position.x, base.position.y, base.position.width, num);
            }
            if (flag)
            {
                GUILayout.Label(this.m_Message, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
            }
            GUILayout.Label("Package: " + previewInfo.packageName, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
            GUILayout.EndVertical();
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(8f);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close", new GUILayoutOption[0]))
            {
                Analytics.Track(string.Format("/AssetStore/PurchaseOk/{0}/{1}", this.m_Asset.packageID, this.m_Asset.id));
                this.m_Asset = null;
                base.Close();
            }
            GUILayout.Space(5f);
            if (GUILayout.Button("Import package", new GUILayoutOption[0]))
            {
                Analytics.Track(string.Format("/AssetStore/PurchaseOkImport/{0}/{1}", this.m_Asset.packageID, this.m_Asset.id));
                this.m_BuildAttempts = 1;
                this.m_Asset.previewInfo.buildProgress = 0f;
                this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.StartBuild;
            }
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.Space(5f);
        }
Exemple #9
0
        private void PurchaseDeclinedGUI()
        {
            AssetStoreAsset.PreviewInfo previewInfo = this.m_Asset.previewInfo;
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(5f);
            GUILayout.Label(AssetStoreInstaBuyWindow.s_AssetStoreLogo, GUIStyle.none, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            });
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Label("Purchase declined", EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUILayout.Label("No money has been drawn from you credit card", new GUILayoutOption[0]);
            bool  flag = this.m_Message != null && this.m_Message != string.Empty;
            float num  = (float)(160 + ((!flag) ? 0 : 20));

            if (num != base.position.height)
            {
                base.position = new Rect(base.position.x, base.position.y, base.position.width, num);
            }
            if (flag)
            {
                GUILayout.Label(this.m_Message, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
            }
            GUILayout.Label("Package: " + previewInfo.packageName, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
            GUILayout.EndVertical();
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(8f);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close", new GUILayoutOption[0]))
            {
                Analytics.Track(string.Format("/AssetStore/DeclinedAbort/{0}/{1}", this.m_Asset.packageID, this.m_Asset.id));
                this.m_Asset = null;
                base.Close();
            }
            GUILayout.Space(5f);
            if (GUILayout.Button("Put to basket", new GUILayoutOption[0]))
            {
                AssetStore.Open(string.Format("content/{0}/basketpurchase", this.m_Asset.packageID));
                Analytics.Track(string.Format("/AssetStore/DeclinedPutToBasket/{0}/{1}", this.m_Asset.packageID, this.m_Asset.id));
                this.m_Asset = null;
                base.Close();
            }
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.Space(5f);
        }
 public static void AddAsset(AssetStoreAsset searchResult, Texture2D placeholderPreviewImage)
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   AssetStoreAssetSelection.\u003CAddAsset\u003Ec__AnonStorey4E assetCAnonStorey4E = new AssetStoreAssetSelection.\u003CAddAsset\u003Ec__AnonStorey4E();
   // ISSUE: reference to a compiler-generated field
   assetCAnonStorey4E.searchResult = searchResult;
   if ((Object) placeholderPreviewImage != (Object) null)
   {
     // ISSUE: reference to a compiler-generated field
     assetCAnonStorey4E.searchResult.previewImage = AssetStoreAssetSelection.ScaleImage(placeholderPreviewImage, 256, 256);
   }
   // ISSUE: reference to a compiler-generated field
   assetCAnonStorey4E.searchResult.previewInfo = (AssetStoreAsset.PreviewInfo) null;
   // ISSUE: reference to a compiler-generated field
   assetCAnonStorey4E.searchResult.previewBundleRequest = (AssetBundleCreateRequest) null;
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   if (!string.IsNullOrEmpty(assetCAnonStorey4E.searchResult.dynamicPreviewURL) && (Object) assetCAnonStorey4E.searchResult.previewBundle == (Object) null)
   {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     AssetStoreAssetSelection.\u003CAddAsset\u003Ec__AnonStorey4D assetCAnonStorey4D = new AssetStoreAssetSelection.\u003CAddAsset\u003Ec__AnonStorey4D();
     // ISSUE: reference to a compiler-generated field
     assetCAnonStorey4D.\u003C\u003Ef__ref\u002478 = assetCAnonStorey4E;
     // ISSUE: reference to a compiler-generated field
     assetCAnonStorey4E.searchResult.disposed = false;
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     assetCAnonStorey4D.client = new AsyncHTTPClient(assetCAnonStorey4E.searchResult.dynamicPreviewURL);
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated method
     assetCAnonStorey4D.client.doneCallback = new AsyncHTTPClient.DoneCallback(assetCAnonStorey4D.\u003C\u003Em__8A);
     // ISSUE: reference to a compiler-generated field
     assetCAnonStorey4D.client.Begin();
   }
   else
   {
     // ISSUE: reference to a compiler-generated field
     if (!string.IsNullOrEmpty(assetCAnonStorey4E.searchResult.staticPreviewURL))
     {
       // ISSUE: reference to a compiler-generated field
       AssetStoreAssetSelection.DownloadStaticPreview(assetCAnonStorey4E.searchResult);
     }
   }
   // ISSUE: reference to a compiler-generated field
   AssetStoreAssetSelection.AddAssetInternal(assetCAnonStorey4E.searchResult);
   AssetStoreAssetSelection.RefreshFromServer((AssetStoreAssetSelection.AssetsRefreshed) null);
 }
Exemple #11
0
        public override string GetInfoString()
        {
            EditorWrapper   previewEditor = this.previewEditor;
            AssetStoreAsset firstAsset    = AssetStoreAssetSelection.GetFirstAsset();

            if (firstAsset == null)
            {
                return("No item selected");
            }
            if ((previewEditor != null) && firstAsset.HasLivePreview)
            {
                return(previewEditor.GetInfoString());
            }
            return(string.Empty);
        }
        public override void OnPreviewSettings()
        {
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();

            if (firstAsset == null)
            {
                return;
            }
            EditorWrapper previewEditor = this.previewEditor;

            if (previewEditor == null || !firstAsset.HasLivePreview)
            {
                return;
            }
            previewEditor.OnPreviewSettings();
        }
        public void OnDownloadProgress(string id, string message, int bytes, int total)
        {
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();

            if (firstAsset == null)
            {
                return;
            }
            AssetStoreAsset.PreviewInfo previewInfo = firstAsset.previewInfo;
            if (previewInfo == null || firstAsset.packageID.ToString() != id)
            {
                return;
            }
            previewInfo.downloadProgress = !(message == "downloading") && !(message == "connecting") || AssetStoreAssetInspector.OfflineNoticeEnabled ? -1f : (float)bytes / (float)total;
            this.Repaint();
        }
Exemple #14
0
 private static void DownloadStaticPreview(AssetStoreAsset searchResult)
 {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     AssetStoreAssetSelection.\u003CDownloadStaticPreview\u003Ec__AnonStorey50 previewCAnonStorey50 = new AssetStoreAssetSelection.\u003CDownloadStaticPreview\u003Ec__AnonStorey50();
     // ISSUE: reference to a compiler-generated field
     previewCAnonStorey50.searchResult = searchResult;
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     previewCAnonStorey50.client = new AsyncHTTPClient(previewCAnonStorey50.searchResult.staticPreviewURL);
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated method
     previewCAnonStorey50.client.doneCallback = new AsyncHTTPClient.DoneCallback(previewCAnonStorey50.\u003C\u003Em__8B);
     // ISSUE: reference to a compiler-generated field
     previewCAnonStorey50.client.Begin();
 }
Exemple #15
0
        public override void OnPreviewSettings()
        {
            AssetStoreAsset asset = AssetStoreAssetSelection.GetFirstAsset();

            if (asset == null)
            {
                return;
            }

            EditorWrapper editor = previewEditor;

            if (editor != null && asset.HasLivePreview)
            {
                editor.OnPreviewSettings();
            }
        }
Exemple #16
0
        public void Update()
        {
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();
            bool            flag       = firstAsset != null && firstAsset.previewInfo != null && (firstAsset.previewInfo.buildProgress >= 0f || firstAsset.previewInfo.downloadProgress >= 0f);

            if ((firstAsset == null && this.lastAssetID != 0) || (firstAsset != null && this.lastAssetID != firstAsset.id) || flag)
            {
                this.lastAssetID = ((firstAsset != null) ? firstAsset.id : 0);
                base.Repaint();
            }
            if (firstAsset != null && firstAsset.previewBundle != null)
            {
                firstAsset.previewBundle.Unload(false);
                firstAsset.previewBundle = null;
                base.Repaint();
            }
        }
Exemple #17
0
        public override string GetInfoString()
        {
            EditorWrapper   editor = previewEditor;
            AssetStoreAsset a      = AssetStoreAssetSelection.GetFirstAsset();

            if (a == null)
            {
                return("No item selected");
            }

            if (editor != null && a.HasLivePreview)
            {
                return(editor.GetInfoString());
            }

            return("");
        }
        public void Update()
        {
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();
            bool            flag       = firstAsset != null && firstAsset.previewInfo != null && ((double)firstAsset.previewInfo.buildProgress >= 0.0 || (double)firstAsset.previewInfo.downloadProgress >= 0.0);

            if (firstAsset == null && this.lastAssetID != 0 || firstAsset != null && this.lastAssetID != firstAsset.id || flag)
            {
                this.lastAssetID = firstAsset != null ? firstAsset.id : 0;
                this.Repaint();
            }
            if (firstAsset == null || !((Object)firstAsset.previewBundle != (Object)null))
            {
                return;
            }
            firstAsset.previewBundle.Unload(false);
            firstAsset.previewBundle = (AssetBundle)null;
            this.Repaint();
        }
Exemple #19
0
        public override void OnInteractivePreviewGUI(Rect r, GUIStyle background)
        {
            EditorWrapper previewEditor = this.previewEditor;

            if (previewEditor != null)
            {
                previewEditor.OnInteractivePreviewGUI(r, background);
            }
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();

            if (firstAsset != null && !firstAsset.HasLivePreview && !string.IsNullOrEmpty(firstAsset.dynamicPreviewURL))
            {
                GUIContent statusWheel = AssetStoreAssetInspector.StatusWheel;
                r.y += (r.height - (float)statusWheel.image.height) / 2f;
                r.x += (r.width - (float)statusWheel.image.width) / 2f;
                GUI.Label(r, AssetStoreAssetInspector.StatusWheel);
                base.Repaint();
            }
        }
        private static void DownloadStaticPreview(AssetStoreAsset searchResult)
        {
            AsyncHTTPClient client = new AsyncHTTPClient(searchResult.staticPreviewURL);

            client.doneCallback = delegate(AsyncHTTPClient c)
            {
                if (!client.IsSuccess())
                {
                    Console.WriteLine("Error downloading static preview: " + client.text);
                    return;
                }
                Texture2D texture   = c.texture;
                Texture2D texture2D = new Texture2D(texture.width, texture.height, TextureFormat.RGB24, false, true);
                AssetStorePreviewManager.ScaleImage(texture2D.width, texture2D.height, texture, texture2D, null);
                searchResult.previewImage = texture2D;
                UnityEngine.Object.DestroyImmediate(texture);
                AssetStoreAssetInspector.Instance.Repaint();
            };
            client.Begin();
        }
        internal static AsyncHTTPClient AssetsInfo(List <AssetStoreAsset> assets, AssetStoreResultBase <AssetStoreAssetsInfo> .Callback callback)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            AssetStoreClient.\u003CAssetsInfo\u003Ec__AnonStorey55 infoCAnonStorey55 = new AssetStoreClient.\u003CAssetsInfo\u003Ec__AnonStorey55();
            string url = AssetStoreClient.APIUrl("/assets/list");

            using (List <AssetStoreAsset> .Enumerator enumerator = assets.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AssetStoreAsset current = enumerator.Current;
                    url = url + "&id=" + current.id.ToString();
                }
            }
            // ISSUE: reference to a compiler-generated field
            infoCAnonStorey55.r = new AssetStoreAssetsInfo(callback, assets);
            // ISSUE: reference to a compiler-generated method
            return(AssetStoreClient.CreateJSONRequest(url, new AssetStoreClient.DoneCallback(infoCAnonStorey55.\u003C\u003Em__93)));
        }
Exemple #22
0
        public override string GetInfoString()
        {
            EditorWrapper   previewEditor = this.previewEditor;
            AssetStoreAsset firstAsset    = AssetStoreAssetSelection.GetFirstAsset();
            string          result;

            if (firstAsset == null)
            {
                result = "No item selected";
            }
            else if (previewEditor != null && firstAsset.HasLivePreview)
            {
                result = previewEditor.GetInfoString();
            }
            else
            {
                result = "";
            }
            return(result);
        }
Exemple #23
0
        public override void OnInteractivePreviewGUI(Rect r, GUIStyle background)
        {
            EditorWrapper editor = previewEditor;

            if (editor != null)
            {
                editor.OnInteractivePreviewGUI(r, background);
            }

            // If the live preview is not available yes the show a spinner
            AssetStoreAsset a = AssetStoreAssetSelection.GetFirstAsset();

            if (a != null && !a.HasLivePreview && !string.IsNullOrEmpty(a.dynamicPreviewURL))
            {
                GUIContent c = StatusWheel;
                r.y += (r.height - c.image.height) / 2f;
                r.x += (r.width - c.image.width) / 2f;
                GUI.Label(r, StatusWheel);
                Repaint();
            }
        }
            void DrawIcon(Rect position, AssetStoreAsset assetStoreResource)
            {
                // bool selected = !AssetStoreAssetSelection.Empty && AssetStoreAssetSelection.ContainsAsset (assetStoreResource.id);
                bool selected = false; // labels have selection rendering only

                m_Content.text = null;

                AssetStorePreviewManager.CachedAssetStoreImage icon = GetIconForAssetStoreAsset(assetStoreResource);

                if (icon == null)
                {
                    // Draw static preview bg color as bg for icons that do not fill the entire rect (mini icons and non-square textures)
                    // s_Styles.previewBg.Draw (position, GUIContent.none, false, false, false, false);

                    // Use builtin type icon
                    Texture2D iconImage = InternalEditorUtility.GetIconForFile(assetStoreResource.name);
                    s_Styles.resultsGrid.Draw(position, iconImage, false, false, selected, selected);
                }
                else
                {
                    // Fade in
                    m_Content.image = icon.image;
                    Color c        = icon.color;
                    Color oldColor = GUI.color;
                    if (c.a != 1.0f)
                    {
                        GUI.color = c;
                    }
                    s_Styles.resultsGrid.Draw(position, m_Content, false, false, selected, selected);
                    if (c.a != 1.0f)
                    {
                        GUI.color = oldColor;
                        // The icon is not entirely faded in yet. Schedule a repaint
                        NeedsRepaint = true;
                    }

                    DrawDropShadowOverlay(position, selected, false, false);
                }
            }
 public static AssetStoreInstaBuyWindow ShowAssetStoreInstaBuyWindow(AssetStoreAsset asset, string purchaseMessage, string paymentMethodCard, string paymentMethodExpire, string priceText)
 {
   AssetStoreInstaBuyWindow windowWithRect = EditorWindow.GetWindowWithRect<AssetStoreInstaBuyWindow>(new Rect(100f, 100f, 400f, 160f), true, "Buy package from Asset Store");
   if (windowWithRect.m_Purchasing != AssetStoreInstaBuyWindow.PurchaseStatus.Init)
   {
     EditorUtility.DisplayDialog("Download in progress", "There is already a package download in progress. You can only have one download running at a time", "Close");
     return windowWithRect;
   }
   windowWithRect.position = new Rect(100f, 100f, 400f, 160f);
   windowWithRect.m_Parent.window.m_DontSaveToLayout = true;
   windowWithRect.m_Asset = asset;
   windowWithRect.m_Password = string.Empty;
   windowWithRect.m_Message = string.Empty;
   windowWithRect.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Init;
   windowWithRect.m_NextAllowedBuildRequestTime = 0.0;
   windowWithRect.m_BuildAttempts = 0;
   windowWithRect.m_PurchaseMessage = purchaseMessage;
   windowWithRect.m_PaymentMethodCard = paymentMethodCard;
   windowWithRect.m_PaymentMethodExpire = paymentMethodExpire;
   windowWithRect.m_PriceText = priceText;
   Analytics.Track(string.Format("/AssetStore/ShowInstaBuy/{0}/{1}", (object) windowWithRect.m_Asset.packageID, (object) windowWithRect.m_Asset.id));
   return windowWithRect;
 }
Exemple #26
0
        public void OnDownloadProgress(string id, string message, int bytes, int total)
        {
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();

            if (firstAsset != null)
            {
                AssetStoreAsset.PreviewInfo previewInfo = firstAsset.previewInfo;
                if (previewInfo != null)
                {
                    if (!(firstAsset.packageID.ToString() != id))
                    {
                        if ((message == "downloading" || message == "connecting") && !AssetStoreAssetInspector.OfflineNoticeEnabled)
                        {
                            previewInfo.downloadProgress = (float)bytes / (float)total;
                        }
                        else
                        {
                            previewInfo.downloadProgress = -1f;
                        }
                        base.Repaint();
                    }
                }
            }
        }
Exemple #27
0
        public void Update()
        {
            // Repaint if asset has changed.
            // This has to be done here because the .target is always set to
            // this inspector when inspecting asset store assets.
            AssetStoreAsset a           = AssetStoreAssetSelection.GetFirstAsset();
            bool            hasProgress = a != null && a.previewInfo != null && (a.previewInfo.buildProgress >= 0f || a.previewInfo.downloadProgress >= 0f);

            if ((a == null && lastAssetID != 0) ||
                (a != null && lastAssetID != a.id) ||
                hasProgress)
            {
                lastAssetID = a == null ? 0 : a.id;
                Repaint();
            }

            // Repaint when the main asset of a possibly downloaded bundle is ready for preview
            if (a != null && a.previewBundle != null)
            {
                a.previewBundle.Unload(false);
                a.previewBundle = null;
                Repaint();
            }
        }
Exemple #28
0
        public static AssetStoreInstaBuyWindow ShowAssetStoreInstaBuyWindow(AssetStoreAsset asset, string purchaseMessage, string paymentMethodCard, string paymentMethodExpire, string priceText)
        {
            AssetStoreInstaBuyWindow windowWithRect = EditorWindow.GetWindowWithRect <AssetStoreInstaBuyWindow>(new Rect(100f, 100f, 400f, 160f), true, "Buy package from Asset Store");

            if (windowWithRect.m_Purchasing != AssetStoreInstaBuyWindow.PurchaseStatus.Init)
            {
                EditorUtility.DisplayDialog("Download in progress", "There is already a package download in progress. You can only have one download running at a time", "Close");
                return(windowWithRect);
            }
            windowWithRect.position = new Rect(100f, 100f, 400f, 160f);
            windowWithRect.m_Parent.window.m_DontSaveToLayout = true;
            windowWithRect.m_Asset      = asset;
            windowWithRect.m_Password   = string.Empty;
            windowWithRect.m_Message    = string.Empty;
            windowWithRect.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Init;
            windowWithRect.m_NextAllowedBuildRequestTime = 0.0;
            windowWithRect.m_BuildAttempts       = 0;
            windowWithRect.m_PurchaseMessage     = purchaseMessage;
            windowWithRect.m_PaymentMethodCard   = paymentMethodCard;
            windowWithRect.m_PaymentMethodExpire = paymentMethodExpire;
            windowWithRect.m_PriceText           = priceText;
            Analytics.Track(string.Format("/AssetStore/ShowInstaBuy/{0}/{1}", windowWithRect.m_Asset.packageID, windowWithRect.m_Asset.id));
            return(windowWithRect);
        }
 public static void AddAsset(AssetStoreAsset searchResult, Texture2D placeholderPreviewImage)
 {
 private void PurchaseDeclinedGUI()
 {
   AssetStoreAsset.PreviewInfo previewInfo = this.m_Asset.previewInfo;
   GUILayout.BeginHorizontal();
   GUILayout.Space(5f);
   GUILayout.Label(AssetStoreInstaBuyWindow.s_AssetStoreLogo, GUIStyle.none, new GUILayoutOption[1]
   {
     GUILayout.ExpandWidth(false)
   });
   GUILayout.BeginVertical();
   GUILayout.Label("Purchase declined", EditorStyles.boldLabel, new GUILayoutOption[0]);
   GUILayout.Label("No money has been drawn from you credit card");
   bool flag = this.m_Message != null && this.m_Message != string.Empty;
   float height = (float) (160 + (!flag ? 0 : 20));
   if ((double) height != (double) this.position.height)
     this.position = new Rect(this.position.x, this.position.y, this.position.width, height);
   if (flag)
     GUILayout.Label(this.m_Message, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
   GUILayout.Label("Package: " + previewInfo.packageName, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
   GUILayout.EndVertical();
   GUILayout.Space(5f);
   GUILayout.EndHorizontal();
   GUILayout.FlexibleSpace();
   GUILayout.BeginHorizontal();
   GUILayout.Space(8f);
   GUILayout.FlexibleSpace();
   if (GUILayout.Button("Close"))
   {
     Analytics.Track(string.Format("/AssetStore/DeclinedAbort/{0}/{1}", (object) this.m_Asset.packageID, (object) this.m_Asset.id));
     this.m_Asset = (AssetStoreAsset) null;
     this.Close();
   }
   GUILayout.Space(5f);
   if (GUILayout.Button("Put to basket"))
   {
     AssetStore.Open(string.Format("content/{0}/basketpurchase", (object) this.m_Asset.packageID));
     Analytics.Track(string.Format("/AssetStore/DeclinedPutToBasket/{0}/{1}", (object) this.m_Asset.packageID, (object) this.m_Asset.id));
     this.m_Asset = (AssetStoreAsset) null;
     this.Close();
   }
   GUILayout.Space(5f);
   GUILayout.EndHorizontal();
   GUILayout.Space(5f);
 }
 private void LoginAndImport(AssetStoreAsset asset)
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: reference to a compiler-generated method
   AssetStoreLoginWindow.Login("Please login to the Asset Store in order to get download information for the package.", new AssetStoreLoginWindow.LoginCallback(new AssetStoreAssetInspector.\u003CLoginAndImport\u003Ec__AnonStorey82()
   {
     asset = asset
   }.\u003C\u003Em__140));
 }
		internal static AsyncHTTPClient BuildPackage(AssetStoreAsset asset, AssetStoreResultBase<BuildPackageResult>.Callback callback)
		{
			string url = AssetStoreClient.APIUrl("/content/download/" + asset.packageID.ToString());
			BuildPackageResult r = new BuildPackageResult(asset, callback);
			return AssetStoreClient.CreateJSONRequest(url, delegate(AssetStoreResponse ar)
			{
				r.Parse(ar);
			});
		}
		public static void AddAsset(AssetStoreAsset searchResult, Texture2D placeholderPreviewImage)
		{
			if (placeholderPreviewImage != null)
			{
				searchResult.previewImage = AssetStoreAssetSelection.ScaleImage(placeholderPreviewImage, 256, 256);
			}
			searchResult.previewInfo = null;
			searchResult.previewBundleRequest = null;
			if (!string.IsNullOrEmpty(searchResult.dynamicPreviewURL) && searchResult.previewBundle == null)
			{
				searchResult.disposed = false;
				AsyncHTTPClient client = new AsyncHTTPClient(searchResult.dynamicPreviewURL);
				client.doneCallback = delegate(AsyncHTTPClient c)
				{
					if (!client.IsSuccess())
					{
						Console.WriteLine("Error downloading dynamic preview: " + client.text);
						searchResult.dynamicPreviewURL = null;
						AssetStoreAssetSelection.DownloadStaticPreview(searchResult);
						return;
					}
					AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();
					if (searchResult.disposed || firstAsset == null || searchResult.id != firstAsset.id)
					{
						return;
					}
					try
					{
						AssetBundleCreateRequest cr = AssetBundle.CreateFromMemory(c.bytes);
						cr.DisableCompatibilityChecks();
						searchResult.previewBundleRequest = cr;
						EditorApplication.CallbackFunction callback = null;
						double startTime = EditorApplication.timeSinceStartup;
						callback = delegate
						{
							AssetStoreUtils.UpdatePreloading();
							if (!cr.isDone)
							{
								double timeSinceStartup = EditorApplication.timeSinceStartup;
								if (timeSinceStartup - startTime > 10.0)
								{
									EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, callback);
									Console.WriteLine("Timed out fetch live preview bundle " + (searchResult.dynamicPreviewURL ?? "<n/a>"));
								}
								return;
							}
							EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, callback);
							AssetStoreAsset firstAsset2 = AssetStoreAssetSelection.GetFirstAsset();
							if (!searchResult.disposed && firstAsset2 != null && searchResult.id == firstAsset2.id)
							{
								searchResult.previewBundle = cr.assetBundle;
								if (cr.assetBundle == null || cr.assetBundle.mainAsset == null)
								{
									searchResult.dynamicPreviewURL = null;
									AssetStoreAssetSelection.DownloadStaticPreview(searchResult);
								}
								else
								{
									searchResult.previewAsset = searchResult.previewBundle.mainAsset;
								}
							}
						};
						EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(EditorApplication.update, callback);
					}
					catch (Exception ex)
					{
						Console.Write(ex.Message);
						Debug.Log(ex.Message);
					}
				};
				client.Begin();
			}
			else
			{
				if (!string.IsNullOrEmpty(searchResult.staticPreviewURL))
				{
					AssetStoreAssetSelection.DownloadStaticPreview(searchResult);
				}
			}
			AssetStoreAssetSelection.AddAssetInternal(searchResult);
			AssetStoreAssetSelection.RefreshFromServer(null);
		}
 internal static AsyncHTTPClient BuildPackage(AssetStoreAsset asset, AssetStoreResultBase<BuildPackageResult>.Callback callback)
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   AssetStoreClient.\u003CBuildPackage\u003Ec__AnonStorey57 packageCAnonStorey57 = new AssetStoreClient.\u003CBuildPackage\u003Ec__AnonStorey57();
   string url = AssetStoreClient.APIUrl("/content/download/" + asset.packageID.ToString());
   // ISSUE: reference to a compiler-generated field
   packageCAnonStorey57.r = new BuildPackageResult(asset, callback);
   // ISSUE: reference to a compiler-generated method
   return AssetStoreClient.CreateJSONRequest(url, new AssetStoreClient.DoneCallback(packageCAnonStorey57.\u003C\u003Em__95));
 }
		private void ImportPackage(AssetStoreAsset asset)
		{
			if (AssetStoreAssetInspector.paymentAvailability == AssetStoreAssetInspector.PaymentAvailability.AnonymousUser)
			{
				this.LoginAndImport(asset);
			}
			else
			{
				AssetStoreInstaBuyWindow.ShowAssetStoreInstaBuyWindowBuilding(asset);
			}
		}
 internal BuildPackageResult(AssetStoreAsset asset, Callback c) : base(c)
 {
     this.asset = asset;
     packageID  = -1;
 }
 private void SetSelection(AssetStoreAsset assetStoreResult, bool doubleClicked)
 {
   this.m_State.m_SelectedInstanceIDs.Clear();
   this.selectedAssetStoreAsset = true;
   AssetStoreAssetSelection.Clear();
   Texture2D image = AssetStorePreviewManager.TextureFromUrl(assetStoreResult.staticPreviewURL, assetStoreResult.name, this.gridSize, ObjectListArea.s_Styles.resultsGridLabel, ObjectListArea.s_Styles.resultsGrid, true).image;
   AssetStoreAssetSelection.AddAsset(assetStoreResult, image);
   if (this.m_ItemSelectedCallback == null)
     return;
   this.Repaint();
   this.m_ItemSelectedCallback(doubleClicked);
 }
Exemple #38
0
 private void LoginAndImport(AssetStoreAsset asset)
 {
 private void DrawLabel(Rect position, AssetStoreAsset assetStoreResource, bool selected)
 {
   if (this.ListMode)
   {
     position.width = Mathf.Max(position.width, 500f);
     this.m_Content.text = assetStoreResource.displayName;
     this.m_Content.image = (Texture) InternalEditorUtility.GetIconForFile(assetStoreResource.name);
     ObjectListArea.s_Styles.resultsLabel.Draw(position, this.m_Content, false, false, selected, selected);
   }
   else
   {
     string croppedLabelText = this.m_Owner.GetCroppedLabelText(assetStoreResource.id + 10000000, assetStoreResource.displayName, position.width);
     position.height -= ObjectListArea.s_Styles.resultsGridLabel.fixedHeight;
     ObjectListArea.s_Styles.resultsGridLabel.Draw(new Rect(position.x, position.yMax + 1f, position.width - 1f, ObjectListArea.s_Styles.resultsGridLabel.fixedHeight), croppedLabelText, false, false, selected, this.m_Owner.HasFocus());
   }
 }
 private void DrawIcon(Rect position, AssetStoreAsset assetStoreResource)
 {
   bool flag = false;
   this.m_Content.text = (string) null;
   AssetStorePreviewManager.CachedAssetStoreImage forAssetStoreAsset = this.GetIconForAssetStoreAsset(assetStoreResource);
   if (forAssetStoreAsset == null)
   {
     Texture2D iconForFile = InternalEditorUtility.GetIconForFile(assetStoreResource.name);
     ObjectListArea.s_Styles.resultsGrid.Draw(position, (Texture) iconForFile, false, false, flag, flag);
   }
   else
   {
     this.m_Content.image = (Texture) forAssetStoreAsset.image;
     Color color1 = forAssetStoreAsset.color;
     Color color2 = GUI.color;
     if ((double) color1.a != 1.0)
       GUI.color = color1;
     ObjectListArea.s_Styles.resultsGrid.Draw(position, this.m_Content, false, false, flag, flag);
     if ((double) color1.a != 1.0)
     {
       GUI.color = color2;
       this.NeedsRepaint = true;
     }
     this.DrawDropShadowOverlay(position, flag, false, false);
   }
 }
 private AssetStorePreviewManager.CachedAssetStoreImage GetIconForAssetStoreAsset(AssetStoreAsset assetStoreResource)
 {
   if (string.IsNullOrEmpty(assetStoreResource.staticPreviewURL))
     return (AssetStorePreviewManager.CachedAssetStoreImage) null;
   ++this.m_Owner.LastScrollTime;
   return AssetStorePreviewManager.TextureFromUrl(assetStoreResource.staticPreviewURL, assetStoreResource.name, this.m_Owner.gridSize, ObjectListArea.s_Styles.resultsGridLabel, ObjectListArea.s_Styles.previewBg, false);
 }
Exemple #42
0
        private void PasswordGUI()
        {
            AssetStoreAsset.PreviewInfo previewInfo = this.m_Asset.previewInfo;
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(5f);
            GUILayout.Label(AssetStoreInstaBuyWindow.s_AssetStoreLogo, GUIStyle.none, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            });
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Label("Complete purchase by entering your AssetStore password", EditorStyles.boldLabel, new GUILayoutOption[0]);
            bool  flag  = this.m_PurchaseMessage != null && this.m_PurchaseMessage != string.Empty;
            bool  flag2 = this.m_Message != null && this.m_Message != string.Empty;
            float num   = (float)(160 + ((!flag) ? 0 : 20) + ((!flag2) ? 0 : 20));

            if (num != base.position.height)
            {
                base.position = new Rect(base.position.x, base.position.y, base.position.width, num);
            }
            if (flag)
            {
                GUILayout.Label(this.m_PurchaseMessage, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
            }
            if (flag2)
            {
                Color color = GUI.color;
                GUI.color = Color.red;
                GUILayout.Label(this.m_Message, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
                GUI.color = color;
            }
            GUILayout.Label("Package: " + previewInfo.packageName, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
            string text = string.Format("Credit card: {0} (expires {1})", this.m_PaymentMethodCard, this.m_PaymentMethodExpire);

            GUILayout.Label(text, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
            GUILayout.Space(8f);
            EditorGUILayout.LabelField("Amount", this.m_PriceText, new GUILayoutOption[0]);
            this.m_Password = EditorGUILayout.PasswordField("Password", this.m_Password, new GUILayoutOption[0]);
            GUILayout.EndVertical();
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(8f);
            if (GUILayout.Button("Just put to basket...", new GUILayoutOption[0]))
            {
                AssetStore.Open(string.Format("content/{0}/basketpurchase", this.m_Asset.packageID));
                Analytics.Track(string.Format("/AssetStore/PutToBasket/{0}/{1}", this.m_Asset.packageID, this.m_Asset.id));
                this.m_Asset = null;
                base.Close();
                GUIUtility.ExitGUI();
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Cancel", new GUILayoutOption[0]))
            {
                Analytics.Track(string.Format("/AssetStore/CancelInstaBuy/{0}/{1}", this.m_Asset.packageID, this.m_Asset.id));
                this.m_Asset = null;
                base.Close();
                GUIUtility.ExitGUI();
            }
            GUILayout.Space(5f);
            if (GUILayout.Button("Complete purchase", new GUILayoutOption[0]))
            {
                this.CompletePurchase();
            }
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.Space(5f);
        }
 private void PurchaseSuccessGUI()
 {
   AssetStoreAsset.PreviewInfo previewInfo = this.m_Asset.previewInfo;
   GUILayout.BeginHorizontal();
   GUILayout.Space(5f);
   GUILayout.Label(AssetStoreInstaBuyWindow.s_AssetStoreLogo, GUIStyle.none, new GUILayoutOption[1]
   {
     GUILayout.ExpandWidth(false)
   });
   GUILayout.BeginVertical();
   GUILayout.Label("Purchase completed succesfully", EditorStyles.boldLabel, new GUILayoutOption[0]);
   GUILayout.Label("You will receive a receipt in your email soon.");
   bool flag = this.m_Message != null && this.m_Message != string.Empty;
   float height = (float) (160 + (!flag ? 0 : 20));
   if ((double) height != (double) this.position.height)
     this.position = new Rect(this.position.x, this.position.y, this.position.width, height);
   if (flag)
     GUILayout.Label(this.m_Message, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
   GUILayout.Label("Package: " + previewInfo.packageName, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
   GUILayout.EndVertical();
   GUILayout.Space(5f);
   GUILayout.EndHorizontal();
   GUILayout.FlexibleSpace();
   GUILayout.BeginHorizontal();
   GUILayout.Space(8f);
   GUILayout.FlexibleSpace();
   if (GUILayout.Button("Close"))
   {
     Analytics.Track(string.Format("/AssetStore/PurchaseOk/{0}/{1}", (object) this.m_Asset.packageID, (object) this.m_Asset.id));
     this.m_Asset = (AssetStoreAsset) null;
     this.Close();
   }
   GUILayout.Space(5f);
   if (GUILayout.Button("Import package"))
   {
     Analytics.Track(string.Format("/AssetStore/PurchaseOkImport/{0}/{1}", (object) this.m_Asset.packageID, (object) this.m_Asset.id));
     this.m_BuildAttempts = 1;
     this.m_Asset.previewInfo.buildProgress = 0.0f;
     this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.StartBuild;
   }
   GUILayout.Space(5f);
   GUILayout.EndHorizontal();
   GUILayout.Space(5f);
 }
 private static void DownloadStaticPreview(AssetStoreAsset searchResult)
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   AssetStoreAssetSelection.\u003CDownloadStaticPreview\u003Ec__AnonStorey50 previewCAnonStorey50 = new AssetStoreAssetSelection.\u003CDownloadStaticPreview\u003Ec__AnonStorey50();
   // ISSUE: reference to a compiler-generated field
   previewCAnonStorey50.searchResult = searchResult;
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   previewCAnonStorey50.client = new AsyncHTTPClient(previewCAnonStorey50.searchResult.staticPreviewURL);
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated method
   previewCAnonStorey50.client.doneCallback = new AsyncHTTPClient.DoneCallback(previewCAnonStorey50.\u003C\u003Em__8B);
   // ISSUE: reference to a compiler-generated field
   previewCAnonStorey50.client.Begin();
 }
		public static void OpenItemInAssetStore(AssetStoreAsset activeAsset)
		{
			if (activeAsset.id != 0)
			{
				AssetStore.Open(string.Format("content/{0}?assetID={1}", activeAsset.packageID, activeAsset.id));
				Analytics.Track(string.Format("/AssetStore/ViewInStore/{0}/{1}", activeAsset.packageID, activeAsset.id));
			}
		}
 internal static void AddAssetInternal(AssetStoreAsset searchResult)
 {
   if (AssetStoreAssetSelection.s_SelectedAssets == null)
     AssetStoreAssetSelection.s_SelectedAssets = new Dictionary<int, AssetStoreAsset>();
   AssetStoreAssetSelection.s_SelectedAssets[searchResult.id] = searchResult;
 }
Exemple #47
0
        public override void OnInspectorGUI()
        {
            if (AssetStoreAssetInspector.styles == null)
            {
                AssetStoreAssetInspector.s_SharedAssetStoreAssetInspector = this;
                AssetStoreAssetInspector.styles = new AssetStoreAssetInspector.Styles();
            }
            AssetStoreAsset firstAsset = AssetStoreAssetSelection.GetFirstAsset();

            AssetStoreAsset.PreviewInfo previewInfo = null;
            if (firstAsset != null)
            {
                previewInfo = firstAsset.previewInfo;
            }
            if (firstAsset != null)
            {
                base.target.name = string.Format("Asset Store: {0}", firstAsset.name);
            }
            else
            {
                base.target.name = "Asset Store";
            }
            EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            bool enabled = GUI.enabled;

            GUI.enabled = (firstAsset != null && firstAsset.packageID != 0);
            if (AssetStoreAssetInspector.OfflineNoticeEnabled)
            {
                Color color = GUI.color;
                GUI.color = Color.yellow;
                GUILayout.Label("Network is offline", new GUILayoutOption[0]);
                GUI.color = color;
            }
            if (firstAsset != null)
            {
                string label = (firstAsset.className != null) ? firstAsset.className.Split(new char[]
                {
                    ' '
                }, 2)[0] : "";
                bool flag = firstAsset.id == -firstAsset.packageID;
                if (flag)
                {
                    label = "Package";
                }
                if (firstAsset.HasLivePreview)
                {
                    label = firstAsset.Preview.GetType().Name;
                }
                EditorGUILayout.LabelField("Type", label, new GUILayoutOption[0]);
                if (flag)
                {
                    this.packageInfoShown = true;
                }
                else
                {
                    EditorGUILayout.Separator();
                    this.packageInfoShown = EditorGUILayout.Foldout(this.packageInfoShown, "Part of package", true);
                }
                if (this.packageInfoShown)
                {
                    EditorGUILayout.LabelField("Name", (previewInfo != null) ? previewInfo.packageName : "-", new GUILayoutOption[0]);
                    EditorGUILayout.LabelField("Version", (previewInfo != null) ? previewInfo.packageVersion : "-", new GUILayoutOption[0]);
                    string label2 = (previewInfo != null) ? ((firstAsset.price == null || !(firstAsset.price != "")) ? "free" : firstAsset.price) : "-";
                    EditorGUILayout.LabelField("Price", label2, new GUILayoutOption[0]);
                    string label3 = (previewInfo == null || previewInfo.packageRating < 0) ? "-" : (previewInfo.packageRating.ToString() + " of 5");
                    EditorGUILayout.LabelField("Rating", label3, new GUILayoutOption[0]);
                    EditorGUILayout.LabelField("Size", (previewInfo != null) ? AssetStoreAssetInspector.intToSizeString(previewInfo.packageSize) : "-", new GUILayoutOption[0]);
                    string label4 = (previewInfo == null || previewInfo.packageAssetCount < 0) ? "-" : previewInfo.packageAssetCount.ToString();
                    EditorGUILayout.LabelField("Asset count", label4, new GUILayoutOption[0]);
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    EditorGUILayout.PrefixLabel("Web page");
                    bool flag2    = previewInfo != null && previewInfo.packageShortUrl != null && previewInfo.packageShortUrl != "";
                    bool enabled2 = GUI.enabled;
                    GUI.enabled = flag2;
                    if (GUILayout.Button((!flag2) ? EditorGUIUtility.TempContent("-") : new GUIContent(previewInfo.packageShortUrl, "View in browser"), AssetStoreAssetInspector.styles.link, new GUILayoutOption[0]))
                    {
                        Application.OpenURL(previewInfo.packageShortUrl);
                    }
                    if (GUI.enabled)
                    {
                        EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
                    }
                    GUI.enabled = enabled2;
                    GUILayout.EndHorizontal();
                    EditorGUILayout.LabelField("Publisher", (previewInfo != null) ? previewInfo.publisherName : "-", new GUILayoutOption[0]);
                }
                if (firstAsset.id != 0)
                {
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayout.FlexibleSpace();
                    string text;
                    if (previewInfo != null && previewInfo.isDownloadable)
                    {
                        text = "Import package";
                    }
                    else
                    {
                        text = "Buy for " + firstAsset.price;
                    }
                    bool enabled3 = GUI.enabled;
                    bool flag3    = previewInfo != null && previewInfo.buildProgress >= 0f;
                    bool flag4    = previewInfo != null && previewInfo.downloadProgress >= 0f;
                    if (flag3 || flag4 || previewInfo == null)
                    {
                        text        = "";
                        GUI.enabled = false;
                    }
                    if (GUILayout.Button(text, new GUILayoutOption[]
                    {
                        GUILayout.Height(40f),
                        GUILayout.Width(120f)
                    }))
                    {
                        if (previewInfo.isDownloadable)
                        {
                            this.ImportPackage(firstAsset);
                        }
                        else
                        {
                            this.InitiateBuySelected();
                        }
                        GUIUtility.ExitGUI();
                    }
                    if (Event.current.type == EventType.Repaint)
                    {
                        Rect lastRect = GUILayoutUtility.GetLastRect();
                        lastRect.height -= 4f;
                        float width = lastRect.width;
                        lastRect.width = lastRect.height;
                        lastRect.y    += 2f;
                        lastRect.x    += 2f;
                        if (flag3 || flag4)
                        {
                            lastRect.width = width - lastRect.height - 4f;
                            lastRect.x    += lastRect.height;
                            EditorGUI.ProgressBar(lastRect, (!flag4) ? previewInfo.buildProgress : previewInfo.downloadProgress, (!flag4) ? "Building" : "Downloading");
                        }
                    }
                    GUI.enabled = enabled3;
                    GUILayout.Space(4f);
                    if (GUILayout.Button("Open Asset Store", new GUILayoutOption[]
                    {
                        GUILayout.Height(40f),
                        GUILayout.Width(120f)
                    }))
                    {
                        AssetStoreAssetInspector.OpenItemInAssetStore(firstAsset);
                        GUIUtility.ExitGUI();
                    }
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();
                }
                GUILayout.FlexibleSpace();
            }
            EditorWrapper previewEditor = this.previewEditor;

            if (previewEditor != null && firstAsset != null && firstAsset.HasLivePreview)
            {
                previewEditor.OnAssetStoreInspectorGUI();
            }
            GUI.enabled = enabled;
            EditorGUILayout.EndVertical();
        }
 internal BuildPackageResult(AssetStoreAsset asset, AssetStoreResultBase <BuildPackageResult> .Callback c)
     : base(c)
 {
     this.asset     = asset;
     this.packageID = -1;
 }
		private static void DownloadStaticPreview(AssetStoreAsset searchResult)
		{
			AsyncHTTPClient client = new AsyncHTTPClient(searchResult.staticPreviewURL);
			client.doneCallback = delegate(AsyncHTTPClient c)
			{
				if (!client.IsSuccess())
				{
					Console.WriteLine("Error downloading static preview: " + client.text);
					return;
				}
				Texture2D texture = c.texture;
				Texture2D texture2D = new Texture2D(texture.width, texture.height, TextureFormat.RGB24, false, true);
				AssetStorePreviewManager.ScaleImage(texture2D.width, texture2D.height, texture, texture2D, null);
				searchResult.previewImage = texture2D;
				UnityEngine.Object.DestroyImmediate(texture);
				AssetStoreAssetInspector.Instance.Repaint();
			};
			client.Begin();
		}
 private void PasswordGUI()
 {
   AssetStoreAsset.PreviewInfo previewInfo = this.m_Asset.previewInfo;
   GUILayout.BeginHorizontal();
   GUILayout.Space(5f);
   GUILayout.Label(AssetStoreInstaBuyWindow.s_AssetStoreLogo, GUIStyle.none, new GUILayoutOption[1]
   {
     GUILayout.ExpandWidth(false)
   });
   GUILayout.BeginVertical();
   GUILayout.Label("Complete purchase by entering your AssetStore password", EditorStyles.boldLabel, new GUILayoutOption[0]);
   bool flag1 = this.m_PurchaseMessage != null && this.m_PurchaseMessage != string.Empty;
   bool flag2 = this.m_Message != null && this.m_Message != string.Empty;
   float height = (float) (160 + (!flag1 ? 0 : 20) + (!flag2 ? 0 : 20));
   if ((double) height != (double) this.position.height)
     this.position = new Rect(this.position.x, this.position.y, this.position.width, height);
   if (flag1)
     GUILayout.Label(this.m_PurchaseMessage, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
   if (flag2)
   {
     Color color = GUI.color;
     GUI.color = Color.red;
     GUILayout.Label(this.m_Message, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
     GUI.color = color;
   }
   GUILayout.Label("Package: " + previewInfo.packageName, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
   GUILayout.Label(string.Format("Credit card: {0} (expires {1})", (object) this.m_PaymentMethodCard, (object) this.m_PaymentMethodExpire), EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
   GUILayout.Space(8f);
   EditorGUILayout.LabelField("Amount", this.m_PriceText, new GUILayoutOption[0]);
   this.m_Password = EditorGUILayout.PasswordField("Password", this.m_Password, new GUILayoutOption[0]);
   GUILayout.EndVertical();
   GUILayout.Space(5f);
   GUILayout.EndHorizontal();
   GUILayout.FlexibleSpace();
   GUILayout.BeginHorizontal();
   GUILayout.Space(8f);
   if (GUILayout.Button("Just put to basket..."))
   {
     AssetStore.Open(string.Format("content/{0}/basketpurchase", (object) this.m_Asset.packageID));
     Analytics.Track(string.Format("/AssetStore/PutToBasket/{0}/{1}", (object) this.m_Asset.packageID, (object) this.m_Asset.id));
     this.m_Asset = (AssetStoreAsset) null;
     this.Close();
     GUIUtility.ExitGUI();
   }
   GUILayout.FlexibleSpace();
   if (GUILayout.Button("Cancel"))
   {
     Analytics.Track(string.Format("/AssetStore/CancelInstaBuy/{0}/{1}", (object) this.m_Asset.packageID, (object) this.m_Asset.id));
     this.m_Asset = (AssetStoreAsset) null;
     this.Close();
     GUIUtility.ExitGUI();
   }
   GUILayout.Space(5f);
   if (GUILayout.Button("Complete purchase"))
     this.CompletePurchase();
   GUILayout.Space(5f);
   GUILayout.EndHorizontal();
   GUILayout.Space(5f);
 }
		private void LoginAndImport(AssetStoreAsset asset)
		{
			AssetStoreLoginWindow.Login("Please login to the Asset Store in order to get download information for the package.", delegate(string errorMessage)
			{
				if (errorMessage != null)
				{
					return;
				}
				AssetStoreAssetSelection.RefreshFromServer(delegate
				{
					AssetStoreInstaBuyWindow.ShowAssetStoreInstaBuyWindowBuilding(asset);
				});
			});
		}