public void EntCartRoom(KWX.RSP_CreateRoom result) { Debuger.Log("创建房间返回" + result.RoomID); m_result = result; //链接游戏服务器 KWXFrom.GetIns.Game_ = this; KWXFrom.GetIns.InitGameFrom(m_result.ServerHost, m_result.ServerPort); Console.ReadLine(); }
public TestFrom() { Debuger.EnableLog = 1;//开启日志打印 0关闭 1控制台下日志 2unity3d日志 日志打印请使用Debuger.Log //链接登录服务器 KWXFrom.GetIns.Login_ = this; KWXFrom.GetIns.InitLoginFrom("172.16.10.153", 4000); Random RANG = new Random(); Console.ReadLine(); //测试登陆 CMD_Login LOGINitem = new CMD_Login() { UserID = (ulong)RANG.Next(1, 99999999), Password = "******", WeiXinCode = "12345" }; KWXFrom.GetIns.LoginCmd.SendLoginGame(LOGINitem, null); Console.ReadLine(); Debuger.Log("回车代表创建房间 其他任意键+回车 代表进入房间"); if (Console.ReadLine() == "") { //测试创建房间 CMD_CreateRoom creatroom = new CMD_CreateRoom() { GameName = "CSMJ", Rule = "哈哈", RoundCount = 8 }; KWXFrom.GetIns.LoginCmd.SendCreatRoom(creatroom); Console.ReadLine(); } else { Debuger.Log("请输入 房间号"); //测试进入房间 uint RoomIDD = uint.Parse(Console.ReadLine()); CMD_EnterRoom entroom = new CMD_EnterRoom() { RoomID = RoomIDD }; KWXFrom.GetIns.LoginCmd.SendEntRoom(entroom); m_result = new RSP_CreateRoom(); m_result.RoomID = RoomIDD; m_result.Password = m_Loginresult.Password; Console.ReadLine(); } int BaoLiCeShi = 0; while (BaoLiCeShi < 200) { //心跳测试 CMD_HeartBeat HeartBeat_ = new CMD_HeartBeat(); KWXFrom.GetIns.GameCmd.SendHeartBeat(HeartBeat_); BaoLiCeShi++; Debuger.Log("心跳暴力测试 次数:" + BaoLiCeShi); //Console.ReadLine(); } }
public void EntCartRoom(RSP_CreateRoom result) { Loom.QueueOnMainThread(() => { Host = result.ServerHost; Port = result.ServerPort; Password = result.Password; SeatID = result.SeatID; RoomID = result.RoomID; Debuger.Log(result.ServerHost); KWXFrom.GetIns.InitGameFrom(result.ServerHost, result.ServerPort); }); }
public static void DispathMssage(BufferData Msg) //消息分发 { Debuger.Log("收到大厅主命令:" + Msg.Cmd); //-1000代表链接服务器成功 switch (Msg.Cmd) { case -1000: { if (KWXFrom.GetIns.Login_ != null) { KWXFrom.GetIns.Login_.LinkLoginServerOK(); } } break; case 1: { RSP_Login result = ProtoBufSerialize <RSP_Login> .DeSerialize(Msg.Buf); if (KWXFrom.GetIns.Login_ != null) { KWXFrom.GetIns.Login_.LoginOK(result); } } break; case 2: { KWXFrom.GetIns.DisConnet(); RSP_CreateRoom result = ProtoBufSerialize <RSP_CreateRoom> .DeSerialize(Msg.Buf); if (KWXFrom.GetIns.Login_ != null) { KWXFrom.GetIns.Login_.EntCartRoom(result); } } break; case 3: { KWXFrom.GetIns.DisConnet(); RSP_EnterRoom result = ProtoBufSerialize <RSP_EnterRoom> .DeSerialize(Msg.Buf); if (KWXFrom.GetIns.Login_ != null) { KWXFrom.GetIns.Login_.EntRoom(result); } } break; default: break; } }