コード例 #1
0
        public void LoadScene(int sceneId)
        {
            if (m_CurrSceneIsLoading)
            {
                GameEntry.LogError("场景{0}正在加载中", m_CurrLoadSceneId);
                return;
            }

            if (m_CurrLoadSceneId == sceneId)
            {
                GameEntry.LogError("正在重复加载场景{0}", m_CurrLoadSceneId);
                return;
            }

            m_CurrLoadingParam = GameEntry.Pool.DequeueClassObject <BaseParams>();

            //加载Loading
            GameEntry.UI.OpenUIForm(UIFormId.Loading, onOpen: (UIFormBase formBase) =>
            {
                m_CurrProgress = 0;
                m_TargetProgressDic.Clear();

                m_CurrSceneIsLoading = true;
                m_CurrLoadSceneId    = sceneId;

                //先卸载当前场景
                UnLoadCurrScene();
            });
        }
コード例 #2
0
        /// <summary>
        /// 下载初始资源
        /// </summary>
        private void DownloadInitResource()
        {
            GameEntry.Event.CommonEvent.Dispatch(SysEventId.CheckVersionBeginDownload);
            m_DownloadingParams = GameEntry.Pool.DequeueClassObject <BaseParams>();
            m_NeedDownloadList.Clear();

            var enumerator = m_CDNVersionDic.GetEnumerator();

            while (enumerator.MoveNext())
            {
                AssetBundleInfoEntity entity = enumerator.Current.Value;
                if (entity.IsFirstData)
                {
                    m_NeedDownloadList.AddLast(entity.AssetBundleName);
                }
            }
            GameEntry.Download.BeginDownloadMulit(m_NeedDownloadList, OnDownloadMulitUpdate, OnDownloadMulitComplete);
        }