示例#1
0
        void DownloadPackage()
        {
            AssetStoreAsset.PreviewInfo item = m_Asset.previewInfo;
            m_Purchasing          = PurchaseStatus.Downloading;
            item.downloadProgress = 0;
            item.buildProgress    = -1f;

            AssetStoreContext.Download(m_Asset.packageID.ToString(), item.packageUrl, item.encryptionKey, item.packageName,
                                       item.publisherName, item.categoryName, delegate(string id, string status, int bytes, int total) {
                if (this == null)
                {
                    return;                   // aborted
                }
                item.downloadProgress = -1f;
                if (status != "ok")
                {
                    Debug.LogErrorFormat("Error downloading package {0} ({1})", item.packageName, id);
                    Debug.LogError(status);
                    Close();
                    return;
                }

                if (m_Asset == null || m_Purchasing != PurchaseStatus.Downloading || id != m_Asset.packageID.ToString())
                {
                    // Aborted
                    Close();
                }

                if (!AssetStoreContext.OpenPackageInternal(id))
                {
                    Debug.LogErrorFormat("Error importing package {0} ({1})", item.packageName, id);
                }
                Close();
            });
        }
示例#2
0
        private void DownloadingGUI()
        {
            AssetStoreAsset.PreviewInfo previewInfo = this.m_Asset.previewInfo;
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(5f);
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
            GUILayout.Label(s_AssetStoreLogo, GUIStyle.none, options);
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            string text = "Importing";

            GUILayout.Label(text, EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUILayout.Label("Package: " + previewInfo.packageName, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
            GUILayout.Label("    ", new GUILayoutOption[0]);
            if (Event.current.type == EventType.Repaint)
            {
                Rect lastRect = GUILayoutUtility.GetLastRect();
                lastRect.height++;
                bool flag = previewInfo.downloadProgress >= 0f;
                EditorGUI.ProgressBar(lastRect, !flag ? previewInfo.buildProgress : previewInfo.downloadProgress, !flag ? "Building" : "Downloading");
            }
            GUILayout.EndVertical();
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Abort", new GUILayoutOption[0]))
            {
                base.Close();
            }
            GUILayout.Space(5f);
            GUILayout.EndHorizontal();
            GUILayout.Space(5f);
        }
 private void DownloadingGUI()
 {
     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("Importing", EditorStyles.boldLabel, new GUILayoutOption[0]);
     GUILayout.Label("Package: " + previewInfo.packageName, EditorStyles.wordWrappedLabel, new GUILayoutOption[0]);
     GUILayout.Label("    ");
     if (Event.current.type == EventType.Repaint)
     {
         Rect lastRect = GUILayoutUtility.GetLastRect();
         ++lastRect.height;
         bool flag = (double)previewInfo.downloadProgress >= 0.0;
         EditorGUI.ProgressBar(lastRect, !flag ? previewInfo.buildProgress : previewInfo.downloadProgress, !flag ? "Building" : "Downloading");
     }
     GUILayout.EndVertical();
     GUILayout.Space(5f);
     GUILayout.EndHorizontal();
     GUILayout.FlexibleSpace();
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     if (GUILayout.Button("Abort"))
     {
         this.Close();
     }
     GUILayout.Space(5f);
     GUILayout.EndHorizontal();
     GUILayout.Space(5f);
 }
示例#4
0
        // Callback for curl to call
        public void OnDownloadProgress(string id, string message, int bytes, int total)
        {
            AssetStoreAsset activeAsset = AssetStoreAssetSelection.GetFirstAsset();

            if (activeAsset == null)
            {
                return;
            }
            AssetStoreAsset.PreviewInfo info = activeAsset.previewInfo;
            if (info == null)
            {
                return;
            }

            if (activeAsset.packageID.ToString() != id)
            {
                return;
            }

            if ((message == "downloading" || message == "connecting") && !OfflineNoticeEnabled)
            {
                info.downloadProgress = (float)bytes / (float)total;
            }
            else
            {
                info.downloadProgress = -1f;
            }
            Repaint();
        }
 public void OnDownloadProgress(string id, string message, int bytes, int total)
 {
     AssetStoreAsset.PreviewInfo previewInfo = this.m_Asset != null ? this.m_Asset.previewInfo : (AssetStoreAsset.PreviewInfo)null;
     if (previewInfo == null || this.m_Asset.packageID.ToString() != id)
     {
         return;
     }
     previewInfo.downloadProgress = message == "downloading" || message == "connecting" ? (float)bytes / (float)total : -1f;
     this.Repaint();
 }
示例#6
0
        void PurchaseSuccessGUI()
        {
            AssetStoreAsset.PreviewInfo item = m_Asset.previewInfo;
            GUILayout.BeginHorizontal();
            GUILayout.Space(5);
            GUILayout.Label(s_AssetStoreLogo, GUIStyle.none, GUILayout.ExpandWidth(false));
            GUILayout.BeginVertical();
            GUILayout.Label("Purchase completed succesfully", EditorStyles.boldLabel);
            GUILayout.Label("You will receive a receipt in your email soon.");

            bool  hasMessage = m_Message != null && m_Message != "";
            float newHeight  = kStandardHeight + (hasMessage ? 20 : 0);

            if (newHeight != position.height)
            {
                position = new Rect(position.x, position.y, position.width, newHeight);
            }

            if (hasMessage)
            {
                GUILayout.Label(m_Message, EditorStyles.wordWrappedLabel);
            }

            GUILayout.Label("Package: " + item.packageName, EditorStyles.wordWrappedLabel);

            GUILayout.EndVertical();
            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();
            GUILayout.Space(8);

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close"))
            {
                UsabilityAnalytics.Track(string.Format("/AssetStore/PurchaseOk/{0}/{1}", m_Asset.packageID, m_Asset.id));
                m_Asset = null;
                this.Close();
            }
            GUILayout.Space(5);
            if (GUILayout.Button("Import package"))
            {
                UsabilityAnalytics.Track(string.Format("/AssetStore/PurchaseOkImport/{0}/{1}", m_Asset.packageID, m_Asset.id));
                m_BuildAttempts = 1;
                m_Asset.previewInfo.buildProgress = 0f;
                m_Purchasing = PurchaseStatus.StartBuild;
            }
            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.Space(5);
        }
示例#7
0
 public void OnDisable()
 {
     AssetStoreAsset.PreviewInfo previewInfo = (this.m_Asset != null) ? this.m_Asset.previewInfo : null;
     if (previewInfo != null)
     {
         previewInfo.downloadProgress = -1f;
         previewInfo.buildProgress    = -1f;
     }
     AssetStoreUtils.UnRegisterDownloadDelegate(this);
     this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Init;
 }
示例#8
0
        void BuildPackage()
        {
            AssetStoreAsset.PreviewInfo item = m_Asset.previewInfo;
            if (item == null)
            {
                return;
            }

            if (m_BuildAttempts++ > kMaxPolls)
            {
                EditorUtility.DisplayDialog("Building timed out", "Timed out during building of package", "Close");
                Close();
                return;
            }

            item.downloadProgress = -1f;
            m_Purchasing          = PurchaseStatus.Building;

            AssetStoreClient.BuildPackage(m_Asset, delegate(BuildPackageResult result) {
                if (this == null)
                {
                    return;                   // aborted
                }
                if (result.error != null)
                {
                    Debug.Log(result.error);
                    if (EditorUtility.DisplayDialog("Error building package",
                                                    "The server was unable to build the package. Please re-import.",
                                                    "Ok"))
                    {
                        Close();
                    }
                    return;
                }

                if (m_Asset == null || m_Purchasing != PurchaseStatus.Building || result.packageID != m_Asset.packageID)
                {
                    // Aborted
                    Close();
                }

                string url = result.asset.previewInfo.packageUrl;
                if (url != null && url != "")
                {
                    DownloadPackage();
                }
                else
                {
                    // Retry since package is not done building on server
                    m_Purchasing = PurchaseStatus.StartBuild;
                }
                Repaint();
            });
        }
示例#9
0
 public void OnDisable()
 {
     AssetStoreAsset.PreviewInfo info = m_Asset == null ? null : m_Asset.previewInfo;
     if (info != null)
     {
         info.downloadProgress = -1f;
         info.buildProgress    = -1;
     }
     AssetStoreUtils.UnRegisterDownloadDelegate(this);
     m_Purchasing = PurchaseStatus.Init;
 }
示例#10
0
        void PurchaseDeclinedGUI()
        {
            AssetStoreAsset.PreviewInfo item = m_Asset.previewInfo;
            GUILayout.BeginHorizontal();
            GUILayout.Space(5);
            GUILayout.Label(s_AssetStoreLogo, GUIStyle.none, GUILayout.ExpandWidth(false));
            GUILayout.BeginVertical();
            GUILayout.Label("Purchase declined", EditorStyles.boldLabel);
            GUILayout.Label("No money has been drawn from you credit card");

            bool  hasMessage = m_Message != null && m_Message != "";
            float newHeight  = kStandardHeight + (hasMessage ? 20 : 0);

            if (newHeight != position.height)
            {
                position = new Rect(position.x, position.y, position.width, newHeight);
            }

            if (hasMessage)
            {
                GUILayout.Label(m_Message, EditorStyles.wordWrappedLabel);
            }

            GUILayout.Label("Package: " + item.packageName, EditorStyles.wordWrappedLabel);

            GUILayout.EndVertical();
            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();
            GUILayout.Space(8);

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close"))
            {
                UsabilityAnalytics.Track(string.Format("/AssetStore/DeclinedAbort/{0}/{1}", m_Asset.packageID, m_Asset.id));
                m_Asset = null;
                Close();
            }
            GUILayout.Space(5);
            if (GUILayout.Button("Put to basket"))
            {
                AssetStore.Open(string.Format("content/{0}/basketpurchase", m_Asset.packageID));
                UsabilityAnalytics.Track(string.Format("/AssetStore/DeclinedPutToBasket/{0}/{1}", m_Asset.packageID, m_Asset.id));
                m_Asset = null;
                Close();
            }
            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.Space(5);
        }
 private void BuildPackage()
 {
     AssetStoreAsset.PreviewInfo previewInfo = this.m_Asset.previewInfo;
     if (previewInfo == null)
     {
         return;
     }
     if (this.m_BuildAttempts++ > 150)
     {
         EditorUtility.DisplayDialog("Building timed out", "Timed out during building of package", "Close");
         this.Close();
     }
     else
     {
         previewInfo.downloadProgress = -1f;
         this.m_Purchasing            = AssetStoreInstaBuyWindow.PurchaseStatus.Building;
         AssetStoreClient.BuildPackage(this.m_Asset, (AssetStoreResultBase <BuildPackageResult> .Callback)(result =>
         {
             if ((Object)this == (Object)null)
             {
                 return;
             }
             if (result.error != null)
             {
                 Debug.Log((object)result.error);
                 if (!EditorUtility.DisplayDialog("Error building package", "The server was unable to build the package. Please re-import.", "Ok"))
                 {
                     return;
                 }
                 this.Close();
             }
             else
             {
                 if (this.m_Asset == null || this.m_Purchasing != AssetStoreInstaBuyWindow.PurchaseStatus.Building || result.packageID != this.m_Asset.packageID)
                 {
                     this.Close();
                 }
                 string packageUrl = result.asset.previewInfo.packageUrl;
                 if (packageUrl != null && packageUrl != string.Empty)
                 {
                     this.DownloadPackage();
                 }
                 else
                 {
                     this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.StartBuild;
                 }
                 this.Repaint();
             }
         }));
     }
 }
示例#12
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);
        }
