Ejemplo n.º 1
0
        public override void InitUI()
        {
            game.background = StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Background_Black", 1.0f);

            // title
            if (game.GameTitle == null)
            {
                game.GameTitle = StaticSprite.CreateSprite(303, 39, game.ScreenScaleFactor, @"Sprite/GameUI/Black_Logo", 0.9f);
            }

            // panel
            if (game.Panel == null)
            {
                game.Panel = StaticSprite.CreateSprite(255, 356, game.ScreenScaleFactor, @"Sprite/GameUI/Black_Panel", 0.8f);
            }

            if (game.TextBoxName == null)
            {
                game.TextBoxName = TextBox.CreateTextBox(445, 380, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextBox", 0.7f);
                game.TextBoxName.InitTextBox();
                game.TextBoxName.SetFont("Black_SegoeWP");
                game.TextBoxName.SetColor(Color.WhiteSmoke);
                TextBoxStyle.Assign(game.TextBoxName);
            }

            if (game.TextBoxRoom == null)
            {
                game.TextBoxRoom = TextBox.CreateTextBox(445, 433, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextBox", 0.7f);
                game.TextBoxRoom.InitTextBox();
                game.TextBoxRoom.SetFont("Black_SegoeWP");
                game.TextBoxRoom.SetColor(Color.WhiteSmoke);
                TextBoxStyle.Assign(game.TextBoxRoom);
            }

            if (game.TextPlayerName == null)
            {
                game.TextPlayerName = StaticSprite.CreateSprite(295, 384, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextPlayerName", 0.7f);
            }

            if (game.TextRoomID == null)
            {
                game.TextRoomID = StaticSprite.CreateSprite(295, 437, game.ScreenScaleFactor, @"Sprite/GameUI/Black_TextRoomID", 0.7f);
            }

            // btn play
            if (game.btnPlaySingle == null)
            {
                game.btnPlaySingle = StaticSprite.CreateSprite(394, 610, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f);
                game.btnPlaySingle.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnSinglePlay", 0.7f));
                game.btnPlaySingle.OnMouseUp += (sender) =>
                {
                    TransitionToGame(StartGameSingle);
                };

                ModernButtonStyle.Assign(game.btnPlaySingle);
            }

            if (game.btnPlayMulti == null)
            {
                game.btnPlayMulti = StaticSprite.CreateSprite(394, 554, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f);
                game.btnPlayMulti.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnMultiPlay", 0.7f));
                game.btnPlayMulti.OnMouseUp += (sender) => {
                    if (String.IsNullOrEmpty(game.TextBoxName.GetText()))
                    {
                        return;
                    }
                    if (String.IsNullOrEmpty(game.TextBoxRoom.GetText()))
                    {
                        return;
                    }
                    TransitionToGame(StartGameMultiplayer);
                };

                ModernButtonStyle.Assign(game.btnPlayMulti);
            }

            if (game.btnSetting == null)
            {
                game.btnSetting = StaticSprite.CreateSprite(394, 666, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f);
                game.btnSetting.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnSetting", 0.7f));

                ModernButtonStyle.Assign(game.btnSetting);
            }

            // small top icons
            if (game.btnShop == null)
            {
                game.btnShop = StaticSprite.CreateSprite(882, 24, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnShop", 0.9f);
                ButtonStyle.Assign(game.btnShop);
            }

            // small top icons
            if (game.btnSound == null)
            {
                game.btnSound = StaticSprite.CreateSprite(934, 24, game.ScreenScaleFactor, @"Sprite/GameUI/Black_audioOn", 0.9f);
                ButtonStyle.Assign(game.btnSound);
            }

            if (game.scoreBoard == null)
            {
                var Red  = StaticSprite.CreateSprite(0, 30, game.ScreenScaleFactor, @"Sprite/GameUI/Player1", 0.6f);
                var Blue = StaticSprite.CreateSprite(0, 110, game.ScreenScaleFactor, @"Sprite/GameUI/Player2", 0.6f);
                game.scoreBoard      = new Scoreboard(Red, Blue, game.ScreenScaleFactor);
                game.scoreBoard.Top  = 320 * game.ScreenScaleFactor.Y;
                game.scoreBoard.Left = 90 * game.ScreenScaleFactor.X;
            }


            //if (game.btnHelp == null)
            //{
            //    game.btnHelp = StaticSprite.CreateSprite(860, 22, game.ScreenScaleFactor, @"Sprite/GameUI/btnHelp", 0.9f);
            //    ButtonStyle.Assign(game.btnHelp);
            //}


            if (game.btnExit == null)
            {
                game.btnExit = StaticSprite.CreateSprite(39, 670 + 300, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnRound", 0.8f);
                game.btnExit.AddChildAtMid(StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Black_btnExit", 0.7f));

                game.btnExit.OnMouseUp += TransitionToMenu;
                ModernButtonStyle.Assign(game.btnExit);
            }

            base.InitUI();
        }
Ejemplo n.º 2
0
        public override void InitUI()
        {
            game.background = StaticSprite.CreateSprite(0, 0, game.ScreenScaleFactor, @"Sprite/GameUI/Background", 1.0f);
            // title
            if (game.GameTitle == null)
            {
                game.GameTitle = StaticSprite.CreateSprite(200, 182, game.ScreenScaleFactor, @"Sprite/GameUI/Title", 0.9f);
            }

            // panel
            if (game.Panel == null)
            {
                game.Panel = StaticSprite.CreateSprite(215, 315, game.ScreenScaleFactor, @"Sprite/GameUI/Panel", 0.8f);
            }

            if (game.TextBoxName == null)
            {
                game.TextBoxName = TextBox.CreateTextBox(454, 350, game.ScreenScaleFactor, @"Sprite/GameUI/TextBox", 0.7f);
                game.TextBoxName.InitTextBox();
                game.TextBoxName.SetFont("SegoeWP");
                TextBoxStyle.Assign(game.TextBoxName);
            }

            if (game.TextBoxRoom == null)
            {
                game.TextBoxRoom = TextBox.CreateTextBox(454, 420, game.ScreenScaleFactor, @"Sprite/GameUI/TextBox", 0.7f);
                game.TextBoxRoom.InitTextBox();
                game.TextBoxRoom.SetFont("SegoeWP");
                TextBoxStyle.Assign(game.TextBoxRoom);
            }

            if (game.TextPlayerName == null)
            {
                game.TextPlayerName = StaticSprite.CreateSprite(273, 360, game.ScreenScaleFactor, @"Sprite/GameUI/TextPlayerName", 0.7f);
            }

            if (game.TextRoomID == null)
            {
                game.TextRoomID = StaticSprite.CreateSprite(273, 430, game.ScreenScaleFactor, @"Sprite/GameUI/TextRoomID", 0.7f);
            }

            // btn play
            if (game.btnPlaySingle == null)
            {
                game.btnPlaySingle = StaticSprite.CreateSprite(440, 538, game.ScreenScaleFactor, @"Sprite/GameUI/btnPlay", 0.8f);

                game.btnPlaySingle.OnMouseUp += TransitionToGame;

                ButtonStyle.Assign(game.btnPlaySingle);
            }

            // small top icons
            if (game.btnShop == null)
            {
                game.btnShop = StaticSprite.CreateSprite(700, 22, game.ScreenScaleFactor, @"Sprite/GameUI/btnShop", 0.9f);
                ButtonStyle.Assign(game.btnShop);
            }

            if (game.btnSetting == null)
            {
                game.btnSetting = StaticSprite.CreateSprite(780, 22, game.ScreenScaleFactor, @"Sprite/GameUI/btnSetting", 0.9f);
                ButtonStyle.Assign(game.btnSetting);
            }

            if (game.btnHelp == null)
            {
                game.btnHelp = StaticSprite.CreateSprite(860, 22, game.ScreenScaleFactor, @"Sprite/GameUI/btnHelp", 0.9f);
                ButtonStyle.Assign(game.btnHelp);
            }

            if (game.btnExit == null)
            {
                game.btnExit = StaticSprite.CreateSprite(940, 22, game.ScreenScaleFactor, @"Sprite/GameUI/btnExit", 0.9f);
                ButtonStyle.Assign(game.btnExit);
                game.btnExit.OnMouseUp += TransitionToMenu;
            }

            base.InitUI();
        }