Ejemplo n.º 1
0
 public GameClient()
 {
     GameTCPClient            = new GameTCPClient();
     GameTCPClient.NetMsgRev += (sender, netmsg) => _onMsgRecv(netmsg);
     MyInfo = new PlayerInfo();
     Room   = new MyRoom();
 }
Ejemplo n.º 2
0
        public GameWindow()
        {
            InitializeComponent();
            GameTCP = new GameTCPClient();
            //LoginIn[] loginIn = new LoginIn[4]
            //{
            //    new LoginIn(){UserName="******",Password="******" },
            //    new LoginIn(){UserName="******",Password="******" },
            //    new LoginIn(){UserName="******",Password="******" },
            //    new LoginIn(){UserName="******",Password="******" },
            //};
            //Match match = new Match() { GameMode = GameMode.SiAn };
            //for (int i = 1; i < GameTCP.Count + 1; i++)
            //{

            //    GameTCP[(OfSide)i].StartUp(IPAddress.Loopback);
            //    GameTCP[(OfSide)i].SendAsync(loginIn[i - 1]).Wait();
            //    GameTCP[(OfSide)i].SendAsync(match).Wait();
            //}
            GameTCP.NetMsgRev += _onMsgRecv;
            try
            {
                GameTCP.StartUp(IPAddress.Loopback);
            }
            catch (Exception e)
            {
                GameInfo.Content = "无法连接服务器,请重试";
            }
        }