public static void GetRoomList(GetRoomListPara para, Action <ResponseEvent> callback) { Sdk.GetRoomList(para, (eve) => { try { if (eve.Data != null) { var rsp = new GetRoomListRsp(); rsp.MergeFrom((ByteString)eve.Data); eve.Data = rsp; } callback?.Invoke(eve); } catch (Exception e) { Debugger.Log("{0}", e.ToString()); } }); }
public static void GetRoomList(GetRoomListPara para, Action <ResponseEvent> callback) { Room.GetRoomList(para, callback); }
public void Btn_Join() { if (TelentDrawController.instance && TelentDrawController.instance.ChatOk) { PlayerInfoPara playerInfoPara = new PlayerInfoPara { Name = usrJoinName.text.Trim(), CustomProfile = "customStr", CustomPlayerStatus = 1, }; // id="k8Ub1rle" JoinRoomPara joinRoomPara = new JoinRoomPara { PlayerInfo = playerInfoPara }; GetRoomListPara getRoomListPara = new GetRoomListPara { PageNo = 1, PageSize = 10, }; string roomId = roomJoinId.text.Trim(); TelentDrawController.instance.JoinRoomId = roomId; TelentDrawController.instance.PlayerInfoPara = playerInfoPara; TelentDrawController.instance.JoinPara = joinRoomPara; TelentDrawController.instance.paintJoinState = PaintJoinState.Joined; TelentDrawController.instance.CurrentRoomName = roomCreateName.text.Trim(); // 不要使用 room.getRoomList // 直接使用 Room 对象 Room.GetRoomList(getRoomListPara, (ResponseEvent eve) => { if (eve.Code == 0) { GetRoomListRsp rsp = (GetRoomListRsp)eve.Data; Debug.Log(rsp.Total); RepeatedField <RoomInfo> infos = rsp.RoomList; for (int i = 0; i < infos.Count; i++) { if (roomId == infos[i].Id) { if ((int)infos[i].MaxPlayers == infos[i].PlayerList.Count) { if (ToastManager.instance) { ToastManager.instance.AddToast(ToastType.Error, "人员已满"); } break; } findRoom = true; // Debug.Log(infos[i].Id); break; } } if (!findRoom) { if (ToastManager.instance) { ToastManager.instance.AddToast(ToastType.Error, "未找到房间号"); } } } else { Debug.Log(eve); } }); } }