Exemple #1
0
        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 static void ReleaseEvent(GEvent evt)
 {
     if (evt == null)
     {
         return;
     }
     getPool(evt.mStyle).Release(evt);
 }
        public static GEvent GetEvent(GEventStyle data)
        {
            if (data == null)
            {
                return(null);
            }
            GEvent evt = getPool(data).Get(data.Attr.dataType) as GEvent;

            return(evt);
        }
        public static GTimeline CreatTimeline(GTimelineStyle style)
        {
            if (style == null)
            {
                return(null);
            }
            GTimeline tl = GEvent.Create(null, style, null) as GTimeline;

            tl.Init();
            return(tl);
        }
Exemple #5
0
 /// @brief Returns event on position \e index, they are ordered left to right.
 public void Remove(GEvent evt)
 {
     if (this.mStyle == null || evt == null)
     {
         return;
     }
     if (_events.Remove(evt))
     {
         this.mStyle.styles.Remove(evt.mStyle);
         evt.Destroy();
         UpdateEventIds();
     }
 }
Exemple #6
0
        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);
        }
Exemple #7
0
 public GEvent Get(GEventStyle s)
 {
     if (this.mStyle == s)
     {
         return(this);
     }
     for (int i = 0; i < _events.Count; i++)
     {
         GEvent e = _events[i].Get(s);
         if (e != null)
         {
             return(e);
         }
     }
     return(null);
 }
Exemple #8
0
 /// @brief Compares events based on their start frame, basically used to order them.
 /// @param e1 Event
 /// @param e2 Event
 public static int Compare(GEvent e1, GEvent e2)
 {
     return(e1.Start.CompareTo(e2.Start));
 }
Exemple #9
0
 /// @brief Does the Event collides the \e e?
 public bool Collides(GEvent e)
 {
     return(frameRange.Collides(e.frameRange));
 }
 public static void ReleaseEvent(GEvent evt)
 {
     getPool(evt.mStyle).Release(evt);
 }