void labelX1_MouseMove(object sender, MouseEventArgs e) { switch (Singleton.Instance.EditDeviceMode) { case DataMonitor.DQ.Infrastructure.EditDeviceMode.None: Cursor.Current = Cursors.Default; break; case DataMonitor.DQ.Infrastructure.EditDeviceMode.Add: case DataMonitor.DQ.Infrastructure.EditDeviceMode.Update: Bitmap a = (Bitmap)Bitmap.FromFile("MyXG.ico"); CursorHelper.SetCursor(this, a, new Point(0, 0)); break; case DataMonitor.DQ.Infrastructure.EditDeviceMode.Delete: Bitmap del = (Bitmap)Bitmap.FromFile("MyDelete.ico"); CursorHelper.SetCursor(this, del, new Point(0, 0)); break; default: Cursor.Current = Cursors.Default; break; } }
private void panel1_MouseMove(object sender, MouseEventArgs e) { switch (Singleton.Instance.EditDeviceMode) { case DataMonitor.DQ.Infrastructure.EditDeviceMode.Add: Bitmap a = (Bitmap)Bitmap.FromFile("MyAdd.ico"); CursorHelper.SetCursor(panel1, a, new Point(0, 0)); break; default: Cursor.Current = Cursors.Default; break; } if (MouseMoveEvent != null) { MouseMoveEvent(e); } }
protected override void SetCursor() { if (!IPointerOverEditorArea) { CursorHelper.ResetCursor(this); return; } if (m_pan) { if (m_rotate && RuntimeTools.Current == RuntimeTool.View) { CursorHelper.SetCursor(this, ViewTexture, new Vector2(0.5f, 0.5f), CursorMode.Auto); } else { CursorHelper.SetCursor(this, MoveTexture, new Vector2(0.5f, 0.5f), CursorMode.Auto); } } else if (m_rotate) { CursorHelper.SetCursor(this, ViewTexture, new Vector2(0.5f, 0.5f), CursorMode.Auto); } else { if (RuntimeTools.Current == RuntimeTool.View) { CursorHelper.SetCursor(this, MoveTexture, new Vector2(0.5f, 0.5f), CursorMode.Auto); } else { bool rotate = InputController._GetKey(RotateKey) || InputController._GetKey(RotateKey2) || InputController._GetKey(RotateKey3); if (!rotate) { CursorHelper.ResetCursor(this); } } } }
protected override void SetCursor() { if (!IPointerOverEditorArea) { CursorHelper.ResetCursor(this); return; } if (m_pan) { if (m_rotate && RuntimeTools.Current == RuntimeTool.View) { CursorHelper.SetCursor(this, ViewTexture, ViewTexture != null ? new Vector2(ViewTexture.width / 2, ViewTexture.height / 2) : Vector2.zero, CursorMode.Auto); } else { CursorHelper.SetCursor(this, MoveTexture, MoveTexture != null ? new Vector2(MoveTexture.width / 2, MoveTexture.height / 2) : Vector2.zero, CursorMode.Auto); } } else if (m_rotate) { CursorHelper.SetCursor(this, ViewTexture, ViewTexture != null ? new Vector2(ViewTexture.width / 2, ViewTexture.height / 2) : Vector2.zero, CursorMode.Auto); } else { if (RuntimeTools.Current == RuntimeTool.View) { CursorHelper.SetCursor(this, MoveTexture, MoveTexture != null ? new Vector2(MoveTexture.width / 2, MoveTexture.height / 2) : Vector2.zero, CursorMode.Auto); } else { bool rotate = InputController.GetKey(RotateKey) || InputController.GetKey(RotateKey2) || InputController.GetKey(RotateKey3); if (!rotate) { CursorHelper.ResetCursor(this); } } } }
private void OnItemBeginDrag(object sender, ItemArgs e) { CursorHelper.SetCursor(this, DragIcon, new Vector2(DragIcon.width / 2, DragIcon.height / 2), CursorMode.Auto); ItemContainer itemContainer = m_listBox.GetItemContainer(e.Items[0]); if (itemContainer != null) { ResourcePreview runtimeResource = itemContainer.GetComponentInChildren <ResourcePreview>(); runtimeResource.BeginSpawn(); } ProjectItemObjectPair objectItemPair = (ProjectItemObjectPair)e.Items[0]; if (BeginDrag != null) { BeginDrag(this, new ProjectResourcesEventArgs(new[] { objectItemPair })); } if (objectItemPair.IsResource) { DragDrop.RaiseBeginDrag(new[] { objectItemPair.Object }); } }
private void LateUpdate() { if (RuntimeTools.ActiveTool != null && RuntimeTools.ActiveTool != this) { return; } if (RuntimeTools.IsViewing) { return; } if (KeyCode == KeyCode.None || InputController.GetKeyDown(KeyCode)) { m_active = true; } if (m_active) { if (Input.GetMouseButtonDown(MouseButton)) { m_startMousePosition = Input.mousePosition; m_isDragging = GetPoint(out m_startPt) && (!RuntimeEditorApplication.IsOpened || RuntimeEditorApplication.IsPointerOverWindow(RuntimeWindowType.SceneView) && !RuntimeTools.IsPointerOverGameObject()); if (m_isDragging) { m_rectTransform.anchoredPosition = m_startPt; m_rectTransform.sizeDelta = new Vector2(0, 0); CursorHelper.SetCursor(this, null, Vector3.zero, CursorMode.Auto); } else { RuntimeTools.ActiveTool = null; } } else if (Input.GetMouseButtonUp(MouseButton)) { if (m_isDragging) { m_isDragging = false; HitTest(); m_rectTransform.sizeDelta = new Vector2(0, 0); CursorHelper.ResetCursor(this); } RuntimeTools.ActiveTool = null; m_active = false; } else if (m_isDragging) { GetPoint(out m_endPt); Vector2 size = m_endPt - m_startPt; if (size != Vector2.zero) { RuntimeTools.ActiveTool = this; } m_rectTransform.sizeDelta = new Vector2(Mathf.Abs(size.x), Mathf.Abs(size.y)); m_rectTransform.localScale = new Vector3(Mathf.Sign(size.x), Mathf.Sign(size.y), 1); } } }
void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData) { m_pointerInside = true; CursorHelper.SetCursor(this, CursorTexture, new Vector2(CursorTexture.width / 2, CursorTexture.height / 2), CursorMode.Auto); }
void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData) { m_pointerInside = true; m_cursorHelper.SetCursor(this, CursorTexture, new Vector2(0.5f, 0.5f), CursorMode.Auto); }
void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData) { CursorHelper.SetCursor(this, DragCursor, new Vector2(0.5f, 0.5f), CursorMode.Auto); }
private void Update() { if (InputController._GetKeyDown(EnterPlayModeKey)) { if (InputController._GetKey(ModifierKey)) { TogglePlayMode(); } } if (IsInPlayMode) { return; } if (BoundingBoxSnapping != TogBoundingBoxSnap.isOn) { TogBoundingBoxSnap.isOn = BoundingBoxSnapping; } if (InputController._GetKeyDown(DuplicateKey)) { if (InputController._GetKey(ModifierKey)) { Duplicate(); } } else if (InputController._GetKeyDown(SnapToGridKey)) { if (InputController._GetKey(ModifierKey)) { SnapToGrid(); } } else if (InputController._GetKeyDown(DeleteKey)) { Delete(); } bool useSceneViewInput = SelectionController is RuntimeSceneView; if (!useSceneViewInput) { float wheel = InputController._GetAxis("Mouse ScrollWheel"); if (wheel != 0.0f) { #if UNITY_WEBGL wheel *= 0.1f; #endif EditorCamera.orthographicSize -= wheel * EditorCamera.orthographicSize; if (EditorCamera.orthographicSize < 0.2f) { EditorCamera.orthographicSize = 0.2f; } else if (EditorCamera.orthographicSize > 15) { EditorCamera.orthographicSize = 15; } } #if UNITY_WEBGL if (InputController._GetMouseButtonDown(1)) #else if (InputController._GetMouseButtonDown(1) || InputController._GetMouseButtonDown(2)) #endif { m_dragPlane = new Plane(Vector3.up, m_pivot); m_pan = GetPointOnDragPlane(InputController._MousePosition, out m_prevMouse); m_prevMouse = InputController._MousePosition; CursorHelper.SetCursor(this, PanTexture, Vector2.zero, CursorMode.Auto); } #if UNITY_WEBGL else if (InputController._GetMouseButton(1)) #else else if (InputController._GetMouseButton(1) || InputController._GetMouseButton(2)) #endif { if (m_pan) { Vector3 pointOnDragPlane; Vector3 prevPointOnDragPlane; if (GetPointOnDragPlane(InputController._MousePosition, out pointOnDragPlane) && GetPointOnDragPlane(m_prevMouse, out prevPointOnDragPlane)) { Vector3 dragOffset = (pointOnDragPlane - prevPointOnDragPlane); m_prevMouse = InputController._MousePosition; m_panOffset -= dragOffset; EditorCamera.transform.position -= dragOffset; } } } #if UNITY_WEBGL else if (InputController._GetMouseButtonUp(1)) #else else if (InputController._GetMouseButtonUp(1) || InputController._GetMouseButtonUp(2)) #endif { m_pan = false; CursorHelper.ResetCursor(this); } if (InputController._GetKey(UpKey)) { Vector3 position = EditorCamera.transform.position; position.y += PanSpeed * Time.deltaTime; m_panOffset.y += PanSpeed * Time.deltaTime; EditorCamera.transform.position = position; } if (InputController._GetKey(DownKey)) { Vector3 position = EditorCamera.transform.position; position.y -= PanSpeed * Time.deltaTime; m_panOffset.y -= PanSpeed * Time.deltaTime; EditorCamera.transform.position = position; } if (InputController._GetKey(LeftKey)) { MoveMinZ(); MovePlusX(); } if (InputController._GetKey(RightKey)) { MovePlusZ(); MoveMinX(); } if (InputController._GetKey(FwdKey)) { MoveMinX(); MoveMinZ(); } if (InputController._GetKey(BwdKey)) { MovePlusX(); MovePlusZ(); } if (InputController._GetKeyDown(FocusKey)) { Focus(); } else if (AutoFocus) { do { if (RuntimeTools.ActiveTool != null) { break; } if (m_autoFocusTranform == null) { break; } if (m_autoFocusTranform.position == m_pivot) { break; } if (m_focusAnimations[0] == null || m_focusAnimations[0].InProgress) { break; } Vector3 offset = (m_autoFocusTranform.position - m_pivot) - m_panOffset; EditorCamera.transform.position += offset; m_pivot += offset; m_panOffset = Vector3.zero; }while (false); } } if (RuntimeSelection.activeTransform != null) { Vector3 offset = Grid.GridOffset; offset.y = RuntimeSelection.activeTransform.position.y; Grid.GridOffset = offset; } }
public static void SetCursor(KnownCursor cursorType) { CursorHelper.SetCursor(m_cursorLocker, cursorType); }