123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- 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>("Text_00");
- Text_01 = UIData.Get<Typewriter>("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<PlayableDirector>();
- ResetTrackAsset(playableDirector);
- }
- private int index = 0;
- /// <summary>
- /// 所有的轨道组
- /// </summary>
- public List<TrackAsset> trackGroups = new List<TrackAsset>();
- 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<TipPanel>();
- SceneManager.LoadScene("baidicheng");
- UIManager.Instance.PlayBGM("Scene04");
- TimeComponent.Instance.AddTimer(22f, () => { UIManager.Instance.LoadAndOpenPanel<ChatPanel>(UIManager.UILayer.Middle); });
- });
- }
- }
- }
- }
|