Пример #1
0
    static void Test()
    {
        int id_anim_group = 0;

        id_anim_group = ResEnum.GetResIDByTypeAndID(id_anim_group, ResEnum.RES_TYPE0_PREFAB, ResEnum.RES_TYPE1_ROLE, ResEnum.RES_TYPE2_ROLE_ANIMGROUP, 0);    //暂定无类型id为0
        Debug.Log("[nafio]--->id_anim_group:" + id_anim_group);
    }
Пример #2
0
    private void loadAsset <T>(string resPath, LoadCb loadCallBack, ResEnum resEnum, bool isAsync = true) where T : UnityEngine.Object
    {
        if (loadedCacheDict.ContainsKey(resPath))
        {
            if (loadCallBack != null)
            {
                addResRef(resPath);
                loadCallBack(loadedCacheDict[resPath], resPath);
            }
            return;
        }

        if (waitLoadInfoDict.ContainsKey(resPath))
        {
            waitLoadInfoDict[resPath].LoadFinishCb.Insert(0, loadCallBack);
            return;
        }

        ResLoadInfo loadInfo = this.resLoadInfoPool.GetItem();

        loadInfo.ResPath = resPath;
        loadInfo.LoadFinishCb.Insert(0, loadCallBack);

        waitLoadInfoDict[resPath] = loadInfo;

        if (isAsync)
        {
            AssetLoader.Instance.LoadAssetAsync <T>(resPath, loadFinishCallBack);
        }
        else
        {
            AssetLoader.Instance.LoadAsset <T>(resPath, loadFinishCallBack);
        }
    }
Пример #3
0
    public T Load <T>(ResEnum resEnum, string targetName) where T : Object
    {
        T temp = null;

#if UNITY_EDITOR
        //TODO...考虑资源的管理。例如:引用计数,自动卸载
        string full_path = Path.Combine(rootPath, resEnum.ToString(), targetName + GetExtName(typeof(T)));
        Debug.Log(full_path);
        temp = AssetDatabase.LoadAssetAtPath <T>(full_path);
#else
#endif
        return(temp);
    }
Пример #4
0
 public void LoadAssetAsync <T>(string resPath, LoadCb loadCallBack, ResEnum resEnum) where T : UnityEngine.Object
 {
     loadAsset <T>(resPath, loadCallBack, resEnum, true);
 }
Пример #5
0
 public void LoadAsync <T>(ResEnum resEnum, string targetName) where T : Object
 {
 }