Esempio n. 1
0
        public static void GetTrackByDataType(Type type, XSeqence seqence, 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(XSeqenceFactory.GetTrack(data, seqence, parent), data, ch);
                        }
                        else
                        {
                            cb(null, data, null);
                        }
                    });
                }
                else
                {
                    cb(XSeqenceFactory.GetTrack(data, seqence, parent), data, null);
                }
            }
            else
            {
                cb(null, null, null);
            }
        }
Esempio 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 = XSeqenceFactory.GetMarker(track, data);
            }
            else if (t == typeof(XSlowMarker))
            {
                data = new SlowMarkData()
                {
                    time = time, slowRate = 0.5f
                };
                marker = XSeqenceFactory.GetMarker(track, data);
            }
            else if (t == typeof(XActiveMark))
            {
                data = new ActiveMarkData()
                {
                    time = time
                };
                marker = XSeqenceFactory.GetMarker(track, data);
            }
            else
            {
                Debug.LogError("unknown mark: " + t);
            }
            if (marker != null)
            {
                track.AddMarker(marker, data);
            }
            return(marker);
        }
Esempio 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] = XSeqenceFactory.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] = XSeqenceFactory.CreateMarkData(reader);
            }
        }