Пример #1
0
 /// <summary>
 /// Set up the settings menu
 /// </summary>
 private void SetUpSettings()
 {
     settingsButton = new List<Button>();
     settings = new Sprite { Color = Color.White };
     int settingsX = game.Window.ClientBounds.Width / 2 - 600 / 2;
     int settingsY = game.Window.ClientBounds.Height / 2 - 468 / 2;
     settings.Position = new Vector2(settingsX, settingsY);
     int cancelX = settingsX + 425;
     int cancelY = settingsY + 400;
     cancel = new Button("cancel", cancelX, cancelY);
     settingsButton.Add(cancel);
     int applyX = settingsX + 40;
     int applyY = settingsY + 400;
     apply = new Button("apply", applyX, applyY);
     settingsButton.Add(apply);
     var rect = new Rectangle(settingsX + (600-325), settingsY + 100, 250, 75);
     playername = new Textbox(rect, "playername") { Text = this.game.PlayerName };
     playername.MoveText(45);
     playerNamePos = new Vector2(settingsX+100, settingsY + 125);
     var volumeRect = new Rectangle(settingsX + (600 - 325) + 100, settingsY + 185, 100, 50);
     var a = (int)(game.MusicVolume * 100);
     volume = new Numberbox(volumeRect, "volumebox", 3) { Number = a, Limit = 100 };
     volume.Text = volume.Number.ToString();
     volumePos = new Vector2(settingsX + 100, settingsY + 200);
     scoreboardPos = new Vector2(settingsX + 100, settingsY + 250);
     menuPos = new Vector2(settingsX + 100, settingsY + 325);
 }
Пример #2
0
        /// <summary>
        /// Set up the create game screen
        /// </summary>
        private void SetUp()
        {
            backGround = new Sprite { Color = Color.White };
            var x = game.Window.ClientBounds.Width / 2 - 400 / 2;
            var y = game.Window.ClientBounds.Height / 2 - 400 / 2;
            backGround.Position = new Vector2(x, y);

            var cgX = x;
            var cgY = y + 325;
            createGame = new Button("creategame", cgX, cgY);

            var cancelX = x + 250;
            var cancelY = y + 325;
            cancel = new Button("cancelcg", cancelX, cancelY);

            var rect = new Rectangle(x + 250, y + 200, 100, 50);
            numberOfPlayers = new Numberbox(rect, "volumebox", 1) { Limit = 5, Number = 5 };
            numberOfPlayers.Text = numberOfPlayers.Number.ToString();

            var sRect = new Rectangle(x + 150, y + 100, 250, 75);
            serverName = new Textbox(sRect, "playername");
            serverName.MoveText(45);

            namePos = new Vector2(x + 10, y + 125);
            playersPos = new Vector2(x + 10, y + 225);

            buttons = new List<Button> { this.cancel, this.createGame };
        }
Пример #3
0
        /// <summary>
        /// Set up the ingame screen
        /// </summary>
        private void SetUp()
        {
            if(game.Host == null) {
                hosting = false;
            } else {
                host = game.Host;
                hosting = true;
            }
            client = game.Client;
            gameName = game.GameName;
            maxPlayers = game.MaxPlayers;

            client.Disconnected += OnDisconnected;
            client.BetRequested += OnBetRequest;
            client.CardRequested += OnCardRequest;
            client.Game.RoundStarted += OnGameStarted;
            client.Game.GameFinished += OnGameFinished;
            client.Game.RoundFinished += OnRoundFinished;

            cards = new List<CardSprite>();

            inJoinbackGround = new Sprite { Color = Color.White };
            var x = game.Window.ClientBounds.Width / 2 - 400 / 2;
            var y = game.Window.ClientBounds.Height / 2 - 500 / 2;
            inJoinbackGround.Position = new Vector2(x, y);

            leaveGame = new Button("leavegame", x + 250, y + 450);

            if(hosting) {
                startGame = new Button("startgame", x, y + 450);
            }

            playerPos = new Vector2(x + 20, y + 85);

            maxPlayerPos = new Vector2(x + 175, y + 85);

            gamePos = new Vector2(x + 5, y + 60);

            namesRectangle = new Rectangle(x + 5, y + 150, 200, 30);

            menu = new Sprite { Color = Color.White };
            var menuX = game.Window.ClientBounds.Width / 2 - 300 / 2;
            var menuY = game.Window.ClientBounds.Height / 2 - 420 / 2;
            menu.Position = new Vector2(menuX, menuY);
            menuX += 75;
            menuY += 100;
            resumeGame = new Button("resumegame", menuX, menuY);
            menuY += Button.Height;
            menuleaveGame = new Button("leavegame", menuX, menuY);
            menuY += Button.Height;
            exitGame = new Button("exitgame", menuX, menuY);
            menuButtons = new List<Button> { this.menuleaveGame, this.resumeGame, this.exitGame };

            var rect = new Rectangle(900, 520, 100, 50);
            betBox = new Numberbox(rect, "bettingbox", 2) { Limit = 10, Number = 0, Locked = false };
            betBox.Text = betBox.Number.ToString();

            bet = new Button("bet", 860,  565);

            cardSize = new Rectangle(5, 615, 100, 120);

            scoreRectangle = new Rectangle(1024-175, 0, 75, 20);

            scoreOverlayRect = new Rectangle(1024-177, 0, 177, 520);

            ingameBottom = new Rectangle(0,615, 1024, 120);
        }