86 lines
2.2 KiB
C#
86 lines
2.2 KiB
C#
using cfg.ShowCfg;
|
|
using Gameplay.SubSystems;
|
|
using Gameplay;
|
|
using PhxhSDK;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using Cysharp.Threading.Tasks;
|
|
using UnityEngine;
|
|
using static Gameplay.CommonUtils;
|
|
|
|
public class RaffleManager : Singlenton<RaffleManager>
|
|
{
|
|
/// <summary>
|
|
/// 进度
|
|
/// </summary>
|
|
private enum E_Process
|
|
{
|
|
None = 0,
|
|
/// <summary>
|
|
/// 加载场景
|
|
/// </summary>
|
|
LoadingScene,
|
|
/// <summary>
|
|
/// 加载UI
|
|
/// </summary>
|
|
LoadingUI,
|
|
/// <summary>
|
|
/// 刷新抽卡
|
|
/// </summary>
|
|
RefreshRaffle,
|
|
/// <summary>
|
|
/// 当前
|
|
/// </summary>
|
|
Present,
|
|
}
|
|
|
|
public RaffleManager() { }
|
|
|
|
private E_Process curProcess = E_Process.None;
|
|
|
|
/// <summary>
|
|
/// 进入抽卡
|
|
/// </summary>
|
|
public async void EnterRaffle()
|
|
{
|
|
UIManager.Instance.HideAllUI();
|
|
curProcess = E_Process.LoadingScene;
|
|
|
|
LoadingExecutorWithUILoadingController loadingExecutor = new()
|
|
{
|
|
getProgress = GetLoadingProcess
|
|
};
|
|
LoadingExecutorManager.Instance.ExecuteLoading(loadingExecutor).Forget();
|
|
UISceneResult uiSceneResult = await OpenUIWithScene(UINameConst.UI_DrawMain, Framework.Constants.RAFFLE_SCENE_PATH, null, false);
|
|
//curProcess = E_Process.RefreshRaffle;
|
|
|
|
curProcess = E_Process.Present;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 退出抽卡
|
|
/// </summary>
|
|
public async void ExitRaffle()
|
|
{
|
|
await CloseUIWithScene(UINameConst.UI_DrawMain);
|
|
curProcess = E_Process.None;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取加载进度
|
|
/// </summary>
|
|
/// <returns>0f-100f</returns>
|
|
private float GetLoadingProcess()
|
|
{
|
|
return curProcess switch
|
|
{
|
|
E_Process.None => 0f,
|
|
E_Process.LoadingScene => GameSceneManager.Instance.GetSceneLoadingProgress(Framework.Constants.CAMP_SCENE_PATH) * 0.5f,
|
|
E_Process.LoadingUI => 60f,
|
|
//E_Process.RefreshRaffle => 60f + ShowManager.Instance.GetRefreshProcess(E_ShowSceneType.Camp) * 40f,
|
|
E_Process.Present => 100f,
|
|
_ => 0f,
|
|
};
|
|
}
|
|
} |