Ejemplo n.º 1
0
        /// <summary>
        /// Resource异步加载;
        /// </summary>
        /// <param name="path"></param>
        /// <param name="progress"></param>
        /// <returns></returns>
        public ResourceAssetProxy LoadResourceAsync(string path, Action <float> progress)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }
            ResourceAssetProxy proxy = PoolMgr.singleton.GetCsharpObject <ResourceAssetProxy>();

            proxy.Initialize(path);
            CoroutineMgr.singleton.RunCoroutine(LoadAsync(path, proxy, progress));
            return(proxy);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Resource同步加载;
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public ResourceAssetProxy LoadResourceProxy(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }
            ResourceAssetProxy proxy = PoolMgr.singleton.GetCsharpObject <ResourceAssetProxy>();

            proxy.Initialize(path);
            Object asset = Resources.Load(path);

            if (asset == null)
            {
                LogHelper.PrintError($"[ResourceMgr]LoadResourceProxy load asset:{path} failure.");
            }
            proxy.OnFinish(asset);
            return(proxy);
        }