示例#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);
        }
示例#2
0
        public static GTimelineStyle DeSerialize(string name, string json)
        {
            GTimelineStyle evt = JsonUtility.FromJson(json, typeof(GTimelineStyle)) as GTimelineStyle;

            evt.name = name;
            GTimelineFactory.Deserialize(evt.styles, evt.jsons, evt.types);
            return(evt);
        }
示例#3
0
 public static void ReleaseTimeline(GTimeline tl)
 {
     if (tl == null)
     {
         return;
     }
     tl.Destroy();
     GTimelineFactory.ReleaseEvent(tl);
 }
示例#4
0
 public void Destroy()
 {
     if (mStyle == null)
     {
         return;
     }
     this.mData  = null;
     this.mStyle = null;
     this.root   = null;
     this.ower   = null;
     for (int i = 0; i != _events.Count; ++i)
     {
         _events[i].Destroy();
     }
     _events.Clear();
     OnDestroy();
     GTimelineFactory.ReleaseEvent(this);
 }
示例#5
0
 public static void Deserialize(List <GEventStyle> styles, List <string> jsons, List <string> types)
 {
     styles.Clear();
     for (int i = 0; i < jsons.Count; i++)
     {
         Type type = GTimelineFactory.GetType(types[i]);
         if (type == null)
         {
             continue;
         }
         try
         {
             GEventStyle evt = JsonUtility.FromJson(jsons[i], type) as GEventStyle;
             DeSerialize(evt);
             styles.Add(evt);
         }
         catch (Exception e)
         {
             Debug.LogError(jsons[i] + "\n" + types[i] + "\n" + e.StackTrace + "\n" + e.Message);
         }
     }
 }
示例#6
0
 public static void Update()
 {
     if (mActiveDic.Count == 0)
     {
         return;
     }
     foreach (var tl in mActiveDic.Values)
     {
         tl.Update();
         if (tl.IsStopped && AutoRelease)
         {
             releaseList.Add(tl);
         }
     }
     if (AutoRelease)
     {
         foreach (var tl in releaseList)
         {
             GTimelineFactory.ReleaseTimeline(tl);
         }
         releaseList.Clear();
     }
 }
示例#7
0
 public static void DeSerialize(GEventStyle style)
 {
     GTimelineFactory.Deserialize(style.styles, style.jsons, style.types);
 }
示例#8
0
 public static string Serialize(GEventStyle style)
 {
     GTimelineFactory.Serialize(style.styles, style.jsons, style.types);
     return(JsonUtility.ToJson(style));
 }