public override void performHoverAction(int x, int y) { base.performHoverAction(x, y); this.hoverBox = null; foreach (var content in this.events.Zip(this.dims.SectionBoxes(), Tuple.Create)) { EconEvent e = content.Item1; Rectangle rect = content.Item2; if (rect.Contains(x, y)) { if (e.AffectedItem > -1) { this.hoverBox = new EconEventHoverBox(e); } break; } } }
/** * <summary>Creates a new News Bulletin to show the given events.</summary> * <remarks> * This constructor will tell the game to play sound - it's expected * that it is called once per opening of this menu at the time the user * requests to open it. * </remarks> * * <param name="events">The events to show.</param> */ public NewsBulletinMenu(IEnumerable <EconEvent> events) : base(x: 0, y: 0, width: 0, height: 0, showUpperRightCloseButton: true) { this.events = new List <EconEvent>(events); this.hoverBox = null; this.dims = new MenuDimensions(this.events.Count, Game1.pixelZoom); var outerBox = this.dims.OuterBox(); this.width = outerBox.Width; this.height = outerBox.Height; this.xPositionOnScreen = outerBox.X; this.yPositionOnScreen = outerBox.Y; // Reinitialize close button: this.initializeUpperRightCloseButton(); // Play sound! Game1.playSound("bigSelect"); }