private static void MouseSelectObject() { Event e = Event.current; if (e.button == 0 && e.type == EventType.MouseDown) { if (StateMachineBGGUI.controlWindowRange.Contains(e.mousePosition)) { bool isSelect = false; foreach (var item in MachineStateGUIDataControl.allMachineStateGUI) { if (StateMachineUtils.MachineGridRectContainsMousePos(e.mousePosition, item.GUIRect)) { isSelect = true; SelectObjectController.SelectItemObject(item); break; } } if (!isSelect) { StateTransitionArrowLine line = StateTransitionArrowLineDataControl.FindClosestStateTransitionArrowLine(e.mousePosition); if (line) { isSelect = true; SelectObjectController.SelectItemObject(line); } } if (isSelect == false) { SelectObjectController.SelectObjectCancel(); } e.Use(); } } }
public static void OnMachineStateMouseRightClickMenu() { if (StateTransitionGUI.startNewTranstion) { return; } Event e = Event.current; if (e.button == 1 && e.type == EventType.ContextClick) { foreach (var item in MachineStateGUIDataControl.allMachineStateGUI) { if (StateMachineUtils.MachineGridRectContainsMousePos(e.mousePosition, item.GUIRect)) { if (!SelectObjectController.IsSelectThis(item)) { SelectObjectController.SelectItemObject(item); } else { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent("New Transition"), false, NewTransitionStart, item.state); menu.AddItem(new GUIContent("Delete"), false, SelectObjectController.DeleteSelectObjet); menu.AddSeparator(""); menu.ShowAsContext(); } e.Use(); break; } } } }