示例#13
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);
        }
示例#14
0
 private void BuildPackage()
 {
     AssetStoreAsset.PreviewInfo previewInfo = this.m_Asset.previewInfo;
     if (previewInfo != null)
     {
         if (this.m_BuildAttempts++ > 150)
         {
             EditorUtility.DisplayDialog("Building timed out", "Timed out during building of package", "Close");
             base.Close();
         }
         else
         {
             previewInfo.downloadProgress = -1f;
             this.m_Purchasing            = AssetStoreInstaBuyWindow.PurchaseStatus.Building;
             AssetStoreClient.BuildPackage(this.m_Asset, delegate(BuildPackageResult result)
             {
                 if (!(this == null))
                 {
                     if (result.error != null)
                     {
                         Debug.Log(result.error);
                         if (EditorUtility.DisplayDialog("Error building package", "The server was unable to build the package. Please re-import.", "Ok"))
                         {
                             base.Close();
                         }
                     }
                     else
                     {
                         if (this.m_Asset == null || this.m_Purchasing != AssetStoreInstaBuyWindow.PurchaseStatus.Building || result.packageID != this.m_Asset.packageID)
                         {
                             base.Close();
                         }
                         string packageUrl = result.asset.previewInfo.packageUrl;
                         if (packageUrl != null && packageUrl != "")
                         {
                             this.DownloadPackage();
                         }
                         else
                         {
                             this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.StartBuild;
                         }
                         base.Repaint();
                     }
                 }
             });
         }
     }
 }
