コード例 #1
0
 public void UnloadBundle(ResourcesProto.Resources res)
 {
     if (res != null)
     {
         abManager.UnloadBundle(res.BunldeName.ToLower() + GameConstants.BundleExtName);
     }
 }
コード例 #2
0
        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);
                    }
                });
            }
        }
コード例 #3
0
 public void ReleaseAsset(ResourcesProto.Resources res)
 {
     if (res != null)
     {
         abManager.ReleaseAsset(res.BunldeName.ToLower() + GameConstants.BundleExtName, res.Name);
     }
 }
コード例 #4
0
 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));
 }
コード例 #5
0
 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);
 }
コード例 #6
0
ファイル: SoundManager.cs プロジェクト: liushengchao112/Ember
    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);
    }
コード例 #7
0
 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);
 }
コード例 #8
0
 // 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);
 }
コード例 #9
0
 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);
 }
コード例 #10
0
        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));
            }
        }
コード例 #11
0
 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);
         }
     });
 }
コード例 #12
0
 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));
             }
         }
     });
 }
コード例 #13
0
 public void UnloadBundle(string assetName)
 {
     ResourcesProto.Resources rr = GetResourcePath(assetName);
     UnloadBundle(rr);
 }
コード例 #14
0
 public void UnloadBundle(int id)
 {
     ResourcesProto.Resources rr = GetResourcePath(id);
     ReleaseAsset(rr);
 }
コード例 #15
0
 public void ReleaseAsset(string assetName)
 {
     ResourcesProto.Resources rr = GetResourcePath(assetName);
     ReleaseAsset(rr);
 }
コード例 #16
0
 public void ReleaseAsset(int id)
 {
     ResourcesProto.Resources rr = GetResourcePath(id);
     ReleaseAsset(rr);
 }