Example #1
0
    private void updateDurationBar()
    {
        float num   = directorState.TimeToPosition(cutscene.Duration) + trackBodyBackground.x;
        Color color = GUI.color;

        GUI.color = (new Color(0.25f, 0.5f, 0.5f));
        Rect rect      = new Rect(num - 8f, bodyArea.height - 13f, 16f, 16f);
        int  controlID = GUIUtility.GetControlID("DurationBar".GetHashCode(), (FocusType)2, rect);

        switch (Event.current.GetTypeForControl(controlID))
        {
        case EventType.MouseDown:
            if (rect.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (controlID);
                Event.current.Use();
            }
            break;

        case EventType.MouseUp:
            if (GUIUtility.hotControl == controlID)
            {
                GUIUtility.hotControl = (0);
            }
            break;

        case EventType.MouseDrag:
            if (GUIUtility.hotControl == controlID)
            {
                Vector2 mousePosition = Event.current.mousePosition;
                mousePosition.x -= trackBodyBackground.x;
                Undo.RecordObject(cutscene.Behaviour, "Changed Cutscene Duration");
                float x = ViewToDrawingTransformPoint(mousePosition).x;
                cutscene.Duration = directorState.SnappedTime(x);
                Event.current.Use();
            }
            break;
        }
        if (num > trackBodyBackground.x && num < bodyArea.width)
        {
            GUI.DrawTexture(rect, this.scrubDurationHead);
        }
        GUI.color     = (color);
        Handles.color = (new Color(0.25f, 0.5f, 0.5f));
        if (num > trackBodyBackground.x)
        {
            Handles.DrawLine(new Vector3(num, 0f, 0f), new Vector2(num, timeRuleArea.y + trackBodyBackgroundNoVerticalScrollbar.height - 13f));
            Handles.DrawLine(new Vector3(num + 1f, 0f, 0f), new Vector2(num + 1f, timeRuleArea.y + trackBodyBackgroundNoVerticalScrollbar.height - 13f));
        }
    }
Example #2
0
    public override void HandleInput(DirectorControlState state, Rect trackPosition)
    {
        CinemaActionWrapper cinemaActionWrapper = base.Wrapper as CinemaActionWrapper;

        if (cinemaActionWrapper == null)
        {
            return;
        }
        if (this.isRenaming)
        {
            return;
        }
        float num  = cinemaActionWrapper.Firetime * state.Scale.x + state.Translation.x;
        float num2 = (cinemaActionWrapper.Firetime + cinemaActionWrapper.Duration) * state.Scale.x + state.Translation.x;

        this.controlPosition = new Rect(num, 0f, num2 - num, trackPosition.height);
        Rect rect  = new Rect(num, 0f, 5f, this.controlPosition.height);
        Rect rect2 = new Rect(num + 5f, 0f, num2 - num - 10f, this.controlPosition.height);
        Rect rect3 = new Rect(num2 - 5f, 0f, 5f, this.controlPosition.height);

        EditorGUIUtility.AddCursorRect(rect, (MouseCursor)3);
        EditorGUIUtility.AddCursorRect(rect2, (MouseCursor)5);
        EditorGUIUtility.AddCursorRect(rect3, (MouseCursor)3);
        this.controlID = GUIUtility.GetControlID(Wrapper.Behaviour.GetInstanceID(), (FocusType)2, this.controlPosition);
        int controlID  = GUIUtility.GetControlID(Wrapper.Behaviour.GetInstanceID(), (FocusType)2, rect);
        int controlID2 = GUIUtility.GetControlID(Wrapper.Behaviour.GetInstanceID(), (FocusType)2, rect2);
        int controlID3 = GUIUtility.GetControlID(Wrapper.Behaviour.GetInstanceID(), (FocusType)2, rect3);

        if (Event.current.GetTypeForControl(this.controlID) == EventType.MouseDown && rect2.Contains(Event.current.mousePosition) && Event.current.button == 1)
        {
            if (!IsSelected)
            {
                GameObject[] gameObjects = Selection.gameObjects;
                ArrayUtility.Add(ref gameObjects, Wrapper.Behaviour.gameObject);
                Selection.objects   = (gameObjects);
                hasSelectionChanged = true;
            }
            this.showContextMenu(base.Wrapper.Behaviour);
            Event.current.Use();
        }
        switch ((int)Event.current.GetTypeForControl(controlID2))
        {
        case 0:
            if (rect2.Contains(Event.current.mousePosition) && (int)Event.current.button == 0)
            {
                GUIUtility.hotControl = (controlID2);
                if (Event.current.control)
                {
                    if (base.IsSelected)
                    {
                        GameObject[] gameObjects2 = Selection.gameObjects;
                        ArrayUtility.Remove <GameObject>(ref gameObjects2, base.Wrapper.Behaviour.gameObject);
                        Selection.objects        = (gameObjects2);
                        this.hasSelectionChanged = true;
                    }
                    else
                    {
                        GameObject[] gameObjects3 = Selection.gameObjects;
                        ArrayUtility.Add <GameObject>(ref gameObjects3, base.Wrapper.Behaviour.gameObject);
                        Selection.objects        = (gameObjects3);
                        this.hasSelectionChanged = true;
                    }
                }
                else if (!base.IsSelected)
                {
                    Selection.activeInstanceID = (base.Behaviour.GetInstanceID());
                }
                this.mouseDragActivity            = false;
                ActionItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - cinemaActionWrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID2)
            {
                ActionItemControl.mouseDownOffset = -1f;
                GUIUtility.hotControl             = (0);
                if (!this.mouseDragActivity)
                {
                    if (Event.current.control)
                    {
                        if (!this.hasSelectionChanged)
                        {
                            if (base.IsSelected)
                            {
                                GameObject[] gameObjects4 = Selection.gameObjects;
                                ArrayUtility.Remove <GameObject>(ref gameObjects4, base.Wrapper.Behaviour.gameObject);
                                Selection.objects = (gameObjects4);
                            }
                            else
                            {
                                GameObject[] gameObjects5 = Selection.gameObjects;
                                ArrayUtility.Add <GameObject>(ref gameObjects5, base.Wrapper.Behaviour.gameObject);
                                Selection.objects = (gameObjects5);
                            }
                        }
                    }
                    else
                    {
                        Selection.activeInstanceID = (base.Behaviour.GetInstanceID());
                    }
                }
                else
                {
                    base.TriggerTrackItemUpdateEvent();
                }
                this.hasSelectionChanged = false;
            }
            break;

        case 3:
            if (GUIUtility.hotControl == controlID2 && !this.hasSelectionChanged)
            {
                Undo.RecordObject(base.Behaviour, string.Format("Changed {0}", base.Behaviour.name));
                float num3 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num3 = state.SnappedTime(num3 - ActionItemControl.mouseDownOffset);
                if (!this.mouseDragActivity)
                {
                    this.mouseDragActivity = (base.Wrapper.Firetime != num3);
                }
                base.TriggerRequestTrackItemTranslate(num3);
            }
            break;
        }
        switch ((int)Event.current.GetTypeForControl(controlID))
        {
        case 0:
            if (rect.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl             = (controlID);
                ActionItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - cinemaActionWrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID)
            {
                ActionItemControl.mouseDownOffset = -1f;
                GUIUtility.hotControl             = (0);
                if (this.AlterAction != null)
                {
                    this.AlterAction(this, new ActionItemEventArgs(cinemaActionWrapper.Behaviour, cinemaActionWrapper.Firetime, cinemaActionWrapper.Duration));
                }
            }
            break;

        case 3:
            if (GUIUtility.hotControl == controlID)
            {
                float num4 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num4 = state.SnappedTime(num4);
                float num5 = 0f;
                float num6 = cinemaActionWrapper.Firetime + cinemaActionWrapper.Duration;
                using (IEnumerator <TimelineItemWrapper> enumerator = base.Track.Items.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        CinemaActionWrapper cinemaActionWrapper2 = enumerator.Current as CinemaActionWrapper;
                        if (cinemaActionWrapper2 != null && cinemaActionWrapper2.Behaviour != base.Wrapper.Behaviour)
                        {
                            float num7 = cinemaActionWrapper2.Firetime + cinemaActionWrapper2.Duration;
                            if (num7 <= base.Wrapper.Firetime)
                            {
                                num5 = Mathf.Max(num5, num7);
                            }
                        }
                    }
                }
                num4 = Mathf.Max(num5, num4);
                num4 = Mathf.Min(num6, num4);
                cinemaActionWrapper.Duration += base.Wrapper.Firetime - num4;
                cinemaActionWrapper.Firetime  = num4;
            }
            break;
        }
        switch ((int)Event.current.GetTypeForControl(controlID3))
        {
        case 0:
            if (rect3.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl             = (controlID3);
                ActionItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - base.Wrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID3)
            {
                ActionItemControl.mouseDownOffset = -1f;
                GUIUtility.hotControl             = (0);
                if (this.AlterAction != null)
                {
                    this.AlterAction(this, new ActionItemEventArgs(cinemaActionWrapper.Behaviour, cinemaActionWrapper.Firetime, cinemaActionWrapper.Duration));
                }
            }
            break;

        case 3:
            if (GUIUtility.hotControl == controlID3)
            {
                float num8 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num8 = state.SnappedTime(num8);
                float num9 = float.PositiveInfinity;
                using (IEnumerator <TimelineItemWrapper> enumerator = base.Track.Items.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        CinemaActionWrapper cinemaActionWrapper3 = enumerator.Current as CinemaActionWrapper;
                        if (cinemaActionWrapper3 != null && cinemaActionWrapper3.Behaviour != base.Wrapper.Behaviour)
                        {
                            float num10 = cinemaActionWrapper.Firetime + cinemaActionWrapper.Duration;
                            if (cinemaActionWrapper3.Firetime >= num10)
                            {
                                num9 = Mathf.Min(num9, cinemaActionWrapper3.Firetime);
                            }
                        }
                    }
                }
                num8 = Mathf.Clamp(num8, base.Wrapper.Firetime, num9);
                cinemaActionWrapper.Duration = num8 - base.Wrapper.Firetime;
            }
            break;
        }
        if (Selection.activeGameObject == base.Wrapper.Behaviour.gameObject)
        {
            if (Event.current.type == (EventType)13 && Event.current.commandName == "Copy")
            {
                Event.current.Use();
            }
            if (Event.current.type == (EventType)14 && Event.current.commandName == "Copy")
            {
                DirectorCopyPaste.Copy(base.Wrapper.Behaviour);
                Event.current.Use();
            }
        }
        if (Event.current.type == (EventType)4 && Event.current.keyCode == (KeyCode)127 && Selection.activeGameObject == base.Wrapper.Behaviour.gameObject)
        {
            base.deleteItem(base.Wrapper.Behaviour);
            Event.current.Use();
        }
    }