示例#15
0
 public void OnDownloadProgress(string id, string message, int bytes, int total)
 {
     AssetStoreAsset.PreviewInfo previewInfo = (this.m_Asset != null) ? this.m_Asset.previewInfo : null;
     if (previewInfo != null && !(this.m_Asset.packageID.ToString() != id))
     {
         if (message == "downloading" || message == "connecting")
         {
             previewInfo.downloadProgress = (float)bytes / (float)total;
         }
         else
         {
             previewInfo.downloadProgress = -1f;
         }
         base.Repaint();
     }
 }
        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();
        }
示例#17
0
        // Callback handler for internal curl
        public void OnDownloadProgress(string id, string message, int bytes, int total)
        {
            AssetStoreAsset.PreviewInfo info = m_Asset == null ? null : m_Asset.previewInfo;
            if (info == null || m_Asset.packageID.ToString() != id)
            {
                return;
            }

            if (message == "downloading" || message == "connecting")
            {
                info.downloadProgress = (float)bytes / (float)total;
            }
            else
            {
                info.downloadProgress = -1f;
            }
            Repaint();
        }
示例#18
0
        void DownloadingGUI()
        {
            AssetStoreAsset.PreviewInfo item = m_Asset.previewInfo;
            GUILayout.BeginHorizontal();
            GUILayout.Space(5);
            GUILayout.Label(s_AssetStoreLogo, GUIStyle.none, GUILayout.ExpandWidth(false));
            GUILayout.BeginVertical();
            string label = "Importing";     // m_Purchasing == PurchaseStatus.Downloading ? "Downloading" : "Building";

            GUILayout.Label(label, EditorStyles.boldLabel);
            GUILayout.Label("Package: " + item.packageName, EditorStyles.wordWrappedLabel);
            // TODO: show progress when multiple progress delegates works
            GUILayout.Label("    ");
            if (Event.current.type == EventType.Repaint)
            {
                Rect r = GUILayoutUtility.GetLastRect();
                r.height += 1;
                bool downloading = item.downloadProgress >= 0;
                EditorGUI.ProgressBar(r,
                                      downloading ? item.downloadProgress : item.buildProgress,
                                      downloading ? "Downloading" : "Building");
            }

            GUILayout.EndVertical();
            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Abort"))
            {
                this.Close();
            }
            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.Space(5);
        }
