Beispiel #1
0
        private void Build()
        {
            if (!graph.IsValid())
            {
                timelineRoot = new GameObject("timeline");
                graph        = PlayableGraph.Create("TimelineGraph");
            }
            var tracksData = config.tracks;
            int len        = tracksData.Length;

            trackTrees = new XTrack[len];
            for (int i = 0; i < len; i++)
            {
                trackTrees[i] = XTimelineFactory.GetTrack(tracksData[i], this);
                if (i >= 0 && i == config.skillHostTrack)
                {
                    SkillHostTrack = trackTrees[i];
                }
            }
            prev = 0;
            if (graph.IsValid())
            {
                if (Application.isPlaying)
                {
                    graph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);
                    graph.Play();
                    editMode = TimelinePlayMode.RealRunning;
                }
            }
            _duration = RecalcuteDuration();
        }
Beispiel #2
0
        public bool IsChild(XTrack p, bool gradsonContains)
        {
            XTrack tmp = this;

            if (gradsonContains)
            {
                while (tmp)
                {
                    if (tmp.parent != null)
                    {
                        if (tmp.parent.Equals(p))
                        {
                            return(true);
                        }
                        else
                        {
                            tmp = tmp.parent;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            else
            {
                return(p != null && this.parent.Equals(p));
            }
            return(false);
        }
Beispiel #3
0
        public static XMarker GetMarker(XTrack track, MarkData data)
        {
            XMarker marker = null;

            switch (data.type)
            {
            case MarkType.Active:
                marker = SharedPool <XActiveMark> .Get();

                break;

            case MarkType.Jump:
                marker = SharedPool <XJumpMarker> .Get();

                break;

            case MarkType.Slow:
                marker = SharedPool <XSlowMarker> .Get();

                break;
            }
            if (marker != null)
            {
                marker.Initial(track, data);
            }
            return(marker);
        }
Beispiel #4
0
        public static XTrack GetTrack(TrackData data, XTimeline tl, XTrack parent = null)
        {
            XTrack xTrack = null;

            switch (data.type)
            {
            case AssetType.Marker:
                xTrack = SharedPool <XMarkerTrack> .Get();

                break;

            case AssetType.Animation:
                xTrack = SharedPool <XAnimationTrack> .Get();

                break;

            case AssetType.BoneFx:
                xTrack = SharedPool <XBoneFxTrack> .Get();

                break;

            case AssetType.SceneFx:
                xTrack = SharedPool <XSceneFxTrack> .Get();

                break;

            case AssetType.PostProcess:
                xTrack = SharedPool <XPostprocessTrack> .Get();

                break;

            case AssetType.Transform:
                xTrack = SharedPool <XTransformTrack> .Get();

                break;

            case AssetType.LogicValue:
                xTrack = SharedPool <XLogicTrack> .Get();

                break;

            case AssetType.Group:
                xTrack = SharedPool <XGroupTrack> .Get();

                break;

            default:
                Debug.LogError("unknown track " + data.type);
                break;
            }
            if (xTrack)
            {
                xTrack.Initial(data, tl, parent);
            }
            return(xTrack);
        }
Beispiel #5
0
 public bool IsHostTrack(XTrack track)
 {
     if (playMode == PlayMode.Skill)
     {
         int idx    = config.skillHostTrack;
         var tracks = config.tracks;
         return(tracks.Length > idx &&
                tracks[idx] == track.data);
     }
     return(false);
 }
Beispiel #6
0
 public void Initial(TrackData data, XSeqence tl, XTrack parent)
 {
     this.data    = data;
     this.seqence = tl;
     this.parent  = parent;
     if (data != null)
     {
         if (data.clips != null)
         {
             int len = data.clips.Length;
             clips = new IClip[len];
             for (int i = 0; i < len; i++)
             {
                 clips[i] = BuildClip(data.clips[i]);
             }
         }
         if (data.marks != null)
         {
             int len = data.marks.Length;
             marks = new XMarker[len];
             for (int i = 0; i < len; i++)
             {
                 marks[i] = XSeqenceFactory.GetMarker(this, data.marks[i]);
             }
         }
         if (data.childs != null)
         {
             int len = data.childs.Length;
             childs = new XTrack[len];
             for (int i = 0; i < len; i++)
             {
                 childs[i] = XSeqenceFactory.GetTrack(data.childs[i], seqence, this);
             }
         }
     }
     OnPostBuild();
 }
Beispiel #7
0
 public bool Equals(XTrack other)
 {
     return(other != null && ID == other.ID);
 }
Beispiel #8
0
 public void Initial(XTrack tk, MarkData data)
 {
     track = tk;
     Data  = data;
     OnPostBuild();
 }