77 lines
1.9 KiB
C#
77 lines
1.9 KiB
C#
using cfg.ShowCfg;
|
|
using Cysharp.Threading.Tasks;
|
|
using PhxhSDK;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 演出管理器
|
|
/// </summary>
|
|
public class ShowManager : Singlenton<ShowManager>, IInitable
|
|
{
|
|
private Dictionary<E_ShowSceneType, IShow> dicShow;
|
|
|
|
public void Init()
|
|
{
|
|
dicShow = new();
|
|
}
|
|
|
|
public void Release()
|
|
{
|
|
dicShow.Clear();
|
|
dicShow = null;
|
|
}
|
|
|
|
public void Add(IShow show)
|
|
{
|
|
dicShow[show.ShowSceneTyp] = show;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 刷新演出
|
|
/// </summary>
|
|
/// <param name="showSceneType"></param>
|
|
/// <returns></returns>
|
|
public async void RefreshShow(E_ShowSceneType showSceneType, object data = null)
|
|
{
|
|
if (TryGetShow(showSceneType, out IShow show))
|
|
await show.RefreshShow(data);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 播放相机动画
|
|
/// </summary>
|
|
/// <param name="showSceneType">演出场景类型</param>
|
|
/// <param name="callbackAction">动画播放完成回调</param>
|
|
public void PlayCameraAnim(E_ShowSceneType showSceneType, Action callbackAction, params string[] args)
|
|
{
|
|
if (TryGetShow(showSceneType, out IShow show))
|
|
show.PlayeCameraAnim(callbackAction, args);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取刷新进度
|
|
/// </summary>
|
|
/// <param name="showSceneType"></param>
|
|
/// <returns></returns>
|
|
public float GetRefreshProcess(E_ShowSceneType showSceneType)
|
|
{
|
|
if (TryGetShow(showSceneType, out IShow show))
|
|
return show.GetRefreshProcess();
|
|
else
|
|
return 0f;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取演出
|
|
/// </summary>
|
|
/// <param name="showSceneType"></param>
|
|
/// <returns></returns>
|
|
private bool TryGetShow(E_ShowSceneType showSceneType, out IShow show)
|
|
{
|
|
return dicShow.TryGetValue(showSceneType, out show) && show != null;
|
|
}
|
|
}
|