summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XSceneLoader.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/XSceneLoader.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/XSceneLoader.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/XSceneLoader.cs630
1 files changed, 630 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/XSceneLoader.cs b/Client/Assets/Scripts/XMainClient/XSceneLoader.cs
new file mode 100644
index 00000000..f83b1456
--- /dev/null
+++ b/Client/Assets/Scripts/XMainClient/XSceneLoader.cs
@@ -0,0 +1,630 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using KKSG;
+using UnityEngine;
+using UnityEngine.SceneManagement;
+using XMainClient.UI;
+using XMainClient.UI.UICommon;
+using XUpdater;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ public sealed class XSceneLoader : MonoBehaviour
+ {
+ private AsyncOperation _op = null;
+
+ private XSceneLoader.AsyncSceneBuildRequest _asbr = null;
+
+ private uint _loading_scene_id = 0u;
+
+ private EXStage _loading_scene_stage = EXStage.Null;
+
+ private bool _enabled = false;
+
+ private bool _prograss = true;
+
+ private float _sub_progress = 0f;
+
+ private float _current_progress = 0f;
+
+ private float _target_progress = 0f;
+
+ private bool _DelayLoadCache = true;
+
+ private bool _LoadingSpectateScene = false;
+
+ private enum LoadingPhase
+ {
+ Scene_Downlaod,
+ Scene_Load,
+ Scene_Build,
+ Scene_Doc
+ }
+
+ private class AsyncSceneBuildRequest
+ {
+ public float Progress = 1f;
+
+ public IEnumerator Pedometer = null;
+ }
+
+ public void LoadScene(string scene, EXStage eStage, bool prograss, uint nextsceneid, uint currentsceneid)
+ {
+ XSingleton<XGame>.singleton.notLoadScene = false;
+ XSingleton<XGame>.singleton.networkRun = false;
+ XSingleton<XTimerMgr>.singleton.update = false;
+ this._loading_scene_id = nextsceneid;
+ this._loading_scene_stage = eStage;
+ this._prograss = prograss;
+ XSingleton<XClientNetwork>.singleton.Clear();
+ ObjectPoolCache.Clear();
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.ClearClass();
+ bool settingEnum = XSingleton<XGlobalConfig>.singleton.GetSettingEnum(ESettingConfig.EClearBundle);
+ if (settingEnum)
+ {
+ XSingleton<XUpdater.XUpdater>.singleton.Clear();
+ }
+ XSingleton<XDebug>.singleton.BeginRecord();
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.MarkLevelEnd();
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.MarkLoadlevel(scene);
+ XQualitySetting.SwitchScene();
+ XSingleton<XGameUI>.singleton.m_uiTool.PreLoad(false);
+ XSingleton<XGameUI>.singleton.m_uiTool.ReleaseAllDrawCall();
+ XSingleton<XResourceLoaderMgr>.singleton.CallUnloadCallback();
+ XSingleton<XResourceLoaderMgr>.singleton.ReleasePool();
+ this._DelayLoadCache = XSingleton<XResourceLoaderMgr>.singleton.DelayLoad;
+ XSingleton<XResourceLoaderMgr>.singleton.DelayLoad = false;
+ XSpectateDocument specificDocument = XDocuments.GetSpecificDocument<XSpectateDocument>(XSpectateDocument.uuID);
+ this._LoadingSpectateScene = specificDocument.IsLoadingSpectateScene;
+ bool flag = SceneType.SCENE_PK != XSingleton<XSceneMgr>.singleton.GetSceneType(nextsceneid) && SceneType.SCENE_INVFIGHT != XSingleton<XSceneMgr>.singleton.GetSceneType(nextsceneid) && SceneType.SCENE_LEAGUE_BATTLE != XSingleton<XSceneMgr>.singleton.GetSceneType(nextsceneid);
+ if (flag)
+ {
+ DlgBase<LoadingDlg, LoadingDlgBehaviour>.singleton.Load();
+ bool isLoadingSpectateScene = specificDocument.IsLoadingSpectateScene;
+ if (isLoadingSpectateScene)
+ {
+ specificDocument.IsLoadingSpectateScene = false;
+ string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("Spectate_Tips").Split(XGlobalConfig.ListSeparator);
+ int num = UnityEngine.Random.Range(0, array.Length);
+ DlgBase<LoadingDlg, LoadingDlgBehaviour>.singleton.SetLoadingTip(array[num]);
+ }
+ else
+ {
+ string loadingTip = (currentsceneid == 1u) ? XSingleton<XSceneMgr>.singleton.GetSceneLoadingTips(true, nextsceneid) : ((nextsceneid == 1u) ? XSingleton<XSceneMgr>.singleton.GetSceneLoadingTips(false, currentsceneid) : ((nextsceneid == 100u) ? XSingleton<XSceneMgr>.singleton.GetSceneLoadingTips(true, nextsceneid) : ((nextsceneid == 3u) ? XSingleton<XSceneMgr>.singleton.GetSceneLoadingTips(false, 2u) : XSingleton<XSceneMgr>.singleton.GetSceneLoadingTips(true, nextsceneid))));
+ DlgBase<LoadingDlg, LoadingDlgBehaviour>.singleton.SetLoadingTip(loadingTip);
+ }
+ bool flag2 = nextsceneid == 100u || nextsceneid == 21u || nextsceneid == 22u;
+ string text;
+ if (flag2)
+ {
+ text = this.GetMyProfessionLoadingPic();
+ }
+ else
+ {
+ text = XSingleton<XSceneMgr>.singleton.GetSceneLoadingPic(nextsceneid);
+ }
+ bool flag3 = string.IsNullOrEmpty(text);
+ if (flag3)
+ {
+ prograss = false;
+ }
+ else
+ {
+ DlgBase<LoadingDlg, LoadingDlgBehaviour>.singleton.SetLoadingPic(text);
+ }
+ DlgBase<LoadingDlg, LoadingDlgBehaviour>.singleton.SetVisible(prograss, true);
+ DlgBase<LoadingDlg, LoadingDlgBehaviour>.singleton.SetLoadingProgress(0f);
+ }
+ Application.backgroundLoadingPriority = (ThreadPriority)4;
+ base.StartCoroutine(this.LoadLevelWithProgress(scene));
+ XSingleton<XScene>.singleton.OnSceneBeginLoad(this._loading_scene_id);
+ }
+
+ private IEnumerator LoadLevelWithProgress(string scene)
+ {
+ base.enabled = true;
+ this._enabled = true;
+ this._current_progress = 0f;
+ this._target_progress = 0f;
+ this.DisplayPrograss(XSceneLoader.LoadingPhase.Scene_Downlaod, 1f);
+ yield return null;
+ bool flag = SceneType.SCENE_PK == XSingleton<XScene>.singleton.SceneType || SceneType.SCENE_INVFIGHT == XSingleton<XScene>.singleton.SceneType;
+ if (flag)
+ {
+ DlgBase<XPkLoadingView, XPkLoadingBehaviour>.singleton.ShowPkLoading(XSingleton<XScene>.singleton.SceneType);
+ }
+ else
+ {
+ bool flag2 = SceneType.SCENE_LEAGUE_BATTLE == XSingleton<XScene>.singleton.SceneType;
+ if (flag2)
+ {
+ DlgBase<XTeamLeagueLoadingView, XTeamLeagueLoadingBehaviour>.singleton.ShowPkLoading();
+ }
+ else
+ {
+ bool flag3 = SceneType.SCENE_PKTWO == XSingleton<XScene>.singleton.SceneType;
+ if (flag3)
+ {
+ DlgBase<XMultiPkLoadingView, XMultiPkLoadingBehaviour>.singleton.ShowPkLoading();
+ }
+ }
+ }
+ XSingleton<XGameUI>.singleton.m_uiTool.EnableUILoadingUpdate(true);
+ yield return null;
+ this.DisplayPrograss(XSceneLoader.LoadingPhase.Scene_Load, 0f);
+ bool flag4 = XSingleton<XUpdater.XUpdater>.singleton.ABManager != null;
+ if (flag4)
+ {
+ XSingleton<XUpdater.XUpdater>.singleton.ABManager.UnloadUnusedBundle(true);
+ }
+ this._op = SceneManager.LoadSceneAsync("empty");
+ while (!this._op.isDone)
+ {
+ yield return null;
+ }
+ this._op = Resources.UnloadUnusedAssets();
+ while (!this._op.isDone)
+ {
+ yield return null;
+ }
+ XSingleton<XResourceLoaderMgr>.singleton.LoadABScene(XSingleton<XSceneMgr>.singleton.GetScenePath(this._loading_scene_id));
+ this._op = SceneManager.LoadSceneAsync(scene);
+ while (!this._op.isDone)
+ {
+ yield return null;
+ }
+ XSingleton<XResourceLoaderMgr>.singleton.DelayLoad = this._DelayLoadCache;
+ XQualitySetting.PostSceneLoad();
+ this.DisplayPrograss(XSceneLoader.LoadingPhase.Scene_Load, 1f);
+ XSingleton<XDebug>.singleton.AddLog("-------------scene ready & begin load other res-------------", null, null, null, null, null, XDebugColor.XDebug_None);
+ yield return null;
+ this._asbr = this.SceneBuildAsync(this._loading_scene_id);
+ yield return null;
+ while (this._asbr.Pedometer.MoveNext())
+ {
+ this.DisplayPrograss(XSceneLoader.LoadingPhase.Scene_Build, this._asbr.Progress);
+ yield return null;
+ }
+ this._asbr = null;
+ bool prograss = this._prograss;
+ if (prograss)
+ {
+ bool flag5 = XStage.IsConcreteStage(this._loading_scene_stage);
+ if (flag5)
+ {
+ XSingleton<XScene>.singleton.RefreshScenMustTransform();
+ this.CreatePlayer();
+ this.DisplayPrograss(XSceneLoader.LoadingPhase.Scene_Doc, 0.3f);
+ yield return null;
+ IEnumerator iter = this.DocPreload(this._loading_scene_id);
+ while (iter.MoveNext())
+ {
+ this.DisplayPrograss(XSceneLoader.LoadingPhase.Scene_Doc, 0.3f + 0.4f * this._sub_progress);
+ yield return null;
+ }
+ iter = null;
+ }
+ XSingleton<XGame>.singleton.OnEnterScene(this._loading_scene_id, false);
+ this.DisplayPrograss(XSceneLoader.LoadingPhase.Scene_Doc, 0.9f);
+ bool flag6 = this._loading_scene_id == 100u;
+ if (flag6)
+ {
+ uint idx = XSingleton<XEntityMgr>.singleton.Player.BasicTypeID - 1u;
+ uint id = XSingleton<XGlobalConfig>.singleton.NewbieLevelRoleID[(int)idx];
+ XEntityStatistics.RowData raw = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(id);
+ XSingleton<XEntityMgr>.singleton.Player.OnTransform(raw.ID);
+ yield return null;
+ raw = null;
+ }
+ this.DisplayPrograss(XSceneLoader.LoadingPhase.Scene_Doc, 1f);
+ yield return null;
+ this._target_progress = 0.9f;
+ bool flag7 = this._prograss && this._current_progress < 0.89f;
+ if (flag7)
+ {
+ yield return null;
+ }
+ this._enabled = false;
+ DlgBase<LoadingDlg, LoadingDlgBehaviour>.singleton.SetLoadingProgress(1f);
+ yield return null;
+ bool flag8 = XStage.IsConcreteStage(this._loading_scene_stage);
+ if (flag8)
+ {
+ RpcC2G_DoEnterScene DoEnterSceneRpc = new RpcC2G_DoEnterScene();
+ DoEnterSceneRpc.oArg.sceneid = XSingleton<XScene>.singleton.SceneID;
+ XSingleton<XClientNetwork>.singleton.Send(DoEnterSceneRpc);
+ XSingleton<XScene>.singleton.bSceneLoadedRpcSend = true;
+ DoEnterSceneRpc = null;
+ }
+ }
+ else
+ {
+ XSingleton<XGame>.singleton.OnEnterScene(this._loading_scene_id, false);
+ }
+ bool flag9 = XStage.IsConcreteStage(this._loading_scene_stage);
+ if (flag9)
+ {
+ yield return null;
+ }
+ else
+ {
+ XSingleton<XScene>.singleton.bSceneServerReady = (XSingleton<XScene>.singleton.Error == ErrorCode.ERR_SUCCESS);
+ yield return null;
+ }
+ int waitTime = 1;
+ XSingleton<XGame>.singleton.networkRun = true;
+ while (!XSingleton<XScene>.singleton.bSceneServerReady)
+ {
+ int num = waitTime;
+ waitTime = num + 1;
+ bool flag10 = XSingleton<XScene>.singleton.Error > ErrorCode.ERR_SUCCESS;
+ if (flag10)
+ {
+ bool flag11 = string.IsNullOrEmpty(XSingleton<XScene>.singleton.ErrorAddtional);
+ if (flag11)
+ {
+ XSingleton<UiUtility>.singleton.OnFatalErrorClosed(XSingleton<XScene>.singleton.Error);
+ }
+ else
+ {
+ XSingleton<UiUtility>.singleton.OnFatalErrorClosed(string.Format(XStringDefineProxy.GetString(XSingleton<XScene>.singleton.Error), XSingleton<XScene>.singleton.ErrorAddtional));
+ }
+ XSingleton<XScene>.singleton.Error = ErrorCode.ERR_SUCCESS;
+ XSingleton<XScene>.singleton.ErrorAddtional = null;
+ XSingleton<XClientNetwork>.singleton.CloseOnServerErrorNtf = false;
+ break;
+ }
+ bool flag12 = XSingleton<XScene>.singleton.SceneEntranceConfig != null;
+ if (flag12)
+ {
+ this._prograss = false;
+ XSingleton<XScene>.singleton.TriggerScene();
+ break;
+ }
+ yield return null;
+ }
+ bool bSceneServerReady = XSingleton<XScene>.singleton.bSceneServerReady;
+ if (bSceneServerReady)
+ {
+ this.PlayBGM(this._loading_scene_id);
+ XAutoFade.MakeBlack(true);
+ this._prograss = false;
+ yield return null;
+ DlgBase<LoadingDlg, LoadingDlgBehaviour>.singleton.HideSelf(false);
+ XSingleton<XScene>.singleton.TriggerScene();
+ yield return null;
+ XAutoFade.FadeIn(1f, true);
+ }
+ this._op = null;
+ bool flag13 = XSingleton<XScene>.singleton.SceneEntranceConfig != null;
+ if (flag13)
+ {
+ XSingleton<XScene>.singleton.SceneEnterTo(true);
+ }
+ XSingleton<XGame>.singleton.notLoadScene = true;
+ XSingleton<XGame>.singleton.switchScene = false;
+ XSingleton<XTimerMgr>.singleton.update = true;
+ Application.backgroundLoadingPriority = (ThreadPriority)2;
+ bool settingEnum = XSingleton<XGlobalConfig>.singleton.GetSettingEnum(ESettingConfig.ESceneUnloadResource);
+ if (settingEnum)
+ {
+ Resources.UnloadUnusedAssets();
+ }
+ bool flag14 = this._loading_scene_id == 1u;
+ if (flag14)
+ {
+ GC.Collect();
+ }
+ XSingleton<XUpdater.XUpdater>.singleton.XPlatform.MarkLoadlevelCompleted();
+ yield break;
+ }
+
+ private void Update()
+ {
+ bool flag = this._enabled && this._prograss;
+ if (flag)
+ {
+ this._current_progress += Mathf.Abs(this._target_progress - this._current_progress) * 0.5f;
+ DlgBase<LoadingDlg, LoadingDlgBehaviour>.singleton.SetLoadingProgress(this._current_progress);
+ }
+ }
+
+ private void DisplayPrograss(XSceneLoader.LoadingPhase phase, float progress)
+ {
+ bool flag = !this._prograss;
+ if (!flag)
+ {
+ switch (phase)
+ {
+ case XSceneLoader.LoadingPhase.Scene_Downlaod:
+ this._target_progress = progress * 0.1f;
+ break;
+ case XSceneLoader.LoadingPhase.Scene_Load:
+ this._target_progress = progress * 0.2f + 0.1f;
+ break;
+ case XSceneLoader.LoadingPhase.Scene_Build:
+ this._target_progress = progress * 0.4f + 0.3f;
+ break;
+ case XSceneLoader.LoadingPhase.Scene_Doc:
+ this._target_progress = progress * 0.2f + 0.7f;
+ break;
+ }
+ }
+ }
+
+ private XSceneLoader.AsyncSceneBuildRequest SceneBuildAsync(uint sceneID)
+ {
+ return new XSceneLoader.AsyncSceneBuildRequest
+ {
+ Pedometer = this.Preloader(sceneID)
+ };
+ }
+
+ private IEnumerator Preloader(uint sceneID)
+ {
+ IEnumerator ietr = null;
+ this._asbr.Progress = 0f;
+ yield return null;
+ XSingleton<XScene>.singleton.OnSceneLoaded(sceneID);
+ this._asbr.Progress = 0.05f;
+ yield return null;
+ ietr = this.PreLoadSceneMonster(sceneID);
+ while (ietr.MoveNext())
+ {
+ this._asbr.Progress = 0.05f + this._sub_progress * 0.75f;
+ yield return null;
+ }
+ ietr = this.PreLoadSceneRes(sceneID);
+ while (ietr.MoveNext())
+ {
+ this._asbr.Progress = 0.8f + this._sub_progress * 0.1f;
+ yield return null;
+ }
+ ietr = this.PlaceSceneNpc(sceneID);
+ while (ietr.MoveNext())
+ {
+ this._asbr.Progress = 0.9f + this._sub_progress * 0.1f;
+ yield return null;
+ }
+ this._asbr.Progress = 1f;
+ yield break;
+ }
+
+ private void CreatePlayer()
+ {
+ this._sub_progress = 0f;
+ XSingleton<XDebug>.singleton.AddLog("Preload Player", null, null, null, null, null, XDebugColor.XDebug_None);
+ XSingleton<XEntityMgr>.singleton.Add(XSingleton<XEntityMgr>.singleton.CreatePlayer(Vector3.zero, Quaternion.identity, false, XSingleton<XScene>.singleton.IsMustTransform || this._LoadingSpectateScene));
+ this._LoadingSpectateScene = false;
+ }
+
+ private IEnumerator PlaceSceneNpc(uint sceneID)
+ {
+ this._sub_progress = 0f;
+ List<uint> npcList = XSingleton<XEntityMgr>.singleton.GetNpcs(sceneID);
+ bool flag = npcList != null && npcList.Count > 0;
+ if (flag)
+ {
+ int step = 0;
+ XTaskDocument taskDoc = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
+ int num;
+ for (int i = 0; i < npcList.Count; i = num + 1)
+ {
+ num = step;
+ step = num + 1;
+ bool flag2 = !taskDoc.ShouldNpcExist(npcList[i]);
+ if (!flag2)
+ {
+ XSingleton<XEntityMgr>.singleton.CreateNpc(npcList[i], true);
+ this._sub_progress = (float)step / (float)npcList.Count;
+ }
+ num = i;
+ }
+ taskDoc = null;
+ }
+ this._sub_progress = 1f;
+ yield return null;
+ yield break;
+ }
+
+ private IEnumerator PreLoadSceneMonster(uint sceneID)
+ {
+ this._sub_progress = 0f;
+ List<uint> prefabs = new List<uint>();
+ XLevelSpawnInfo spawner = XSingleton<XLevelSpawnMgr>.singleton.GetSpawnerBySceneID(sceneID);
+ bool flag = spawner != null;
+ if (flag)
+ {
+ Dictionary<int, int> preloadInfo = new Dictionary<int, int>();
+ foreach (KeyValuePair<int, int> keyValuePair in spawner._preloadInfo)
+ {
+ bool flag2 = keyValuePair.Key == 0;
+ if (!flag2)
+ {
+ preloadInfo.Add(keyValuePair.Key, keyValuePair.Value);
+ //!
+ // keyValuePair = default(KeyValuePair<int, int>);
+ }
+ }
+ Dictionary<int, int>.Enumerator enumerator = default(Dictionary<int, int>.Enumerator);
+ bool flag3 = !XSingleton<XLevelSpawnMgr>.singleton.ForcePreloadOneWave;
+ if (flag3)
+ {
+ int i = 0;
+ while (i < XSingleton<XLevelSpawnMgr>.singleton.MonsterIDs.Count && preloadInfo.Count < XSingleton<XLevelSpawnMgr>.singleton.MaxPreloadCount)
+ {
+ bool flag4 = XSingleton<XLevelSpawnMgr>.singleton.MonsterIDs[i] == 0u;
+ if (!flag4)
+ {
+ bool flag5 = !preloadInfo.ContainsKey((int)XSingleton<XLevelSpawnMgr>.singleton.MonsterIDs[i]);
+ if (flag5)
+ {
+ preloadInfo.Add((int)XSingleton<XLevelSpawnMgr>.singleton.MonsterIDs[i], 1);
+ }
+ }
+ int num = i + 1;
+ i = num;
+ }
+ }
+ int step = 0;
+ float progress = 0f;
+ foreach (KeyValuePair<int, int> keyValuePair2 in preloadInfo)
+ {
+ int num = step;
+ step = num + 1;
+ progress = (float)step / (float)preloadInfo.Count * 0.9f;
+ uint enemyID = (uint)keyValuePair2.Key;
+ XEntityStatistics.RowData data = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(enemyID);
+ bool flag6 = data == null;
+ if (flag6)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("Cant find statistic id: ", enemyID.ToString(), null, null, null, null);
+ }
+ else
+ {
+ XEntityPresentation.RowData presentData = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(data.PresentID);
+ bool flag7 = presentData == null;
+ if (flag7)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("Cant find present id ", data.PresentID.ToString(), " while statistic id = ", data.ID.ToString(), null, null);
+ }
+ else
+ {
+ string prefab = presentData.Prefab;
+ bool flag8 = !prefabs.Contains(data.PresentID);
+ if (flag8)
+ {
+ string location = "Prefabs/" + prefab;
+ float diff = progress - this._sub_progress;
+ XSingleton<XResourceLoaderMgr>.singleton.CreateInAdvance(location, 1, ECreateHideType.DisableAnim);
+ this._sub_progress += diff * 0.2f;
+ XSingleton<XDebug>.singleton.AddLog("Preload ", prefab, " with pid ", data.PresentID.ToString(), null, null, XDebugColor.XDebug_None);
+ XSingleton<XEntityMgr>.singleton.PreloadTemp(data.PresentID, enemyID, (EntitySpecies)data.Type);
+ this._sub_progress += diff * 0.7f;
+ prefabs.Add(data.PresentID);
+ location = null;
+ }
+ this._sub_progress = progress;
+ bool flag9 =(int) Application.platform == 7 || Application.platform == 0;
+ if (flag9)
+ {
+ yield return null;
+ }
+ data = null;
+ presentData = null;
+ prefab = null;
+ //!
+ //keyValuePair2 = default(KeyValuePair<int, int>);
+ }
+ }
+ }
+ Dictionary<int, int>.Enumerator enumerator2 = default(Dictionary<int, int>.Enumerator);
+ this._sub_progress = 0.9f;
+ XSingleton<XResourceLoaderMgr>.singleton.CreateInAdvance(XCombatHUDMgr.HUD_NORMAL, 10, ECreateHideType.NotHide);
+ XSingleton<XResourceLoaderMgr>.singleton.CreateInAdvance(XCombatHUDMgr.HUD_CRITICAL, 5, ECreateHideType.NotHide);
+ XSingleton<XResourceLoaderMgr>.singleton.CreateInAdvance(XCombatHUDMgr.HUD_PLAYER, 5, ECreateHideType.NotHide);
+ this._sub_progress = 1f;
+ preloadInfo = null;
+ }
+ bool flag10 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_HALL;
+ if (flag10)
+ {
+ XBillBoardDocument.PreLoad(16);
+ XSingleton<XGameUI>.singleton.m_uiTool.PreLoad(true);
+ }
+ else
+ {
+ bool flag11 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_LOGIN;
+ if (!flag11)
+ {
+ XSingleton<XGameUI>.singleton.m_uiTool.PreLoad(true);
+ }
+ }
+ yield return null;
+ this._sub_progress = 1f;
+ yield break;
+ yield break;
+ }
+
+ private IEnumerator PreLoadSceneRes(uint sceneID)
+ {
+ this._sub_progress = 0f;
+ bool flag = sceneID > 3u;
+ if (flag)
+ {
+ PreloadAnimationList.RowData[] Anims = XSingleton<XSceneMgr>.singleton.AnimReader.Table;
+ int step = 0;
+ int i = 0;
+ int imax = Anims.Length;
+ while (i < imax)
+ {
+ this._sub_progress = 0.5f + (float)step / ((float)Anims.Length * 2f);
+ PreloadAnimationList.RowData rowData = Anims[i];
+ bool flag2 = rowData.SceneID == 0 || (long)rowData.SceneID == (long)((ulong)sceneID);
+ int num;
+ if (flag2)
+ {
+ num = step;
+ step = num + 1;
+ XSingleton<XResourceLoaderMgr>.singleton.GetXAnimation(rowData.AnimName, true, true);
+ yield return null;
+ }
+ rowData = null;
+ num = i + 1;
+ i = num;
+ }
+ Anims = null;
+ }
+ this._sub_progress = 1f;
+ yield break;
+ }
+
+ private void PlayBGM(uint sceneid)
+ {
+ string sceneBGM = XSingleton<XSceneMgr>.singleton.GetSceneBGM(sceneid);
+ XSingleton<XAudioMgr>.singleton.PlayBGM(sceneBGM);
+ }
+
+ private IEnumerator DocPreload(uint sceneid)
+ {
+ this._sub_progress = 0f;
+ int num;
+ for (int i = 0; i < XSingleton<XGame>.singleton.Doc.Components.Count; i = num + 1)
+ {
+ XSingleton<XGame>.singleton.Doc.Components[i].OnEnterScene();
+ this._sub_progress = (float)i / (float)XSingleton<XGame>.singleton.Doc.Components.Count;
+ num = i;
+ }
+ yield return null;
+ this._sub_progress = 1f;
+ yield break;
+ }
+
+ private string GetMyProfessionLoadingPic()
+ {
+ uint num = XSingleton<XAttributeMgr>.singleton.XPlayerData.TypeID % 10u;
+ string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("ProfessionLoadingPic").Split(XGlobalConfig.AllSeparators);
+ bool flag = array.Length % 2 != 0;
+ string result;
+ if (flag)
+ {
+ result = "";
+ }
+ else
+ {
+ for (int i = 0; i < array.Length; i += 2)
+ {
+ bool flag2 = uint.Parse(array[i]) == num;
+ if (flag2)
+ {
+ return array[i + 1];
+ }
+ }
+ result = "";
+ }
+ return result;
+ }
+ }
+}