From b273996793becff0e659e69d5e52f922557c3940 Mon Sep 17 00:00:00 2001 From: huyulong <1838407198@qq.com> Date: Mon, 30 Dec 2024 22:59:22 +0800 Subject: [PATCH] 1230bug --- xiaofang/Assets/ProtoBuf/test.cs | 36 +- .../Res/gsj/scripts/Personnelpreparation.cs | 32 +- .../Assets/Res/gsj/scripts/RoomManager.cs | 4 +- xiaofang/Assets/Res/gsj/scripts/Starthost.cs | 14 +- xiaofang/Assets/Scenes/Tmap 1.unity | 3878 ++++++++++++++++- xiaofang/Assets/Scenes/loginscene.unity | 1 + .../Script/DirllInterface/getPlayerList.cs | 1 + 7 files changed, 3904 insertions(+), 62 deletions(-) diff --git a/xiaofang/Assets/ProtoBuf/test.cs b/xiaofang/Assets/ProtoBuf/test.cs index 14079409..52db2dc3 100644 --- a/xiaofang/Assets/ProtoBuf/test.cs +++ b/xiaofang/Assets/ProtoBuf/test.cs @@ -39,8 +39,8 @@ public class test : MonoBehaviour void lodingWebSocket() { LoginRequest data = new LoginRequest(); - data.UserId = "1845037177556934657"; - data.Account = "17311259169"; + data.UserId = GlobalData.ServerData.data.userId ; + data.Account = GlobalData.ServerData.data.openId; WSMessage msg = new WSMessage(); @@ -574,9 +574,27 @@ public class test : MonoBehaviour wEBScriptListener.SendMessageByte(sendData); } + public void PlayerSituation(string roomId) + { + JoinRoomRequest data = new JoinRoomRequest(); + data.RoomId = roomId; + WSMessage msg = new WSMessage(); + msg.Module = "hall"; + msg.ServiceName = "PlayerSituation"; + msg.Data = ByteString.CopyFrom(ProtoBufffer.Serialize(data)); + byte[] sendData = ProtoBufffer.Serialize(msg); + WSMessage deinfo = ProtoBufffer.DeSerialize(sendData); + JoinRoomRequest login = ProtoBufffer.DeSerialize(deinfo.Data.ToByteArray()); + Debug.Log("==========消息转发函数调用"); + //BroadcastFrameMsg.FramesFieldNumber + + wEBScriptListener.SendMessageByte(sendData); + } + + // Start is called before the first frame update async void Start() @@ -920,7 +938,7 @@ public class test : MonoBehaviour break; - //17.语音频道 + //17.语音频道v case "voice.RtcTokenHandler": Debug.Log("-----------move.MoveNpc"); VoiceResponse voiceResponse = ProtoBufffer.DeSerialize(bytes); @@ -971,8 +989,18 @@ public class test : MonoBehaviour break; - + case "move.PlayerSituation": + Debug.LogError("玩家状态11111111111111111"); + PlayerStatisticsResponse playerStatisticsResponse = ProtoBufffer.DeSerialize(bytes); + foreach(var item in playerStatisticsResponse.Data) + { + Debug.Log(item.RoleId); + Debug.Log(item.IsReady); + } + Personnelpreparation.instance.playerStatisticsResponse = playerStatisticsResponse; + Personnelpreparation.instance.UpdateSubObjectList(); + break; //case "prop.CreateNpc": diff --git a/xiaofang/Assets/Res/gsj/scripts/Personnelpreparation.cs b/xiaofang/Assets/Res/gsj/scripts/Personnelpreparation.cs index b18d07d4..a711eedc 100644 --- a/xiaofang/Assets/Res/gsj/scripts/Personnelpreparation.cs +++ b/xiaofang/Assets/Res/gsj/scripts/Personnelpreparation.cs @@ -6,15 +6,19 @@ using System.Linq; using UnityEngine.Events; public class Personnelpreparation : MonoBehaviour { + public static Personnelpreparation instance; private Button closeBtn; private ScrollRect scrollView; + public GameObject item; private List subObjects; // 用于存储Scroll View的Content下的子物体Transform列表 // 定义一个事件,用于在子物体状态变化时触发重新排序 public UnityEvent onStatusChanged; - + public PlayerStatisticsResponse playerStatisticsResponse; + public getPlayerList userInfo; // Start is called before the first frame update void Start() { + instance = this; closeBtn=transform.Find("bg/top/closeBtn").GetComponent