using AibisDream.Kit; using UnityEngine; using UnityEngine.Playables; using System.Collections; namespace AibisDream { public class OutsideCenter : Singleton { public BubbleSlotGroup bubbleSlotGroup; public PlayableDirector director; public override void OnSingletonInit() { // 加载气泡 DialogCanvasManager.Instance.SwitchDialogView(DialogViewType.StandardBubble); BubbleGroup.Instance.LoadBubbles(bubbleSlotGroup.CollectData()); } public void PlayTimeline(string timelinePath) { StartCoroutine(PlayTimelineCoroutine(timelinePath)); } public void PlayTimelineAsync(string timelinePath) { var timeline = Resources.Load(timelinePath); if (timeline != null) { director.playableAsset = timeline; director.Play(); } else { Debug.LogError($"Timeline not found at path: {timelinePath}"); } } public IEnumerator PlayTimelineCoroutine(string timelinePath) { var timeline = Resources.Load(timelinePath); if (timeline != null) { director.playableAsset = timeline; director.Play(); yield return new WaitForSeconds((float)director.duration); } else { Debug.LogError($"Timeline not found at path: {timelinePath}"); } } } }