using cfg.ShowCfg;
using Cysharp.Threading.Tasks;
using PhxhSDK;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 演出管理器
///
public class ShowManager : Singlenton, IInitable
{
private Dictionary dicShow;
public void Init()
{
dicShow = new();
}
public void Release()
{
dicShow.Clear();
dicShow = null;
}
public void Add(IShow show)
{
dicShow[show.ShowSceneTyp] = show;
}
///
/// 刷新演出
///
///
///
public async UniTask RefreshShow(E_ShowSceneType showSceneType)
{
if (TryGetShow(showSceneType, out IShow show))
await show.RefreshShow();
}
///
/// 获取刷新进度
///
///
///
public float GetRefreshProcess(E_ShowSceneType showSceneType)
{
if (TryGetShow(showSceneType, out IShow show))
return show.GetRefreshProcess();
else
return 0f;
}
///
/// 获取演出
///
///
///
private bool TryGetShow(E_ShowSceneType showSceneType, out IShow show)
{
return dicShow.TryGetValue(showSceneType, out show) && show != null;
}
}