Esempio n. 1
0
        public void setUp()
        {
            ICollection <Player> playerList = ClientDataStore.Instance.Players;

            foreach (Player player in playerList)
            {
                NineGridRow row        = scoreboard.addRow(player.ID.ToString());
                NineCell    playerCell = row.getCell("player");
                string      nameText   = player.Name;
                if (nameText.Length > 12)
                {
                    nameText = nameText.Substring(0, 10) + "...";
                }
                playerCell.Text   = nameText;
                playerCell.Colour = ColourHelper.getPlayerColour(player.ID, playerList.Count);
                NineCell scoreCell = row.getCell("score");
                scoreCell.Text      = "0";
                scoreCell.Alignment = 'C';
                NineCell bidCell = row.getCell("bid");
                bidCell.Text      = "-";
                bidCell.Alignment = 'C';
                NineCell trickCell = row.getCell("tricks");
                trickCell.Text      = "0";
                trickCell.Alignment = 'C';
            }
            scoreboard.blink(new Vector2(scoreboard.Position.X, 0f));
            scoreTab.blink(new Vector2(scoreTab.Position.X, scoreboard.Height));
            stowPosition    = Arranger.staticPoint(0f, 0f);
            stowPosition.Y -= scoreboard.Height;
            patchPos        = scoreboard.Position.ToPoint();
            patchSize       = new Point(69 * ScaleManager.InterfaceScale, scoreboard.Height);
            patchPos.X      = (int)((scoreTab.Position.X - (32.5f * ScaleManager.InterfaceScale)) + 0.5f);
        }
Esempio n. 2
0
 public void clearPlayerList()
 {
     for (int i = 1; i <= 6; i++)
     {
         NineGridRow row = joinedGrid.getRow(i.ToString());
         row.getCell("player").Text   = "...";
         row.getCell("player").Colour = Color.White;
     }
 }
Esempio n. 3
0
        public FrameEndgame(Vector2 position) : base(position)
        {
            scoreboard = new NineGrid(Vector2.Zero, ScaleManager.InterfaceScale, ScaleManager.LargeFont, new string[] { "player", "score" }, new int[] { 15, 6 });
            NineGridRow header     = scoreboard.addRow("header");
            NineCell    playerCell = header.getCell("player");

            playerCell.Text      = "Player";
            playerCell.Alignment = 'C';
            NineCell scoreCell = header.getCell("score");

            scoreCell.Text      = "Score";
            scoreCell.Alignment = 'C';
        }
Esempio n. 4
0
 public void removePlayer(Player player)
 {
     for (int i = 1; i <= 6; i++)
     {
         if (joinedGrid.getRow(i.ToString()).Label == player.ID.ToString())
         {
             NineGridRow row = joinedGrid.getRow(i.ToString());
             row.getCell("player").Text   = "...";
             row.getCell("player").Colour = Color.White;
             break;
         }
     }
 }
Esempio n. 5
0
        private void calculateTextures()
        {
            NineGridRow lastRow    = rows[rows.Count - 1];
            string      lastColumn = columnLabels[columnLabels.Length - 1];

            foreach (NineGridRow row in rows)
            {
                foreach (string label in columnLabels)
                {
                    row.getCell(label).Patch = ContentStore.gridPatches[4];
                }
            }
            lastRow.getCell(lastColumn).Patch      = ContentStore.gridPatches[3];
            lastRow.getCell(columnLabels[0]).Patch = ContentStore.gridPatches[2];
            rows[0].getCell(lastColumn).Patch      = ContentStore.gridPatches[1];
            rows[0].getCell(columnLabels[0]).Patch = ContentStore.gridPatches[0];
        }
Esempio n. 6
0
        public void addPlayer(Player player)
        {
            NineGridRow newPlayerRow = joinedGrid.getRow(player.ID.ToString());
            string      nameText     = player.Name;

            if (nameText.Length > 13)
            {
                nameText = nameText.Substring(0, 11) + "...";
            }
            newPlayerRow.getCell("player").Text = nameText;
            for (int i = 1; i <= player.ID; i++)
            {
                NineGridRow row = joinedGrid.getRow(i.ToString());
                row.getCell("player").Colour = ColourHelper.getPlayerColour(i, player.ID);
                row.getCell("player").Value  = player.ID;
            }
        }
Esempio n. 7
0
        public FrameScoreboard(Vector2 position) : base(position)
        {
            scoreboard = new NineGrid(Vector2.Zero, ScaleManager.InterfaceScale, ScaleManager.LargeFont, new string[] { "player", "score", "bid", "tricks" }, new int[] { 12, 6, 4, 4 });
            NineGridRow header     = scoreboard.addRow("header");
            NineCell    playerCell = header.getCell("player");

            playerCell.Text      = "Player";
            playerCell.Alignment = 'C';
            NineCell scoreCell = header.getCell("score");

            scoreCell.Text      = "Score";
            scoreCell.Alignment = 'C';
            NineCell bidCell = header.getCell("bid");

            bidCell.Text      = "Bid";
            bidCell.Alignment = 'C';
            NineCell trickCell = header.getCell("tricks");

            trickCell.Text      = "Won";
            trickCell.Alignment = 'C';
            LinePoly scoreTabPoly = new LinePoly(
                Vector2.Zero,
                new Vector2(34.5f, 0),
                new Vector2(34.5f, 5),
                new Vector2(25.5f, 16),
                new Vector2(-25.5f, 16),
                new Vector2(-34.5f, 5),
                new Vector2(-34.5f, 0)
                );

            scoreTab = new PolyButton(Arranger.staticPoint(1 / 4f, 0f), scoreTabPoly, ContentStore.scoreTab, new Vector2(32.5f, 0), ScaleManager.CardScale, 0f);
            Arranger arranger = new Arranger(true, 1, 'L', 0);

            arranger.addObject(scoreboard, 0);
            arranger.performArrangements();
            trayPatch = ContentStore.scorePatch;
            patchPos  = Point.Zero;
            patchSize = Point.Zero;
        }
