forked from powerfun/udpservice
房间状态为进行中,如果房间为空也要删除房间
This commit is contained in:
1 parent
22e77b1d46
commit
bc0499b9f4
2 files changed
+8
-8
No files matched your search
@@ -528,7 +528,7 @@ namespace OnlineUserPool.ViewModels
|
||||
if (needRemove != null)
|
||||
{
|
||||
list.Remove(needRemove);
|
||||
//如果当前是房主退出房间,房主替换成其他人
|
||||
//如果当前是房主退出房间,房主替换成其他人, 房主客户端中断也算
|
||||
if (needRemove.IsOwner && list.Count() > 0)
|
||||
{
|
||||
var newOwner = list.FirstOrDefault();
|
||||
@@ -537,7 +537,7 @@ namespace OnlineUserPool.ViewModels
|
||||
}
|
||||
}
|
||||
//人数为0,删除房间
|
||||
if (list.Count() == 0 && room.Status == 0)
|
||||
if (list.Count() == 0)
|
||||
{
|
||||
RoomList.Remove(room);
|
||||
}
|
||||
@@ -845,18 +845,18 @@ namespace OnlineUserPool.ViewModels
|
||||
|
||||
private void GameRoomDisConnectHandler(HostModel client)
|
||||
{
|
||||
//如果是在对战房间或者对战列表掉线执行,骑行阶段断开连接不移除房间信息
|
||||
if (client.Model != null && !client.Model.Equals("GameRoom"))
|
||||
return;
|
||||
////如果是在对战房间或者对战列表掉线执行,骑行阶段断开连接不移除房间信息
|
||||
//if (client.Model != null && !client.Model.Equals("GameRoom"))
|
||||
// return;
|
||||
|
||||
RoomList.ToList().ForEach(o => {
|
||||
if (o.List != null && o.Status == 0)
|
||||
if (o.List != null && o.Status != 2)
|
||||
{
|
||||
var needRemove = o.List.Where(c => c.UserId == client.MemberId).FirstOrDefault();
|
||||
o.List.Remove(needRemove);
|
||||
}
|
||||
});
|
||||
var needRemoveList = RoomList.ToList().Where(c => c.List.Count == 0 && c.Status == 0).ToList();
|
||||
var needRemoveList = RoomList.ToList().Where(c => c.List.Count == 0 && c.Status != 2).ToList();
|
||||
foreach (var item in needRemoveList)
|
||||
{
|
||||
RoomList.Remove(item);
|
||||
|
||||
Reference in new issue
Block a user