示例#19
0
 private void DownloadPackage()
 {
     AssetStoreAsset.PreviewInfo item = this.m_Asset.previewInfo;
     this.m_Purchasing     = AssetStoreInstaBuyWindow.PurchaseStatus.Downloading;
     item.downloadProgress = 0f;
     item.buildProgress    = -1f;
     AssetStoreContext.Download(this.m_Asset.packageID.ToString(), item.packageUrl, item.encryptionKey, item.packageName, item.publisherName, item.categoryName, delegate(string id, string status, int bytes, int total)
     {
         if (!(this == null))
         {
             item.downloadProgress = -1f;
             if (status != "ok")
             {
                 Debug.LogErrorFormat("Error downloading package {0} ({1})", new object[]
                 {
                     item.packageName,
                     id
                 });
                 Debug.LogError(status);
                 this.Close();
             }
             else
             {
                 if (this.m_Asset == null || this.m_Purchasing != AssetStoreInstaBuyWindow.PurchaseStatus.Downloading || id != this.m_Asset.packageID.ToString())
                 {
                     this.Close();
                 }
                 if (!AssetStoreContext.OpenPackageInternal(id))
                 {
                     Debug.LogErrorFormat("Error importing package {0} ({1})", new object[]
                     {
                         item.packageName,
                         id
                     });
                 }
                 this.Close();
             }
         }
     });
 }
示例#20
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();
                    }
                }
            }
        }
