You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.5 KiB
40 lines
1.5 KiB
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using AX.Network.Protocols; |
|
using UnityEngine; |
|
using AX.Serialization; |
|
|
|
//大厅房间列表信息跟新处理脚本 |
|
public class ROOM_UPDATE_SYNC : NetworkMessageBehaviour |
|
{ |
|
public Transform RoomParent;//大厅房间列表父对象 |
|
|
|
protected override void Execute(BinaryMessage message) |
|
{ |
|
var info = message.Body.Deserialize<Room>();//从服务器获取到发生信息改变的房间对象 |
|
|
|
for (int i = 0; i < Lobby.roomList.Count; i++)//比对当前大厅中的(房间数据列表)找出该房间重新绑定信息 |
|
{ |
|
if (Lobby.roomList[i].Id == info.Id) |
|
{ |
|
Lobby.roomList[i] = info; |
|
} |
|
} |
|
for (int i = 0; i < RoomParent.childCount; i++)//比对当前大厅中的(房间显示列表)找出该房间重新绑定信息 |
|
{ |
|
if (RoomParent.GetChild(i).GetComponent<RoomManager>().MyRoom.Id == info.Id) |
|
{ |
|
RoomParent.GetChild(i).GetComponent<RoomManager>().MyRoom = info; |
|
|
|
if (LobbyDataManager.GetInstance.NowRoomId == info.Id)//如果当前正在浏览该房间信息 |
|
{ |
|
if (LobbyDataManager.GetInstance.MapImg.gameObject.activeSelf)//并且浏览界面可见重新绑定信息 |
|
{ |
|
LobbyDataManager.GetInstance.BindRoomMessage(RoomParent.GetChild(i).GetComponent<RoomManager>()); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
}
|
|
|