private void TimedAutoMatchRoom_Sub_Match(ref IRoomModel room, AutoMatchRoomModel amr, IUserModel user, AppSession userSession, ref ToSitDownStatus sitDownStatus, ref bool sitDown, ref int roomId, int matchLvl) { try { foreach (int roomKey in roomList.Keys) { room = (IRoomModel)roomList.get(roomKey); //自动匹配差1人 if (amr.Tab == room.Tab) { roomId = room.Id; //不可为上次的房间,否则会因三人中的二人未退出,又匹配到该房间 if (amr.getRoomOldId() == roomId) { continue; } //不可为正在游戏中的房间 if (room.hasGamePlaying()) { continue; } //不可为断线重连中的房间 if (room.isWaitReconnection) { continue; } //不可为有尸体的房间 if (logicChkRoomByDeadPeople(roomId)) { continue; } //自动匹配原则是 差1人的游戏最佳 //所以这里不能单单只是坐下,要做在差一人的坐位上 sitDown = logicHasIdleChairAndMatchSitDown(roomId, matchLvl, //user.getStrIpPort(), userSession.RemoteEndPoint.ToString(), true, out sitDownStatus); if (sitDown) { TimedAutoMatchRoom_Sub_SitDown_Ok(room, userSession); break; }//end if }//end if }//end for } catch (Exception exd) { Log.WriteStrByException(CLASS_NAME, "TimedAutoMatchRoom_Sub_Match", exd.Message, exd.Source, exd.StackTrace); } }
public void doorAutoMatchRoom(AppSession session, XmlDocument doc, SessionMessage item) { try { int tab = 0; // XmlNode node = doc.SelectSingleNode("/msg/body/room"); string old = node.Attributes["old"].Value; XmlNode node2 = doc.SelectSingleNode("/msg/body/tab"); tab = Convert.ToInt32(node2.ChildNodes[0].InnerText); // string strIpPort = session.RemoteEndPoint.ToString(); // int roomOldId = Convert.ToInt32(old); AutoMatchRoomModel amr = new AutoMatchRoomModel(strIpPort, tab, roomOldId); // if (!getAutoMatchWaitList().containsKey(strIpPort)) { getAutoMatchWaitList().put(strIpPort, amr); }else { //覆盖数据 getAutoMatchWaitList().put(strIpPort,amr); } } catch (Exception exd) { Log.WriteStrByException(CLASS_NAME, "doorAutoMatchRoom", exd.Message, exd.Source, exd.StackTrace); } }