From bc0499b9f4d2520051338e52fd2cd9ecd52293c6 Mon Sep 17 00:00:00 2001 From: lishuo Date: Wed, 24 Aug 2022 18:45:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=BF=E9=97=B4=E7=8A=B6=E6=80=81=E4=B8=BA?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=AD=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=88=BF?= =?UTF-8?q?=E9=97=B4=E4=B8=BA=E7=A9=BA=E4=B9=9F=E8=A6=81=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=88=BF=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/RoomModel.cs | 2 +- ViewModels/MainWindowViewModel.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Model/RoomModel.cs b/Model/RoomModel.cs index 5a3fab6..4940f1e 100644 --- a/Model/RoomModel.cs +++ b/Model/RoomModel.cs @@ -10,7 +10,7 @@ namespace OnlineUserPool.Model public int RoomId { get; set; } public string Name { get; set; } public int UserId { get; set; }//房主 - public int Status { get; set; }//房间状态 0 :准备状态 1:开始loading + public int Status { get; set; }//房间状态 0 :准备状态 1:开始loading 2:结束 public DateTime StatusChangedTime { get; set; } public DateTime CreateTime { get; set; }//创建时间 public DateTime? StartTime { get; set; }//开始时间 diff --git a/ViewModels/MainWindowViewModel.cs b/ViewModels/MainWindowViewModel.cs index 340a9e5..76c311d 100644 --- a/ViewModels/MainWindowViewModel.cs +++ b/ViewModels/MainWindowViewModel.cs @@ -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);