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; } } }
public void Awake() { Button.onClick.AddListener(() => { OnClicked?.Invoke(this); }); }
public override void clicked(TaskPositioner positioner) { if (OnClicked != null) { OnClicked.Invoke(this); } }
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 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 FireOnClicked() { if (OnClicked != null) { OnClicked.Invoke(this, EventArgs.Empty); } }
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); }
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 Constructor(GameStateSlot prototype, string id, GameStateMap state = null, OnClicked onClicked = null, OnDeleteClicked onDeleteClicked = null) : base(prototype, id, onClicked) { ConstructedSlot.State = state; ConstructedSlot.onDeleteClickedAction = onDeleteClicked; }
private void Press(int option) { if (OnClicked != null) { OnClicked.Invoke(this, new TextMenuClickedEventArgs(option)); } }
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; } } }
/// <summary> /// Called once claim Button is pressed /// </summary> public void ClaimPressed() { claimButton.OnClicked -= ClaimPressed; visuals.SetActive(false); OnClicked?.Invoke(); }
/// <summary> /// If you use this constructor, this tab control will possibly remove/add cards from that dictionary as it is only passing in a reference. /// This will happen if you have set up click events to move cards to places like in an editing screen. /// Just be careful that this dictionary is being passed as a REFERENCE. /// </summary> /// <param name="cardData"></param> /// <param name="size"></param> /// <param name="localPosition"></param> /// <param name="textureAsset"></param> public CardTypesTabControl(Dictionary <string, Dictionary <string, CardData> > cardData, Vector2 tabsTotalSize, Vector2 cardPagesSize, Vector2 localPosition, OnClicked cardOnLeftClicked = null, string textureAsset = AssetManager.DefaultEmptyTextureAsset) : base(tabsTotalSize, localPosition, textureAsset) { CardData = cardData; CardGridControlSize = cardPagesSize; CardOnLeftClicked = cardOnLeftClicked; }
public void invokeClicked() { if (OnClicked != null) { OnClicked.Invoke(this, null); } }
public void Clicked() { if (OnClicked != null) { OnClicked.Invoke(); } }
void IPointerClickHandler.OnPointerClick(PointerEventData eventData) { if (!eventData.dragging) { OnClicked?.Invoke(eventData.position); } }
public virtual void Draw() { if (GUILayout.Button(_ct, GUILayout.Width(50), GUILayout.Height(50))) { OnClicked?.Invoke(); } }
public LocationMessageItem(float timeToDisplay, string text, Vector3 location, OnClicked callbackOnClicked) : base(timeToDisplay) { this.text = text; this.location = location; this.OnClickedAction += callbackOnClicked; }
public static void Main(string[] args) { OnClicked clicked = new OnClicked(Func); clicked += Func; ButtonPressed(clicked); }
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 ToolbarClickListener(Android.Support.V4.Widget.DrawerLayout layout, Toolbar toolbar, OnClicked callback) { _layout = layout; _toolbar = toolbar; _callback = callback; MustGoBack = false; Enabled = false; }