mirror of
https://github.com/AndrioCelos/TableturfBattleApp.git
synced 2026-04-26 01:47:22 -05:00
Tell the client where the starting spaces are
This commit is contained in:
parent
dc3dcb0c82
commit
94739183ac
|
|
@ -89,6 +89,7 @@ function onGameStateChange(game: any, playerData: PlayerData | null) {
|
|||
clearPlayContainers();
|
||||
if (game.board) {
|
||||
board.resize(game.board);
|
||||
board.startSpaces = game.startSpaces;
|
||||
board.refresh();
|
||||
}
|
||||
loadPlayers(game.players);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ public class Game {
|
|||
public string? StageName { get; private set; }
|
||||
[JsonProperty("board")]
|
||||
public Space[,]? Board { get; private set; }
|
||||
[JsonProperty("startSpaces")]
|
||||
public Point[]? StartSpaces;
|
||||
|
||||
public Game(int maxPlayers) => this.MaxPlayers = maxPlayers;
|
||||
|
||||
|
|
@ -149,6 +151,7 @@ public class Game {
|
|||
|
||||
// Place starting positions.
|
||||
var list = stage.startSpaces.Where(s => s.Length >= this.Players.Count).MinBy(s => s.Length) ?? throw new InvalidOperationException("Couldn't find start spaces");
|
||||
this.StartSpaces = list;
|
||||
for (int i = 0; i < this.Players.Count; i++)
|
||||
this.Board[list[i].X, list[i].Y] = Space.SpecialInactive1 | (Space) i;
|
||||
|
||||
|
|
@ -339,7 +342,7 @@ public class Game {
|
|||
for (int i = 0; i < 4; i += 2)
|
||||
writer.Write((byte) (player.initialDrawOrder![i] | player.initialDrawOrder[i + 1]));
|
||||
for (int i = 0; i < 15; i += 2)
|
||||
writer.Write((byte) (player.drawOrder![i] | (i < 14 ? player.drawOrder[i + 1] << 4 : 0)));
|
||||
writer.Write((byte) (player.drawOrder![i] | (i < 14 ? player.drawOrder[i + 1] << 4 : player.UIBaseColourIsSpecialColour ? 0x80 : 0)));
|
||||
writer.Write(player.Name);
|
||||
}
|
||||
for (int i = 0; i < 12; i++) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user