Exemplo n.º 1
0
        /// <summary>
        /// 检测模块是否需要热更新
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public async Task <bool> CheckModuleNeedLoad(string key)
        {
            if (Define.UseEditorResouces)
            {
                return(false);
            }

            if (!this.resGroups.TryGetValue(key, out ResGroupData item))
            {
                Log.Error($"播放传入的 key:{key} 没有对应的资源组数据");

                return(false);
            }
            if (this.remoteVersionConfig == null)
            {
                this.remoteVersionConfig = await BundleHelper.GetRemoteVersion();
            }

            if (this.streamingVersionConfig == null)
            {
                this.streamingVersionConfig = await BundleHelper.GetLocalVersionConfig();
            }

            return(item.LoadingPanel.CheckModuleNeedLoad(item, remoteVersionConfig, streamingVersionConfig));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 加载资源组
        /// </summary>
        /// <param name="key"></param>
        public async void Load(string key)
        {
            if (this == null || this.InstanceId == 0)
            {
                Log.Error("此ResGroupLoadComponent 组件已经被销毁,请不要再调用此方法");

                return;
            }

            if (!this.resGroups.TryGetValue(key, out ResGroupData data))
            {
                Log.Error($"播放传入的 key:{key} 没有对应的资源组数据");

                return;
            }

            //重置
            this.Reset();

            if (this.remoteVersionConfig == null)
            {
                this.remoteVersionConfig = await BundleHelper.GetRemoteVersion();
            }

            if (this.streamingVersionConfig == null)
            {
                this.streamingVersionConfig = await BundleHelper.GetLocalVersionConfig();
            }

            this.BeginLoad(key);
        }