예제 #1
0
 public void SetTexture(int i)
 {
     if (textures.IsEmpty())
     {
         return;
     }
     if (Platform.isPlaying)
     {
         texLoader.Load(textures[i], null);
     }
     else
     {
         #if UNITY_EDITOR
         i = i.Clamp(0, textures.Count);
         if (texLoader.rend != null)
         {
             AssetRef r = textures[i];
             r.LoadAsset <Texture>(t =>
             {
                 texLoader.tex = t;
                 UnityEditor.SceneManagement.EditorSceneManager.MarkAllScenesDirty();
             });
         }
         #else
         texLoader.Load(textures[i], null);
         #endif
     }
 }
예제 #2
0
 private void Load(AssetRef texRef, Material mat, string texName)
 {
     if (texRef.isEmpty)
     {
         count++;
         if (count == materials.Length * 2)
         {
             callback.Call();
         }
     }
     else
     {
         Cdn.cache.GetTexture(texRef.path, tex => {
             if (tex != null)
             {
                 mat.SetTexture(texName, tex);
             }
             count++;
             if (count == materials.Length * 2)
             {
                 callback.Call();
             }
         });
     }
 }
예제 #3
0
파일: AssetRef.cs 프로젝트: mulova/comunity
 public AssetRef(AssetRef src)
 {
     this.cdn       = src.cdn;
     this.path      = src.path;
     this.guid      = src.guid;
     this.reference = src.reference;
     this.md5       = src.md5;
 }
예제 #4
0
파일: AssetRef.cs 프로젝트: mulova/comunity
 public override bool Equals(object o)
 {
     if (this == o)
     {
         return(true);
     }
     if (o is AssetRef)
     {
         AssetRef that = o as AssetRef;
         return(this.cdn == that.cdn && this.path == that.path);
     }
     return(false);
 }
예제 #5
0
 public void Load(AssetRef asset, Action <Texture> callback)
 {
     if (rend != null && !asset.isEmpty)
     {
         if (asset.cdn)
         {
             Load(asset.path, callback);
         }
         else if (asset.GetReference() != null)
         {
             this.loadedCallback = callback;
             SetTexture(asset.GetReference() as Texture);
         }
     }
 }
예제 #6
0
 public static string GetEditorPath(this AssetRef r)
 {
     if (!r.guid.IsEmpty())
     {
         string path = AssetDatabase.GUIDToAssetPath(r.guid);
         if (!path.IsEmpty())
         {
             return(path);
         }
     }
     if (!r.path.IsEmpty())
     {
         return("Assets/" + r.path);
     }
     else
     {
         return(string.Empty);
     }
 }
예제 #7
0
 public void Add(AssetRef asset)
 {
     queue.Enqueue(asset);
 }
예제 #8
0
 public static void SetPath(this AssetRef r, Object o)
 {
     r.path = GetPath(o);
     r.cdn  = AssetBundlePath.inst.IsRawCdnAsset(o);
     r.guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(o));
 }