private void handleClick(bool repeat) { if (Alpha == 0 || LastFrameRendered < GameBase.TotalFramesRendered - 1) { clickHandledAtLeastOnce = true; return; } //Force update of currently hovered sprite. pSprite lastHoverSprite = CurrentHoverSprite; resetHoverSprite(); int count = SpriteList.Count; if (repeat && clickHandledAtLeastOnce) { return; } for (int i = 0; i < count; i++) { CheckHover(SpriteList[i]); } clickHandledAtLeastOnce = true; if (lastHoverSprite != null && lastHoverSprite != CurrentHoverSprite) { lastHoverSprite.Hovering = false; } if (CurrentHoverSprite == null) { return; } if (!HandleInput || ClickHandledSprite != null || !CurrentHoverSprite.HandleInput || !CurrentHoverSprite.IsVisible || MouseManager.MouseMiddle == ButtonState.Pressed) { return; } if (CurrentHoverSprite.Click(false)) { InputManager.LastClickHandled = true; } ClickHandledSprite = CurrentHoverSprite; }
private void GameBase_OnClick(object sender, EventArgs e) { if (!HandleMouseClicks || !MouseHandler.actualClickRegistered || ClickHandled) { return; } if (hoverSprite != null && hoverSprite.IsClickable) { hoverSprite.Click(); ClickHandled = true; if (hoverSprite != null && hoverSprite.CatchUniversal) { UniversalFocusCaught = true; } } }