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); }
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'; }
public void setUp() { blackout = new Texture2D(MainGame.Instance.GraphicsDevice, 1, 1); blackout.SetData <Color>(new Color[] { Color.Black }); ICollection <Player> playerList = ClientDataStore.Instance.Players; for (int i = 0; i < playerList.Count; i++) { scoreboard.addRow(i.ToString()); } Arranger arranger = new Arranger(true, 1, 'C', 0); arranger.addObject(scoreboard, 0); arranger.performArrangements(); GameClient.Instance.frameController.editStow(this, Arranger.staticPoint(0f, 1f)); }
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; }
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(); }