/// <summary> /// コンストラクタ /// </summary> public MouseState(EventSystem eventSystem) { _mouseData = new PointerInputModule.MouseButtonEventData[3]; _mouseData[0] = new PointerInputModule.MouseButtonEventData(); _mouseData[0].buttonData = new PointerEventData(eventSystem); _mouseData[1] = new PointerInputModule.MouseButtonEventData(); _mouseData[1].buttonData = new PointerEventData(eventSystem); _mouseData[2] = new PointerInputModule.MouseButtonEventData(); _mouseData[2].buttonData = new PointerEventData(eventSystem); }
protected void ProcessMouseEvent(int id) { PointerInputModule.MouseState mousePointerEventData = this.GetMousePointerEventData(id); PointerInputModule.MouseButtonEventData eventData = mousePointerEventData.GetButtonState(PointerEventData.InputButton.Left).eventData; this.ProcessMousePress(eventData); this.ProcessMove(eventData.buttonData); this.ProcessDrag(eventData.buttonData); this.ProcessMousePress(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Right).eventData); this.ProcessDrag(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Right).eventData.buttonData); this.ProcessMousePress(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Middle).eventData); this.ProcessDrag(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Middle).eventData.buttonData); if (!Mathf.Approximately(eventData.buttonData.scrollDelta.sqrMagnitude, 0f)) { GameObject eventHandler = ExecuteEvents.GetEventHandler <IScrollHandler>(eventData.buttonData.pointerCurrentRaycast.gameObject); ExecuteEvents.ExecuteHierarchy <IScrollHandler>(eventHandler, eventData.buttonData, ExecuteEvents.scrollHandler); } }
public static int get_buttonState(IntPtr l) { int result; try { PointerInputModule.MouseButtonEventData mouseButtonEventData = (PointerInputModule.MouseButtonEventData)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushEnum(l, (int)mouseButtonEventData.buttonState); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int constructor(IntPtr l) { int result; try { PointerInputModule.MouseButtonEventData o = new PointerInputModule.MouseButtonEventData(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int ReleasedThisFrame(IntPtr l) { int result; try { PointerInputModule.MouseButtonEventData mouseButtonEventData = (PointerInputModule.MouseButtonEventData)LuaObject.checkSelf(l); bool b = mouseButtonEventData.ReleasedThisFrame(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, b); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
/// <summary> /// 指定されたボタンのイベント情報を取得 /// </summary> /// <param name="buttonId">マウスのボタンId。左:0、右:1、中:2</param> /// <param name="mouseEventData">イベント情報</param> /// <returns>イベント情報を生成したかの有無</returns> public bool GetButtonEventData(int buttonId, out PointerInputModule.MouseButtonEventData mouseEventData) { bool result = false; if (buttonId < 0 || buttonId >= _mouseData.Length) { throw new InvalidOperationException("対応していないマウスボタンが指定されました"); } if (_mouseData[buttonId] == null) { result = true; _mouseData[buttonId] = new PointerInputModule.MouseButtonEventData(); } mouseEventData = _mouseData[buttonId]; return(result); }
public static int set_buttonState(IntPtr l) { int result; try { PointerInputModule.MouseButtonEventData mouseButtonEventData = (PointerInputModule.MouseButtonEventData)LuaObject.checkSelf(l); PointerEventData.FramePressState buttonState; LuaObject.checkEnum <PointerEventData.FramePressState>(l, 2, out buttonState); mouseButtonEventData.buttonState = buttonState; LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int set_buttonData(IntPtr l) { int result; try { PointerInputModule.MouseButtonEventData mouseButtonEventData = (PointerInputModule.MouseButtonEventData)LuaObject.checkSelf(l); PointerEventData buttonData; LuaObject.checkType <PointerEventData>(l, 2, out buttonData); mouseButtonEventData.buttonData = buttonData; LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
// Token: 0x0600627D RID: 25213 RVA: 0x00231DD4 File Offset: 0x002301D4 protected void ProcessMouseEvent() { PointerInputModule.MouseState mouseState = this.VRCGetMousePointerEventData(); PointerInputModule.MouseButtonEventData eventData = mouseState.GetButtonState(PointerEventData.InputButton.Left).eventData; this.overSelection = null; if (eventData.buttonData.pointerCurrentRaycast.gameObject != null) { this.overSelection = eventData.buttonData.pointerCurrentRaycast.gameObject.GetComponentInParent <Selectable>(); } this.ProcessMousePress(eventData, true); this.ProcessMove(eventData.buttonData); this.ProcessDrag(eventData.buttonData); PointerInputModule.MouseButtonEventData eventData2 = mouseState.GetButtonState(PointerEventData.InputButton.Right).eventData; eventData2.buttonData.button = PointerEventData.InputButton.Left; this.ProcessMousePress(eventData2, false); this.ProcessMove(eventData2.buttonData); this.ProcessDrag(eventData2.buttonData); if (!Mathf.Approximately(eventData.buttonData.scrollDelta.sqrMagnitude, 0f)) { GameObject eventHandler = ExecuteEvents.GetEventHandler <IScrollHandler>(eventData.buttonData.pointerCurrentRaycast.gameObject); ExecuteEvents.ExecuteHierarchy <IScrollHandler>(eventHandler, eventData.buttonData, ExecuteEvents.scrollHandler); } }
private void ProcessMouseEvent() { PointerInputModule.MouseState mousePointerEventData = this.GetMousePointerEventData(-1); bool pressed = mousePointerEventData.AnyPressesThisFrame(); bool released = mousePointerEventData.AnyReleasesThisFrame(); PointerInputModule.MouseButtonEventData eventData = mousePointerEventData.GetButtonState(PointerEventData.InputButton.Left).eventData; if (!RewiredStandaloneInputModule.UseMouse(pressed, released, eventData.buttonData)) { return; } this.ProcessMousePress(eventData); this.ProcessMove(eventData.buttonData); this.ProcessDrag(eventData.buttonData); this.ProcessMousePress(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Right).eventData); this.ProcessDrag(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Right).eventData.buttonData); this.ProcessMousePress(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Middle).eventData); this.ProcessDrag(mousePointerEventData.GetButtonState(PointerEventData.InputButton.Middle).eventData.buttonData); if (!Mathf.Approximately(eventData.buttonData.scrollDelta.sqrMagnitude, 0f)) { GameObject eventHandler = ExecuteEvents.GetEventHandler <IScrollHandler>(eventData.buttonData.pointerCurrentRaycast.gameObject); ExecuteEvents.ExecuteHierarchy <IScrollHandler>(eventHandler, eventData.buttonData, ExecuteEvents.scrollHandler); } }
protected void ProcessMouseEvent(int id) { PointerInputModule.MouseState pointerEventData = this.GetMousePointerEventData(id); PointerInputModule.MouseButtonEventData eventData = pointerEventData.GetButtonState((PointerEventData.InputButton) 0).get_eventData(); RaycastResult pointerCurrentRaycast1 = ((PointerEventData)eventData.buttonData).get_pointerCurrentRaycast(); this._currentFocusedGameObject = ((RaycastResult) ref pointerCurrentRaycast1).get_gameObject(); this.ProcessMousePress(eventData); this.ProcessMove((PointerEventData)eventData.buttonData); this.ProcessDrag((PointerEventData)eventData.buttonData); this.ProcessMousePress(pointerEventData.GetButtonState((PointerEventData.InputButton) 1).get_eventData()); this.ProcessDrag((PointerEventData)pointerEventData.GetButtonState((PointerEventData.InputButton) 1).get_eventData().buttonData); this.ProcessMousePress(pointerEventData.GetButtonState((PointerEventData.InputButton) 2).get_eventData()); this.ProcessDrag((PointerEventData)pointerEventData.GetButtonState((PointerEventData.InputButton) 2).get_eventData().buttonData); Vector2 scrollDelta = ((PointerEventData)eventData.buttonData).get_scrollDelta(); if (Mathf.Approximately(((Vector2) ref scrollDelta).get_sqrMagnitude(), 0.0f)) { return; } RaycastResult pointerCurrentRaycast2 = ((PointerEventData)eventData.buttonData).get_pointerCurrentRaycast(); ExecuteEvents.ExecuteHierarchy <IScrollHandler>(ExecuteEvents.GetEventHandler <IScrollHandler>(((RaycastResult) ref pointerCurrentRaycast2).get_gameObject()), (BaseEventData)eventData.buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_scrollHandler()); }
private void ProcessMousePress(PointerInputModule.MouseButtonEventData data) { var buttonData = data.buttonData; var gameObject = buttonData.pointerCurrentRaycast.gameObject; if (data.PressedThisFrame()) { buttonData.eligibleForClick = true; buttonData.delta = Vector2.zero; buttonData.dragging = false; buttonData.useDragThreshold = true; buttonData.pressPosition = buttonData.position; buttonData.pointerPressRaycast = buttonData.pointerCurrentRaycast; var gameObject2 = ExecuteEvents.ExecuteHierarchy <IPointerDownHandler>(gameObject, buttonData, ExecuteEvents.pointerDownHandler); if (gameObject2 == null) { gameObject2 = ExecuteEvents.GetEventHandler <IPointerClickHandler>(gameObject); } float unscaledTime = Time.unscaledTime; if (gameObject2 == buttonData.lastPress) { float num = unscaledTime - buttonData.clickTime; if (num < 0.3f) { buttonData.clickCount++; } else { buttonData.clickCount = 1; } buttonData.clickTime = unscaledTime; } else { buttonData.clickCount = 1; } buttonData.pointerPress = gameObject2; buttonData.rawPointerPress = gameObject; buttonData.clickTime = unscaledTime; buttonData.pointerDrag = ExecuteEvents.GetEventHandler <IDragHandler>(gameObject); if (buttonData.pointerDrag != null) { ExecuteEvents.Execute <IInitializePotentialDragHandler>(buttonData.pointerDrag, buttonData, ExecuteEvents.initializePotentialDrag); } } if (data.ReleasedThisFrame()) { ExecuteEvents.Execute <IPointerUpHandler>(buttonData.pointerPress, buttonData, ExecuteEvents.pointerUpHandler); var eventHandler = ExecuteEvents.GetEventHandler <IPointerClickHandler>(gameObject); if (buttonData.pointerPress == eventHandler && buttonData.eligibleForClick) { ExecuteEvents.Execute <IPointerClickHandler>(buttonData.pointerPress, buttonData, ExecuteEvents.pointerClickHandler); } else { if (buttonData.pointerDrag != null) { ExecuteEvents.ExecuteHierarchy <IDropHandler>(gameObject, buttonData, ExecuteEvents.dropHandler); } } buttonData.eligibleForClick = false; buttonData.pointerPress = null; buttonData.rawPointerPress = null; buttonData.dragging = false; if (buttonData.pointerDrag != null) { ExecuteEvents.Execute <IEndDragHandler>(buttonData.pointerDrag, buttonData, ExecuteEvents.endDragHandler); } buttonData.pointerDrag = null; if (gameObject != buttonData.pointerEnter) { base.HandlePointerExitAndEnter(buttonData, null); base.HandlePointerExitAndEnter(buttonData, gameObject); } } }
/// <summary> /// マウスの押下イベントを処理 /// </summary> /// <param name="buttonEventData">マウスボタンのイベント情報</param> void ProcessPress(PointerInputModule.MouseButtonEventData buttonEventData) { PointerEventData eventData = buttonEventData.buttonData; GameObject rayTarget = eventData.pointerCurrentRaycast.gameObject; // ボタンを押下した時 if (buttonEventData.PressedThisFrame()) { GameObject eventTarget; eventData.eligibleForClick = true; eventData.delta = Vector2.zero; eventData.dragging = false; eventData.useDragThreshold = true; eventData.pressPosition = eventData.position; eventData.pointerPressRaycast = eventData.pointerCurrentRaycast; DeselectIfSelectionChanged(rayTarget, eventData); // 押下イベントを発行。対象となるオブジェクトを取得 eventTarget = ExecuteEvents.ExecuteHierarchy <IPointerDownHandler>( rayTarget, eventData, ExecuteEvents.pointerDownHandler); if (eventTarget == null) { eventTarget = ExecuteEvents.GetEventHandler <IPointerClickHandler>(rayTarget); } // 選択したオブジェクトが直前のものと同じ場合、クリック回数をカウント float unscaledTime = Time.unscaledTime; if (eventTarget == eventData.lastPress) { float deltaTime = unscaledTime - eventData.clickTime; if (deltaTime < 0.3f) { eventData.clickCount++; } else { eventData.clickCount = 1; } } else { eventData.clickCount = 1; } eventData.pointerPress = eventTarget; eventData.rawPointerPress = rayTarget; eventData.clickTime = unscaledTime; // ドラッグ開始の直前イベント eventData.pointerDrag = ExecuteEvents.GetEventHandler <IDragHandler>(rayTarget); if (eventData.pointerDrag != null) { ExecuteEvents.Execute <IInitializePotentialDragHandler>( eventData.pointerDrag, eventData, ExecuteEvents.initializePotentialDrag); } } // ボタンを離上した時 if (buttonEventData.ReleasedThisFrame()) { // 離上イベントを発行 ExecuteEvents.Execute <IPointerUpHandler>( eventData.pointerPress, eventData, ExecuteEvents.pointerUpHandler); // クリックイベント GameObject eventHandler = ExecuteEvents.GetEventHandler <IPointerClickHandler>(rayTarget); if (eventData.pointerPress == eventHandler && eventData.eligibleForClick) { ExecuteEvents.Execute <IPointerClickHandler>( eventData.pointerPress, eventData, ExecuteEvents.pointerClickHandler); } // ドロップイベント else if (eventData.pointerDrag != null && eventData.dragging) { ExecuteEvents.ExecuteHierarchy <IDropHandler>( rayTarget, eventData, ExecuteEvents.dropHandler); } eventData.eligibleForClick = false; eventData.pointerPress = null; eventData.rawPointerPress = null; // ドラッグ終了 if (eventData.pointerDrag != null && eventData.dragging) { ExecuteEvents.Execute <IEndDragHandler>( eventData.pointerDrag, eventData, ExecuteEvents.endDragHandler); } eventData.dragging = false; eventData.pointerDrag = null; // マウスオーバー更新 if (rayTarget != eventData.pointerEnter) { base.HandlePointerExitAndEnter(eventData, null); base.HandlePointerExitAndEnter(eventData, rayTarget); } } }
protected void ProcessMousePress(PointerInputModule.MouseButtonEventData data) { PointerEventData buttonData = (PointerEventData)data.buttonData; RaycastResult pointerCurrentRaycast = buttonData.get_pointerCurrentRaycast(); GameObject gameObject1 = ((RaycastResult) ref pointerCurrentRaycast).get_gameObject(); if (data.PressedThisFrame()) { buttonData.set_eligibleForClick(true); buttonData.set_delta(Vector2.get_zero()); buttonData.set_dragging(false); buttonData.set_useDragThreshold(true); buttonData.set_pressPosition(buttonData.get_position()); buttonData.set_pointerPressRaycast(buttonData.get_pointerCurrentRaycast()); this.DeselectIfSelectionChanged(gameObject1, (BaseEventData)buttonData); GameObject gameObject2 = ExecuteEvents.ExecuteHierarchy <IPointerDownHandler>(gameObject1, (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerDownHandler()); if (Object.op_Equality((Object)gameObject2, (Object)null)) { gameObject2 = ExecuteEvents.GetEventHandler <IPointerClickHandler>(gameObject1); } float unscaledTime = Time.get_unscaledTime(); if (Object.op_Equality((Object)gameObject2, (Object)buttonData.get_lastPress())) { if ((double)(unscaledTime - buttonData.get_clickTime()) < 0.300000011920929) { PointerEventData pointerEventData = buttonData; pointerEventData.set_clickCount(pointerEventData.get_clickCount() + 1); } else { buttonData.set_clickCount(1); } buttonData.set_clickTime(unscaledTime); } else { buttonData.set_clickCount(1); } buttonData.set_pointerPress(gameObject2); buttonData.set_rawPointerPress(gameObject1); buttonData.set_clickTime(unscaledTime); buttonData.set_pointerDrag(ExecuteEvents.GetEventHandler <IDragHandler>(gameObject1)); if (Object.op_Inequality((Object)buttonData.get_pointerDrag(), (Object)null)) { ExecuteEvents.Execute <IInitializePotentialDragHandler>(buttonData.get_pointerDrag(), (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_initializePotentialDrag()); } } if (!data.ReleasedThisFrame()) { return; } ExecuteEvents.Execute <IPointerUpHandler>(buttonData.get_pointerPress(), (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerUpHandler()); GameObject eventHandler = ExecuteEvents.GetEventHandler <IPointerClickHandler>(gameObject1); if (Object.op_Equality((Object)buttonData.get_pointerPress(), (Object)eventHandler) && buttonData.get_eligibleForClick()) { ExecuteEvents.Execute <IPointerClickHandler>(buttonData.get_pointerPress(), (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerClickHandler()); } else if (Object.op_Inequality((Object)buttonData.get_pointerDrag(), (Object)null) && buttonData.get_dragging()) { ExecuteEvents.ExecuteHierarchy <IDropHandler>(gameObject1, (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_dropHandler()); } buttonData.set_eligibleForClick(false); buttonData.set_pointerPress((GameObject)null); buttonData.set_rawPointerPress((GameObject)null); if (Object.op_Inequality((Object)buttonData.get_pointerDrag(), (Object)null) && buttonData.get_dragging()) { ExecuteEvents.Execute <IEndDragHandler>(buttonData.get_pointerDrag(), (BaseEventData)buttonData, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_endDragHandler()); } buttonData.set_dragging(false); buttonData.set_pointerDrag((GameObject)null); if (!Object.op_Inequality((Object)gameObject1, (Object)buttonData.get_pointerEnter())) { return; } ((BaseInputModule)this).HandlePointerExitAndEnter(buttonData, (GameObject)null); ((BaseInputModule)this).HandlePointerExitAndEnter(buttonData, gameObject1); }