private void PassInputToLayout(bool passInput, TouchInputLayout til) { if (til != null) { til.ShouldReceiveInput(passInput); return; } }
private void RenderLayout(bool render, TouchInputLayout til) { if (til != null) { til.ShouldRender(render); return; } }
public void Select(TouchInputLayout toSelect) { GUI.FocusControl(""); _activeTracker = null; _activeBase = null; _layout = toSelect; if(toSelect != null) { renameNameTemp = _layout.name; } }
void StartJoystickMove(TouchInputLayout.TrackerPrefabBasePrefabPair tracker, Vector2 currentPos) { if(!_isDragging) { _modifyStartPos = currentPos; _rectStartOfDrag = tracker._tracker.activeRegion; trackerBeingModified = tracker; } _isDragging = true; }
void StartJoystickResize( TouchInputLayout.TrackerPrefabBasePrefabPair tracker, Vector2 currentPos, ResizeSide side) { if (!_isResizing) { _modifyStartPos = currentPos; _rectStartOfDrag = tracker._tracker.activeRegion; _resizeSide = side; trackerBeingModified = tracker; } _isResizing = true; }
void ResizableDraggableJoystick(TouchInputLayout.TrackerPrefabBasePrefabPair toResize, Rect drawnArea, Rect fullArea) { Rect resizePosLeft = new Rect(drawnArea.xMin, drawnArea.yMin + 8, 8, drawnArea.height - 16); EditorGUIUtility.AddCursorRect(resizePosLeft, MouseCursor.ResizeHorizontal); Rect resizePosRight = new Rect(drawnArea.xMax - 8, drawnArea.yMin + 8, 8, drawnArea.height - 16); EditorGUIUtility.AddCursorRect(resizePosRight, MouseCursor.ResizeHorizontal); Rect resizePosTop = new Rect(drawnArea.xMin + 8, drawnArea.yMin, drawnArea.width - 16, 8); EditorGUIUtility.AddCursorRect(resizePosTop, MouseCursor.ResizeVertical); Rect resizePosBottom = new Rect(drawnArea.xMin + 8, drawnArea.yMax - 8, drawnArea.width - 16, 8); EditorGUIUtility.AddCursorRect(resizePosBottom, MouseCursor.ResizeVertical); Rect dragZone = new Rect(drawnArea.xMin + 10, drawnArea.yMin + 10, drawnArea.width - 20, 15); EditorGUIUtility.AddCursorRect(dragZone, MouseCursor.MoveArrow); if (Event.current != null) { if (Event.current.isMouse) { _currentPos = Event.current.mousePosition; _currentPos.x -= fullArea.x; _currentPos.x /= (fullArea.width); _currentPos.y -= (16); _currentPos.y /= (fullArea.height - (16)); } if (Event.current.rawType == EventType.MouseDown) { if (dragZone.Contains(Event.current.mousePosition)) { trackerBeingModified = toResize; StartJoystickMove(toResize,_currentPos); Event.current.Use(); } else if (resizePosLeft.Contains(Event.current.mousePosition)) { trackerBeingModified = toResize; StartJoystickResize(toResize,_currentPos,ResizeSide.Left); Event.current.Use(); } else if (resizePosRight.Contains(Event.current.mousePosition)) { trackerBeingModified = toResize; StartJoystickResize(toResize,_currentPos,ResizeSide.Right); Event.current.Use(); } else if (resizePosTop.Contains(Event.current.mousePosition)) { trackerBeingModified = toResize; StartJoystickResize(toResize,_currentPos,ResizeSide.Top); Event.current.Use(); } else if (resizePosBottom.Contains(Event.current.mousePosition)) { trackerBeingModified = toResize; StartJoystickResize(toResize,_currentPos,ResizeSide.Bottom); Event.current.Use(); } } else if (Event.current.rawType == EventType.mouseUp && trackerBeingModified != null) { _isResizing = false; _isDragging = false; trackerBeingModified = null; Event.current.Use(); } } }
private bool IsInputIDUnique(string id, TouchInputLayout layout) { if (layout == null) return false; int count = 0; foreach (TouchInputLayout.TrackerPrefabBasePrefabPair trackerPrefabBasePrefabPair in layout.trackerPrefabBasePrefab) { if (trackerPrefabBasePrefabPair._tracker._id == id) { count++; if (count > 1) return false; } } return true; }