public override void receiveLeftClick(int x, int y, bool playSound = true) { if (this.isWithinBounds(x, y)) { foreach (ClickableComponent monster in Pages[currentPage]) { if (monster.GetType() == typeof(MultiClickableMonsterComponent)) { MultiClickableMonsterComponent m = (MultiClickableMonsterComponent)monster; m.ReceiveLeftClick(x, y); } else if (monster.containsPoint(x, y)) { ClickableMonsterComponent m = (ClickableMonsterComponent)monster; Game1.activeClickableMenu = new MonsterPlaceMenu(monster.name, null, m.sprite); } } base.receiveLeftClick(x, y, true); } else if (leftArrow.containsPoint(x, y)) { currentPage = currentPage - 1 < 0 ? Pages.Count - 1 : currentPage - 1; Game1.playSound("smallSelect"); } else if (rightArrow.containsPoint(x, y)) { currentPage = currentPage + 1 == Pages.Count ? 0 : currentPage + 1; Game1.playSound("smallSelect"); } else { Game1.exitActiveMenu(); } }
public override void draw(SpriteBatch b) { b.Draw(Game1.fadeToBlackRect, destinationRectangle: Game1.graphics.GraphicsDevice.Viewport.Bounds, color: Color.Black * 0.4f); Game1.drawDialogueBox(base.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true, (string)null, false, false); Game1.drawDialogueBox(this.xPositionOnScreen - 300, this.yPositionOnScreen, 300, this.height / 2, false, true, (string)null, false, false); b.DrawString(Game1.dialogueFont, "Select a\nmonster\nto spawn", new Vector2(xPositionOnScreen - 240, yPositionOnScreen + 110), Color.Black); foreach (ClickableComponent c in Pages[currentPage]) { if (c.GetType() == typeof(MultiClickableMonsterComponent)) { MultiClickableMonsterComponent m = (MultiClickableMonsterComponent)c; m.Draw(b); } else { ClickableMonsterComponent m = (ClickableMonsterComponent)c; m.Draw(b); } } leftArrow.draw(b); rightArrow.draw(b); b.DrawString(Game1.dialogueFont, $"{currentPage + 1}/{Pages.Count}", new Vector2(this.xPositionOnScreen + (float)((this.width / 3) * 1.5), this.yPositionOnScreen + this.height), Color.White); this.drawMouse(b); base.draw(b); }
public override void performHoverAction(int x, int y) { base.performHoverAction(x, y); foreach (ClickableComponent monster in Pages[currentPage]) { if (monster.GetType() == typeof(ClickableMonsterComponent)) { ClickableMonsterComponent m = (ClickableMonsterComponent)monster; m.PerformHoverAction(x, y); } else { MultiClickableMonsterComponent m = (MultiClickableMonsterComponent)monster; m.PerformHoverAction(x, y); } } }