using System.Collections.Generic; using Mono.UI.Core; using UnityEngine; using UnityEngine.Playables; using UnityEngine.SceneManagement; using UnityEngine.Timeline; using UnityEngine.UI; namespace Mono { [UIBinding(prefab = "TipPanel")] public class TipPanel : UIPanel { public Text Text_00; public Typewriter Text_01; public override void GetUIData() { Text_00 = UIData.Get("Text_00"); Text_01 = UIData.Get("Text_01"); } private PlayableDirector playableDirector; public override void Show() { base.Show(); index = 0; // Text_01.StringContent = "龙泉剑\n在白帝城偶遇诗仙李白获赠的随身佩剑"; // Text_01.SetContent(); // playableDirector = GameObject.Find("timeline").gameObject.GetComponent(); ResetTrackAsset(playableDirector); } private int index = 0; /// /// 所有的轨道组 /// public List trackGroups = new List(); public void ResetTrackAsset(PlayableDirector pd) { trackGroups.Clear(); TimelineAsset ta = (TimelineAsset)pd.playableAsset; for (int i = 0; i < ta.rootTrackCount; i++) { TrackAsset trackAsset = ta.GetRootTrack(i); trackAsset.muted = true; trackGroups.Add(trackAsset); } } private void MuteAll() { foreach (TrackAsset trackGroup in trackGroups) { // trackGroup. trackGroup.muted = true; } } public void DBJNext() { MuteAll(); foreach (var trackGroup in trackGroups) { switch (index) { case 0: if (trackGroup.name == "1") { trackGroup.muted = false; } break; case 1: if (trackGroup.name == "2") { trackGroup.muted = false; } UIManager.Instance.PlayAudioClip("SowrdDraw"); break; } } playableDirector.Stop(); playableDirector.time = 0; playableDirector.Play(); index++; if (index > 1) { TimeComponent.Instance.AddTimer(1.5f, () => { UIManager.Instance.HideUIPanel(); SceneManager.LoadScene("baidicheng"); UIManager.Instance.PlayBGM("Scene04"); TimeComponent.Instance.AddTimer(22f, () => { UIManager.Instance.LoadAndOpenPanel(UIManager.UILayer.Middle); }); }); } } } }