Example #1
0
        private void ButtonClick(object s)
        {
            string value = (s as Button).Text;

            int seed = Main.random.Next(int.MaxValue);
            //Console.WriteLine(white);

            var msg = Networking.CreateMessage();

            msg.Write((byte)MainScreen.Side.GAME_SIDE);
            msg.Write(value);
            //msg.Write(value + "," + (white ? "B" : "W"));
            msg.Write(seed);
            Networking.SendMessage(msg);

            mainScreen.LoadFromString(value, seed);
        }
Example #2
0
        public void ReceiveMessage(NetIncomingMessage msg)
        {
            /*
             * string[] parts = msg.ReadString().Split(',');
             *
             * if (parts.Length != 2) return;
             *
             * bool white = parts[1] == "W";
             *
             * mainScreen.LoadFromString(parts[0], white);
             */

            string n    = msg.ReadString();
            int    seed = msg.ReadInt32();

            mainScreen.LoadFromString(n, seed);
        }