Exemplo n.º 1
0
        public static void GetTrackByDataType(Type type, XTimeline timeline, 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(XTimelineFactory.GetTrack(data, timeline, parent), data, ch);
                        }
                        else
                        {
                            cb(null, data, null);
                        }
                    });
                }
                else
                {
                    cb(XTimelineFactory.GetTrack(data, timeline, parent), data, null);
                }
            }
            else
            {
                cb(null, null, null);
            }
        }
Exemplo n.º 2
0
        public static XMarker MakeMarker(Type t, float time, XTrack track)
        {
            XMarker  marker = null;
            MarkData data   = null;

            if (t == typeof(XJumpMarker))
            {
                data = new JumpMarkData()
                {
                    time = time
                };
                marker = XTimelineFactory.GetMarker(track, data);
            }
            else if (t == typeof(XSlowMarker))
            {
                data = new SlowMarkData()
                {
                    time = time, slowRate = 0.5f
                };
                marker = XTimelineFactory.GetMarker(track, data);
            }
            else if (t == typeof(XActiveMark))
            {
                data = new ActiveMarkData()
                {
                    time = time
                };
                marker = XTimelineFactory.GetMarker(track, data);
            }
            else
            {
                Debug.LogError("unknown mark: " + t);
            }
            if (marker != null)
            {
                track.AddMarker(marker, data);
            }
            return(marker);
        }
Exemplo n.º 3
0
        public virtual void Read(BinaryReader reader)
        {
            int len = reader.ReadInt32();

            if (len > 0)
            {
                clips = new ClipData[len];
            }
            int len2 = reader.ReadInt32();

            if (len2 > 0)
            {
                childs = new TrackData[len2];
            }
            int len3 = reader.ReadInt32();

            if (len3 > 0)
            {
                marks = new MarkData[len3];
            }

            for (int j = 0; j < len; j++)
            {
                clips[j] = XTimelineFactory.CreateClipData(reader);
            }
            for (int j = 0; j < len2; j++)
            {
                childs[j]      = new TrackData();
                childs[j].type = (AssetType)reader.ReadInt32();
                childs[j].Read(reader);
            }
            for (int i = 0; i < len3; i++)
            {
                marks[i] = XTimelineFactory.CreateMarkData(reader);
            }
        }