Ejemplo n.º 1
0
 internal static Server GetInstance(Game game, GamePanel panel, Client client)
 {
     if (game == null)
         throw new ArgumentException("Game may not be null!", nameof(game));
     if (Instance == null)
         Instance = new Server(game, panel, client);
     return Instance;
 }
Ejemplo n.º 2
0
 private Server(Game game, GamePanel panel, Client client)
 {
     this.game = game;
     GameState = new ServerGameState(this);
     for (var i = 1; i < 5; i++)
         GameState.SeatedPlayers[i] = Player.GetPlayerServerSide($"Temp {i}");
     ServerMessageHandler = new ServerMessageHandler(this, GameState);
 }
Ejemplo n.º 3
0
 public ClientGameState(GamePanel panel, Client client, Game game, bool isHost)
     : base()
 {
     IsHost = isHost;
     Client = client;
     Chat = ChatHandler.Initialize(this);
     client.OnConnected += BindGetGamestate;
     panel.InitializePiles(DrawPile, DiscardPile);
     for (var i = 0; i < 17; i++)
         DrawPile.AddCard(new CardPolicyUnknown());
     Window = game;
     this.panel = panel;
     OnStart += (ClientGameState state) =>
     {
         state.FascistActions = FascistAction.GetActionsForPlayers(state.PlayerCount);
     };
 }
Ejemplo n.º 4
0
 public static Client GetClient(Game game, string username)
 {
     Instance = new Client(game, username);
     return Instance;
 }
Ejemplo n.º 5
0
 private Client(Game game, string username = null)
 {
     this.game = game;
     this.username = username;
 }