static AssetStoreContext()
 {
     AssetStoreContext.s_StandardPackageRegExp  = new Regex("/Standard Packages/(Character\\ Controller|Glass\\ Refraction\\ \\(Pro\\ Only\\)|Image\\ Effects\\ \\(Pro\\ Only\\)|Light\\ Cookies|Light\\ Flares|Particles|Physic\\ Materials|Projectors|Scripts|Standard\\ Assets\\ \\(Mobile\\)|Skyboxes|Terrain\\ Assets|Toon\\ Shading|Tree\\ Creator|Water\\ \\(Basic\\)|Water\\ \\(Pro\\ Only\\))\\.unitypackage$", RegexOptions.IgnoreCase);
     AssetStoreContext.s_GeneratedIDRegExp      = new Regex("^\\{(.*)\\}$");
     AssetStoreContext.s_InvalidPathCharsRegExp = new Regex("[^a-zA-Z0-9() _-]");
     AssetStoreContext.GetInstance();
 }
예제 #2
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();
            });
        }
예제 #3
0
 public static AssetStoreContext GetInstance()
 {
     if (AssetStoreContext.s_Instance == null)
     {
         AssetStoreContext.s_Instance = new AssetStoreContext();
         JSProxyMgr.GetInstance().AddGlobalObject("AssetStoreContext", (object)AssetStoreContext.s_Instance);
     }
     return(AssetStoreContext.s_Instance);
 }
 public static AssetStoreContext GetInstance()
 {
   if (AssetStoreContext.s_Instance == null)
   {
     AssetStoreContext.s_Instance = new AssetStoreContext();
     JSProxyMgr.GetInstance().AddGlobalObject("AssetStoreContext", (object) AssetStoreContext.s_Instance);
   }
   return AssetStoreContext.s_Instance;
 }
        public static AssetStoreContext GetInstance()
        {
            if (s_Instance == null)
            {
                s_Instance = new AssetStoreContext();
            }

            return(s_Instance);
        }
예제 #6
0
 private void CreateContextObject()
 {
     if (this.m_ContextScriptObject != null)
     {
         return;
     }
     this.m_ContextScriptObject           = ScriptableObject.CreateInstance <AssetStoreContext>();
     this.m_ContextScriptObject.hideFlags = HideFlags.HideAndDontSave;
     this.m_ContextScriptObject.window    = this;
 }
예제 #7
0
        public static void OpenURL(string url)
        {
            AssetStoreWindow assetStoreWindow = AssetStoreWindow.Init();

            assetStoreWindow.InvokeJSMethod("document.AssetStore", "openURL", new object[]
            {
                url
            });
            AssetStoreContext.GetInstance().initialOpenURL = url;
        }
예제 #8
0
 public void UpdateDockStatusIfNeeded()
 {
     if (this.m_IsDocked != base.docked)
     {
         this.m_IsDocked = base.docked;
         if (this.scriptObject != null)
         {
             AssetStoreContext.GetInstance().docked = base.docked;
             this.InvokeJSMethod("document.AssetStore", "updateDockStatus", new object[0]);
         }
     }
 }
예제 #9
0
 private void Update()
 {
     if (this.m_ShouldRetryInitialURL)
     {
         this.m_ShouldRetryInitialURL = false;
         string initialOpenURL = AssetStoreContext.GetInstance().initialOpenURL;
         if (!string.IsNullOrEmpty(initialOpenURL))
         {
             AssetStoreWindow.OpenURL(initialOpenURL);
         }
     }
 }
        public static void OpenURL(string url)
        {
            AssetStoreWindow window      = Init();
            bool             shouldDefer = !window.initialized;

            window.InvokeJSMethod("document.AssetStore", "openURL", url);
            AssetStoreContext.GetInstance().initialOpenURL = url;
            if (shouldDefer)
            {
                // Ugly hack - help, asset store team!
                window.ScheduleOpenURL(TimeSpan.FromSeconds(3));
            }
        }
예제 #11
0
        public static void OpenURL(string url)
        {
            AssetStoreWindow window = Init();
            bool             flag   = !window.initialized;

            object[] args = new object[] { url };
            window.InvokeJSMethod("document.AssetStore", "openURL", args);
            AssetStoreContext.GetInstance().initialOpenURL = url;
            if (flag)
            {
                window.ScheduleOpenURL(TimeSpan.FromSeconds(3.0));
            }
        }
        public void UpdateDockStatusIfNeeded()
        {
            if (m_IsDocked != docked)
            {
                m_IsDocked = docked;

                if (scriptObject != null)
                {
                    AssetStoreContext.GetInstance().docked = docked;
                    InvokeJSMethod("document.AssetStore", "updateDockStatus");
                }
            }
        }