Example #3
0
    public virtual void HandleInput(DirectorControlState state, Rect trackPosition)
    {
        Behaviour behaviour = this.wrapper.Behaviour;

        if (behaviour == null)
        {
            return;
        }
        float num = this.wrapper.Firetime * state.Scale.x + state.Translation.x;

        this.controlPosition = new Rect(num - 8f, 0f, 16f, trackPosition.height);
        this.controlID       = GUIUtility.GetControlID(this.wrapper.Behaviour.GetInstanceID(), (FocusType)2, this.controlPosition);
        switch ((int)Event.current.GetTypeForControl(this.controlID))
        {
        case 0:
            if (this.controlPosition.Contains(Event.current.mousePosition) && (int)Event.current.button == 0)
            {
                GUIUtility.hotControl = (this.controlID);
                if (Event.current.control)
                {
                    if (base.IsSelected)
                    {
                        GameObject[] gameObjects = Selection.gameObjects;
                        ArrayUtility.Remove <GameObject>(ref gameObjects, this.Wrapper.Behaviour.gameObject);
                        Selection.objects        = (gameObjects);
                        this.hasSelectionChanged = true;
                    }
                    else
                    {
                        GameObject[] gameObjects2 = Selection.gameObjects;
                        ArrayUtility.Add <GameObject>(ref gameObjects2, this.Wrapper.Behaviour.gameObject);
                        Selection.objects        = (gameObjects2);
                        this.hasSelectionChanged = true;
                    }
                }
                else if (!base.IsSelected)
                {
                    Selection.activeInstanceID = (behaviour.GetInstanceID());
                }
                this.mouseDragActivity = false;
                Event.current.Use();
            }
            if (this.controlPosition.Contains(Event.current.mousePosition) && (int)Event.current.button == 1)
            {
                if (!base.IsSelected)
                {
                    GameObject[] gameObjects3 = Selection.gameObjects;
                    ArrayUtility.Add <GameObject>(ref gameObjects3, this.Wrapper.Behaviour.gameObject);
                    Selection.objects        = (gameObjects3);
                    this.hasSelectionChanged = true;
                }
                this.showContextMenu(behaviour);
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == this.controlID)
            {
                GUIUtility.hotControl = (0);
                if (!this.mouseDragActivity)
                {
                    if (Event.current.control)
                    {
                        if (!this.hasSelectionChanged)
                        {
                            if (base.IsSelected)
                            {
                                GameObject[] gameObjects4 = Selection.gameObjects;
                                ArrayUtility.Remove <GameObject>(ref gameObjects4, this.Wrapper.Behaviour.gameObject);
                                Selection.objects = (gameObjects4);
                            }
                            else
                            {
                                GameObject[] gameObjects5 = Selection.gameObjects;
                                ArrayUtility.Add <GameObject>(ref gameObjects5, this.Wrapper.Behaviour.gameObject);
                                Selection.objects = (gameObjects5);
                            }
                        }
                    }
                    else
                    {
                        Selection.activeInstanceID = (behaviour.GetInstanceID());
                    }
                }
                else if (this.TrackItemUpdate != null)
                {
                    this.TrackItemUpdate(this, new TrackItemEventArgs(this.wrapper.Behaviour, this.wrapper.Firetime));
                }
                this.hasSelectionChanged = false;
            }
            break;

        case 3:
            if (GUIUtility.hotControl == this.controlID && !this.hasSelectionChanged)
            {
                Undo.RecordObject(behaviour, string.Format("Changed {0}", behaviour.name));
                float num2 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num2 = state.SnappedTime(num2);
                if (!this.mouseDragActivity)
                {
                    this.mouseDragActivity = (this.Wrapper.Firetime != num2);
                }
                if (this.RequestTrackItemTranslate != null)
                {
                    float firetime  = num2 - this.wrapper.Firetime;
                    float firetime2 = this.RequestTrackItemTranslate(this, new TrackItemEventArgs(this.wrapper.Behaviour, firetime));
                    if (this.TrackItemTranslate != null)
                    {
                        this.TrackItemTranslate(this, new TrackItemEventArgs(this.wrapper.Behaviour, firetime2));
                    }
                }
            }
            break;
        }
        if (Selection.activeGameObject == behaviour.gameObject)
        {
            if ((int)(int)Event.current.type == 13 && Event.current.commandName == "Copy")
            {
                Event.current.Use();
            }
            if ((int)Event.current.type == 14 && Event.current.commandName == "Copy")
            {
                DirectorCopyPaste.Copy(behaviour);
                Event.current.Use();
            }
        }
        if ((int)Event.current.type == 4 && (int)Event.current.keyCode == 127 && Selection.activeGameObject == behaviour.gameObject)
        {
            deleteItem(behaviour);
            Event.current.Use();
        }
    }
