Пример #1
0
        public void Finish(LoadOperation loader)
        {
            progress = 1.0f;

            if (OnFinish != null)
            {
                OnFinish.Invoke(loader);
                OnFinish = null;
            }
        }
Пример #2
0
        /// <summary>
        /// 添加需要被加载的资源
        /// </summary>
        /// <param name="loader">异步加载器</param>
        /// <param name="weight">权重,用于计算进度</param>
        public LoadOperation AddLoader(LoadOperation loader, int weight = 1)
        {
            Weight += weight;

            AsyncLoader asyncLoader = new AsyncLoader();

            asyncLoader.Weight = weight;
            asyncLoader.Loader = loader;

            this.loaders.Add(asyncLoader);

            return(loader);
        }
Пример #3
0
        /// <summary>
        /// 添加场景资源加载器
        /// </summary>
        /// <param name="loader">加载器</param>
        /// <param name="weight">资源权重</param>
        public void AddLoader(LoadOperation loader, int weight)
        {
            Weight += weight;

            AsyncLoader asyncLoader = new AsyncLoader();

            asyncLoader.Weight = weight;
            asyncLoader.Loader = loader;

            this.assets.Add(asyncLoader);

            if (nextLoader == null)
            {
                nextLoader = asyncLoader;
                curLoader  = nextLoader;
            }
        }