123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- 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");
- }
- public override void Show()
- {
- base.Show();
- index = 0;
- Text_01.StringContent = "龙泉剑\n在白帝城偶遇诗仙李白获赠的随身佩剑";
- Text_01.SetContent();
- }
- 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()
- {
- PlayableDirector playableDirector = GameObject.Find("timeline").gameObject.GetComponent<PlayableDirector>();
- ResetTrackAsset(playableDirector);
- 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;
- }
- break;
- }
- }
- // foreach (var playableAssetOutput in playableDirector.playableAsset.outputs)
- // {
- //
- // TrackAsset asset = playableAssetOutput.sourceObject as TrackAsset;
- // asset.muted = true;
- // }
- //
- //
- // foreach (var playableAssetOutput in playableDirector.playableAsset.outputs)
- // {
- // TrackAsset asset = playableAssetOutput.sourceObject as TrackAsset;
- //
- //
- // switch (index)
- // {
- // case 0:
- //
- // if (asset.GetGroup().name == "1")
- // {
- // asset.muted = false;
- // }
- //
- // break;
- //
- // case 1:
- //
- // if (asset.GetGroup().name == "2")
- // {
- // asset.muted = false;
- // }
- //
- //
- // break;
- // }
- // }
- playableDirector.time = 0;
- playableDirector.Play();
- index++;
- if (index > 1)
- {
- TimeComponent.Instance.AddTimer(1.8f, () =>
- {
- UIManager.Instance.HideUIPanel<TipPanel>();
- SceneManager.LoadScene("baidicheng");
- TimeComponent.Instance.AddTimer(23f, () => { UIManager.Instance.LoadAndOpenPanel<ChatPanel>(UIManager.UILayer.Middle); });
- });
- }
- }
- }
- }
|