Example #4
0
    public virtual void HandleInput(DirectorControlState state, Rect trackPosition)
    {
        Behaviour behaviour = wrapper.Behaviour;

        if (behaviour == null)
        {
            return;
        }
        float num = wrapper.Firetime * state.Scale.x + state.Translation.x;

        controlPosition = new Rect(num - 8f, 0f, 16f, trackPosition.height);
        controlID       = GUIUtility.GetControlID(wrapper.Behaviour.GetInstanceID(), FocusType.Passive, controlPosition);
        switch (Event.current.GetTypeForControl(controlID))
        {
        case EventType.MouseDown:
            if (controlPosition.Contains(Event.current.mousePosition) && Event.current.button == 0)
            {
                GUIUtility.hotControl = controlID;
                if (Event.current.control)
                {
                    if (IsSelected)
                    {
                        GameObject[] gameObjects = Selection.gameObjects;
                        ArrayUtility.Remove(ref gameObjects, Wrapper.Behaviour.gameObject);
                        Selection.objects   = (gameObjects);
                        hasSelectionChanged = true;
                    }
                    else
                    {
                        GameObject[] gameObjects2 = Selection.gameObjects;
                        ArrayUtility.Add(ref gameObjects2, Wrapper.Behaviour.gameObject);
                        Selection.objects   = (gameObjects2);
                        hasSelectionChanged = true;
                    }
                }
                else if (!IsSelected)
                {
                    Selection.activeInstanceID = (behaviour.GetInstanceID());
                }
                mouseDragActivity = false;
                Event.current.Use();
            }
            if (controlPosition.Contains(Event.current.mousePosition) && Event.current.button == 1)
            {
                if (!IsSelected)
                {
                    GameObject[] gameObjects3 = Selection.gameObjects;
                    ArrayUtility.Add(ref gameObjects3, Wrapper.Behaviour.gameObject);
                    Selection.objects   = (gameObjects3);
                    hasSelectionChanged = true;
                }
                showContextMenu(behaviour);
                Event.current.Use();
            }
            break;

        case EventType.MouseUp:
            if (GUIUtility.hotControl == controlID)
            {
                GUIUtility.hotControl = (0);
                if (!mouseDragActivity)
                {
                    if (Event.current.control)
                    {
                        if (!hasSelectionChanged)
                        {
                            if (IsSelected)
                            {
                                GameObject[] gameObjects4 = Selection.gameObjects;
                                ArrayUtility.Remove(ref gameObjects4, Wrapper.Behaviour.gameObject);
                                Selection.objects = (gameObjects4);
                            }
                            else
                            {
                                GameObject[] gameObjects5 = Selection.gameObjects;
                                ArrayUtility.Add(ref gameObjects5, Wrapper.Behaviour.gameObject);
                                Selection.objects = (gameObjects5);
                            }
                        }
                    }
                    else
                    {
                        Selection.activeInstanceID = (behaviour.GetInstanceID());
                    }
                }
                else
                {
                    TrackItemUpdate?.Invoke(this, new TrackItemEventArgs(wrapper.Behaviour, wrapper.Firetime));
                }
                hasSelectionChanged = false;
            }
            break;

        case EventType.MouseDrag:
            if (GUIUtility.hotControl == controlID && !hasSelectionChanged)
            {
                Undo.RecordObject(behaviour, string.Format("Changed {0}", behaviour.name));
                float num2 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num2 = state.SnappedTime(num2);
                if (!mouseDragActivity)
                {
                    mouseDragActivity = (Wrapper.Firetime != num2);
                }
                if (RequestTrackItemTranslate != null)
                {
                    float firetime  = num2 - wrapper.Firetime;
                    float firetime2 = RequestTrackItemTranslate(this, new TrackItemEventArgs(wrapper.Behaviour, firetime));
                    TrackItemTranslate?.Invoke(this, new TrackItemEventArgs(wrapper.Behaviour, firetime2));
                }
            }
            break;
        }
        if (Selection.activeGameObject == behaviour.gameObject)
        {
            if (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "Copy")
            {
                Event.current.Use();
            }
            if ((int)Event.current.type == 14 && Event.current.commandName == "Copy")
            {
                DirectorCopyPaste.Copy(behaviour);
                Event.current.Use();
            }
        }
        if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Delete && Selection.activeGameObject == behaviour.gameObject)
        {
            deleteItem(behaviour);
            Event.current.Use();
        }
    }
