using System; using UnityEngine; using UnityEngine.Playables; namespace Thousandto.Launcher.ExternalLibs { /// /// 触发消息的模块 /// [Serializable] public class PushEventClip : PlayableAsset { //是否为全局触发,没有特定的事件接收者 public bool IsGlobal = true; //是否为多次触发 -- 没帧都会触发 public bool IsMultiple = false; //事件ID public int EventID = -1; //事件参数 public string EventParams = string.Empty; private PushEventBehaviour template = new PushEventBehaviour(); public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable.Create(graph, template); var behaviour = playable.GetBehaviour(); if (behaviour != null) { behaviour.IsGlobal = IsGlobal; behaviour.IsMultiple = IsMultiple; behaviour.EventID = EventID; behaviour.EventParams = EventParams; } return playable; } } }