/// <summary> /// 某人离开桌子了 /// </summary> /// <param name="msg"></param> void SVR_OnOneLeaveWaitTable(string msg) { Proto.OnOneLeaveMatchTable data = JsonUtility.FromJson <Proto.OnOneLeaveMatchTable>(msg); if (data.uid == PlayerInfo.uid) { PlayerInfo.nowGameType = 0; PlayerInfo.nowGameId = 0; PlayerInfo.waitPlayers.Clear(); ShowOutMatchWarn("您被踢出该房间"); return; } PlayerInfo.waitPlayers.Remove(data.uid); Transform trsm = waitUserParent.Find(data.uid.ToString()); if (trsm) { trsm.GetComponent <WaitUserPrefab>().Leave(); } if (data.nowMaster != 0) { masterId = data.nowMaster; PlayerInfo.waitPlayers[masterId].isMaster = true; PlayerInfo.waitPlayers[masterId].isReady = true; } foreach (var tmpUserInfo in PlayerInfo.waitPlayers.Values) { if (!tmpUserInfo.isMaster) { tmpUserInfo.isReady = false; } waitUserParent.Find(tmpUserInfo.uid.ToString()).GetComponent <WaitUserPrefab>().Init(tmpUserInfo); } }
void SVR_OnOneLeaveWaitTable(string msg) { Proto.OnOneLeaveMatchTable data = JsonUtility.FromJson <Proto.OnOneLeaveMatchTable>(msg); if (data.uid == PlayerInfo.uid) { PlayerInfo.nowGameType = 0; PlayerInfo.nowGameId = 0; PlayerInfo.waitPlayers.Clear(); return; } PlayerInfo.waitPlayers.Remove(data.uid); if (data.nowMaster != 0) { PlayerInfo.waitPlayers[data.nowMaster].isMaster = true; PlayerInfo.waitPlayers[data.nowMaster].isReady = true; } foreach (var tmpUserInfo in PlayerInfo.waitPlayers.Values) { if (!tmpUserInfo.isMaster) { tmpUserInfo.isReady = false; } } }