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
 public ServerGameState(Server server)
     : base()
 {
     Server = server;
     votes = new Vote[10];
     for (var i = 0; i < 6; i++)
         DrawPile.AddCard(new CardPolicyLiberal());
     for (var i = 0; i < 11; i++)
         DrawPile.AddCard(new CardPolicyFascist());
     DrawPile.Shuffle();
 }
Ejemplo n.º 3
0
 public Netviewer(Server server, Client client)
     :this()
 {
     this.server = server;
     this.client = client;
     if(client != null && client.ReceiveHandler != null)
     {
         client.ReceiveHandler.OnReceive += ClientReceive;
         client.OnSent += ClientSent;
     }
     if (server != null)
     {
         server.ServerMessageHandler.OnReceive += ServerReceive;
         server.OnSent += ServerSent;
     }
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 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;
     }
 }
 public ServerMessageHandler(Server server, ServerGameState gameState)
 {
     this.server = server;
     this.gameState = gameState;
 }
Ejemplo n.º 7
0
 public PingSockets(Server server)
 {
     this.server = server;
     DoWork += Ping;
     enabled = true;
     RunWorkerAsync();
 }
Ejemplo n.º 8
0
 public Netviewer(Server server)
     : this(server, null)
 { }