34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
|
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.Timeline;
|
|||
|
using UnityEngine.Playables;
|
|||
|
|
|||
|
namespace Thousandto.Launcher.ExternalLibs
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 触发消息的Track
|
|||
|
/// </summary>
|
|||
|
[TrackColor(0.155f, 0.8623f, 0.870f)]
|
|||
|
[TrackClipType(typeof(PushEventClip))]
|
|||
|
[TrackBindingType(typeof(GameObject))]
|
|||
|
public class PushEventTrack : TrackAsset
|
|||
|
{
|
|||
|
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
|
|||
|
{
|
|||
|
var playable = ScriptPlayable<PushEventMixBehaviour>.Create(graph, inputCount);
|
|||
|
var bh = playable.GetBehaviour();
|
|||
|
var index = 0;
|
|||
|
var enumerator = GetClips().GetEnumerator();
|
|||
|
while (enumerator.MoveNext())
|
|||
|
{
|
|||
|
var tc = enumerator.Current;
|
|||
|
var clip = tc.asset as PushEventClip;
|
|||
|
// 重命名
|
|||
|
tc.displayName = string.Format("PushEvent({0},{1})", clip.EventID, clip.EventParams);
|
|||
|
index++;
|
|||
|
}
|
|||
|
return playable;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|