예제 #1
0
        public NPlayer(string _name, Socket socket)
        {
            this.name = _name;
            handler   = socket.Accept();
            Console.WriteLine("Accepted Socket");
            networkStream = new NetworkStream(handler);
            StreamWriter writer = new StreamWriter(networkStream);
            StreamReader reader = new StreamReader(networkStream);

            this.relay = new NetworkRelay(writer, reader);
            Console.WriteLine("Got the stream setup");
            this.playerState = State.start;
        }
예제 #2
0
        public PlayerProxy(IPlayer player, string c, StreamWriter writer, StreamReader reader)
        {
            if (!Constants.colors.Contains(c))
            {
                throw new ArgumentException("Color not allowed");
            }
            Hand    = new List <Tile>();
            iplayer = player;
            Color   = c;

            networkRelay = new NetworkRelay(writer, reader);
            Console.WriteLine("Got the streams set up for proxy player");
            GameFinished = false;
        }