Beispiel #1
0
        public static bool AddMarker(this XTrack track, XMarker marker, MarkData data)
        {
            if (track.marks != null)
            {
                var list = track.marks.ToList();

                if (!list.Contains(marker))
                {
                    list.Add(marker);
                    list.Sort((x, y) => x.time.CompareTo(y.time));
                    track.marks = list.ToArray();

                    var datas = track.data.marks.ToList();
                    datas.Add(data);
                    track.data.marks = datas.ToArray();
                    return(true);
                }
            }
            else
            {
                track.marks      = new XMarker[1];
                track.marks[0]   = marker;
                track.data.marks = new[] { data };
            }
            return(false);
        }
Beispiel #2
0
        void DeleteRectMark(object arg)
        {
            XMarker select = (XMarker)arg;
            var     track  = state.seqence.markerTrack;

            track.RmMarker(select);
        }
Beispiel #3
0
 public override void OnInit(XSeqenceObject marker)
 {
     this.baseMarker = (XMarker)marker;
     draging         = false;
     e = Event.current;
     OnInit();
 }
Beispiel #4
0
 void DrawMarkItem(XMarker mark)
 {
     if (IsTimeRange(mark.time))
     {
         float x    = TimeToPixel(mark.time);
         Rect  rect = markderRect;
         rect.x     = x - 8;
         rect.width = markWidth;
         GUIContent cont = state.config.GetIcon(mark.type);
         GUI.Box(rect, cont, GUIStyle.none);
     }
 }
Beispiel #5
0
        void _Init()
        {
            originMarker           = new XMarker();
            originMarker.DrawColor = Color.FromArgb(125, Color.Red);
            aimMarker            = new XMarker();
            aimMarker.DrawColor  = Color.FromArgb(125, Color.Red);
            spinMarker           = new XMarker();
            spinMarker.DrawColor = Color.FromArgb(125, Color.Green);
            //aimTraj = new Trajectory("aimTraj");
            //spinTraj = new Trajectory("spinTraj");

            aimTraj  = new Trajectory("aimTraj");
            spinTraj = new Trajectory("spinTraj");
        }
Beispiel #6
0
        public static bool RmMarker(this XTrack track, XMarker marker)
        {
            if (track.marks != null)
            {
                var list = track.marks.ToList();

                if (list.Contains(marker))
                {
                    var datas = track.data.marks.ToList();
                    datas.Remove(marker.Data);
                    track.data.marks = datas.ToArray();

                    list.Remove(marker);
                    track.marks = list.ToArray();
                    return(true);
                }
            }
            return(false);
        }
Beispiel #7
0
        private void ProcessEvent()
        {
            if (e == null)
            {
                e = Event.current;
            }
            bool inMarkRect = markderRect.Contains(e.mousePosition);

            switch (e.type)
            {
            case (EventType.ContextClick):
                if (e.button == 1 && inMarkRect)
                {
                    GenMenu(e);
                }
                break;

            case EventType.MouseDown:
                if (inMarkRect)
                {
                    OnMouseDown(e);
                }
                break;

            case EventType.MouseUp:
                if (draging != null)
                {
                    var tre = state.seqence.trackTrees;
                    tre[0].SortMark();
                }
                draging = null;
                break;

            case EventType.MouseDrag:
            case EventType.ScrollWheel:
                OnMarkDrag(e);
                break;
            }
        }
Beispiel #8
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);
        }
Beispiel #9
0
 void InitializeMarkerHeader()
 {
     draging            = null;
     markderRect.width  = winArea.width;
     markderRect.height = WindowConstants.markerRowHeight;
 }
Beispiel #10
0
 private void OnMouseDown(Event e)
 {
     draging = TrigerMark(e);
 }