예제 #1
0
    public static T EditorLoad <T>(string name) where T : Object
    {
        T      res  = null;
        string path = ResourcesConfigManager.GetLoadPath(AssetsLoadType.Resources, name);

        res = Resources.Load <T>(path);
        return(res);
    }
예제 #2
0
    /// <summary>
    /// 同步加载一个资源
    /// </summary>
    /// <param name="name"></param>
    public static Object Load(string name)
    {
        string     path   = ResourcesConfigManager.GetLoadPath(loadType, name);
        AssetsData assets = loadAssetsController.LoadAssets(path);

        if (assets != null)
        {
            return(assets.Assets[0]);
        }
        return(null);
    }
예제 #3
0
    public static void DestoryAssetsCounter(string name, int times = 1)
    {
        if (!ResourcesConfigManager.GetIsExitRes(name))
        {
            return;
        }
        string path = ResourcesConfigManager.GetLoadPath(loadType, name);

        if (times <= 0)
        {
            times = 1;
        }
        for (int i = 0; i < times; i++)
        {
            loadAssetsController.DestoryAssetsCounter(path);
        }
    }
예제 #4
0
    /// <summary>
    /// 加载资源
    /// 注意释放资源,方法: DestoryAssetsCounter
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="name"></param>
    /// <returns></returns>
    public static T Load <T>(string name) where T : Object
    {
        T      res  = null;
        string path = ResourcesConfigManager.GetLoadPath(loadType, name);
        //Debug.Log("ResourcesConfigManager.GetLoadPath :"+ path);
        AssetsData assets = loadAssetsController.LoadAssets <T>(path);

        if (assets != null)
        {
            res = assets.GetAssets <T>();
        }
        if (res == null)
        {
            Debug.LogError("Error=> Load Name :" + name + "  Type:" + typeof(T).FullName + "\n" + " Load Object:" + res);
        }
        return(res);
    }
예제 #5
0
    public static void LoadAsync(string name, Type resType, CallBack <Object> callBack)
    {
        string path = ResourcesConfigManager.GetLoadPath(loadType, name);

        loadAssetsController.LoadAsync(path, resType, callBack);
    }
예제 #6
0
    public static void Release(string name)
    {
        string path = ResourcesConfigManager.GetLoadPath(loadType, name);

        loadAssetsController.Release(path);
    }