public void SetRoomInfo(RoomInfo roomInfo) { // if(roomInfo!=null) Debugger.Log("setRoomInfo {0}", roomInfo.PlayerList); if (roomInfo == null) { roomInfo = new RoomInfo(); } var oldRoomInfo = _room.RoomInfo ?? new RoomInfo(); _room.RoomInfo = roomInfo; // 更新玩家信息 if (_room.IsInRoom()) { foreach (var info in _room.RoomInfo.PlayerList.Where(info => info.Id == RequestHeader.PlayerId)) { GamePlayerInfo.SetInfo((PlayerInfo)info); break; } } // 重置帧广播信息: // 1 切换房间 // 2 不存在房间id // 3 不在房间中 // 4 房间的开始帧同步时间发生变化 if (!oldRoomInfo.Id.Equals(_room.RoomInfo.Id) || string.IsNullOrEmpty(_room.RoomInfo.Id) || !_room.IsInRoom() || oldRoomInfo.StartGameTime != this._room.RoomInfo.StartGameTime) { _room.RoomBroadcast?.FrameBroadcastFrameIdReset(0); } // 激活第二条链接 if (_room.RoomInfo != null && _room.RoomInfo.PlayerList != null) { if (_room.RoomInfo.PlayerList.Any(info => Listener.IsMe(info.Id))) { this.ActiveFrame(); } } _room.onUpdate(this._room); }
/** * 本地网络状态变化 */ public void OnNetwork(ResponseEvent eve) { _room.onUpdate(this._room); }