using cfg.ShowCfg;
using Cysharp.Threading.Tasks;
using PhxhSDK;
using System;
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 void RefreshShow(E_ShowSceneType showSceneType, object data = null)
{
if (TryGetShow(showSceneType, out IShow show))
await show.RefreshShow(data);
}
///
/// 播放相机动画
///
/// 演出场景类型
/// 动画播放完成回调
public void PlayCameraAnim(E_ShowSceneType showSceneType, Action callbackAction, params string[] args)
{
if (TryGetShow(showSceneType, out IShow show))
show.PlayeCameraAnim(callbackAction, args);
}
///
/// 获取刷新进度
///
///
///
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;
}
}