Exemple #1
0
        public void SetData(TimelineData data)
        {
            Data = data;

            int maxActionIndex = 0;

            foreach (var track in data.Tracks)
            {
                foreach (var action in track.Actions)
                {
                    if (action.Index > maxActionIndex)
                    {
                        maxActionIndex = action.Index;
                    }
                }
            }
            setting.MaxActionIndex = maxActionIndex;

            trackDrawers.Clear();
            selectedTrackIndex = -1;

            for (int i = 0; i < data.Tracks.Count; ++i)
            {
                TracklineDrawer tracklineDrawer = new TracklineDrawer(this);
                tracklineDrawer.SetData(data.Tracks[i]);

                trackDrawers.Add(tracklineDrawer);
            }
        }
Exemple #2
0
        internal void OnTrackAdded(TracklineData tracklineData, int insertIndex = -1)
        {
            if (insertIndex < 0)
            {
                insertIndex = trackDrawers.Count;
            }

            TracklineDrawer tracklineDrawer = new TracklineDrawer(this);

            tracklineDrawer.SetData(tracklineData);

            Data.Tracks.Insert(insertIndex, tracklineData);
            trackDrawers.Insert(insertIndex, tracklineDrawer);
        }
Exemple #3
0
        internal void OnTrackSelected(TracklineDrawer tracklineDrawer)
        {
            if (tracklineDrawer == null)
            {
                selectedTrackIndex = -1;
            }
            else
            {
                int newSelectedTrackIndex = trackDrawers.IndexOf(tracklineDrawer);
                if (newSelectedTrackIndex != selectedTrackIndex)
                {
                    if (selectedTrackIndex >= 0 && selectedTrackIndex < trackDrawers.Count)
                    {
                        trackDrawers[selectedTrackIndex].IsSelected = false;
                    }
                    selectedTrackIndex = newSelectedTrackIndex;
                }
            }

            Window.Repaint();
        }
Exemple #4
0
 public ActionDrawer(TracklineDrawer drawer)
 {
     ParentDrawer = drawer;
 }