Exemplo n.º 1
0
 /// <summary>
 /// Perform the previously-selected action when the mouse is clicked
 /// </summary>
 public void OnLeftMouseClick()
 {
     if (activeMouseDragAction != null)
     {
         _draggingIsActive = true;
         activeMouseDragAction.StartDragging();
     }
     activeMouseClickAction?.DoAction();
 }
Exemplo n.º 2
0
        /// <summary>
        /// See whether an action is possible based on mouse click and perform it.
        /// </summary>
        /// <param name="mouseX"></param>
        /// <param name="mouseY"></param>
        public void OnLeftMouseClick(int mouseX, int mouseY)
        {
            foreach (EditorActionMouseDrag mouseDragAction in mouseDragActions)
            {
                if (mouseDragAction.MenuState(currentTrainPath, activeNode, activeTrackLocation, UpdateAfterEdits,
                                              mouseX, mouseY))
                {
                    activeMouseDragAction = mouseDragAction;
                    activeMouseDragAction.StartDragging();
                    return;
                }
            }

            foreach (EditorAction action in editorActionsMouseClicked)
            {
                bool actionCanBeExecuted = action.MenuState(currentTrainPath, activeNode, activeTrackLocation, UpdateAfterEdits,
                                                            mouseX, mouseY);
                if (actionCanBeExecuted)
                {
                    action.DoAction();
                    break;
                }
            }
        }