public static void Remove(this XTrack track, XSeqence seqence) { if (track.parent) { var chs = track.parent.childs; int idx = -1; for (int i = 0; i < chs.Length; i++) { if (chs[i].Equals(track)) { idx = i; break; } } if (idx >= 0) { track.parent.RemoveChild(idx); } } else { var list = seqence.trackTrees.ToList(); if (list.Contains(track)) { list.Remove(track); seqence.trackTrees = list.ToArray(); } } track.OnDestroy(); }
public static void AddRootTrack(this XSeqence seqence, XTrack track) { var tracks = seqence.trackTrees.ToList(); tracks.Add(track); seqence.trackTrees = tracks.ToArray(); }
public static void GetTrackByDataType(Type type, XSeqence seqence, XTrack parent, Action <XTrack, TrackData, object> cb) { TrackData data = CreateTrackData(type); if (data != null) { if (type == typeof(XAnimationTrack)) { CharacterWindow.ShowWindow(ch => { if (ch != null) { var bd = data as AnimationTrackData; bd.prefab = ch.prefab; bd.roleid = ch.id; cb(XSeqenceFactory.GetTrack(data, seqence, parent), data, ch); } else { cb(null, data, null); } }); } else { cb(XSeqenceFactory.GetTrack(data, seqence, parent), data, null); } } else { cb(null, null, null); } }
public void Start() { Application.targetFrameRate = 30; if (Application.isPlaying) { seqence = new XSeqence(path, PlayMode.Plot); seqence.SetPlaying(true); } play = true; }
public void CheckExist() { if (seqence == null && Application.isPlaying) { var run = Object.FindObjectOfType <RuntimeSeqence>(); if (run) { seqence = run.seqence; } } }
public void Open(string path, PlayMode mode) { Dispose(); this.path = path; seqence = new XSeqence(path, mode); seqence.Finish = OnPlayFinish; AddRuntime(); float dur = seqence.RecalcuteDuration(); window.SetTimeRange(0, dur * 1.5f); }
public void Dispose() { path = string.Empty; CleanEnv(); RebuildInspector(); seqence?.Dispose(); seqence = null; if (window != null) { window.Dispose(); } XResources.Clean(); }
public void PlaySkill(string skill) { string path = "Assets/skill/" + skill + ".xml"; if (timeline == null) { timeline = new XSeqence(path, UnityEngine.Timeline.PlayMode.Skill, ator); timeline.SetPlaying(true); } else { timeline.BlendTo(path); } }
public static void BuildConf(this XSeqence seqence) { var tree = seqence.trackTrees; if (tree != null) { int len = tree.Length; seqence.config.tracks = new TrackData[len]; for (int i = 0; i < len; i++) { seqence.config.tracks[i] = tree[i].data; } } }
private void OnPlayChanged(PlayModeStateChange state) { if (state == PlayModeStateChange.ExitingEditMode || state == PlayModeStateChange.ExitingPlayMode || state == PlayModeStateChange.EnteredEditMode) { seqence?.Dispose(); seqence = null; CleanEnv(); if (window != null) { window.Dispose(); window.Repaint(); } } }
public static void OnSave(this XSeqence seqence) { var tree = seqence.trackTrees; if (tree != null) { foreach (var track in tree) { if (track.clips != null) { foreach (var clip in track.clips) { clip.OnSave(); } } } } }
public void CreateTimeline(string path, PlayMode mode) { Dispose(); this.path = path; TimelineConfig xconf = new TimelineConfig(); xconf.tracks = new TrackData[1]; TrackData data = new TrackData(); data.type = AssetType.Marker; xconf.tracks[0] = data; xconf.Write(path); seqence = new XSeqence(xconf, mode); seqence.Finish = OnPlayFinish; AddRuntime(); seqence.Time = 1.0f; seqence.editMode = SeqencePlayMode.EditorRun; }