public void AddButton(Button button) { buttonList.Add(button); button.Animations = 4; button.Frames = 25; button.EventListener = this; }
public MainMenu(Game1 game, ContentManager content, string background) : base(game, content, background) { //load and play the background sound _bgMusic = _content.Load<Song>("Audio/Music/LightBG"); MediaPlayer.IsRepeating = true; MediaPlayer.Play(_bgMusic); MediaPlayer.Volume = 1.0f; AddButton(_button1 = new Button(content, "Buttons/button_play",new Vector2(400,380),1)); _button1.Animations = 3; // AddButton(_button2 = new Button(content, "Buttons/button_score",new Vector2(400,380),1)); // _button2.Animations = 3; // AddButton(_button3 = new Button(content, "Buttons/button_credits",new Vector2(475,380),1)); // _button3.Animations = 3; _menuFrame = new Entity(content, "menu frame"); _menuFrame.Position = new Vector2(400, 300); _menuFrame.Animations = 1; _menuFrame.Frames = 1; _menuLogo = new Entity(content, "menu logo"); _menuLogo.Position = new Vector2(400, 250); _menuLogo.Animations = 1; _menuLogo.Frames = 1; }
/* /// <summary> /// Constructor /// </summary> /// <param name="content"></param> /// <param name="background"></param> public GameScreen(ContentManager content, string background) : base(content, background) { _level = null; }*/ /// <summary> /// Override on event /// </summary> /// <param name="sender"></param> public override void OnEvent(Button sender) { if (sender.PrivateData == 1) { //_level.MainLayer.LoadEntity("sign_howto"); } base.OnEvent(sender); }
public override void OnEvent(Button sender) { if (sender == _button1) { // Game.LoadNextScreen(); // MediaPlayer.Stop(); } base.OnEvent(sender); }
public CreditsScreen(Game1 game, ContentManager content, string background) : base(game, content, background) { _content = content; AddButton(_button1 = new Button(content, "Buttons/button_back", new Vector2(400, 430), 1)); _button1.Animations = 3; _CreditsTitle = new Entity(content, "Credits title"); _CreditsTitle.Position = new Vector2(400, 170); _CreditsTitle.Animations = 1; _CreditsTitle.Frames = 1; _menuFrame = new Entity(content, "menu frame"); _menuFrame.Position = new Vector2(400, 300); _menuFrame.Animations = 1; _menuFrame.Frames = 1; _credits = new Entity(content, "credits"); _credits.Position = new Vector2(400, 300); _credits.Animations = 1; _credits.Frames = 1; }
public virtual void OnEvent(Button sender) { }
/// <summary> /// Load button /// </summary> /// <param name="asset"></param> /// <returns></returns> public Button LoadButton(String asset) { Button ent = new Button(_content, asset, Vector2.Zero, 0); _ents.Add(ent); return ent; }