Example #5
0
    public override void HandleInput(DirectorControlState state, Rect trackPosition)
    {
        CinemaActionFixedWrapper wrapper = base.Wrapper as CinemaActionFixedWrapper;

        if (wrapper == null)
        {
            return;
        }
        if (base.isRenaming)
        {
            return;
        }
        float num  = state.TimeToPosition(wrapper.Firetime);
        float num2 = state.TimeToPosition(wrapper.Firetime + wrapper.Duration);

        base.controlPosition = new Rect(num, 0f, num2 - num, trackPosition.height);
        bool  flag1 = this.controlPosition.width < 15f;
        float num3  = flag1 ? 0f : 5f;
        Rect  rect  = new Rect(num, 0f, num3, trackPosition.height);
        Rect  rect2 = new Rect(num + num3, 0f, (num2 - num) - (2f * num3), trackPosition.height);
        Rect  rect3 = new Rect(num2 - num3, 0f, num3, trackPosition.height);

        EditorGUIUtility.AddCursorRect(rect2, MouseCursor.SlideArrow);
        if (!flag1)
        {
            EditorGUIUtility.AddCursorRect(rect, MouseCursor.ResizeHorizontal);
            EditorGUIUtility.AddCursorRect(rect3, MouseCursor.ResizeHorizontal);
        }
        base.controlID = GUIUtility.GetControlID(wrapper.Behaviour.GetInstanceID(), UnityEngine.FocusType.Passive, base.controlPosition);
        int num4 = GUIUtility.GetControlID(wrapper.Behaviour.GetInstanceID(), FocusType.Passive, rect);
        int num5 = GUIUtility.GetControlID(wrapper.Behaviour.GetInstanceID(), FocusType.Passive, rect2);
        int num6 = GUIUtility.GetControlID(wrapper.Behaviour.GetInstanceID(), FocusType.Passive, rect3);

        if (((Event.current.GetTypeForControl(base.controlID) == EventType.MouseDown) && rect2.Contains(Event.current.mousePosition)) && (Event.current.button == 1))
        {
            if (!base.IsSelected)
            {
                GameObject[] objArray = Selection.gameObjects;
                ArrayUtility.Add <GameObject>(ref objArray, base.Wrapper.Behaviour.gameObject);
                Selection.objects        = objArray;
                base.hasSelectionChanged = true;
            }
            this.showContextMenu(wrapper.Behaviour);
            if (!base.TrackControl.TargetTrack.IsLocked)
            {
                Event.current.Use();
            }
        }
        switch (Event.current.GetTypeForControl(num5))
        {
        case 0:
        {
            if (!rect2.Contains(Event.current.mousePosition) || (Event.current.button != 0))
            {
                goto Label_0447;
            }
            GUIUtility.hotControl = num5;
            if (!Event.current.control)
            {
                if (!base.IsSelected)
                {
                    Selection.activeInstanceID = base.Behaviour.GetInstanceID();
                }
                break;
            }
            if (!base.IsSelected)
            {
                GameObject[] objArray3 = Selection.gameObjects;
                ArrayUtility.Add <GameObject>(ref objArray3, base.Wrapper.Behaviour.gameObject);
                Selection.objects        = objArray3;
                base.hasSelectionChanged = true;
                break;
            }
            GameObject[] objArray2 = Selection.gameObjects;
            ArrayUtility.Remove <GameObject>(ref objArray2, base.Wrapper.Behaviour.gameObject);
            Selection.objects        = (objArray2);
            base.hasSelectionChanged = true;
            break;
        }

        case EventType.MouseUp:
            if (GUIUtility.hotControl == num5)
            {
                mouseDownOffset       = -1f;
                GUIUtility.hotControl = (0);
                if (base.mouseDragActivity)
                {
                    base.TriggerTrackItemUpdateEvent();
                }
                else if (!Event.current.control)
                {
                    Selection.activeInstanceID = (base.Behaviour.GetInstanceID());
                }
                else if (!base.hasSelectionChanged)
                {
                    if (!base.IsSelected)
                    {
                        GameObject[] objArray5 = Selection.gameObjects;
                        ArrayUtility.Add <GameObject>(ref objArray5, base.Wrapper.Behaviour.gameObject);
                        Selection.objects = (objArray5);
                    }
                    else
                    {
                        GameObject[] objArray4 = Selection.gameObjects;
                        ArrayUtility.Remove <GameObject>(ref objArray4, base.Wrapper.Behaviour.gameObject);
                        Selection.objects = (objArray4);
                    }
                }
                base.hasSelectionChanged = false;
            }
            goto Label_0447;

        case (EventType)3:
            if (GUIUtility.hotControl == num5)
            {
                Undo.RecordObject(base.Behaviour, string.Format("Changed {0}", base.Behaviour.name));
                float firetime = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                firetime = state.SnappedTime(firetime - mouseDownOffset);
                if (!base.mouseDragActivity)
                {
                    base.mouseDragActivity = base.Wrapper.Firetime != firetime;
                }
                base.TriggerRequestTrackItemTranslate(firetime);
            }
            goto Label_0447;

        default:
            goto Label_0447;
        }
        base.mouseDragActivity = false;
        mouseDownOffset        = ((Event.current.mousePosition.x - state.Translation.x) / state.Scale.x) - wrapper.Firetime;
        if (!base.TrackControl.TargetTrack.IsLocked)
        {
            Event.current.Use();
        }
Label_0447:
        switch (Event.current.GetTypeForControl(num4))
        {
        case 0:
            if (rect.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (num4);
                mouseDownOffset       = ((Event.current.mousePosition.x - state.Translation.x) / state.Scale.x) - wrapper.Firetime;
                if (!base.TrackControl.TargetTrack.IsLocked)
                {
                    Event.current.Use();
                }
            }
            break;

        case (EventType)1:
            if (GUIUtility.hotControl == num4)
            {
                mouseDownOffset       = -1f;
                GUIUtility.hotControl = (0);
            }
            break;

        case (EventType)3:
            if (GUIUtility.hotControl == num4)
            {
                float time = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                time = state.SnappedTime(time);
                if (time >= 0f)
                {
                    float num9 = wrapper.InTime - (wrapper.Firetime - time);
                    num9 = Mathf.Clamp(num9, 0f, wrapper.ItemLength);
                    float num10 = num9 - wrapper.InTime;
                    wrapper.InTime    = num9;
                    wrapper.Firetime += num10;
                    if (this.AlterFixedAction != null)
                    {
                        this.AlterFixedAction(this, new ActionFixedItemEventArgs(wrapper.Behaviour, wrapper.Firetime, wrapper.Duration, wrapper.InTime, wrapper.OutTime));
                    }
                }
            }
            break;
        }
        switch (Event.current.GetTypeForControl(num6))
        {
        case 0:
            if (rect3.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (num6);
                mouseDownOffset       = ((Event.current.mousePosition.x - state.Translation.x) / state.Scale.x) - wrapper.Firetime;
                if (!base.TrackControl.TargetTrack.IsLocked)
                {
                    Event.current.Use();
                }
            }
            break;

        case (EventType)1:
            if (GUIUtility.hotControl == num6)
            {
                mouseDownOffset       = -1f;
                GUIUtility.hotControl = (0);
            }
            break;

        case (EventType)3:
            if (GUIUtility.hotControl == num6)
            {
                float num11 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                float num12 = state.SnappedTime(num11) - (wrapper.Firetime - wrapper.InTime);
                Undo.RecordObject(wrapper.Behaviour, string.Format("Changed {0}", wrapper.Behaviour.name));
                wrapper.OutTime = Mathf.Clamp(num12, 0f, wrapper.ItemLength);
                if (this.AlterFixedAction != null)
                {
                    this.AlterFixedAction(this, new ActionFixedItemEventArgs(wrapper.Behaviour, wrapper.Firetime, wrapper.Duration, wrapper.InTime, wrapper.OutTime));
                }
            }
            break;
        }
        if (Selection.activeGameObject == base.Wrapper.Behaviour.gameObject)
        {
            if ((Event.current.type == (EventType)13) && (Event.current.commandName == "Copy"))
            {
                Event.current.Use();
            }
            if ((Event.current.type == (EventType)14) && (Event.current.commandName == "Copy"))
            {
                DirectorCopyPaste.Copy(base.Wrapper.Behaviour);
                Event.current.Use();
            }
        }
        if (((Event.current.type == (EventType)4) && (Event.current.keyCode == (KeyCode)0x7f)) && (Selection.activeGameObject == base.Wrapper.Behaviour.gameObject))
        {
            base.deleteItem(base.Wrapper.Behaviour);
            Event.current.Use();
        }
    }
