Ejemplo n.º 1
0
        void AssetUnitBasicOut.PickAssetAtPath <ContentType>(string path, AssetBasicTaker <ContentType> collector)
        {
            var www = new UnityWebRequest(auInfo.reference + path);

            NetworkUtil.ProcessWebRequest(www, (givenWWW) => {
                if (string.IsNullOrEmpty(givenWWW.error))
                {
                    if (typeof(ContentType) == typeof(byte[]))
                    {
                        collector.CollectAsset((ContentType)(object)givenWWW.downloadHandler.data);
                    }
                    else if (typeof(ContentType) == typeof(AudioClip))
                    {
                        collector.CollectAsset((ContentType)(object)DownloadHandlerAudioClip.GetContent(givenWWW));
                    }
                    else if (typeof(ContentType) == typeof(Texture2D))
                    {
                        collector.CollectAsset((ContentType)(object)DownloadHandlerTexture.GetContent(givenWWW));
                    }
                    else
                    {
                        collector.CollectRawAsset(givenWWW.downloadHandler.data);
                    }
                }
                collector.OnFinish();
            });
        }
Ejemplo n.º 2
0
 void AssetUnitBasicOut.PickAssetAtPath <ElementType>(string path, AssetBasicTaker <ElementType> collector)
 {
     try {
         var nObj = namedObjects.Find((elem) => path == elem.path);
         if (nObj != null)
         {
             collector.CollectAsset((ElementType)nObj.content);
         }
         collector.OnFinish();
     } catch (System.Exception e) {
         Debug.LogError(e);
         collector.OnFinish();
     }
 }
Ejemplo n.º 3
0
        public static void PickFromDownloadLink <ContentType>(string url, AssetBasicTaker <ContentType> collector)
        {
            UnityWebRequest www = null;

            if (typeof(ContentType) == typeof(Texture2D))
            {
                www = UnityWebRequestTexture.GetTexture(url);
            }
            else
            {
                www = UnityWebRequest.Get(url);
            }
            NetworkUtil.ProcessWebRequest(www, (givenWWW) => {
                if (string.IsNullOrEmpty(givenWWW.error))
                {
                    if (typeof(ContentType) == typeof(byte[]))
                    {
                        collector.CollectAsset((ContentType)(object)givenWWW.downloadHandler.data);
                    }
                    else if (typeof(ContentType) == typeof(AudioClip))
                    {
                        collector.CollectAsset((ContentType)(object)DownloadHandlerAudioClip.GetContent(givenWWW));
                    }
                    else if (typeof(ContentType) == typeof(Texture2D))
                    {
                        var texture = DownloadHandlerTexture.GetContent(givenWWW);
                        Debug.Log(texture);
                        collector.CollectAsset((ContentType)(object)texture);
                    }
                    else
                    {
                        collector.CollectRawAsset(givenWWW.downloadHandler.data);
                    }
                }
                collector.OnFinish();
            });
        }
Ejemplo n.º 4
0
        void AssetUnitBasicOut.PickAssetAtPath <ContentType>(string path, AssetBasicTaker <ContentType> collector)
        {
            string url = parent.addressBase + repositoryAddress + "/" + path;

            UnityAssetUtil.PickFromDownloadLink(url, collector);
        }