Example #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);
        }
Example #2
0
        public GEventStyle AddStyle(Type t)
        {
            GEventStyle evt = Activator.CreateInstance(t) as GEventStyle;

            styles.Add(evt);
            return(evt);
        }
Example #3
0
        static ObjectPool getPool(GEventStyle data)
        {
            ObjectPool pool = null;

            eventPoolDic.TryGetValue(data.typeName, out pool);
            return(pool);
        }
Example #4
0
        public static GEventAttribute GetAttr(GEventStyle data)
        {
            GEventAttribute attr = null;

            eventAttrDic.TryGetValue(data.GetType(), out attr);
            return(attr);
        }
Example #5
0
        public GEventStyle CreatStyle(Type t)
        {
            GEventStyle evt = Activator.CreateInstance(t) as GEventStyle;

            evt.range = this.range;
            return(evt);
        }
Example #6
0
        public static GEvent GetEvent(GEventStyle data)
        {
            if (data == null)
            {
                return(null);
            }
            GEvent evt = getPool(data).Get(data.Attr.dataType) as GEvent;

            return(evt);
        }
Example #7
0
        public GEvent AddChild(GEventStyle data)
        {
            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);
        }
Example #8
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);
 }
Example #9
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);
         }
     }
 }
Example #10
0
 public static void DeSerialize(GEventStyle style)
 {
     GTimelineFactory.Deserialize(style.styles, style.jsons, style.types);
 }
Example #11
0
 public static string Serialize(GEventStyle style)
 {
     GTimelineFactory.Serialize(style.styles, style.jsons, style.types);
     return(JsonUtility.ToJson(style));
 }