Example #6
0
    public virtual void HandleInput(DirectorControlState state, Rect trackPosition)
    {
        Behaviour behaviour = this.wrapper.Behaviour;

        if (behaviour == null)
        {
            return;
        }
        float num = (this.wrapper.Firetime * state.Scale.x) + state.Translation.x;

        this.controlPosition = new Rect(num - 8f, 0f, 16f, trackPosition.height);
        this.controlID       = GUIUtility.GetControlID(this.wrapper.Behaviour.GetInstanceID(), (FocusType)2, this.controlPosition);
        switch (Event.current.GetTypeForControl(this.controlID))
        {
        case 0:
        {
            if (!this.controlPosition.Contains(Event.current.mousePosition) || (Event.current.button != 0))
            {
                goto Label_0183;
            }
            GUIUtility.hotControl = (this.controlID);
            if (!Event.current.control)
            {
                if (!base.IsSelected)
                {
                    Selection.activeInstanceID = (behaviour.GetInstanceID());
                }
                break;
            }
            if (!base.IsSelected)
            {
                GameObject[] objArray2 = Selection.gameObjects;
                ArrayUtility.Add <GameObject>(ref objArray2, this.Wrapper.Behaviour.gameObject);
                Selection.objects        = (objArray2);
                this.hasSelectionChanged = true;
                break;
            }
            GameObject[] objArray = Selection.gameObjects;
            ArrayUtility.Remove <GameObject>(ref objArray, this.Wrapper.Behaviour.gameObject);
            Selection.objects        = (objArray);
            this.hasSelectionChanged = true;
            break;
        }

        case (EventType)1:
            if (GUIUtility.hotControl == this.controlID)
            {
                GUIUtility.hotControl = (0);
                if (this.mouseDragActivity)
                {
                    if (this.TrackItemUpdate != null)
                    {
                        this.TrackItemUpdate(this, new TrackItemEventArgs(this.wrapper.Behaviour, this.wrapper.Firetime));
                    }
                }
                else if (!Event.current.control)
                {
                    Selection.activeInstanceID = (behaviour.GetInstanceID());
                }
                else if (!this.hasSelectionChanged)
                {
                    if (!base.IsSelected)
                    {
                        GameObject[] objArray5 = Selection.gameObjects;
                        ArrayUtility.Add <GameObject>(ref objArray5, this.Wrapper.Behaviour.gameObject);
                        Selection.objects = (objArray5);
                    }
                    else
                    {
                        GameObject[] objArray4 = Selection.gameObjects;
                        ArrayUtility.Remove <GameObject>(ref objArray4, this.Wrapper.Behaviour.gameObject);
                        Selection.objects = (objArray4);
                    }
                }
                this.hasSelectionChanged = false;
            }
            goto Label_03AD;

        case (EventType)3:
            if ((GUIUtility.hotControl == this.controlID) && !this.hasSelectionChanged)
            {
                Undo.RecordObject(behaviour, string.Format("Changed {0}", behaviour.name));
                float time = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                time = state.SnappedTime(time);
                if (!this.mouseDragActivity)
                {
                    this.mouseDragActivity = this.Wrapper.Firetime != time;
                }
                if (this.RequestTrackItemTranslate != null)
                {
                    float firetime = time - this.wrapper.Firetime;
                    float num4     = this.RequestTrackItemTranslate(this, new TrackItemEventArgs(this.wrapper.Behaviour, firetime));
                    if (this.TrackItemTranslate != null)
                    {
                        this.TrackItemTranslate(this, new TrackItemEventArgs(this.wrapper.Behaviour, num4));
                    }
                }
            }
            goto Label_03AD;

        default:
            goto Label_03AD;
        }
        this.mouseDragActivity = false;
        if (!this.TrackControl.TargetTrack.IsLocked)
        {
            Event.current.Use();
        }
Label_0183:
        if (this.controlPosition.Contains(Event.current.mousePosition) && (Event.current.button == 1))
        {
            if (!base.IsSelected)
            {
                GameObject[] objArray3 = Selection.gameObjects;
                ArrayUtility.Add <GameObject>(ref objArray3, this.Wrapper.Behaviour.gameObject);
                Selection.objects        = (objArray3);
                this.hasSelectionChanged = true;
            }
            this.showContextMenu(behaviour);
            Event.current.Use();
        }
Label_03AD:
        if (Selection.activeGameObject == behaviour.gameObject)
        {
            if ((Event.current.type == (EventType)13) && (Event.current.commandName == "Copy"))
            {
                Event.current.Use();
            }
            if ((Event.current.type == (EventType)14) && (Event.current.commandName == "Copy"))
            {
                DirectorCopyPaste.Copy(behaviour);
                Event.current.Use();
            }
        }
        if (((Event.current.type == (EventType)4) && (Event.current.keyCode == (KeyCode)0x7f)) && (Selection.activeGameObject == behaviour.gameObject))
        {
            this.deleteItem(behaviour);
            Event.current.Use();
        }
    }
    public override void HandleInput(DirectorControlState state, Rect trackPosition)
    {
        CinemaActionFixedWrapper cinemaActionFixedWrapper = base.Wrapper as CinemaActionFixedWrapper;

        if (cinemaActionFixedWrapper == null)
        {
            return;
        }
        if (this.isRenaming)
        {
            return;
        }
        float num  = state.TimeToPosition(cinemaActionFixedWrapper.Firetime);
        float num2 = state.TimeToPosition(cinemaActionFixedWrapper.Firetime + cinemaActionFixedWrapper.Duration);

        this.controlPosition = new Rect(num, 0f, num2 - num, trackPosition.height);
        bool  expr_67 = this.controlPosition.width < 15f;
        float num3    = expr_67 ? 0f : 5f;
        Rect  rect    = new Rect(num, 0f, num3, trackPosition.height);
        Rect  rect2   = new Rect(num + num3, 0f, num2 - num - 2f * num3, trackPosition.height);
        Rect  rect3   = new Rect(num2 - num3, 0f, num3, trackPosition.height);

        EditorGUIUtility.AddCursorRect(rect2, (MouseCursor)5);
        if (!expr_67)
        {
            EditorGUIUtility.AddCursorRect(rect, (MouseCursor)3);
            EditorGUIUtility.AddCursorRect(rect3, (MouseCursor)3);
        }
        this.controlID = GUIUtility.GetControlID(cinemaActionFixedWrapper.Behaviour.GetInstanceID(), (FocusType)2, this.controlPosition);
        int controlID  = GUIUtility.GetControlID(cinemaActionFixedWrapper.Behaviour.GetInstanceID(), (FocusType)2, rect);
        int controlID2 = GUIUtility.GetControlID(cinemaActionFixedWrapper.Behaviour.GetInstanceID(), (FocusType)2, rect2);
        int controlID3 = GUIUtility.GetControlID(cinemaActionFixedWrapper.Behaviour.GetInstanceID(), (FocusType)2, rect3);

        if (Event.current.GetTypeForControl(this.controlID) == EventType.MouseDown && rect2.Contains(Event.current.mousePosition) && (int)Event.current.button == 1)
        {
            if (!base.IsSelected)
            {
                GameObject[] gameObjects = Selection.gameObjects;
                ArrayUtility.Add <GameObject>(ref gameObjects, base.Wrapper.Behaviour.gameObject);
                Selection.objects        = (gameObjects);
                this.hasSelectionChanged = true;
            }
            this.showContextMenu(cinemaActionFixedWrapper.Behaviour);
            Event.current.Use();
        }
        switch ((int)Event.current.GetTypeForControl(controlID2))
        {
        case 0:
            if (rect2.Contains(Event.current.mousePosition) && (int)Event.current.button == 0)
            {
                GUIUtility.hotControl = (controlID2);
                if (Event.current.control)
                {
                    if (base.IsSelected)
                    {
                        GameObject[] gameObjects2 = Selection.gameObjects;
                        ArrayUtility.Remove <GameObject>(ref gameObjects2, base.Wrapper.Behaviour.gameObject);
                        Selection.objects        = (gameObjects2);
                        this.hasSelectionChanged = true;
                    }
                    else
                    {
                        GameObject[] gameObjects3 = Selection.gameObjects;
                        ArrayUtility.Add <GameObject>(ref gameObjects3, base.Wrapper.Behaviour.gameObject);
                        Selection.objects        = (gameObjects3);
                        this.hasSelectionChanged = true;
                    }
                }
                else if (!base.IsSelected)
                {
                    Selection.activeInstanceID = (base.Behaviour.GetInstanceID());
                }
                this.mouseDragActivity = false;
                ActionFixedItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - cinemaActionFixedWrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID2)
            {
                ActionFixedItemControl.mouseDownOffset = -1f;
                GUIUtility.hotControl = (0);
                if (!this.mouseDragActivity)
                {
                    if (Event.current.control)
                    {
                        if (!this.hasSelectionChanged)
                        {
                            if (base.IsSelected)
                            {
                                GameObject[] gameObjects4 = Selection.gameObjects;
                                ArrayUtility.Remove <GameObject>(ref gameObjects4, base.Wrapper.Behaviour.gameObject);
                                Selection.objects = (gameObjects4);
                            }
                            else
                            {
                                GameObject[] gameObjects5 = Selection.gameObjects;
                                ArrayUtility.Add <GameObject>(ref gameObjects5, base.Wrapper.Behaviour.gameObject);
                                Selection.objects = (gameObjects5);
                            }
                        }
                    }
                    else
                    {
                        Selection.activeInstanceID = (base.Behaviour.GetInstanceID());
                    }
                }
                else
                {
                    base.TriggerTrackItemUpdateEvent();
                }
                this.hasSelectionChanged = false;
            }
            break;

        case 3:
            if (GUIUtility.hotControl == controlID2)
            {
                Undo.RecordObject(base.Behaviour, string.Format("Changed {0}", base.Behaviour.name));
                float num4 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num4 = state.SnappedTime(num4 - ActionFixedItemControl.mouseDownOffset);
                if (!this.mouseDragActivity)
                {
                    this.mouseDragActivity = (base.Wrapper.Firetime != num4);
                }
                base.TriggerRequestTrackItemTranslate(num4);
            }
            break;
        }
        switch ((int)Event.current.GetTypeForControl(controlID))
        {
        case 0:
            if (rect.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (controlID);
                ActionFixedItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - cinemaActionFixedWrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID)
            {
                ActionFixedItemControl.mouseDownOffset = -1f;
                GUIUtility.hotControl = (0);
            }
            break;

        case 3:
            if (GUIUtility.hotControl == controlID)
            {
                float num5 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num5 = state.SnappedTime(num5);
                if (num5 >= 0f)
                {
                    float num6 = cinemaActionFixedWrapper.InTime - (cinemaActionFixedWrapper.Firetime - num5);
                    num6 = Mathf.Clamp(num6, 0f, cinemaActionFixedWrapper.ItemLength);
                    float num7 = num6 - cinemaActionFixedWrapper.InTime;
                    cinemaActionFixedWrapper.InTime    = num6;
                    cinemaActionFixedWrapper.Firetime += num7;
                    if (this.AlterFixedAction != null)
                    {
                        this.AlterFixedAction(this, new ActionFixedItemEventArgs(cinemaActionFixedWrapper.Behaviour, cinemaActionFixedWrapper.Firetime, cinemaActionFixedWrapper.Duration, cinemaActionFixedWrapper.InTime, cinemaActionFixedWrapper.OutTime));
                    }
                }
            }
            break;
        }
        switch ((int)Event.current.GetTypeForControl(controlID3))
        {
        case 0:
            if (rect3.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (controlID3);
                ActionFixedItemControl.mouseDownOffset = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x - cinemaActionFixedWrapper.Firetime;
                Event.current.Use();
            }
            break;

        case 1:
            if (GUIUtility.hotControl == controlID3)
            {
                ActionFixedItemControl.mouseDownOffset = -1f;
                GUIUtility.hotControl = (0);
            }
            break;

        case 3:
            if (GUIUtility.hotControl == controlID3)
            {
                float num8 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num8 = state.SnappedTime(num8);
                float num9 = num8 - (cinemaActionFixedWrapper.Firetime - cinemaActionFixedWrapper.InTime);
                Undo.RecordObject(cinemaActionFixedWrapper.Behaviour, string.Format("Changed {0}", cinemaActionFixedWrapper.Behaviour.name));
                cinemaActionFixedWrapper.OutTime = Mathf.Clamp(num9, 0f, cinemaActionFixedWrapper.ItemLength);
                if (this.AlterFixedAction != null)
                {
                    this.AlterFixedAction(this, new ActionFixedItemEventArgs(cinemaActionFixedWrapper.Behaviour, cinemaActionFixedWrapper.Firetime, cinemaActionFixedWrapper.Duration, cinemaActionFixedWrapper.InTime, cinemaActionFixedWrapper.OutTime));
                }
            }
            break;
        }
        if (Selection.activeGameObject == Wrapper.Behaviour.gameObject)
        {
            if (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "Copy")
            {
                Event.current.Use();
            }
            if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "Copy")
            {
                DirectorCopyPaste.Copy(Wrapper.Behaviour);
                Event.current.Use();
            }
        }
        if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Delete && Selection.activeGameObject == Wrapper.Behaviour.gameObject)
        {
            deleteItem(Wrapper.Behaviour);
            Event.current.Use();
        }
    }
