1
This commit is contained in:
Binary file not shown.
@@ -207,14 +207,13 @@ namespace Assets.MyGame.Scripts.Net
|
||||
break;
|
||||
case "ExitRoomSuccess":
|
||||
{
|
||||
// 4.4 退出成功(自己):清空本地房间状态 → 面板还开着(被踢/其他路径)才回大厅刷列表
|
||||
// 4.4 退出成功(自己):清空本地房间状态。
|
||||
// 列表刷新由各返回入口自己按当前分区发起(结算面板返回/被踢路径),
|
||||
// 这里不再发 GetRoomList——避免与界面已发的请求形成双响应竞争,把列表覆盖成其他分区数据
|
||||
var va = JsonConvert.DeserializeObject<WebSocketResponseBase<string>>(msg).arguments[0];
|
||||
if (GameManager.Instance.user.id == va)
|
||||
{
|
||||
if (roomMainPanel != null) roomMainPanel.ClearRoomLocalState();
|
||||
// 面板已关闭(返回大厅退出)时不刷列表,否则 GetRoomList 响应会把已关的面板重新拉起
|
||||
if (roomMainPanel != null && roomMainPanel.gameObject.activeInHierarchy)
|
||||
WebSocketSendList.GetRoomListChineseChess(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -912,10 +912,11 @@ public class ChineseChessMainPanel : GameMainPanel_Base
|
||||
{
|
||||
if (userId != MyChessUserId) return;
|
||||
|
||||
// 停止计时/棋盘/输入 → 清空房间本地状态 → 回大厅重拉列表
|
||||
// 停止计时/棋盘/输入 → 清空房间本地状态 → 回大厅按当前选中分区重拉列表(不能用 0,会返回全部分区导致列表与 tab 不符)
|
||||
ClearRoomLocalState();
|
||||
subUIManager.CloseAll();
|
||||
WebSocketSendList.GetRoomListChineseChess(0);
|
||||
var districtPanel = subUIManager.Get<UIChineseChessDistrict>(UIPanel.ZGXQDistrict);
|
||||
WebSocketSendList.GetRoomListChineseChess(districtPanel != null ? districtPanel.currDistrict : 1);
|
||||
|
||||
// 优先显示服务端 reason,为空显示默认文案
|
||||
UIManager.Instance.ShowBoardError(string.IsNullOrEmpty(reason) ? "已被移出房间" : reason);
|
||||
|
||||
@@ -20,6 +20,8 @@ public class UIChineseChessDistrict : SubUIBase
|
||||
public Transform tra_DaQuParent;
|
||||
public Transform tra_FenQuItem; // child0=Toggle, child0.child0=TextMeshProUGUI(象棋n区)
|
||||
public int maxDistrict = 10; // 最大分区数
|
||||
/// <summary>当前选中的分区号(1 开始):退房/被踢回大厅时用它刷新,保证列表与 tab 一致</summary>
|
||||
public int currDistrict = 1;
|
||||
|
||||
private bool _tabsBuilt = false;
|
||||
|
||||
@@ -164,6 +166,7 @@ public class UIChineseChessDistrict : SubUIBase
|
||||
Destroy(panel_RoomItemParent.GetChild(i).gameObject);
|
||||
itemListDic.Clear();
|
||||
|
||||
currDistrict = district; // 记录当前选中分区(退房/被踢回大厅时按它刷新)
|
||||
WebSocketSendList.GetRoomListChineseChess(district);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user