/// <summary> /// 房间创建 需要知道选择模型里的数据 /// </summary> public void Create(SelectModel[] teamOne, SelectModel[] teamTwo) { FightRoom room; if (!cacheRooms.TryPop(out room)) { room = new FightRoom(); //添加唯一ID room.SetArea(AddIndex); } //房间数据初始化 room.Init(teamOne, teamTwo); foreach (SelectModel item in teamOne) { userRoom.TryAdd(item.UserID, room.GetArea()); } foreach (SelectModel item in teamTwo) { userRoom.TryAdd(item.UserID, room.GetArea()); } roomMap.TryAdd(room.GetArea(), room); }
/// <summary> /// 房间创建 需要知道选择模型里的数据 /// </summary> public void Create(SelectModel[] teamOne,SelectModel[] teamTwo) { FightRoom room; if(!cacheRooms.TryPop(out room)) { room = new FightRoom(); //添加唯一ID room.SetArea(AddIndex); } //房间数据初始化 room.Init(teamOne,teamTwo); foreach (SelectModel item in teamOne) { userRoom.TryAdd(item.UserID, room.GetArea()); } foreach (SelectModel item in teamTwo) { userRoom.TryAdd(item.UserID, room.GetArea()); } roomMap.TryAdd(room.GetArea(), room); }