示例#21
0
        protected override void Parse(Dictionary <string, JSONValue> dict)
        {
            Dictionary <string, JSONValue> dictionary = dict["purchase_info"].AsDict(true);
            JSONValue value4 = dictionary["status"];

            switch (value4.AsString(true))
            {
            case "basket-not-empty":
                this.status = Status.BasketNotEmpty;
                break;

            case "service-disabled":
                this.status = Status.ServiceDisabled;
                break;

            case "user-anonymous":
                this.status = Status.AnonymousUser;
                break;

            case "ok":
                this.status = Status.Ok;
                break;
            }
            this.paymentTokenAvailable = dictionary["payment_token_available"].AsBool();
            if (dictionary.ContainsKey("payment_method_card"))
            {
                this.paymentMethodCard = dictionary["payment_method_card"].AsString(true);
            }
            if (dictionary.ContainsKey("payment_method_expire"))
            {
                this.paymentMethodExpire = dictionary["payment_method_expire"].AsString(true);
            }
            this.price     = dictionary["price"].AsFloat(true);
            this.vat       = dictionary["vat"].AsFloat(true);
            this.priceText = dictionary["price_text"].AsString(true);
            this.vatText   = dictionary["vat_text"].AsString(true);
            this.currency  = dictionary["currency"].AsString(true);
            this.message   = !dictionary.ContainsKey("message") ? null : dictionary["message"].AsString(true);
            JSONValue value14 = dict["results"];

            foreach (JSONValue value2 in value14.AsList(true))
            {
                AssetStoreAsset asset;
                int             key     = 0;
                JSONValue       value15 = value2["id"];
                if (value15.IsString())
                {
                    key = int.Parse(value2["id"].AsString());
                }
                else
                {
                    JSONValue value17 = value2["id"];
                    key = (int)value17.AsFloat();
                }
                if (this.assets.TryGetValue(key, out asset))
                {
                    JSONValue value27;
                    if (asset.previewInfo == null)
                    {
                        asset.previewInfo = new AssetStoreAsset.PreviewInfo();
                    }
                    AssetStoreAsset.PreviewInfo previewInfo = asset.previewInfo;
                    JSONValue value18 = value2["class_names"];
                    asset.className = value18.AsString(true).Trim();
                    JSONValue value19 = value2["package_name"];
                    previewInfo.packageName = value19.AsString(true).Trim();
                    JSONValue value20 = value2["short_url"];
                    previewInfo.packageShortUrl = value20.AsString(true).Trim();
                    asset.price                = !value2.ContainsKey("price_text") ? null : value2["price_text"].AsString(true).Trim();
                    previewInfo.packageSize    = int.Parse(!value2.Get("package_size").IsNull() ? value2["package_size"].AsString(true) : "-1");
                    asset.packageID            = int.Parse(value2["package_id"].AsString());
                    previewInfo.packageVersion = value2["package_version"].AsString();
                    if (!value2.Get("rating").IsNull())
                    {
                        value27 = value2["rating"];
                    }
                    previewInfo.packageRating = int.Parse((value27.AsString(true).Length != 0) ? value2["rating"].AsString(true) : "-1");
                    JSONValue value29 = value2["package_asset_count"];
                    previewInfo.packageAssetCount = int.Parse(!value29.IsNull() ? value2["package_asset_count"].AsString(true) : "-1");
                    previewInfo.isPurchased       = value2.ContainsKey("purchased") && value2["purchased"].AsBool(true);
                    previewInfo.isDownloadable    = previewInfo.isPurchased || (asset.price == null);
                    JSONValue value32 = value2["publisher_name"];
                    previewInfo.publisherName    = value32.AsString(true).Trim();
                    previewInfo.packageUrl       = !value2.Get("package_url").IsNull() ? value2["package_url"].AsString(true) : string.Empty;
                    previewInfo.encryptionKey    = !value2.Get("encryption_key").IsNull() ? value2["encryption_key"].AsString(true) : string.Empty;
                    previewInfo.categoryName     = !value2.Get("category_name").IsNull() ? value2["category_name"].AsString(true) : string.Empty;
                    previewInfo.buildProgress    = -1f;
                    previewInfo.downloadProgress = -1f;
                }
            }
        }