Example #8
0
    public override void HandleInput(DirectorControlState state, Rect trackPosition)
    {
        CinemaActionWrapper wrapper = base.Wrapper as CinemaActionWrapper;

        if (wrapper == null)
        {
            return;
        }
        if (base.isRenaming)
        {
            return;
        }
        float num  = (wrapper.Firetime * state.Scale.x) + state.Translation.x;
        float num2 = ((wrapper.Firetime + wrapper.Duration) * state.Scale.x) + state.Translation.x;

        ResizeControlPosition(state, trackPosition);
        Rect rect  = new Rect(num, this.controlPosition.y, 5f, this.controlPosition.height);
        Rect rect2 = new Rect(num + 5f, this.controlPosition.y, (num2 - num) - 10f, this.controlPosition.height);
        Rect rect3 = new Rect(num2 - 5f, this.controlPosition.y, 5f, this.controlPosition.height);

        EditorGUIUtility.AddCursorRect(rect, (MouseCursor)3);
        EditorGUIUtility.AddCursorRect(rect2, (MouseCursor)5);
        EditorGUIUtility.AddCursorRect(rect3, (MouseCursor)3);
        base.controlID = GUIUtility.GetControlID(base.Wrapper.Behaviour.GetInstanceID(), (FocusType)2, base.controlPosition);
        int num3 = GUIUtility.GetControlID(base.Wrapper.Behaviour.GetInstanceID(), (FocusType)2, rect);
        int num4 = GUIUtility.GetControlID(base.Wrapper.Behaviour.GetInstanceID(), (FocusType)2, rect2);
        int num5 = GUIUtility.GetControlID(base.Wrapper.Behaviour.GetInstanceID(), (FocusType)2, rect3);

        if (((Event.current.GetTypeForControl(base.controlID) == EventType.MouseDown) && rect2.Contains(Event.current.mousePosition)) && (Event.current.button == 1))
        {
            if (!base.IsSelected)
            {
                GameObject[] objArray = Selection.gameObjects;
                ArrayUtility.Add <GameObject>(ref objArray, base.Wrapper.Behaviour.gameObject);
                Selection.objects        = objArray;
                base.hasSelectionChanged = true;
            }
            this.showContextMenu(base.Wrapper.Behaviour);
            Event.current.Use();
        }
        switch (Event.current.GetTypeForControl(num4))
        {
        case 0:
        {
            if (!rect2.Contains(Event.current.mousePosition) || (Event.current.button != 0))
            {
                goto Label_0471;
            }
            GUIUtility.hotControl = (num4);
            if (!Event.current.control)
            {
                if (!base.IsSelected)
                {
                    Selection.activeInstanceID = (base.Behaviour.GetInstanceID());
                }
                break;
            }
            if (!base.IsSelected)
            {
                GameObject[] objArray3 = Selection.gameObjects;
                ArrayUtility.Add <GameObject>(ref objArray3, base.Wrapper.Behaviour.gameObject);
                Selection.objects        = (objArray3);
                base.hasSelectionChanged = true;
                break;
            }
            GameObject[] objArray2 = Selection.gameObjects;
            ArrayUtility.Remove <GameObject>(ref objArray2, base.Wrapper.Behaviour.gameObject);
            Selection.objects        = (objArray2);
            base.hasSelectionChanged = true;
            break;
        }

        case (EventType)1:
            if (GUIUtility.hotControl == num4)
            {
                mouseDownOffset       = -1f;
                GUIUtility.hotControl = (0);
                if (base.mouseDragActivity)
                {
                    base.TriggerTrackItemUpdateEvent();
                }
                else if (!Event.current.control)
                {
                    Selection.activeInstanceID = (base.Behaviour.GetInstanceID());
                }
                else if (!base.hasSelectionChanged)
                {
                    if (!base.IsSelected)
                    {
                        GameObject[] objArray5 = Selection.gameObjects;
                        ArrayUtility.Add <GameObject>(ref objArray5, base.Wrapper.Behaviour.gameObject);
                        Selection.objects = (objArray5);
                    }
                    else
                    {
                        GameObject[] objArray4 = Selection.gameObjects;
                        ArrayUtility.Remove <GameObject>(ref objArray4, base.Wrapper.Behaviour.gameObject);
                        Selection.objects = (objArray4);
                    }
                }
                base.hasSelectionChanged = false;
            }
            goto Label_0471;

        case (EventType)3:
            if ((GUIUtility.hotControl == num4) && !base.hasSelectionChanged)
            {
                Undo.RecordObject(base.Behaviour, string.Format("Changed {0}", base.Behaviour.name));
                float firetime = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                firetime = state.SnappedTime(firetime - mouseDownOffset);
                if (!base.mouseDragActivity)
                {
                    base.mouseDragActivity = base.Wrapper.Firetime != firetime;
                }
                base.TriggerRequestTrackItemTranslate(firetime);
            }
            goto Label_0471;

        default:
            goto Label_0471;
        }
        base.mouseDragActivity = false;
        mouseDownOffset        = ((Event.current.mousePosition.x - state.Translation.x) / state.Scale.x) - wrapper.Firetime;
        if (!base.TrackControl.TargetTrack.IsLocked)
        {
            Event.current.Use();
        }
Label_0471:
        switch (Event.current.GetTypeForControl(num3))
        {
        case 0:
            if (rect.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (num3);
                mouseDownOffset       = ((Event.current.mousePosition.x - state.Translation.x) / state.Scale.x) - wrapper.Firetime;
                if (!base.TrackControl.TargetTrack.IsLocked)
                {
                    Event.current.Use();
                }
            }
            break;

        case (EventType)1:
            if (GUIUtility.hotControl == num3)
            {
                mouseDownOffset       = -1f;
                GUIUtility.hotControl = (0);
                if (this.AlterAction != null)
                {
                    this.AlterAction(this, new ActionItemEventArgs(wrapper.Behaviour, wrapper.Firetime, wrapper.Duration));
                }
            }
            break;

        case (EventType)3:
            if (GUIUtility.hotControl == num3)
            {
                float time = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                time = state.SnappedTime(time);
                float num8 = 0f;
                float num9 = wrapper.Firetime + wrapper.Duration;
                foreach (CinemaActionWrapper wrapper2 in base.Track.Items)
                {
                    if ((wrapper2 != null) && (wrapper2.Behaviour != base.Wrapper.Behaviour))
                    {
                        float num10 = wrapper2.Firetime + wrapper2.Duration;
                        if (num10 <= base.Wrapper.Firetime)
                        {
                            num8 = Mathf.Max(num8, num10);
                        }
                    }
                }
                time              = Mathf.Max(num8, time);
                time              = Mathf.Min(num9, time);
                wrapper.Duration += base.Wrapper.Firetime - time;
                wrapper.Firetime  = time;
            }
            break;
        }
        switch (Event.current.GetTypeForControl(num5))
        {
        case 0:
            if (rect3.Contains(Event.current.mousePosition))
            {
                GUIUtility.hotControl = (num5);
                mouseDownOffset       = ((Event.current.mousePosition.x - state.Translation.x) / state.Scale.x) - base.Wrapper.Firetime;
                if (!base.TrackControl.TargetTrack.IsLocked)
                {
                    Event.current.Use();
                }
            }
            break;

        case (EventType)1:
            if (GUIUtility.hotControl == num5)
            {
                mouseDownOffset       = -1f;
                GUIUtility.hotControl = (0);
                if (this.AlterAction != null)
                {
                    this.AlterAction(this, new ActionItemEventArgs(wrapper.Behaviour, wrapper.Firetime, wrapper.Duration));
                }
            }
            break;

        case (EventType)3:
            if (GUIUtility.hotControl == num5)
            {
                float num11 = (Event.current.mousePosition.x - state.Translation.x) / state.Scale.x;
                num11 = state.SnappedTime(num11);
                float positiveInfinity = float.PositiveInfinity;
                foreach (CinemaActionWrapper wrapper3 in base.Track.Items)
                {
                    if ((wrapper3 != null) && (wrapper3.Behaviour != base.Wrapper.Behaviour))
                    {
                        float num13 = wrapper.Firetime + wrapper.Duration;
                        if (wrapper3.Firetime >= num13)
                        {
                            positiveInfinity = Mathf.Min(positiveInfinity, wrapper3.Firetime);
                        }
                    }
                }
                num11            = Mathf.Clamp(num11, base.Wrapper.Firetime, positiveInfinity);
                wrapper.Duration = num11 - base.Wrapper.Firetime;
            }
            break;
        }
        if (base.Wrapper.Behaviour.gameObject != null && Selection.activeGameObject != null && Selection.activeGameObject == base.Wrapper.Behaviour.gameObject)
        {
            if ((Event.current.type == (EventType)13) && (Event.current.commandName == "Copy"))
            {
                Event.current.Use();
            }
            if ((Event.current.type == (EventType)14) && (Event.current.commandName == "Copy"))
            {
                DirectorCopyPaste.Copy(base.Wrapper.Behaviour);
                Event.current.Use();
            }
        }
        if (((Event.current.type == (EventType)4) && (Event.current.keyCode == (KeyCode)0x7f)) && (Selection.activeGameObject == base.Wrapper.Behaviour.gameObject))
        {
            base.deleteItem(base.Wrapper.Behaviour);
            Event.current.Use();
        }
    }