protected static PointerEventData.FramePressState StateForMouseButton(int buttonId) { var pressed = MyInput.GetMouseButtonDown(buttonId); var released = MyInput.GetMouseButtonUp(buttonId); if (pressed && released) { return(PointerEventData.FramePressState.PressedAndReleased); } if (pressed) { return(PointerEventData.FramePressState.Pressed); } if (released) { return(PointerEventData.FramePressState.Released); } return(PointerEventData.FramePressState.NotChanged); }
public override bool ShouldActivateModule() { if (!base.ShouldActivateModule()) { return(false); } var shouldActivate = m_ForceModuleActive; shouldActivate |= MyInput.GetButtonDown(m_SubmitButton); shouldActivate |= MyInput.GetButtonDown(m_CancelButton); shouldActivate |= !Mathf.Approximately(MyInput.GetAxisRaw(m_HorizontalAxis), 0.0f); shouldActivate |= !Mathf.Approximately(MyInput.GetAxisRaw(m_VerticalAxis), 0.0f); shouldActivate |= (m_MousePosition - m_LastMousePosition).sqrMagnitude > 0.0f; shouldActivate |= MyInput.GetMouseButtonDown(0); if (MyInput.touchCount > 0) { shouldActivate = true; } return(shouldActivate); }