public override void Update(GameTime gameTime) { if (!Visible || !Game.IsActive) { return; } MouseState curState = Mouse.GetState(); if (m_filterClick.ContainsPoint(curState.X, curState.Y) && curState.LeftButton == ButtonState.Released && PreviousMouseState.LeftButton == ButtonState.Pressed) { m_filter++; if (m_filter == Filter.Max) { m_filter = Filter.All; } m_scrollBar.ScrollToTop(); } base.Update(gameTime); }
public override void Update(GameTime gt) { if ((Dialogs.Count > 0 && Dialogs.Peek() != this) || !Visible || !Game.IsActive) return; rotClickArea = new Rectangle(235 + DrawAreaWithOffset.X, 58 + DrawAreaWithOffset.Y, 99, 123); if (((Mouse.GetState().LeftButton == ButtonState.Released && PreviousMouseState.LeftButton == ButtonState.Pressed) || (Mouse.GetState().RightButton == ButtonState.Released && PreviousMouseState.RightButton == ButtonState.Pressed)) && rotClickArea.ContainsPoint(Mouse.GetState().X, Mouse.GetState().Y)) { charRender.Facing++; } base.Update(gt); }
private bool _getMouseOverActual() { var skinDrawLoc = _getSkinDrawLoc(); var actualDrawAreaRect = new Rectangle((int)skinDrawLoc.X, (int)skinDrawLoc.Y, m_skinSourceRect.Width, m_skinSourceRect.Height); bool mouseOverActual = actualDrawAreaRect.ContainsPoint(Mouse.GetState().X, Mouse.GetState().Y); return mouseOverActual; }
public override void Update(GameTime gameTime) { if (!Visible || !EOGame.Instance.IsActive) return; MouseState mouseState = Mouse.GetState(); //this is our own button press handler if (MouseOver && mouseState.LeftButton == ButtonState.Released && PreviousMouseState.LeftButton == ButtonState.Pressed) { if (!Selected) { ((EOChatRenderer)parent).SetSelectedTab(WhichTab); } //logic for handling the close button (not actually a button, was I high when I made this...?) if ((WhichTab == ChatTabs.Private1 || WhichTab == ChatTabs.Private2) && closeRect != null) { Rectangle withOffset = new Rectangle(DrawAreaWithOffset.X + closeRect.Value.X, DrawAreaWithOffset.Y + closeRect.Value.Y, closeRect.Value.Width, closeRect.Value.Height); if (withOffset.ContainsPoint(Mouse.GetState().X, Mouse.GetState().Y)) { ClosePrivateChat(); } } } else if (Selected && mouseState.RightButton == ButtonState.Released && PreviousMouseState.RightButton == ButtonState.Pressed && WhichTab != ChatTabs.None) { XNAControl tmpParent = parent.GetParent(); //get the panel containing this tab, the parent is the chatRenderer if (tmpParent.DrawAreaWithOffset.Contains(mouseState.X, mouseState.Y)) { int adjustedY = mouseState.Y - tmpParent.DrawAreaWithOffset.Y; int level = (int)Math.Round(adjustedY / 13.0) - 1; if (level >= 0 && scrollBar.ScrollOffset + level < chatStrings.Count) { EOGame.Instance.Hud.SetChatText("!" + chatStrings.Keys[scrollBar.ScrollOffset + level].Who + " "); } } } base.Update(gameTime); }