public static GEvent Create(GTimeline root, GEventStyle data, GEvent parent) { GEvent evt = GTimelineFactory.GetEvent(data); if (root == null) { if (evt is GTimeline) { root = evt as GTimeline; } else { return(null); } } evt.mParent = parent; evt.root = root; evt.mStyle = data; evt.frameRange = data.range; for (int i = 0; i < data.styles.Count; i++) { GEvent child = GEvent.Create(root, data.styles[i], evt); child.SetId(i); evt._events.Add(child); } return(evt); }
public GEvent Add <T>(T data) where T : GEventStyle { if (mStyle == null || data == null) { return(null); } mStyle.styles.Add(data); GEvent evt = GEvent.Create(this.root, data, this); int id = _events.Count; _events.Add(evt); evt.SetId(id); evt.Init(); return(evt); }