コード例 #1
0
        public override void update(GameTime gameTime)
        {
            base.update(gameTime);
            FrameController controller = GameClient.Instance.frameController;

            foreach (GestureSample gesture in GestureManager.Gestures)
            {
                if (gesture.GestureType == GestureType.Tap)
                {
                    if (scoreTab.checkForHit(gesture.Position))
                    {
                        if (IsActive)
                        {
                            controller.stow(this);
                            Console.WriteLine("STOWED");
                        }
                        else
                        {
                            controller.activate(this);
                            Console.WriteLine("ACTIVATED");
                        }
                    }
                }
            }
            foreach (Player player in ClientDataStore.Instance.Players)
            {
                NineGridRow row = scoreboard.getRow(player.ID.ToString());
                row.getCell("score").Text  = player.Score.ToString();
                row.getCell("bid").Text    = (player.Bid == -1 ? "-" : player.Bid.ToString());
                row.getCell("tricks").Text = player.TricksWon.ToString();
            }
        }
コード例 #2
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);
        }
コード例 #3
0
ファイル: NineGrid.cs プロジェクト: liangyee/Wizard
 private void calculatePositions()
 {
     rows[0].blink(position);
     for (int i = 1; i < rows.Count; i++)
     {
         NineGridRow aboveRow = rows[i - 1];
         rows[i].blink(aboveRow.Position + new Vector2(0, aboveRow.Height - (2 * scale)));
     }
 }
コード例 #4
0
ファイル: NineGrid.cs プロジェクト: liangyee/Wizard
        public NineGridRow addRow(string label)
        {
            NineGridRow row = new NineGridRow(label, scale, font, columnLabels, columnWidths.Values.ToArray());

            rows.Add(row);
            calculatePositions();
            calculateTextures();
            return(row);
        }
コード例 #5
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;
     }
 }
コード例 #6
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';
        }
コード例 #7
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;
         }
     }
 }
コード例 #8
0
ファイル: NineGrid.cs プロジェクト: liangyee/Wizard
        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];
        }
コード例 #9
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;
            }
        }
コード例 #10
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;
        }
コード例 #11
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';
            }
        }
コード例 #12
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();
        }