コード例 #1
0
    private IEnumerator TestButton(Antilatency.HardwareExtensionInterface.IInputPin inputPin)
    {
        while (_aheiCotask != null)
        {
            yield return(new WaitForSeconds(0.001f));

            var inputValue = inputPin.getState();

            if (inputValue == Antilatency.HardwareExtensionInterface.Interop.PinState.Low)
            {
                OnButtonReleased.Invoke();
                if (_playing == true)
                {
                    OnButtonReleased.Invoke();
                    _playing = false;
                }
            }
            else
            {
                if (_playing == false)
                {
                    OnButtonPressed.Invoke();
                    _playing = true;
                }
            }
        }
    }
コード例 #2
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         OnPress.Invoke(true);
     }
     if (Input.GetMouseButtonUp(0))
     {
         OnPress.Invoke(false);
     }
 }
コード例 #3
0
    void Update()
    {
        if (isPointerDown && !longPressed)
        {
            if (Time.time - timePressStarted > holdTime)
            {
                longPressed = true;
                onPress.Invoke(true);
#if UI_DEBUG
                Debug.LogError("OnLongPress:" + this.gameObject);
#endif
            }
        }
    }
コード例 #4
0
        // Check if this binding has been activated, and if so, dispatch events and change state
        public override void Update(GameTime gameTime)
        {
            // Update State (pressed if any of the keys is pressed
            bool oldPressed = isPressed;

            reset();  // Update the state based on the keyboard

            // Invoke state change events
            if (downEvent != null && isPressed && !oldPressed)
            {
                downEvent.Invoke();
            }
            else
            {
                if (upEvent != null && !isPressed && oldPressed)
                {
                    upEvent.Invoke();
                }
            }
        }
コード例 #5
0
 public void Play()
 {
     OnPress.Invoke();
 }
コード例 #6
0
 public void OnPress(Android.Views.Keycode primaryCode)
 {
     PressEvent?.Invoke(primaryCode);
 }