示例#22
0
        public override void OnInspectorGUI()
        {
            if (styles == null)
            {
                // Set the singleton in case the DrawEditors() has created this window
                s_SharedAssetStoreAssetInspector = this;
                styles = new Styles();
            }

            AssetStoreAsset activeAsset = AssetStoreAssetSelection.GetFirstAsset();

            AssetStoreAsset.PreviewInfo info = null;
            if (activeAsset != null)
            {
                info = activeAsset.previewInfo;
            }

            if (activeAsset != null)
            {
                target.name = string.Format("Asset Store: {0}", activeAsset.name);
            }
            else
            {
                target.name = "Asset Store";
            }

            EditorGUILayout.BeginVertical();

            bool guiEnabled = GUI.enabled;

            GUI.enabled = activeAsset != null && activeAsset.packageID != 0;

            if (OfflineNoticeEnabled)
            {
                Color col = GUI.color;
                GUI.color = Color.yellow;
                GUILayout.Label("Network is offline");
                GUI.color = col;
            }

            if (activeAsset != null)
            {
                string typeName  = activeAsset.className == null ? "" : activeAsset.className.Split(new char[] { ' ' }, 2)[0];
                bool   isPackage = activeAsset.id == -activeAsset.packageID;
                if (isPackage)
                {
                    typeName = "Package";
                }
                if (activeAsset.HasLivePreview)
                {
                    typeName = activeAsset.Preview.GetType().Name;
                }
                EditorGUILayout.LabelField("Type", typeName);

                if (isPackage)
                {
                    packageInfoShown = true;
                }
                else
                {
                    EditorGUILayout.Separator();
                    packageInfoShown = EditorGUILayout.Foldout(packageInfoShown, "Part of package", true);
                }
                if (packageInfoShown)
                {
                    EditorGUILayout.LabelField("Name", info == null ? "-" : info.packageName);
                    EditorGUILayout.LabelField("Version", info == null ? "-" : info.packageVersion);
                    string price = info == null ? "-" : (!string.IsNullOrEmpty(activeAsset.price) ? activeAsset.price : "free");
                    EditorGUILayout.LabelField("Price", price);
                    string rating = info != null && info.packageRating >= 0 ? info.packageRating + " of 5" : "-";
                    EditorGUILayout.LabelField("Rating", rating);
                    EditorGUILayout.LabelField("Size", info == null ? "-" : intToSizeString(info.packageSize));
                    string assetCount = info != null && info.packageAssetCount >= 0 ? info.packageAssetCount.ToString() : "-";
                    EditorGUILayout.LabelField("Asset count", assetCount);
                    GUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Web page");
                    bool hasPageUrl = info != null && info.packageShortUrl != null && info.packageShortUrl != "";
                    bool guiBefore  = GUI.enabled;
                    GUI.enabled = hasPageUrl;

                    if (GUILayout.Button(hasPageUrl ? new GUIContent(info.packageShortUrl, "View in browser") : EditorGUIUtility.TempContent("-"), styles.link))
                    {
                        Application.OpenURL(info.packageShortUrl);
                    }
                    if (GUI.enabled)
                    {
                        EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
                    }
                    GUI.enabled = guiBefore;
                    GUILayout.EndHorizontal();
                    EditorGUILayout.LabelField("Publisher", info == null ? "-" : info.publisherName);
                }

                if (activeAsset.id != 0)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();

                    if (GUILayout.Button("Open Asset Store", GUILayout.Height(40), GUILayout.Width(120)))
                    {
                        OpenItemInAssetStore(activeAsset);
                        GUIUtility.ExitGUI();
                    }
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();
                }
                GUILayout.FlexibleSpace();
            }
            EditorWrapper editor = previewEditor;

            if (editor != null && activeAsset != null && activeAsset.HasLivePreview)
            {
                editor.OnAssetStoreInspectorGUI();
            }

            GUI.enabled = guiEnabled;

            EditorGUILayout.EndVertical();
        }
