public override IEnumerator OnReceive(Session session, Gamnet.Packet packet) { Packet.MsgCliSvr_Join_Req req = packet.Deserialize <Packet.MsgCliSvr_Join_Req>(); Packet.MsgSvrCli_Join_Ans ans = new Packet.MsgSvrCli_Join_Ans(); ans.errorCode = Packet.ErrorCode.Success; Room room = Main.Room.Find(req.roomId); room.AddUser(session); session.Send(ans); int needPlayerCount = 2; if (false == GameManager.Instance.multiPlay) { needPlayerCount = 1; } if (needPlayerCount == room.sessions.Count) { Main.Room.Remove(room.Id); room.Ready(); } yield break; }
public override IEnumerator OnReceive(Session session, Gamnet.Packet packet) { Packet.MsgCliSvr_Join_Req req = packet.Deserialize <Packet.MsgCliSvr_Join_Req>(); Packet.MsgSvrCli_Join_Ans ans = new Packet.MsgSvrCli_Join_Ans(); ans.errorCode = Packet.ErrorCode.Success; Room room = Main.Room.Find(req.roomId); room.AddUser(session); session.Send(ans); if (1 == room.sessions.Count) { Main.Room.Remove(room.Id); room.Ready(); } yield break; }
public void OnRecv_Join_Ans(Packet.MsgSvrCli_Join_Ans ans) { }