コード例 #1
0
 private void UnbindConnectionCallbacks(TransitionConnectionUI connection)
 {
     if (connection != null)
     {
         connection.OnCreatedTransition -= CreatedTransition;
         connection.OnRemovedTransition -= RemovedTransition;
     }
 }
コード例 #2
0
        public void Hide()
        {
            UnbindConnectionCallbacks(_connection);

            _connection         = null;
            _selectedTransition = null;
            style.display       = DisplayStyle.None;
        }
コード例 #3
0
        public void Show(TransitionConnectionUI connection)
        {
            UnbindConnectionCallbacks(_connection);

            _connection         = connection;
            _selectedTransition = _connection.Transitions[0];

            BindTransitionFields(_selectedTransition);
            BindConnectionCallbacks(_connection);

            _transitions.itemsSource   = _connection.Transitions;
            _transitions.selectedIndex = 0;
            _transitions.Refresh();
            style.display = DisplayStyle.Flex;
        }
コード例 #4
0
        public StateNodeUITransitionItem(TransitionConnectionUI transition)
        {
            StateNodeUI destinationState = (StateNodeUI)transition.Destination;

            DestinationLabel             = new Label(destinationState.Name);
            DestinationLabel.pickingMode = PickingMode.Ignore;

            var moveUpButton = new Button(MoveUp)
            {
                text = "▲"
            };

            moveUpButton.AddToClassList("move-up");

            var moveDownButton = new Button(MoveDown)
            {
                text = "▼"
            };

            moveDownButton.AddToClassList("move-down");

            Add(DestinationLabel);
            Add(moveUpButton);
            Add(moveDownButton);

            _transition = transition;

            destinationState.OnNameChanged += ChangeDestinationLabel;

            RegisterCallback <MouseDownEvent>(e =>
            {
                if (e.clickCount < 2)
                {
                    return;
                }

                schedule.Execute(() =>
                {
                    StateMachineEditor.Editor.GraphView.ClearSelection();
                    StateMachineEditor.Editor.GraphView.AddToSelection((StateNodeUI)_transition.Destination);
                    StateMachineEditor.Editor.GraphView.FrameSelection();
                });
            });
        }
コード例 #5
0
 void RemovedTransition(TransitionConnectionUI transitionConnection, TransitionInfo transitionInfo, int index)
 {
     _transitions.Refresh();
     _transitions.selectedIndex = index == transitionConnection.Transitions.Count ? index - 1 : index;
 }
コード例 #6
0
 void CreatedTransition(TransitionConnectionUI transitionConnection, TransitionInfo transitionInfo)
 {
     _transitions.Refresh();
     _transitions.selectedIndex = transitionConnection.Transitions.Count - 1;
 }