private void Update() { if (_Pressed) { OnPress?.Invoke(); } }
public void HandleAction(ActionType action) { if (action == ActionType.Activate) { OnPress?.Invoke(); } }
private void Update() { if (IsTripleTouch) { OnTripleTouch?.Invoke(); return; } if (StaticUtilities.IsPointerOverUIObject()) { return; } var inputPosition = Input.mousePosition; if (IsPressed) { OnPress?.Invoke(inputPosition); } if (IsDrag) { OnDrag?.Invoke(inputPosition); } if (IsReleased) { OnRelease?.Invoke(); } }
protected virtual void Update() { Touch[] touches = UnityEngine.Input.touches; if (touches.Length <= _index) { return; } Touch touch = touches[_index]; if (touch.phase == TouchPhase.Began) { _currentTouchID = touch.fingerId; OnDown?.Invoke(createArg(ButtonState.Down)); } else if (touch.phase == TouchPhase.Canceled || touch.phase == TouchPhase.Ended) { _currentTouchID = int.MinValue; OnReleased?.Invoke(createArg(ButtonState.Released)); } else if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Stationary) { if (_currentTouchID != touch.fingerId) { throw new ArgumentException("The touch iD change before entering Canceled or Ended state!"); } OnPress?.Invoke(createArg(ButtonState.Pressed)); } }
public override void Init() { GetButton(ModifierButton).OnRelease += () => { if (Blocked || !Pressed) { return; } Pressed = false; OnRelease?.Invoke(); }; GetButton(Button).OnPress += () => { if (Blocked || !GetButton(ModifierButton).isActive) { return; } Pressed = true; OnPress?.Invoke(); }; GetButton(Button).OnRelease += () => { if (Blocked || !Pressed) { return; } if (!GetButton(ModifierButton).isActive) { return; } Pressed = false; OnRelease?.Invoke(); }; }
private void Press(object sender, MoveEventArgs e) { Pushed = true; OnPress?.Invoke(this, Color); GateBehavior.SendMessage(GateBehavior.GateMsg.Open, Color); pressingButton = sender; }
// c'tor public ModalDisplay(OnPress OnContinue, OnPress OnBack, OnPress OnExitTutorial) { this.OnContinue = OnContinue; this.OnBack = OnBack; this.OnExitTutorial = OnExitTutorial; // We're rendering the text into a 1024x768 rt and then composing that with // the background elements into another 1024x768 rt. This is then scaled // and rendered onto the backbuffer. camera = new PerspectiveUICamera(); camera.Resolution = new Point(1024, 768); { GetTexture getTexture = delegate() { return(ButtonTextures.AButton); }; continueButton = new Button(Strings.Localize("tutorial.continue"), Color.White, getTexture, UI2D.Shared.GetGameFont20); } { GetTexture getTexture = delegate() { return(ButtonTextures.BButton); }; backButton = new Button(Strings.Localize("tutorial.back"), Color.White, getTexture, UI2D.Shared.GetGameFont20); } { GetTexture getTexture = delegate() { return(ButtonTextures.XButton); }; exitTutorialButton = new Button(Strings.Localize("tutorial.exitTutorial"), Color.White, getTexture, UI2D.Shared.GetGameFont20); } } // end of c'tor
// Start is called before the first frame update void Start() { button.onClick.AddListener(() => { OnPress?.Invoke(ItemInfo); }); }
internal static void Init() { PreUpdate(); LastPosition = Position; App.platform.OnMouseButtonDown += id => { down[id] = true; pressed[id] = true; OnPress?.Invoke((MouseButton)id); }; App.platform.OnMouseButtonUp += id => { down[id] = false; released[id] = true; OnRelease?.Invoke((MouseButton)id); }; App.platform.OnMouseScroll += (x, y) => { Scroll += new Point2((int)(x / Screen.PixelSize), (int)(y / Screen.PixelSize)); OnScroll?.Invoke(); }; }
public void Update(RenderWindow window) { bool pressed = Mouse.IsButtonPressed(Mouse.Button.Left); Vector2f mousePos = new Vector2f(Mouse.GetPosition(window).X, Mouse.GetPosition(window).Y); mousePos -= window.GetView().Size * 0.5f - window.GetView().Center; Vector2f delta = mousePos - _background.Position; if (Math.Abs(delta.X) < _background.Size.X * 0.5f && Math.Abs(delta.Y) < _background.Size.Y * 0.5f) { // Hover _background.FillColor = pressed ? _pressColor : _hoverColor; if (!pressed && _lastFramePressed) { OnPress?.Invoke(this, EventArgs.Empty); } } else { _background.FillColor = _defaultColor; } _lastFramePressed = pressed; }
public virtual void Init() { var otherButtons = BUTTONS.Where(button => button != Button).ToList(); otherButtons.ForEach(button => GetButton(button).OnPress += () => { Pressed = false; }); GetButton(Button).OnPress += () => { if (Blocked) { return; } if (otherButtons.Any(id => GetButton(id).isActive)) { return; } Pressed = true; OnPress?.Invoke(); }; GetButton(Button).OnRelease += () => { if (Blocked || !Pressed) { return; } if (otherButtons.Any(id => GetButton(id).isActive)) { return; } Pressed = false; OnRelease?.Invoke(); }; }
public override void MouseUp(NSEvent theEvent) { CGPoint p = theEvent.LocationInWindow; ClickArgs.Position = new SKPointI((int)p.X, (int)View.Frame.Height - (int)p.Y); OnPress?.Invoke(this, ClickArgs); }
public void OnPointerDown(PointerEventData eventData) { Knob.OnDragBegin(eventData.position); _pressPosition = eventData.position; _moveDirection = Vector2.zero; Knob.gameObject.SetActive(true); OnPress?.Invoke(); }
public void OnPointerDown(PointerEventData eventData) { offsetPosition = eventData.position - (Vector2)rectTransform.position; targetPosition = eventData.position - offsetPosition; OnPress.Invoke(); IsPressing = true; }
public void OnPointerClick(PointerEventData pointerEventData) { if (model.messageType != ChatMessage.Type.PRIVATE) { return; } OnPress?.Invoke(model.otherUserId); }
public override void Use() { OnPress.Invoke(); if (pressedSprite) { StartCoroutine("VisualizeUse"); } }
public void OnPointerDown(PointerEventData eventData) { if (!myButton.interactable) { return; } myButton.image.sprite = pressedSprite; OnPress?.Invoke(); }
public void KeyUp(int vCode, Keys key) { if (KeysDown.ContainsKey(vCode)) { KeysDown[vCode].To = DateTime.UtcNow; var pressed = KeysDown.ToList(); KeysDown.Remove(vCode); OnPress?.Invoke(pressed.Select(p => p.Key).ToList(), pressed.Select(p => p.Value).ToList()); } }
public void Init() { CaveInputBinding.Flystick(Instance).GetButton(Button).OnPress += () => { Pressed = true; OnPress?.Invoke(); }; CaveInputBinding.Flystick(Instance).GetButton(Button).OnRelease += () => { Pressed = false; OnRelease?.Invoke(); }; }
private bool Press(int touchId, Vector2 position) { if (!Pressed && (CheckHit == null || CheckHit(position))) { Pressed = true; TouchId = touchId; OnPress?.Invoke(position); return(true); } return(false); }
private void _buttonPin_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e) { if (e.Edge == GpioPinEdge.FallingEdge) { OnPress?.Invoke(sender, e); } else { OnRelease?.Invoke(sender, e); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("playerShadow")) { _audioSource.clip = AudioList.Instance.button; _audioSource.Play(); _animator.SetBool("Active", true); _boxCollider.enabled = false; OnPress.Invoke(_id); } }
public override void OnPointerDown(PointerEventData eventData) { if (joystickType != JoystickType.Fixed) { background.anchoredPosition = ScreenPointToAnchoredPosition(eventData.position); background.gameObject.SetActive(true); } OnPress?.Invoke(eventData); base.OnPointerDown(eventData); }
public void CheckForInput() { if (ButtonType == ButtonType.Mouse ? Input.GetMouseButtonDown((int)MouseButton) : Input.GetKeyDown(KeyboardButton)) { Pressed = true; OnPress?.Invoke(); } if (ButtonType == ButtonType.Mouse ? Input.GetMouseButtonUp((int)MouseButton) : Input.GetKeyUp(KeyboardButton)) { Pressed = false; OnRelease?.Invoke(); } }
public _BackdropTitle( Key key = null, Animation <float> listenable = null, OnPress onPress = null, Widget frontTitle = null, Widget backTitle = null ) : base(key: key, listenable: listenable) { D.assert(frontTitle != null); D.assert(backTitle != null); this.backTitle = backTitle; this.frontTitle = frontTitle; this.onPress = onPress; }
private void Window_MouseButtonPressed(object sender, MouseButtonEventArgs e) { if (e.Button != Mouse.Button.Left) { return; } if (MouseInBounds() && Program.WindowFocused) { if (OnPress != null) { OnPress.Invoke(); } } }
private void HandleKeyReleasedHookEvent(KeyboardHookEventArgs args) { OnHook?.Invoke(args); lock (downKeys) { bool removed = downKeys.Remove(args.KeyCode); OnRelease?.Invoke(args); if (removed) { OnPress?.Invoke(args); } } }
protected virtual void Update() { if (UnityEngine.Input.GetKeyDown(_key)) { OnDown?.Invoke(createArg(ButtonState.Down)); } else if (UnityEngine.Input.GetKey(_key)) { _stateDuration += Time.deltaTime; OnPress?.Invoke(createArg(ButtonState.Pressed)); } else if (UnityEngine.Input.GetKeyUp(_key)) { _stateDuration += Time.deltaTime; OnReleased?.Invoke(createArg(ButtonState.Released)); _stateDuration = 0; } }
public void StopUsing() { if (_isHovered) { this.Hover(); } else { this.Default(); } if (debugMode) { Debug.Log("Slider value: " + this.Value); } OnPress.Invoke(); }
public static void UpdateMouse(GameTime gameTime, MouseState mState) { if (currentCamera == null) { currentCamera = Repository.GetSelectedCamera(); } if (mState.LeftButton == ButtonState.Pressed) { // Taking into account the camera position since it is causing issues when the camera is moved. var currentMousePosition = mState.Position.ToVector2() + currentCamera.Transform.Position; var delta = Vector2.Zero; if (!LastMouseClick.Equals(Vector2.Zero)) { delta = currentMousePosition - LastMouseClick; } if (!Pressed) { OnPress?.Invoke(new PointerEventDataArgs(currentMousePosition, delta)); Pressed = true; } LastMouseClick = currentMousePosition; if (delta != Vector2.Zero) { OnDrag?.Invoke(new PointerEventDataArgs(currentMousePosition, delta)); } if (LastMouseClick.Equals(Vector2.Zero)) { LastMouseClick = currentMousePosition; } } else if (Pressed) { OnRelease?.Invoke(new PointerEventDataArgs(LastMouseClick, Vector2.Zero)); Pressed = false; LastMouseClick = Vector2.Zero; } }