public BattleshipsGame(ServerClient client1, ServerClient client2)
        {
            client1Board = new GameBoard();
            client2Board = new GameBoard();
            clients = new ServerClient[2];
            clients[0] = client1;
            clients[1] = client2;
            client1Board.InitBoard();
            client2Board.InitBoard();
            client1TempPositions = new List<GridPosition>();
            client2TempPositions = new List<GridPosition>();

        }
예제 #2
0
        private void PostGameStatisticsUpdate(ServerClient[] clients)
        {
            for (int i = 0; i < clients.Length; i++)
            {
                Dictionary<string, string> data = new Dictionary<string, string>();
                data.Add("WINS", clients[i].Wins.ToString());
                data.Add("LOSSES", clients[i].Losses.ToString());
                try
                {
                    dataBase.Update("USERS", data, string.Format("USERNAME = '******'", clients[i].Username));
                }
                catch (Exception e)
                {
                    Console.WriteLine("Data Update Failed: " + e.Message);
                }

            }
        }
예제 #3
0
 private void AddNewClient(Socket socket)
 {
     ServerClient newClient = new ServerClient(socket);
     newClient.CommandRecieved += new CommandRecievedEventHandler(CommandRecieved);
     newClient.Disconnected += new DisconnectedEventHandler(ClientDisconnected);
     clientList.Add(newClient);
     Console.WriteLine("User connected from {0}:{1} at {2}/{3}", newClient.IP, newClient.Port, DateTime.Now.ToShortTimeString(), DateTime.Now.ToLongDateString());
 }