public void InitializeState(ClientGameState state) { this.state = state; state.OnStart += DefineBoards; GeneratePlayAreas(state); GeneratePlacards(); }
public static ChatHandler Initialize(ClientGameState state) { if (Instance == null) { Instance = new ChatHandler(state); } return Instance; }
private void DefineBoards(ClientGameState obj) { if (FascistBoard != null) lock (Objects) Objects.Remove(FascistBoard); var xLocation = Width / 2; var yLocation = Height / 2 - (Board.DEFAULTSIZE.Height / 2); FascistBoard = new FascistBoard(obj, obj.PlayerCount) { Location = new Point(xLocation, yLocation) }; lock (Objects) { if (LiberalBoard == null) { LiberalBoard = new LiberalBoard(obj) { Location = new Point(xLocation - Board.DEFAULTSIZE.Width, yLocation) }; Objects.AddFirst(LiberalBoard); } Objects.AddFirst(FascistBoard); } }
public Game(ServerClientDialog dialog) { InitializeComponent(); client = Client.GetClient(this, dialog.Username); client.Name = dialog.Username; if (!dialog.Join) { //Host code server = Server.GetInstance(this, gamePanel, client); server.Start(); while (!server.Running) ; } GameState = new ClientGameState(gamePanel, client, this, server != null); gamePanel.InitializeState(GameState); client.Connect(dialog.IPAddress); statusLabel.Parent = gamePanel; playerMsg.Parent = gamePanel; }
public DebugConsole(Server server, ServerGameState serverGameState, Client client, ClientGameState clientGameState) :this() { this.server = server; this.serverGameState = serverGameState; this.client = client; this.clientGameState = clientGameState; for(var i = 0; i < serverGameState.SeatedPlayers.Length; i++) { if (serverGameState.SeatedPlayers[i] == null) continue; playerButtons[i].Enabled = true; playerButtons[i].Text = serverGameState.SeatedPlayers[i].Name; playerButtons[i].Tag = serverGameState.SeatedPlayers[i]; } for (var i = 0; i < policyButtons.Length; i++) { policyButtons[i].Tag = (byte)i; } }
private void GeneratePlayAreas(ClientGameState state) { int horizontalSpacing = Width / 4; int playerAreaWidth = PlayArea.DEFAULTSIZE.Width; int padding = (horizontalSpacing - playerAreaWidth) / 2; int borderBottom = 720; int offsetBottom = borderBottom - PlayArea.DEFAULTSIZE.Height; int borderTop = 0; int paddingSide = 10; int offsetTop = borderTop + PlayArea.DEFAULTSIZE.Height; int locationVertical = (offsetBottom - offsetTop - playerAreaWidth) / 2 + offsetTop + 60; for (var i = 0; i < PlayerAreas.Length; i++) { var area = new PlayArea(state, i); if (i < 8) area.Location = new Point((i % 4) * horizontalSpacing + padding, i / 4 == 0 ? offsetBottom : borderTop); else area.Location = new Point(i == 8 ? -50 : Width - paddingSide - PlayArea.DEFAULTSIZE.Height - 50, locationVertical); Objects.AddLast(area); PlayerAreas[i] = area; } }
private ChatHandler(ClientGameState state) { this.state = state; state.Client.OnConnected += Client_OnConnected; }
public PlayArea(ClientGameState state, int ID) { State = state; this.ID = ID; }