示例#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
 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
        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));
 }