protected void EventMeauDeleteClipEvent(EditorClip clip, EditorClipMaker maker) { clip.BeginChange(); clip.ListClipEvent.Remove(this); clip.EndChange(); maker.ClearSelectClipEvent(); maker.MarkModified(); }
protected void MeauEventClearClipEvent(object param) { EditorClipMaker editorMaker = param as EditorClipMaker; this.BeginChange(); ListClipEvent.Clear(); this.EndChange(); editorMaker.MarkModified(); }
protected void MeauEventAddClipEvent(float rate, EditorClipMaker maker) { this.BeginChange(); EditorClipEvent clipEvent = new EditorClipEvent(); clipEvent.triggerTime = rate; ListClipEvent.Add(clipEvent); this.EndChange(); maker.MarkModified(); }
protected void MeauEventParseClipEvent(float rate, EditorClipMaker maker) { this.BeginChange(); if (EditorClipEvent.CloneInstance != null) { EditorClipEvent.CloneInstance.triggerTime = rate; ListClipEvent.Add(EditorClipEvent.CloneInstance); } EditorClipEvent.CloneInstance = null; this.EndChange(); maker.MarkModified(); }
public void Draw(Rect rect, EditorClip clip, EditorClipMaker maker) { float x = 0; if (mDrag) { x = rect.width * m_DragTriggerTime; } else { x = rect.width * m_TriggerTime; } position = new Rect(rect.x + x - WidthNode / 2, rect.y, WidthNode, maker.heightTrack); EditorGUI.DrawRect(position, maker.GetColorSet(this.name)); if (Event.current.type == EventType.MouseDown && Event.current.button == 1 && position.Contains(Event.current.mousePosition)) { // Now create the menu, add items and show it GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("Copy Event"), false, EventMeauCopyClipEvent); menu.AddSeparator(""); menu.AddItem(new GUIContent("Delete Event"), false, (e) => { EventMeauDeleteClipEvent(clip, maker); }, null); menu.ShowAsContext(); Event.current.Use(); } else { if (Event.current.type == EventType.MouseDown && Event.current.button == 0) { if (position.Contains(Event.current.mousePosition)) { mDrag = true; m_DragTriggerTime = rect.width * triggerTime; maker.SetSelectClip(clip); maker.SetSelectClipEvent(this); maker.SetSelectListClipEvent(clip, this); maker.SetClickOpera(this); maker.Repaint(); Event.current.Use(); } } else if (Event.current.type == EventType.MouseUp) { if (mDrag == true && m_DragTriggerTime != m_TriggerTime) { this.BeginChange(); m_TriggerTime = m_DragTriggerTime; this.EndChange(); maker.MarkModified(); } mDrag = false; } if (mDrag) { float dragDetlaPos = Mathf.Clamp(Event.current.mousePosition.x, rect.x, rect.x + rect.width) - rect.x; dragDetlaPos = Mathf.Clamp(dragDetlaPos, 0, rect.width); float newtrigger = Mathf.Max(dragDetlaPos / rect.width, 0); if (Mathf.Abs(newtrigger - m_DragTriggerTime) > Deadzoom) { m_DragTriggerTime = (float)System.Math.Round(newtrigger, 2); maker.SetSelectListClipEvent(clip, this); maker.Repaint(); // maker.MarkChange (); // colorFrame = frameColorselected; } } else { // colorFrame = getFrameColor(editorAAClip.Target); } } }