Esempio n. 8
0
        public void populate()
        {
            List <Player> playerList = new List <Player>(ClientDataStore.Instance.Players);

            playerList.Sort((x, y) => x.Score.CompareTo(y.Score));
            for (int i = 0; i < playerList.Count; i++)
            {
                Player      player     = playerList[i];
                NineGridRow row        = scoreboard.getRow(i.ToString());
                NineCell    playerCell = row.getCell("player");
                string      nameText   = player.Name;
                if (nameText.Length > 15)
                {
                    nameText = nameText.Substring(0, 13) + "...";
                }
                playerCell.Text      = nameText;
                playerCell.Alignment = 'C';
                playerCell.Colour    = ColourHelper.getPlayerColour(player.ID, playerList.Count);
                NineCell scoreCell = row.getCell("score");
                scoreCell.Text      = player.Score.ToString();
                scoreCell.Alignment = 'C';
            }
        }
Esempio n. 9
0
        public PageHostGame(MainGame mainGame) : base(mainGame)
        {
            Arranger arranger = new Arranger(true, 2, 'C', ScaleManager.InterfaceScale * 2);

            spacer = new Arranger.ArrangerSpacer(100 * ScaleManager.InterfaceScale, false);
            addMovable(spacer);
            arranger.addObject(spacer, 0);

            ipField = new PatchField(2, 13, Vector2.Zero, ScaleManager.InterfaceScale, "IP", "Starting...", null, false);
            addField(ipField);
            arranger.addObject(ipField, 0);

            backButton = new PatchButton(5, Vector2.Zero, buttonPatch, ScaleManager.InterfaceScale, "Back", () => {
                AudioHelper.play(ContentStore.soundPop);
                mainGame.menuController.changeActivePage(mainGame.preHostGame);
                UltraServer.Instance.network.CloseServer();
                UltraClient.Instance.network.CloseClient();
                for (int i = 1; i <= 6; i++)
                {
                    NineGridRow row              = joinedGrid.getRow(i.ToString());
                    row.getCell("player").Text   = "...";
                    row.getCell("player").Colour = Color.White;
                }
                ClientDataStore.Instance.resetPlayers();
            });
            addButton(backButton);
            arranger.addObject(backButton, 0);

            joinedGrid = new NineGrid(Vector2.Zero, ScaleManager.InterfaceScale, ScaleManager.LargeFont, new string[] { "player" }, new int[] { 13 });
            NineGridRow header = joinedGrid.addRow("header");

            header.getCell("player").Text      = "Players";
            header.getCell("player").Alignment = 'C';
            for (int i = 1; i <= 6; i++)
            {
                NineGridRow playerRow = joinedGrid.addRow(i.ToString());
                playerRow.getCell("player").Text      = ("...");
                playerRow.getCell("player").Alignment = 'C';
            }
            addMovable(joinedGrid);
            arranger.addObject(joinedGrid, 1);

            beginButton = new PatchButton(13, Vector2.Zero, buttonPatch, ScaleManager.InterfaceScale, "Begin!", () => {
                AudioHelper.play(ContentStore.soundPop);

                int playerCount = UltraServer.Instance.network.Players.GetPlayers().Count;
                if ((playerCount < 3 && SettingsHelper.Instance.PlayerCountCheck) || (!SettingsHelper.Instance.PlayerCountCheck && playerCount == 0))
                {
                    if (!SettingsHelper.Instance.PlayerCountCheck)
                    {
                        mainGame.GeneralMessageQueue.Enqueue("At least 1 more player must join!");
                        return;
                    }

                    if (3 - playerCount > 1)
                    {
                        mainGame.GeneralMessageQueue.Enqueue("At least " + (3 - playerCount) + " more players must join!");
                    }
                    else
                    {
                        mainGame.GeneralMessageQueue.Enqueue("At least " + (3 - playerCount) + " more player must join!");
                    }

                    return;
                }

                if (mainGame.HostOnly)
                {
                    mainGame.gameIsRunning = true;
                    UltraServer.Instance.network.SendStartGameMessage();
                    GameScheduler.initialise(UltraServer.Instance.network.Players.GetPlayers(), UltraServer.Instance.network, UltraServer.Instance);
                    UltraServer.Instance.HostStarted();
                }
                else
                {
                    UltraServer.Instance.network.SendStartGameMessage();
                    GameScheduler.initialise(UltraServer.Instance.network.Players.GetPlayers(), UltraServer.Instance.network, UltraServer.Instance);
                }

                Thread schedulerThread = new Thread(new ThreadStart(GameScheduler.schedulerThread));
                schedulerThread.Start();
            });
            addButton(beginButton);
            arranger.addObject(beginButton, 1);

            arranger.performArrangements();
        }