public void UnloadBundle(ResourcesProto.Resources res)
 {
     if (res != null)
     {
         abManager.UnloadBundle(res.BunldeName.ToLower() + GameConstants.BundleExtName);
     }
 }
        public void LoadAssetAsync <T>(ResourcesProto.Resources res, Callback <T> callBack) where T : UnityEngine.Object
        {
            if (res.BunldeName.Equals("null"))
            {
                LoadResourceByPath(res.ResourcePath, delegate(string name, GAbstractData gAbstractData, System.Object param)
                {
                    if (callBack != null)
                    {
                        callBack(( T )gAbstractData.Data);
                    }
                }, true);
            }
            else
            {
#if UNITY_EDITOR
                if (GameConstants.LoadAssetByEditor)
                {
                    if (callBack != null)
                    {
                        callBack(UnityEditor.AssetDatabase.LoadAssetAtPath <T>(res.ResourcePath));
                    }
                    return;
                }
#endif
                abManager.GetAssetAsync(res.BunldeName.ToLower() + GameConstants.BundleExtName, res.Name,
                                        delegate(Object asset)
                {
                    if (callBack != null)
                    {
                        callBack(( T )asset);
                    }
                });
            }
        }
 public void ReleaseAsset(ResourcesProto.Resources res)
 {
     if (res != null)
     {
         abManager.ReleaseAsset(res.BunldeName.ToLower() + GameConstants.BundleExtName, res.Name);
     }
 }
 public T LoadAsset <T>(string assetName) where T : UnityEngine.Object
 {
     ResourcesProto.Resources res = GetResourcePath(assetName);
     if (res == null)
     {
         DebugUtils.LogError(DebugUtils.Type.Resource, string.Format("assetName = {0} can't be find in ResourceTableProto! Please check!", assetName));
         return(null);
     }
     return(LoadAsset <T>(res));
 }
 public void LoadAtlasSprite(string name, OnLoadedAtlasSpriteComplete onComplete, System.Object param = null)
 {
     ResourcesProto.Resources res = GetResourcePath(name);
     if (res == null)
     {
         DebugUtils.LogError(DebugUtils.Type.Resource, string.Format("name = {0} can't be find in ResourceTableProto! Please check!", name));
         return;
     }
     LoadAtlasSprite(res, onComplete, param);
 }
    private string GetAudioPath(int id)
    {
        ResourcesProto.Resources resourcesProto = DataManager.GetInstance().resourcesProtoData.Find(p => p.ID == id);

        if (resourcesProto != null)
        {
            return(resourcesProto.ResourcePath);
        }
        return(string.Empty);
    }
 private ResourcesProto.Resources GetResourcePath(int id)
 {
     ResourcesProto.Resources r = null;
     for (int i = 0; i < resourceList.Count; i++)
     {
         if (resourceList[i].ID == id)
         {
             r = resourceList[i];
             break;
         }
     }
     return(r);
 }
 // Utils
 public ResourcesProto.Resources GetResourcePath(string assetName)
 {
     ResourcesProto.Resources r = null;
     for (int i = 0; i < resourceList.Count; i++)
     {
         if (resourceList[i].Name == assetName)
         {
             r = resourceList[i];
             break;
         }
     }
     return(r);
 }
 public void LoadAssetAsync <T>(int id, Callback <T> callBack = null) where T : UnityEngine.Object
 {
     ResourcesProto.Resources res = GetResourcePath(id);
     if (res == null)
     {
         DebugUtils.LogError(DebugUtils.Type.Resource, string.Format("id = {0} can't be find in ResourceTableProto! Please check!", id));
         if (callBack != null)
         {
             callBack(null);
         }
         return;
     }
     LoadAssetAsync(res, callBack);
 }
        public T LoadAsset <T>(ResourcesProto.Resources res) where T : UnityEngine.Object
        {
            if (res.BunldeName.Equals("null"))
            {
                return(Resources.Load <T>(res.ResourcePath));
            }
            else
            {
#if UNITY_EDITOR
                if (GameConstants.LoadAssetByEditor)
                {
                    return(UnityEditor.AssetDatabase.LoadAssetAtPath <T>(res.ResourcePath));
                }
#endif
                return(abManager.GetAsset <T>(res.BunldeName.ToLower() + GameConstants.BundleExtName, res.Name));
            }
        }
 public void LoadAssetAsync <T, U, V>(string assetName, Callback <T, U, V> callBack, U data1, V data2) where T : UnityEngine.Object
 {
     ResourcesProto.Resources res = GetResourcePath(assetName);
     if (res == null)
     {
         DebugUtils.LogError(DebugUtils.Type.Resource, string.Format("assetName = {0} can't be find in ResourceTableProto! Please check!", assetName));
         if (callBack != null)
         {
             callBack(null, data1, data2);
         }
         return;
     }
     LoadAssetAsync(res, delegate(T t)
     {
         if (callBack != null)
         {
             callBack(t, data1, data2);
         }
     });
 }
 public void LoadAtlasSprite(ResourcesProto.Resources res, OnLoadedAtlasSpriteComplete onComplete, System.Object param = null)
 {
     LoadAssetAsync <GameObject>(res, delegate(GameObject go)
     {
         if (go == null)
         {
             onComplete(res.Name, null, param);
             DebugUtils.LogError(DebugUtils.Type.Resource, string.Format(" Load Unity.Object failed! path : {0}", res.ResourcePath));
         }
         else
         {
             UI.AtlasSprite atlasSprite = go.GetComponent <UI.AtlasSprite>();
             if (atlasSprite != null)
             {
                 onComplete(res.Name, atlasSprite, param);
             }
             else
             {
                 onComplete(res.Name, null, param);
                 DebugUtils.LogError(DebugUtils.Type.Resource, string.Format(" Load Unity.Object failed! path : {0}", res.ResourcePath));
             }
         }
     });
 }
 public void UnloadBundle(string assetName)
 {
     ResourcesProto.Resources rr = GetResourcePath(assetName);
     UnloadBundle(rr);
 }
 public void UnloadBundle(int id)
 {
     ResourcesProto.Resources rr = GetResourcePath(id);
     ReleaseAsset(rr);
 }
 public void ReleaseAsset(string assetName)
 {
     ResourcesProto.Resources rr = GetResourcePath(assetName);
     ReleaseAsset(rr);
 }
 public void ReleaseAsset(int id)
 {
     ResourcesProto.Resources rr = GetResourcePath(id);
     ReleaseAsset(rr);
 }