Example #1
0
 public void AddButton(Button button)
 {
     buttonList.Add(button);
     button.Animations = 4;
     button.Frames = 25;
     button.EventListener = this;
 }
Example #2
0
        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;
        }
Example #3
0
        /*  /// <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);
        }
Example #4
0
        public override void OnEvent(Button sender)
        {
            if (sender == _button1)
            {
               // Game.LoadNextScreen();
                // MediaPlayer.Stop();
            }

            base.OnEvent(sender);
        }
Example #5
0
        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;
        }
Example #6
0
 public virtual void OnEvent(Button sender)
 {
 }
Example #7
0
 /// <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;
 }