コード例 #1
0
ファイル: Menu.cs プロジェクト: mp1011/Simple2DGame
        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;
        }
コード例 #2
0
ファイル: Shop.cs プロジェクト: mp1011/Simple2DGame
        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
            });
        }