Beispiel #1
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();
            });
        }
 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();
             }
         }));
     }
 }
Beispiel #3
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();
                     }
                 }
             });
         }
     }
 }