Пример #1
0
        public StartScene(Game game, SpriteFont smallFont, SpriteFont largeFont, Texture2D background, Texture2D elements)
            : base(game)
        {
            this.elements = elements;
            Components.Add(new ImageComponent(game, background, ImageComponent.DrawMode.Center));

            string[] items = {"One Player", "Two Players", "Help", "Credits", "Quit"};
            menu = new TextMenuComponent(game, smallFont, largeFont);
            menu.SetMenuItems(items);
            Components.Add(menu);

            spriteBatch = (SpriteBatch) Game.Services.GetService(typeof (SpriteBatch));
            audio = (AudioLibrary) Game.Services.GetService(typeof (AudioLibrary));
        }
        public StartScene(Game game, SpriteFont smallFont, SpriteFont largeFont, Texture2D background, Texture2D elements)
            : base(game)
        {
            this._elements = elements;
            Components.Add(new ImageComponent(game, background, ImageComponent.DrawMode.Center));

            string[] items = Enum.GetValues(typeof(MenuItems)).Cast<MenuItems>().Select(s => s.GetDisplayOrName()).ToArray();
            this._menu = new TextMenuComponent(game, smallFont, largeFont);
            this._menu.SetMenuItems(items);
            Components.Add(this._menu);

            this._spriteBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
            this._audio = (AudioLibrary)Game.Services.GetService(typeof(AudioLibrary));
        }