コード例 #1
0
ファイル: LoginScreen.cs プロジェクト: tjw0051/MGSE-Project
        /// <summary>
        /// Load initial game data and assets once.
        /// </summary>
        public override void LoadContent()
        {
            //TODO: Offload to initialize
            ScreenManager.Game.IsMouseVisible = true;
            spriteBatch = ScreenManager.SpriteBatch;
            content = new ContentManager(ScreenManager.Game.Services, "Content");
            //Load banner Image

            //Load Instruction text (also error text)
            textMessage = new TextBox(message,
                new Vector2(this.ScreenManager.GraphicsDevice.Viewport.Width/2, 290), Color.Black);
            textMessage.LoadContent(spriteBatch, ScreenManager.GraphicsDevice,
                content);
            //Load Input box
            inputBox = new InputBox(new Vector2(390, 390), Color.Orange, 10);
            inputBox.LoadContent(spriteBatch, ScreenManager.GraphicsDevice, content);
            //Load Login Button
            loginButton = new Button("Login", new Vector2(390, 500), Color.Aqua);
            loginButton.LoadContent(spriteBatch, ScreenManager.GraphicsDevice,
                content);
            exitButton = new Button("Exit", new Vector2(510, 500), Color.PaleVioletRed);
            exitButton.LoadContent(spriteBatch, ScreenManager.GraphicsDevice,
                content);
            //Load Exit Button
        }
コード例 #2
0
        /// <summary>
        /// Load initial game data and assets once.
        /// </summary>
        public override void LoadContent()
        {
            //TODO: Offload to initialize
            ScreenManager.Game.IsMouseVisible = true;
            spriteBatch = ScreenManager.SpriteBatch;
            content = new ContentManager(ScreenManager.Game.Services, "Content");
            //Load banner Image

            //Server Name
            int screenWidth = this.ScreenManager.GraphicsDevice.Viewport.Width;
            textMessage = new TextBox("Server: " + Connection.Instance.ServerName,
                new Vector2( screenWidth/ 2 , 100),
                Color.Black);
            textMessage.LoadContent(spriteBatch, ScreenManager.GraphicsDevice,
                content);
            //Player Names
            playerNames = new List<TextBox>();
            playerList = new List<PlayerState>();

            for(int i = 0; i < 10; i++)             //TODO: Get number of players from server;
            {
                playerNames.Add(new TextBox("",
                    new Vector2(screenWidth / 2, 150 + (50* i)),
                    Color.Gray));
                playerNames.ElementAt(i).LoadContent(spriteBatch,
                    ScreenManager.GraphicsDevice, content);
            }
            //Load Login Button
            joinButton = new Button("Join", new Vector2(390, 650), Color.Aqua);
            joinButton.LoadContent(spriteBatch, ScreenManager.GraphicsDevice,
                content);
            exitButton = new Button("Exit", new Vector2(510, 650), Color.PaleVioletRed);
            exitButton.LoadContent(spriteBatch, ScreenManager.GraphicsDevice,
                content);
            //Load Exit Button
        }