public override void Update() { if (!Visible) { return; } if (MouseIsIntersecting()) { if (Core.Input.LeftButtonPressed()) { IsPressed = true; } else { if (IsPressed) { Console.WriteLine("yay!"); OnClicked?.Invoke(); } IsPressed = false; } } IsHovered = MouseIsIntersecting(); }
protected override void RenderElements(Rect drawArea) { if (GUILayout.Button(Text, GUILayout.Width(drawArea.width), GUILayout.Height(drawArea.height))) { OnClicked?.Invoke(); } }
public void OnInput() { if (Input.GetKeyDown(KeyCode.LeftArrow)) { OnClicked?.Invoke(EInputState.Left); } else if (Input.GetKeyUp(KeyCode.LeftArrow)) { OnClickedOff?.Invoke(); } else if (Input.GetKeyDown(KeyCode.RightArrow)) { OnClicked?.Invoke(EInputState.Right); } else if (Input.GetKeyUp(KeyCode.RightArrow)) { OnClickedOff?.Invoke(); } else if (Input.GetKeyDown(KeyCode.DownArrow)) { OnClicked?.Invoke(EInputState.Down); } else if (Input.GetKeyUp(KeyCode.DownArrow)) { OnClickedOff?.Invoke(); } }
public void ActivateClick() { if (OnClicked != null) { OnClicked.Invoke(); } }
private void Update() { transform.position = Vector3.Lerp(transform.position, player.transform.position + new Vector3(0, 5, -15), 5f * Time.deltaTime); if (deScore == 0 || (5 - level - Score) <= 0) { if ((5 - level - Score) <= 0) { scoreText.text = "Level Complete!"; } else { scoreText.text = "You failed!"; } } else { scoreText.text = "Soldiers Needed: " + (5 - level - Score); } if (GameStatus && (Input.touchCount >= 1)) { GameObject.Find("Button").SetActive(false); player.GetComponent <Animator>().Play("Sword Sprint"); OnClicked?.Invoke(); GameStatus = false; } }
private void HandleInput() { if (Input.GetMouseButtonDown(0)) { isGrappling = true; } if (Input.GetMouseButton(0)) { if (isGrappling) { isGrappling = false; var clickResult = OnClicked?.Invoke(player.transform.position); if (clickResult.HasValue) { var joint = clickResult.Value.Item1; joint.connectedBody = player; OnAttach?.Invoke(joint.transform.position); TravelAmount = clickResult.Value.Item2 + 1; OnScore?.Invoke(TravelAmount); } } } if (Input.GetMouseButtonUp(0)) { OnRelease?.Invoke(); } }
protected override void OnLayoutDraw() { if (GUILayout.Button(Label, Style, LayoutOptions)) { OnClicked?.Invoke(); } }
private void ChatItem_Click(object sender, EventArgs e) { if (getClicked != null) { getClicked.Invoke(this, e); } }
public void Awake() { Button.onClick.AddListener(() => { OnClicked?.Invoke(this); }); }
public UINewspaperItemButton() { BaseButton = new UINineSliceButton(); BaseButton.SetNineSlice(15, 15, 15, 15); BaseButton.Width = 180; BaseButton.Height = 48; BaseButton.OnButtonClick += (btn) => OnClicked?.Invoke(btn); Add(BaseButton); Title = new UILabel(); Title.CaptionStyle = Title.CaptionStyle.Clone(); Title.CaptionStyle.Size = 12; Title.CaptionStyle.Color = Color.White; Title.Alignment = TextAlignment.Left | TextAlignment.Top; Title.Position = new Vector2(7, -1); Add(Title); Body = new UITextEdit(); Body.TextStyle = Body.TextStyle.Clone(); Body.TextStyle.Size = 9; Body.TextStyle.LineHeightModifier = -5; Body.SetSize(167, 32); Body.Mode = UITextEditMode.ReadOnly; Body.Position = new Vector2(7, 15); Body.RemoveMouseEvent(); Add(Body); }
public override void onUpdate() { //only handle the update if the button is enabled and the parent screen is visible if (screenVisible && render) { //hovering logic if (isMouseHovering() && selectable && enabled) { Parent.FocusedComponent = this; if (isHovered == false) { isHovered = true; if (OnHover != null) { OnHover.Invoke(this, null); } } if (InputManager.IsPressed("gui.click")) { if (isClicked == false) { isClicked = true; } } if (InputManager.Released("gui.click")) { if (isClicked && Parent.FocusedComponent != null && Parent.FocusedComponent == this) { isClicked = false; if (OnClicked != null) { OnClicked.Invoke(this, null); } } } } //unhover logic else { if (isHovered) { isHovered = false; } if (!InputManager.IsPressed("gui.click")) { if (isClicked == true) { isClicked = false; if (OnReleased != null) { OnReleased.Invoke(this, null); } } } } } }
public void Clicked() { if (OnClicked != null) { OnClicked.Invoke(); } }
protected override void OnUpdate(float dt) { var hover = TestMouse(); if (hover != m_hover) { m_hover = hover; if (hover) { PlayHighlightSound(); } } if (CheckPressed()) { if (Screen.InputMethod == InputMethod.Mouse) { PlaySelectSound(); } if (OnClicked != null) { OnClicked.Invoke(this, EventArgs.Empty); } } if (ShowShortcutPrompt) { UpdatePromptText(); } m_frame++; }
public override void clicked(TaskPositioner positioner) { if (OnClicked != null) { OnClicked.Invoke(this); } }
public override void Update(GameTime gameTime) { _previousMouse = _currentMouse; _currentMouse = Mouse.GetState(); var mouseRectangle = new Rectangle(_currentMouse.X, _currentMouse.Y, 1, 1); var previousMouseRectangle = new Rectangle(_previousMouse.X, _previousMouse.Y, 1, 1); _isHovering = false; _isClicked = false; // If the mouse clicks while it is hovering over the button, this code is executed if (mouseRectangle.Intersects(Rectangle) && previousMouseRectangle.Intersects(Rectangle)) { if (_currentMouse.LeftButton == ButtonState.Pressed && _previousMouse.LeftButton == ButtonState.Released) { _isHovering = false; _isClicked = true; OnClicked?.Invoke(this, new EventArgs()); if (_playSound) { SoundManager.PlayButtonSound(); } } else { _isHovering = true; _isClicked = false; } } }
private void Press(int option) { if (OnClicked != null) { OnClicked.Invoke(this, new TextMenuClickedEventArgs(option)); } }
internal override void Update(UIMouseState mouseState) { if (this.ContainsPoint(mouseState.MouseX, mouseState.MouseY)) { this.Hovered = true; if (mouseState.MouseLeftDown && !this.Active) { this.Active = true; Invalidate(); } else if (!mouseState.MouseLeftDown && this.Active) { this.Active = false; OnClicked?.Invoke(this, EventArgs.Empty); Invalidate(); } } else { if (this.Hovered) { if (this.Active) { this.Active = false; Invalidate(); } this.Hovered = false; } } }
void IPointerClickHandler.OnPointerClick(PointerEventData eventData) { if (!eventData.dragging) { OnClicked?.Invoke(eventData.position); } }
public void ClickedButton() { if (clickFunc != null) { clickFunc.Invoke(); } }
private void FireOnClicked() { if (OnClicked != null) { OnClicked.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Called once claim Button is pressed /// </summary> public void ClaimPressed() { claimButton.OnClicked -= ClaimPressed; visuals.SetActive(false); OnClicked?.Invoke(); }
public virtual void Draw() { if (GUILayout.Button(_ct, GUILayout.Width(50), GUILayout.Height(50))) { OnClicked?.Invoke(); } }
public void invokeClicked() { if (OnClicked != null) { OnClicked.Invoke(this, null); } }
public void RevertCursor(bool revertBase = false) { if (revertBase) { SetBase(0); } OnClicked.Invoke(CursorSpriteList[_baseNumber]); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { var selectedPrediction = predictionList[indexPath.Row]; OnClicked?.Invoke(this, new CellClickedEventArgs { thisPrediction = selectedPrediction }); }
protected virtual void OnMouseDown() { if (GameManager.Instance.State != GameState.Menu) { return; } // Destroy(gameObject); OnClicked?.Invoke(this); }
public override void clicked(TaskPositioner positioner) { if (OnClicked != null) { CurrentTaskPositioner = positioner; OnClicked.Invoke(this); CurrentTaskPositioner = null; } }
public override bool ClickInControl() { _mouseInside = false; if (InputManager.Instance.MouseState.LeftButton == ButtonState.Pressed) { if (_mouseButtonPressed) { return(true); } if (Rect.Contains(InputManager.Instance.GetMousePositionToVector2())) { if (!_isPressed) { _isPressed = true; if (OnPressed != null) { OnPressed(); } } _mouseInside = true; } else { _mouseButtonPressed = true; } } else { _mouseButtonPressed = false; if (_isPressed) { _isPressed = false; if (Rect.Contains(InputManager.Instance.GetMousePositionToVector2())) { double newSubtract = DateTime.Now.Subtract(new DateTime(2010, 1, 1)).TotalMilliseconds; if (Math.Abs(newSubtract - _lastPressed) > 100) { if (OnReleased != null) { OnReleased(); } if (OnClicked != null) { OnClicked.Invoke(); } _lastPressed = newSubtract; } _mouseInside = true; } } else { _isPressed = false; } } return(_mouseInside); }
protected override void OnUpdate(float dt) { base.OnUpdate(dt); UpdateHover(false); if (m_highlight && Screen.Mouse.Buttons[MouseButton.Left].Pressed) { if (m_deleteHover) { if (OnDeleteClicked != null) { OnDeleteClicked.Invoke(this, EventArgs.Empty); } } else if (m_moveLeftHover) { if (OnMoveLeftClicked != null) { OnMoveLeftClicked.Invoke(this, EventArgs.Empty); } } else if (m_moveRightHover) { if (OnMoveRightClicked != null) { OnMoveRightClicked.Invoke(this, EventArgs.Empty); } } else { if (OnClicked != null) { OnClicked.Invoke(this, EventArgs.Empty); } } PlaySelectSound(); } if (m_animTime < ANIM_DURATION) { var oldAnimTime = m_animTime; m_animTime = Math.Min(m_animTime + dt, ANIM_DURATION); if (m_justCompleted && oldAnimTime <= 0.0f && m_animTime > 0.0f) { Screen.Audio.PlaySound("sound/trophy.wav"); } if (m_justUnlocked && oldAnimTime <= 0.5f && m_animTime > 0.5f) { Screen.Audio.PlaySound("sound/unlock.wav"); } if (m_justUnlocked || m_justCompleted) { RequestRebuild(); } } }
protected override void InitFormControls() { base.InitFormControls(); view = GetView <CellViewFrame>(); view.Button.onClick.AddListener(() => OnClicked?.Invoke(this)); initialColor = view.Image.color; }