Exemple #1
0
        public MainMenu(ContentManager content)
        {
            _bigFont    = content.Load <SpriteFont>("BigFont");
            _normalFont = content.Load <SpriteFont>("NormalFont");

            _logoTexture = content.Load <Texture2D>("logo");

            _btnTexLeft  = content.Load <Texture2D>("ButtonLeft");
            _btnTexMid   = content.Load <Texture2D>("ButtonMid");
            _btnTexRight = content.Load <Texture2D>("ButtonRight");

            _txtTexLeft  = content.Load <Texture2D>("TextboxLeft");
            _txtTexMid   = content.Load <Texture2D>("TextboxMid");
            _txtTexRight = content.Load <Texture2D>("TextboxRight");

            _logo = new Sprite(_logoTexture);

            _mainMenuBackground = new Background(content.Load <Texture2D>("background"));

            _play = new Button(_btnTexLeft, _btnTexMid, _btnTexRight, 40, "Connect", _bigFont);
            _exit = new Button(_btnTexLeft, _btnTexMid, _btnTexRight, 40, "Quit Game", _bigFont);

            _userName = new Textbox(_txtTexLeft, _txtTexMid, _txtTexRight, 40, Vector2.Zero, "Username:"******"Password:"******"Server:", _bigFont, _normalFont);

            _userName.SetTextLength(16);
            _password.SetTextLength(64);
            _server.SetTextLength(32);

            var login = MinecraftUtilities.GetLastLogin();

            if (login != null)
            {
                _userName.SetText(login.Username);
                _password.SetText(login.Password);
            }
        }