示例#23
0
        void PasswordGUI()
        {
            AssetStoreAsset.PreviewInfo item = m_Asset.previewInfo;
            GUILayout.BeginHorizontal();
            GUILayout.Space(5);
            GUILayout.Label(s_AssetStoreLogo, GUIStyle.none, GUILayout.ExpandWidth(false));
            GUILayout.BeginVertical();
            GUILayout.Label("Complete purchase by entering your AssetStore password", EditorStyles.boldLabel);
            bool  hasMessage      = m_PurchaseMessage != null && m_PurchaseMessage != "";
            bool  hasErrorMessage = m_Message != null && m_Message != "";
            float newHeight       = kStandardHeight + (hasMessage ? 20 : 0) + (hasErrorMessage ? 20 : 0);

            if (newHeight != position.height)
            {
                position = new Rect(position.x, position.y, position.width, newHeight);
            }

            if (hasMessage)
            {
                GUILayout.Label(m_PurchaseMessage, EditorStyles.wordWrappedLabel);
            }
            if (hasErrorMessage)
            {
                Color oldColor = GUI.color;
                GUI.color = Color.red;
                GUILayout.Label(m_Message, EditorStyles.wordWrappedLabel);
                GUI.color = oldColor;
            }
            GUILayout.Label("Package: " + item.packageName, EditorStyles.wordWrappedLabel);
            string cardInfo = string.Format("Credit card: {0} (expires {1})", m_PaymentMethodCard, m_PaymentMethodExpire);

            GUILayout.Label(cardInfo, EditorStyles.wordWrappedLabel);
            GUILayout.Space(8);
            EditorGUILayout.LabelField("Amount", m_PriceText);
            m_Password = EditorGUILayout.PasswordField("Password", m_Password);
            GUILayout.EndVertical();
            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();
            GUILayout.Space(8);
            if (GUILayout.Button("Just put to basket..."))
            {
                AssetStore.Open(string.Format("content/{0}/basketpurchase", m_Asset.packageID));
                UsabilityAnalytics.Track(string.Format("/AssetStore/PutToBasket/{0}/{1}", m_Asset.packageID, m_Asset.id));
                m_Asset = null;
                this.Close();
                GUIUtility.ExitGUI();
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Cancel"))
            {
                UsabilityAnalytics.Track(string.Format("/AssetStore/CancelInstaBuy/{0}/{1}", m_Asset.packageID, m_Asset.id));
                m_Asset = null;
                this.Close();
                GUIUtility.ExitGUI();
            }
            GUILayout.Space(5);
            if (GUILayout.Button("Complete purchase"))
            {
                CompletePurchase();
            }

            GUILayout.Space(5);
            GUILayout.EndHorizontal();

            GUILayout.Space(5);
        }
示例#24
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);
        }
		protected override void Parse(Dictionary<string, JSONValue> dict)
		{
			Dictionary<string, JSONValue> dictionary = dict["purchase_info"].AsDict(true);
			string a = dictionary["status"].AsString(true);
			if (a == "basket-not-empty")
			{
				this.status = AssetStoreAssetsInfo.Status.BasketNotEmpty;
			}
			else
			{
				if (a == "service-disabled")
				{
					this.status = AssetStoreAssetsInfo.Status.ServiceDisabled;
				}
				else
				{
					if (a == "user-anonymous")
					{
						this.status = AssetStoreAssetsInfo.Status.AnonymousUser;
					}
					else
					{
						if (a == "ok")
						{
							this.status = AssetStoreAssetsInfo.Status.Ok;
						}
					}
				}
			}
			this.paymentTokenAvailable = dictionary["payment_token_available"].AsBool();
			if (dictionary.ContainsKey("payment_method_card"))
			{
				this.paymentMethodCard = dictionary["payment_method_card"].AsString(true);
			}
			if (dictionary.ContainsKey("payment_method_expire"))
			{
				this.paymentMethodExpire = dictionary["payment_method_expire"].AsString(true);
			}
			this.price = dictionary["price"].AsFloat(true);
			this.vat = dictionary["vat"].AsFloat(true);
			this.priceText = dictionary["price_text"].AsString(true);
			this.vatText = dictionary["vat_text"].AsString(true);
			this.currency = dictionary["currency"].AsString(true);
			this.message = ((!dictionary.ContainsKey("message")) ? null : dictionary["message"].AsString(true));
			List<JSONValue> list = dict["results"].AsList(true);
			foreach (JSONValue current in list)
			{
				int key;
				if (current["id"].IsString())
				{
					key = int.Parse(current["id"].AsString());
				}
				else
				{
					key = (int)current["id"].AsFloat();
				}
				AssetStoreAsset assetStoreAsset;
				if (this.assets.TryGetValue(key, out assetStoreAsset))
				{
					if (assetStoreAsset.previewInfo == null)
					{
						assetStoreAsset.previewInfo = new AssetStoreAsset.PreviewInfo();
					}
					AssetStoreAsset.PreviewInfo previewInfo = assetStoreAsset.previewInfo;
					assetStoreAsset.className = current["class_names"].AsString(true).Trim();
					previewInfo.packageName = current["package_name"].AsString(true).Trim();
					previewInfo.packageShortUrl = current["short_url"].AsString(true).Trim();
					assetStoreAsset.price = ((!current.ContainsKey("price_text")) ? null : current["price_text"].AsString(true).Trim());
					previewInfo.packageSize = int.Parse((!current.Get("package_size").IsNull()) ? current["package_size"].AsString(true) : "-1");
					assetStoreAsset.packageID = int.Parse(current["package_id"].AsString());
					previewInfo.packageVersion = current["package_version"].AsString();
					previewInfo.packageRating = int.Parse((!current.Get("rating").IsNull() && current["rating"].AsString(true).Length != 0) ? current["rating"].AsString(true) : "-1");
					previewInfo.packageAssetCount = int.Parse((!current["package_asset_count"].IsNull()) ? current["package_asset_count"].AsString(true) : "-1");
					previewInfo.isPurchased = (current.ContainsKey("purchased") && current["purchased"].AsBool(true));
					previewInfo.isDownloadable = (previewInfo.isPurchased || assetStoreAsset.price == null);
					previewInfo.publisherName = current["publisher_name"].AsString(true).Trim();
					previewInfo.packageUrl = ((!current.Get("package_url").IsNull()) ? current["package_url"].AsString(true) : string.Empty);
					previewInfo.encryptionKey = ((!current.Get("encryption_key").IsNull()) ? current["encryption_key"].AsString(true) : string.Empty);
					previewInfo.categoryName = ((!current.Get("category_name").IsNull()) ? current["category_name"].AsString(true) : string.Empty);
					previewInfo.buildProgress = -1f;
					previewInfo.downloadProgress = -1f;
				}
			}
		}
