using PhxhSDK; using Framework.UI; using Gameplay.Level; using Gameplay.Manager; using Framework.Manager; using Framework.Constants; using Cysharp.Threading.Tasks; using Gameplay.ForestLevel; using UnityEngine.SceneManagement; using UnityEngine.AddressableAssets; namespace Gameplay.LoadingExecutor { public class LevelLoadingExecutor : LoadingExecutorWithUILoadingController { private string _levelID; protected override async UniTask _DoLoading() { await Addressables.LoadSceneAsync(PathConstants.SceneLevelPath, LoadSceneMode.Single).ToUniTask(); _destProgress = 10f; await LevelManager.Instance.LoadLevel(_levelID); _destProgress = 20f; KongManager.Instance.Init(); _destProgress = 30f; await KongManager.Instance.PreLoadLevelItem(); _destProgress = 40f; await UniTask.Delay(20); PlankManager.Instance.Init(); _destProgress = 50f; await PlankManager.Instance.PreLoadLevelItem(); _destProgress = 70f; await LevelManager.Instance.Init(); _destProgress = 90f; await InitLevelUI(); _destProgress = 100f; } public LevelLoadingExecutor(string levelID) { _levelID = levelID; } private async UniTask InitLevelUI() { UIManager.Instance.CloseWindow(UIConstants.UIWinPanel); UIManager.Instance.CloseWindow(UIConstants.UILosePanel); await UIManager.Instance.OpenWindow(UIConstants.UILevelPanel); var window = UIManager.Instance.GetOpenedWindowByPath(UIConstants.UILevelPanel); window?.ReloadWindow(); CommonUIUtils.DestroyScreenshot(); } protected override void _OnEnd() { LevelManager.Instance.IsInGame = true; LevelManager.Instance.ReportEnterLevel(); AudioManager.Instance.PlayMusic(AudioType.MUSIC, AudioManager.Instance.BGMInLevel, new UnityAudio(true)); } } }