internal void UpdateRoomServerInfo(RoomServerInfo info) { RoomServerInfo info_; if (!m_LobbyInfo.RoomServerInfos.TryGetValue(info.RoomServerName, out info_)) { m_LobbyInfo.RoomServerInfos.Add(info.RoomServerName, info); } else { info_.IdleRoomNum = info.IdleRoomNum; info_.UserNum = info.UserNum; } //LogSys.Log(LOG_TYPE.DEBUG, "UpdateRoomServerInfo,name:{0},idle room num:{1},cur user num:{2}", info.RoomServerName, info.IdleRoomNum, info.UserNum); }
internal void RegisterRoomServer(RoomServerInfo info) { if (!m_LobbyInfo.RoomServerInfos.ContainsKey(info.RoomServerName)) { m_LobbyInfo.RoomServerInfos.Add(info.RoomServerName, info); } else { RoomServerInfo info_ = m_LobbyInfo.RoomServerInfos[info.RoomServerName]; info_.RoomServerName = info.RoomServerName; info_.ServerIp = info.ServerIp; info_.ServerPort = info.ServerPort; info_.MaxRoomNum = info.MaxRoomNum; } Msg_LR_ReplyRegisterRoomServer resultBuilder = new Msg_LR_ReplyRegisterRoomServer(); resultBuilder.IsOk = true; LobbyServer.Instance.RoomSvrChannel.Send(info.RoomServerName, resultBuilder); LogSys.Log(LOG_TYPE.DEBUG, "RegisterRoomServer,name:{0},ip:{1},port:{2},max room num:{3}", info.RoomServerName, info.ServerIp, info.ServerPort, info.MaxRoomNum); }
private string GetIdlestRoomServer() { string name = ""; int minNum = int.MaxValue; RoomServerInfo retInfo = null; foreach (RoomServerInfo info in m_RoomServerInfos.Values) { if (info.IdleRoomNum > info.AllocedRoomNum && info.UserNum < minNum) { LogSys.Log(LOG_TYPE.DEBUG, "GetIdlestRoomServer, Bubble process, Server:{0} UserNum:{1} < {2}", info.RoomServerName, info.UserNum, minNum); minNum = info.UserNum; retInfo = info; } } if (null != retInfo) { ++retInfo.AllocedRoomNum; name = retInfo.RoomServerName; } LogSys.Log(LOG_TYPE.DEBUG, "GetIdlestRoomServer, Name:{0} UserNum:{1}", name, minNum); return(name); }
internal void UpdateRoomServerInfo(RoomServerInfo info) { RoomServerInfo info_; if (!m_LobbyInfo.RoomServerInfos.TryGetValue(info.RoomServerName, out info_)) m_LobbyInfo.RoomServerInfos.Add(info.RoomServerName, info); else { info_.IdleRoomNum = info.IdleRoomNum; info_.UserNum = info.UserNum; } //LogSys.Log(LOG_TYPE.DEBUG, "UpdateRoomServerInfo,name:{0},idle room num:{1},cur user num:{2}", info.RoomServerName, info.IdleRoomNum, info.UserNum); }