Example #1
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;
 }
 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();
             }
         }));
     }
 }
Example #3
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);
        }
Example #4
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();
                     }
                 }
             });
         }
     }
 }
Example #5
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();
             }
         }
     });
 }
 private void DownloadPackage()
 {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     AssetStoreInstaBuyWindow.\u003CDownloadPackage\u003Ec__AnonStorey58 packageCAnonStorey58 = new AssetStoreInstaBuyWindow.\u003CDownloadPackage\u003Ec__AnonStorey58();
     // ISSUE: reference to a compiler-generated field
     packageCAnonStorey58.\u003C\u003Ef__this = this;
     // ISSUE: reference to a compiler-generated field
     packageCAnonStorey58.item = this.m_Asset.previewInfo;
     this.m_Purchasing         = AssetStoreInstaBuyWindow.PurchaseStatus.Downloading;
     // ISSUE: reference to a compiler-generated field
     packageCAnonStorey58.item.downloadProgress = 0.0f;
     // ISSUE: reference to a compiler-generated field
     packageCAnonStorey58.item.buildProgress = -1f;
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated method
     AssetStoreContext.Download(this.m_Asset.packageID.ToString(), packageCAnonStorey58.item.packageUrl, packageCAnonStorey58.item.encryptionKey, packageCAnonStorey58.item.packageName, packageCAnonStorey58.item.publisherName, packageCAnonStorey58.item.categoryName, new AssetStoreUtils.DownloadDoneCallback(packageCAnonStorey58.\u003C\u003Em__98));
 }
