private void UpdateButton() { if (axis.axisState == ETCAxis.AxisState.Down) { isOnPress = true; axis.axisState = ETCAxis.AxisState.Press; } if (isOnPress) { axis.UpdateButton(); onPressed.Invoke(); onPressedValue.Invoke(axis.axisValue); } if (axis.axisState == ETCAxis.AxisState.Up) { isOnPress = false; axis.axisState = ETCAxis.AxisState.None; } if (enableKeySimulation && _activated && _visible && !isOnTouch) { if (Input.GetKey(axis.positivekey) && axis.axisState == ETCAxis.AxisState.None) { axis.axisState = ETCAxis.AxisState.Down; } if (!Input.GetKey(axis.positivekey) && axis.axisState == ETCAxis.AxisState.Press) { axis.axisState = ETCAxis.AxisState.Up; onUp.Invoke(); } } }
private void UpdateButton() { if (axisCenter.axisState == ETCAxis.AxisState.Down) { axisCenter.axisState = ETCAxis.AxisState.Press; axisCenter.UpdateButton(); } if (axisCenter.axisState == ETCAxis.AxisState.Up) { axisCenter.axisState = ETCAxis.AxisState.None; } //if (enableKeySimulation && _activated && _visible && !isOnTouch) //{ // if (Input.GetKey(axis.positivekey) && axis.axisState == ETCAxis.AxisState.None) // { // axis.axisState = ETCAxis.AxisState.Down; // } // if (!Input.GetKey(axis.positivekey) && axis.axisState == ETCAxis.AxisState.Press) // { // axis.axisState = ETCAxis.AxisState.Up; // onUp.Invoke(); // } //} }
public void OnPointerDown(PointerEventData eventData) { if (_activated && !isOnTouch) { pointId = eventData.pointerId; axis.ResetAxis(); axis.axisState = ETCAxis.AxisState.Down; isOnPress = false; isOnTouch = true; onDown.Invoke(); ApllyState(); axis.UpdateButton(); } }
private void UpdateButton() { ///delete /// #region dynamic joystick //if (joystickType == JoystickType.Dynamic && !_visible && _activated) //{ // Vector2 localPosition = Vector2.zero; // Vector2 screenPosition = Vector2.zero; // if (isTouchOverJoystickArea(ref localPosition, ref screenPosition)) // { // GameObject overGO = GetFirstUIElement(screenPosition); // if (overGO == null || (allowJoystickOverTouchPad && overGO.GetComponent<ETCTouchPad>()) || (overGO != null && overGO.GetComponent<ETCArea>())) // { // cachedRectTransform.anchoredPosition = localPosition; // visible = true; // } // } //} if (axis.axisState == ETCAxis.AxisState.Down) { isOnPress = true; axis.axisState = ETCAxis.AxisState.Press; } if (isOnPress) { axis.UpdateButton(); onPressed.Invoke(); onPressedValue.Invoke(axis.axisValue); } if (axis.axisState == ETCAxis.AxisState.Up) { isOnPress = false; axis.axisState = ETCAxis.AxisState.None; } if (enableKeySimulation && _activated && _visible && !isOnTouch) { if (Input.GetKey(axis.positivekey) && axis.axisState == ETCAxis.AxisState.None) { axis.axisState = ETCAxis.AxisState.Down; } if (!Input.GetKey(axis.positivekey) && axis.axisState == ETCAxis.AxisState.Press) { axis.axisState = ETCAxis.AxisState.Up; onUp.Invoke(); } } }
public void OnPointerDown(PointerEventData eventData) { if (_activated && !isOnTouch) { pointId = eventData.pointerId; axis.ResetAxis(); axis.axisState = ETCAxis.AxisState.Down; isOnPress = false; isOnTouch = true; onDown.Invoke(); ApllyState(); axis.UpdateButton(); // modified by cat heaven CrossPlatformInputManager.SetButtonDown(axis.unityAxis); // modified by cat heaven } }