2024-05-17 19:27:02 +08:00
|
|
|
|
using Cysharp.Threading.Tasks;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
using Framework;
|
|
|
|
|
|
using Gameplay;
|
2024-05-29 16:36:30 +08:00
|
|
|
|
using Gameplay.Guide;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
using Gameplay.SubSystems;
|
2024-06-21 12:46:27 +08:00
|
|
|
|
using System;
|
2024-07-12 15:21:16 +08:00
|
|
|
|
using System.Runtime.CompilerServices;
|
2025-03-18 14:15:32 +08:00
|
|
|
|
using UnityEngine;
|
2024-05-31 14:26:33 +08:00
|
|
|
|
#if SDK_TAPTAP
|
|
|
|
|
|
using PhxhSDK;
|
|
|
|
|
|
#endif
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
public class GameStateMainScene : IState
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-10-15 18:48:43 +08:00
|
|
|
|
private readonly Func<UniTask> callbackFunc;
|
2024-10-30 16:58:42 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否打开主界面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private bool isOpenMain;
|
2024-06-21 12:46:27 +08:00
|
|
|
|
|
2024-07-12 15:21:16 +08:00
|
|
|
|
public bool IsLogin { get; }
|
|
|
|
|
|
|
2024-10-30 16:58:42 +08:00
|
|
|
|
public GameStateMainScene(bool isLogin = false, bool isOpenMain = true, Func<UniTask> callback = null)
|
2024-06-21 12:46:27 +08:00
|
|
|
|
{
|
2024-10-15 18:48:43 +08:00
|
|
|
|
callbackFunc = callback;
|
2024-10-30 16:58:42 +08:00
|
|
|
|
this.isOpenMain = isOpenMain;
|
2024-07-12 15:21:16 +08:00
|
|
|
|
IsLogin = isLogin;
|
2024-06-21 12:46:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-28 17:03:50 +08:00
|
|
|
|
public void OnEnter()
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2025-03-18 14:15:32 +08:00
|
|
|
|
#region TODO 涛哥手机视频卡死测试
|
|
|
|
|
|
int test = PlayerPrefs.GetInt("Test_Login_Type", 0); // 测试代码,为0时走正常加载,1时测试通用加载
|
|
|
|
|
|
E_LoadingType loadingType;
|
|
|
|
|
|
if (0 == test)
|
|
|
|
|
|
loadingType = IsLogin ? E_LoadingType.Login : E_LoadingType.CommonLoading;
|
|
|
|
|
|
else
|
|
|
|
|
|
loadingType = E_LoadingType.CommonLoading;
|
|
|
|
|
|
#endregion
|
2024-12-11 11:16:11 +08:00
|
|
|
|
DebugUtil.Log("loginType:" + loadingType.ToString());
|
2024-08-30 15:58:29 +08:00
|
|
|
|
LoadingManager.Instance.ExecuteLoading(new MainSceneLoadingExecutor(loadingType, OnLoadingComplete)).Forget();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnUpdate(float deltaTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-02-22 12:46:45 +08:00
|
|
|
|
public void OnExit()
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-08-29 14:54:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-15 18:17:40 +08:00
|
|
|
|
private async UniTask OnLoadingComplete()
|
2024-08-29 14:54:12 +08:00
|
|
|
|
{
|
2024-10-30 16:58:42 +08:00
|
|
|
|
if(isOpenMain)
|
2024-10-30 16:05:53 +08:00
|
|
|
|
await UI_MainPanelController.Open();
|
2024-10-30 16:58:42 +08:00
|
|
|
|
|
|
|
|
|
|
if (null != callbackFunc)
|
2024-10-15 18:48:43 +08:00
|
|
|
|
await callbackFunc.Invoke();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|