예제 #13
0
 public void UpdateDockStatusIfNeeded()
 {
     if (this.m_IsDocked == this.docked)
     {
         return;
     }
     this.m_IsDocked = this.docked;
     if (!((UnityEngine.Object) this.scriptObject != (UnityEngine.Object)null))
     {
         return;
     }
     AssetStoreContext.GetInstance().docked = this.docked;
     this.InvokeJSMethod("document.AssetStore", "updateDockStatus");
 }
        void Update()
        {
            if (!m_ShouldRetryInitialURL)
            {
                return;
            }

            m_ShouldRetryInitialURL = false;
            string url = AssetStoreContext.GetInstance().initialOpenURL;

            if (!string.IsNullOrEmpty(url))
            {
                OpenURL(url);
            }
        }
예제 #15
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();
             }
         }
     });
 }
예제 #16
0
        public static void Download(string package_id, string url, string key, string package_name, string publisher_name, string category_name, AssetStoreUtils.DownloadDoneCallback doneCallback)
        {
            string[]  destination = AssetStoreContext.PackageStorePath(publisher_name, category_name, package_name, package_id, url);
            JSONValue jSONValue   = JSONParser.SimpleParse(AssetStoreUtils.CheckDownload(package_id, url, destination, key));

            if (jSONValue.Get("in_progress").AsBool(true))
            {
                Debug.Log("Will not download " + package_name + ". Download is already in progress.");
                return;
            }
            string    a        = jSONValue.Get("download.url").AsString(true);
            string    a2       = jSONValue.Get("download.key").AsString(true);
            bool      resumeOK = a == url && a2 == key;
            JSONValue value    = default(JSONValue);

            value["url"] = url;
            value["key"] = key;
            JSONValue jSONValue2 = default(JSONValue);

            jSONValue2["download"] = value;
            AssetStoreUtils.Download(package_id, url, destination, key, jSONValue2.ToString(), resumeOK, doneCallback);
        }
 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));
 }
예제 #18
0
        public static void Download(string package_id, string url, string key, string package_name, string publisher_name, string category_name, AssetStoreUtils.DownloadDoneCallback doneCallback)
        {
            string[]  destination = AssetStoreContext.PackageStorePath(publisher_name, category_name, package_name, package_id, url);
            JSONValue jsonValue1  = JSONParser.SimpleParse(AssetStoreUtils.CheckDownload(package_id, url, destination, key));

            if (jsonValue1.Get("in_progress").AsBool(true))
            {
                Debug.Log((object)("Will not download " + package_name + ". Download is already in progress."));
            }
            else
            {
                string    str1       = jsonValue1.Get("download.url").AsString(true);
                string    str2       = jsonValue1.Get("download.key").AsString(true);
                bool      resumeOK   = str1 == url && str2 == key;
                JSONValue jsonValue2 = new JSONValue();
                jsonValue2["url"] = (JSONValue)url;
                jsonValue2["key"] = (JSONValue)key;
                JSONValue jsonValue3 = new JSONValue();
                jsonValue3["download"] = jsonValue2;
                AssetStoreUtils.Download(package_id, url, destination, key, jsonValue3.ToString(), resumeOK, doneCallback);
            }
        }
예제 #19
0
 static AssetStoreContext()
 {
     AssetStoreContext.GetInstance();
 }
예제 #20
0
 public static void OpenURL(string url)
 {
     object[] args = new object[] { url };
     Init().InvokeJSMethod("document.AssetStore", "openURL", args);
     AssetStoreContext.GetInstance().initialOpenURL = url;
 }
예제 #21
0
		private void CreateContextObject()
		{
			if (this.m_ContextScriptObject != null)
			{
				return;
			}
			this.m_ContextScriptObject = ScriptableObject.CreateInstance<AssetStoreContext>();
			this.m_ContextScriptObject.hideFlags = HideFlags.HideAndDontSave;
			this.m_ContextScriptObject.window = this;
		}
예제 #22
0
 public void Download(AssetStoreContext.Package package, AssetStoreContext.DownloadInfo downloadInfo)
 {
     AssetStoreContext.Download(downloadInfo.id, downloadInfo.url, downloadInfo.key, package.title, package.publisher.label, package.category.label, null);
 }
예제 #23
0
 public bool OpenPackage(string id, string action)
 {
     return(AssetStoreContext.OpenPackageInternal(id));
 }
예제 #24
0
		public void Download(AssetStoreContext.Package package, AssetStoreContext.DownloadInfo downloadInfo)
		{
			AssetStoreContext.Download(downloadInfo.id, downloadInfo.url, downloadInfo.key, package.title, package.publisher.label, package.category.label, null);
		}