public override void OnRecv(ref Conn conn) { CG_CreateRole createRole = GetData <CG_CreateRole>(structBytes); Console.WriteLine("userName:"******"接受创建name:" + createRole.name); Console.WriteLine("接受创建occ:" + createRole.occ); TablePlayer playerTable = DBPlayer.Inst.CreatePlayer(createRole.userName, createRole.name, createRole.occ); playerTable.X = 140; playerTable.Y = 170; if (playerTable != null) { eno = 0; playerData = MsgLogin.CreatePlayer(ref conn, createRole.userName, ref playerTable); Console.WriteLine("创建角色成功,返回角色信息"); // 进入默认场景 Lobby map = LobbyManager.Inst.GetLobby(playerData.mapId); map.AddPlayer(conn.player); } else { eno = -1; Console.WriteLine("创建角色失败"); } conn.Send(this); }