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 void calculatePositions() { cells[0].blink(position); for (int i = 1; i < cells.Count; i++) { NineCell leftCell = cells[i - 1]; cells[i].blink(leftCell.Position + new Vector2(leftCell.Width - (2 * scale), 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'; }
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 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'; } }