예제 #1
0
파일: Server.cs 프로젝트: jandar78/Avalon
 //Main constructor
 private Server(string address, int port, ServerForm serverForm)
 {
     this.IPAddress = address;
     this.Port = System.Net.IPAddress.HostToNetworkOrder(port);
     ReceiveBuffer = new byte[1024];
     clientSocketList = new ConcurrentDictionary<Socket, Players>();
     _serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     _serverSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
     ServerForm = serverForm;
 }
예제 #2
0
파일: Program.cs 프로젝트: jandar78/Avalon
 public Game(ServerForm serverForm, Server server)
 {
     ServerForm = serverForm;
     Server = server;
     CurrentRoleDeck = new List<PlayingCards>();
     CurrentKing = -1;
     CurrentLadyLake = -1;
     CurrentTeamSelectionRound = 1;
     CurrentRound = 1;
     MaxRounds = 5;
     MaxTeamMembersCurrentRound = 5;
     MatchOver = true;
 }
예제 #3
0
파일: Program.cs 프로젝트: jandar78/Avalon
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ServerForm serverForm = new ServerForm();
            Server server = Server.GetServer(serverForm);
            Game game = new Game(serverForm, server);

            ThreadPool.QueueUserWorkItem(delegate { game.Run(); });
            serverForm.ShowDialog();
        }
예제 #4
0
파일: Server.cs 프로젝트: jandar78/Avalon
 public static Server GetServer(ServerForm form)
 {
     return _server ?? (_server = new Server("192.168.1.1", 8814, form));
 }