Beispiel #1
0
 public override void NodeUI(UnityEditor.Graphs.GraphGUI host)
 {
     this.graphGUI = (host as GraphGUI);
     Assert.NotNull(this.graphGUI);
     if (Node.IsLeftClick())
     {
         host.edgeGUI.EndSlotDragging(base.inputSlots.First <Slot>(), true);
     }
     if (Node.IsDoubleClick())
     {
         if (this.stateMachine == this.graphGUI.stateMachineGraph.parentStateMachine)
         {
             this.graphGUI.tool.GoToBreadCrumbTarget(this.stateMachine);
         }
         else
         {
             this.graphGUI.tool.AddBreadCrumb(this.stateMachine);
         }
         Event.current.Use();
     }
     if (Node.IsRightClick() && this.stateMachine != this.graphGUI.stateMachineGraph.parentStateMachine)
     {
         GenericMenu genericMenu = new GenericMenu();
         genericMenu.AddItem(new GUIContent("Make Transition"), false, new GenericMenu.MenuFunction(this.MakeTransitionCallback));
         genericMenu.AddItem(new GUIContent("Copy"), false, new GenericMenu.MenuFunction(this.CopyStateMachineCallback));
         genericMenu.AddItem(new GUIContent("Delete"), false, new GenericMenu.MenuFunction(this.DeleteStateMachineCallback));
         genericMenu.ShowAsContext();
         Event.current.Use();
     }
 }
Beispiel #2
0
 public override void NodeUI(UnityEditor.Graphs.GraphGUI host)
 {
     if (Node.IsLeftClick())
     {
         host.edgeGUI.EndSlotDragging(base.inputSlots.First <Slot>(), true);
     }
 }
Beispiel #3
0
        public override void NodeUI(UnityEditor.Graphs.GraphGUI host)
        {
            this.graphGUI = (host as GraphGUI);
            Assert.NotNull(this.graphGUI);
            Event current = Event.current;

            if (Node.IsRightClick())
            {
                GenericMenu genericMenu = new GenericMenu();
                genericMenu.AddItem(new GUIContent("Make Transition"), false, new GenericMenu.MenuFunction(this.MakeTransitionCallback));
                genericMenu.ShowAsContext();
                current.Use();
            }
        }
Beispiel #4
0
        public override void NodeUI(UnityEditor.Graphs.GraphGUI host)
        {
            this.graphGUI = (host as GraphGUI);
            Assert.NotNull(this.graphGUI);
            Event current = Event.current;

            if (Node.IsRightClick())
            {
                GenericMenu genericMenu = new GenericMenu();
                genericMenu.AddItem(new GUIContent("Make Transition"), false, new GenericMenu.MenuFunction(this.MakeTransitionCallback));
                genericMenu.AddItem(new GUIContent("Set StateMachine Default State"), false, new GenericMenu.MenuFunction(this.MakeDefaultStateCallback));
                genericMenu.ShowAsContext();
                current.Use();
            }
            if (Node.IsLeftClick())
            {
                host.edgeGUI.EndSlotDragging(base.inputSlots.First <Slot>(), true);
            }
        }
Beispiel #5
0
        public override void NodeUI(UnityEditor.Graphs.GraphGUI host)
        {
            this.graphGUI = (host as GraphGUI);
            Assert.NotNull(this.graphGUI);
            Event current = Event.current;

            if (Node.IsLeftClick())
            {
                host.edgeGUI.EndSlotDragging(base.inputSlots.First <Slot>(), true);
            }
            if (Node.IsDoubleClick())
            {
                Motion stateEffectiveMotion = AnimatorControllerTool.tool.animatorController.GetStateEffectiveMotion(this.state, AnimatorControllerTool.tool.selectedLayerIndex);
                if (stateEffectiveMotion is BlendTree)
                {
                    this.graphGUI.tool.AddBreadCrumb(this.state);
                }
                else if (stateEffectiveMotion is AnimationClip)
                {
                    Selection.activeObject = stateEffectiveMotion;
                    AnimationClipEditor.EditWithImporter(stateEffectiveMotion as AnimationClip);
                }
                current.Use();
            }
            if (Node.IsRightClick())
            {
                GenericMenu genericMenu = new GenericMenu();
                genericMenu.AddItem(new GUIContent("Make Transition"), false, new GenericMenu.MenuFunction(this.MakeTransitionCallback));
                if (this.graphGUI.rootStateMachine.defaultState == this.state)
                {
                    genericMenu.AddDisabledItem(new GUIContent("Set as Layer Default State"));
                }
                else
                {
                    genericMenu.AddItem(new GUIContent("Set as Layer Default State"), false, new GenericMenu.MenuFunction(this.SetDefaultCallback));
                }
                genericMenu.AddItem(new GUIContent("Copy"), false, new GenericMenu.MenuFunction(this.CopyStateCallback));
                genericMenu.AddItem(new GUIContent("Create new BlendTree in State"), false, new GenericMenu.MenuFunction(this.AddNewBlendTreeCallback));
                genericMenu.AddItem(new GUIContent("Delete"), false, new GenericMenu.MenuFunction(this.DeleteStateCallback));
                genericMenu.ShowAsContext();
                current.Use();
            }
            Rect rect = GUILayoutUtility.GetRect(200f, 10f);

            if (Event.current.type == EventType.Repaint && (this.graphGUI.liveLinkInfo.currentState == this.state || this.graphGUI.liveLinkInfo.nextState == this.state))
            {
                GUIStyle gUIStyle  = "MeLivePlayBackground";
                GUIStyle gUIStyle2 = "MeLivePlayBar";
                float    num       = (!(this.graphGUI.liveLinkInfo.currentState == this.state)) ? this.graphGUI.liveLinkInfo.nextStateNormalizedTime : this.graphGUI.liveLinkInfo.currentStateNormalizedTime;
                bool     flag      = (!(this.graphGUI.liveLinkInfo.currentState == this.state)) ? this.graphGUI.liveLinkInfo.nextStateLoopTime : this.graphGUI.liveLinkInfo.currentStateLoopTime;
                rect = gUIStyle.margin.Remove(rect);
                Rect position = gUIStyle.padding.Remove(rect);
                if (flag)
                {
                    if (num < 0f)
                    {
                        position.width = position.width * (1f - Mathf.Abs(num) % 1f) + 2f;
                    }
                    else
                    {
                        position.width = position.width * (num % 1f) + 2f;
                    }
                }
                else
                {
                    position.width = position.width * Mathf.Clamp(num, 0f, 1f) + 2f;
                }
                gUIStyle2.Draw(position, false, false, false, false);
                gUIStyle.Draw(rect, false, false, false, false);
            }
        }