public void AddOption(TItem option) { bool wasVisible = this.Visible; var newOption = new MenuOption <TItem>(option, this); Options.Add(newOption); SelectedOption = new CyclingInteger(Options.Count); MenuPanel.AddItem(newOption); this.Visible = wasVisible; }
public ShopMenu(QuickGameScene scene) : base(scene.InterfaceLayer, Fonts.SmallFont, GameTiles.Border(), Input.GetInput(scene), new MenuKeys { Select = GameKeys.MenuOK, Cancel = GameKeys.Start }) { MenuPanel.AddItem(new GameText(Fonts.SmallFont, "WELCOME!", scene.InterfaceLayer)); MenuPanel.AddItem(new DynamicText <King>(scene.Player, p => "COINS: " + p.Coins, Fonts.SmallFont, scene.InterfaceLayer)); AddOption(new ExtraHeartShopItem() { Player = scene.Player, MenuPanel = MenuPanel }); AddOption(new BetterAttackShopItem() { Player = scene.Player, MenuPanel = MenuPanel }); AddOption(new ExitShopOption() { Player = scene.Player, MenuPanel = MenuPanel }); }