示例#26
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();
        }
        protected override void Parse(Dictionary <string, JSONValue> dict)
        {
            Dictionary <string, JSONValue> purchaseInfo = dict["purchase_info"].AsDict(true);
            string statusStr = purchaseInfo["status"].AsString(true);

            if (statusStr == "basket-not-empty")
            {
                status = Status.BasketNotEmpty;
            }
            else if (statusStr == "service-disabled")
            {
                status = Status.ServiceDisabled;
            }
            else if (statusStr == "user-anonymous")
            {
                status = Status.AnonymousUser;
            }
            else if (statusStr == "ok")
            {
                status = Status.Ok;
            }

            paymentTokenAvailable = purchaseInfo["payment_token_available"].AsBool();
            if (purchaseInfo.ContainsKey("payment_method_card"))
            {
                paymentMethodCard = purchaseInfo["payment_method_card"].AsString(true);
            }
            if (purchaseInfo.ContainsKey("payment_method_expire"))
            {
                paymentMethodExpire = purchaseInfo["payment_method_expire"].AsString(true);
            }
            price     = purchaseInfo["price"].AsFloat(true);
            vat       = purchaseInfo["vat"].AsFloat(true);
            priceText = purchaseInfo["price_text"].AsString(true);
            vatText   = purchaseInfo["vat_text"].AsString(true);
            currency  = purchaseInfo["currency"].AsString(true);
            message   = purchaseInfo.ContainsKey("message") ? purchaseInfo["message"].AsString(true) : null;

            List <JSONValue> assetsIn = dict["results"].AsList(true);

            foreach (JSONValue val in assetsIn)
            {
                AssetStoreAsset asset;
                int             aid = 0;
                if (val["id"].IsString())
                {
                    aid = int.Parse(val["id"].AsString());
                }
                else
                {
                    aid = (int)val["id"].AsFloat();
                }

                if (!assets.TryGetValue(aid, out asset))
                {
                    continue;
                }

                if (asset.previewInfo == null)
                {
                    asset.previewInfo = new AssetStoreAsset.PreviewInfo();
                }

                AssetStoreAsset.PreviewInfo a = asset.previewInfo;
                asset.className   = val["class_names"].AsString(true).Trim();
                a.packageName     = val["package_name"].AsString(true).Trim();
                a.packageShortUrl = val["short_url"].AsString(true).Trim();
                // a.packagePrice = val.ContainsKey("price_text") ? val["price_text"].AsString(true).Trim() : null;
                asset.price         = val.ContainsKey("price_text") ? val["price_text"].AsString(true).Trim() : null;
                a.packageSize       = int.Parse(val.Get("package_size").IsNull() ? "-1" : val["package_size"].AsString(true));
                asset.packageID     = int.Parse(val["package_id"].AsString());
                a.packageVersion    = val["package_version"].AsString();
                a.packageRating     = int.Parse(val.Get("rating").IsNull() || val["rating"].AsString(true).Length == 0 ? "-1" : val["rating"].AsString(true));
                a.packageAssetCount = int.Parse(val["package_asset_count"].IsNull() ? "-1" : val["package_asset_count"].AsString(true));
                a.isPurchased       = val.ContainsKey("purchased") ? val["purchased"].AsBool(true) : false;
                a.isDownloadable    = a.isPurchased || asset.price == null;
                a.publisherName     = val["publisher_name"].AsString(true).Trim();
                // a.previewBundle = (!val.ContainsKey("preview_bundle") || val["preview_bundle"].IsNull()) ? "" : val["preview_bundle"].AsString(true);
                a.packageUrl       = val.Get("package_url").IsNull() ? "" : val["package_url"].AsString(true);
                a.encryptionKey    = val.Get("encryption_key").IsNull() ? "" : val["encryption_key"].AsString(true);
                a.categoryName     = val.Get("category_name").IsNull() ? "" : val["category_name"].AsString(true);
                a.buildProgress    = -1f;
                a.downloadProgress = -1f;
            }
        }