Example #7
0
        private void CompletePurchase()
        {
            this.m_Message = string.Empty;
            string password = this.m_Password;

            this.m_Password   = string.Empty;
            this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.InProgress;
            AssetStoreClient.DirectPurchase(this.m_Asset.packageID, password, delegate(PurchaseResult result)
            {
                this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Init;
                if (result.error != null)
                {
                    this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Declined;
                    this.m_Message    = "An error occured while completing you purhase.";
                    base.Close();
                }
                string text = null;
                switch (result.status)
                {
                case PurchaseResult.Status.BasketNotEmpty:
                    this.m_Message    = "Something else has been put in our Asset Store basket while doing this purchase.";
                    this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Declined;
                    break;

                case PurchaseResult.Status.ServiceDisabled:
                    this.m_Message    = "Single click purchase has been disabled while doing this purchase.";
                    this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Declined;
                    break;

                case PurchaseResult.Status.AnonymousUser:
                    this.m_Message    = "You have been logged out from somewhere else while doing this purchase.";
                    this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Declined;
                    break;

                case PurchaseResult.Status.PasswordMissing:
                    this.m_Message = result.message;
                    base.Repaint();
                    break;

                case PurchaseResult.Status.PasswordWrong:
                    this.m_Message = result.message;
                    base.Repaint();
                    break;

                case PurchaseResult.Status.PurchaseDeclined:
                    this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Declined;
                    if (result.message != null)
                    {
                        this.m_Message = result.message;
                    }
                    base.Repaint();
                    break;

                case PurchaseResult.Status.Ok:
                    this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Complete;
                    if (result.message != null)
                    {
                        this.m_Message = result.message;
                    }
                    base.Repaint();
                    break;
                }
                if (text != null)
                {
                    EditorUtility.DisplayDialog("Purchase failed", text + " This purchase has been cancelled.", "Add this item to basket", "Cancel");
                }
            });
            Analytics.Track(string.Format("/AssetStore/InstaBuy/{0}/{1}", this.m_Asset.packageID, this.m_Asset.id));
        }
 public void OnDisable()
 {
   AssetStoreAsset.PreviewInfo previewInfo = this.m_Asset != null ? this.m_Asset.previewInfo : (AssetStoreAsset.PreviewInfo) null;
   if (previewInfo != null)
   {
     previewInfo.downloadProgress = -1f;
     previewInfo.buildProgress = -1f;
   }
   AssetStoreUtils.UnRegisterDownloadDelegate((ScriptableObject) this);
   this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Init;
 }
 private void DownloadPackage()
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   AssetStoreInstaBuyWindow.\u003CDownloadPackage\u003Ec__AnonStorey58 packageCAnonStorey58 = new AssetStoreInstaBuyWindow.\u003CDownloadPackage\u003Ec__AnonStorey58();
   // ISSUE: reference to a compiler-generated field
   packageCAnonStorey58.\u003C\u003Ef__this = this;
   // ISSUE: reference to a compiler-generated field
   packageCAnonStorey58.item = this.m_Asset.previewInfo;
   this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Downloading;
   // ISSUE: reference to a compiler-generated field
   packageCAnonStorey58.item.downloadProgress = 0.0f;
   // ISSUE: reference to a compiler-generated field
   packageCAnonStorey58.item.buildProgress = -1f;
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated method
   AssetStoreContext.Download(this.m_Asset.packageID.ToString(), packageCAnonStorey58.item.packageUrl, packageCAnonStorey58.item.encryptionKey, packageCAnonStorey58.item.packageName, packageCAnonStorey58.item.publisherName, packageCAnonStorey58.item.categoryName, new AssetStoreUtils.DownloadDoneCallback(packageCAnonStorey58.\u003C\u003Em__98));
 }
 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();
       }
     }));
   }
 }
 private void CompletePurchase()
 {
   this.m_Message = string.Empty;
   string password = this.m_Password;
   this.m_Password = string.Empty;
   this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.InProgress;
   AssetStoreClient.DirectPurchase(this.m_Asset.packageID, password, (AssetStoreResultBase<PurchaseResult>.Callback) (result =>
   {
     this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Init;
     if (result.error != null)
     {
       this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Declined;
       this.m_Message = "An error occured while completing you purhase.";
       this.Close();
     }
     string str = (string) null;
     switch (result.status)
     {
       case PurchaseResult.Status.BasketNotEmpty:
         this.m_Message = "Something else has been put in our Asset Store basket while doing this purchase.";
         this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Declined;
         break;
       case PurchaseResult.Status.ServiceDisabled:
         this.m_Message = "Single click purchase has been disabled while doing this purchase.";
         this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Declined;
         break;
       case PurchaseResult.Status.AnonymousUser:
         this.m_Message = "You have been logged out from somewhere else while doing this purchase.";
         this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Declined;
         break;
       case PurchaseResult.Status.PasswordMissing:
         this.m_Message = result.message;
         this.Repaint();
         break;
       case PurchaseResult.Status.PasswordWrong:
         this.m_Message = result.message;
         this.Repaint();
         break;
       case PurchaseResult.Status.PurchaseDeclined:
         this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Declined;
         if (result.message != null)
           this.m_Message = result.message;
         this.Repaint();
         break;
       case PurchaseResult.Status.Ok:
         this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Complete;
         if (result.message != null)
           this.m_Message = result.message;
         this.Repaint();
         break;
     }
     if (str == null)
       return;
     EditorUtility.DisplayDialog("Purchase failed", str + " This purchase has been cancelled.", "Add this item to basket", "Cancel");
   }));
   Analytics.Track(string.Format("/AssetStore/InstaBuy/{0}/{1}", (object) this.m_Asset.packageID, (object) this.m_Asset.id));
 }
 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 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)
				{
					return;
				}
				item.downloadProgress = -1f;
				if (status != "ok")
				{
					Debug.LogErrorFormat("Error downloading package {0} ({1})", new object[]
					{
						item.packageName,
						id
					});
					Debug.LogError(status);
					this.Close();
					return;
				}
				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();
			});
		}
		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");
				base.Close();
				return;
			}
			previewInfo.downloadProgress = -1f;
			this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.Building;
			AssetStoreClient.BuildPackage(this.m_Asset, delegate(BuildPackageResult result)
			{
				if (this == null)
				{
					return;
				}
				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();
					}
					return;
				}
				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 != string.Empty)
				{
					this.DownloadPackage();
				}
				else
				{
					this.m_Purchasing = AssetStoreInstaBuyWindow.PurchaseStatus.StartBuild;
				}
				base.Repaint();
			});
		}