1230bug
This commit is contained in:
parent
8a1991e948
commit
b273996793
@ -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<WSMessage>(sendData);
|
||||
JoinRoomRequest login = ProtoBufffer.DeSerialize<JoinRoomRequest>(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<VoiceResponse>(bytes);
|
||||
@ -971,8 +989,18 @@ public class test : MonoBehaviour
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case "move.PlayerSituation":
|
||||
Debug.LogError("玩家状态11111111111111111");
|
||||
PlayerStatisticsResponse playerStatisticsResponse = ProtoBufffer.DeSerialize<PlayerStatisticsResponse>(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":
|
||||
|
@ -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<Transform> 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<Button>();
|
||||
closeBtn.onClick.AddListener(OnClickCloseBtn);
|
||||
scrollView=transform.Find("bg/mid/Scroll View").GetComponent<ScrollRect>();
|
||||
@ -42,15 +46,29 @@ public class Personnelpreparation : MonoBehaviour
|
||||
}
|
||||
|
||||
}
|
||||
private void UpdateSubObjectList()
|
||||
public async void UpdateSubObjectList()
|
||||
{
|
||||
Transform contentTransform = scrollView.content;
|
||||
subObjects.Clear();
|
||||
PlayerListResponse playerListResponse = await userInfo.GetPlayerList();
|
||||
foreach(var iterm in subObjects)
|
||||
{
|
||||
Destroy(iterm.gameObject);
|
||||
}
|
||||
if (playerStatisticsResponse == null) return;
|
||||
// 重新遍历Content下的所有子物体,更新子物体列表
|
||||
for (int i = 0; i < contentTransform.childCount; i++)
|
||||
for (int i = 0; i < playerStatisticsResponse.Data.Count; i++)
|
||||
{
|
||||
subObjects.Add(contentTransform.GetChild(i));
|
||||
}
|
||||
GameObject ob = Instantiate(item);
|
||||
ob.transform.SetParent(scrollView.content.transform, false);
|
||||
subObjects.Add(ob.transform);
|
||||
foreach (var item in playerListResponse.data)
|
||||
{
|
||||
if (playerStatisticsResponse.Data[i].UserId.ToString() == item.UserId)
|
||||
{
|
||||
ob.transform.Find("Text (Legacy)").GetComponent<Text>().text = playerStatisticsResponse.Data[i].UserId.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStatusChanged()
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.SearchService;
|
||||
|
||||
//using System.Drawing;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
@ -89,7 +89,7 @@ public class RoomManager : MonoBehaviour
|
||||
}
|
||||
// 添加 RoomDataHolder 脚本并存储数据
|
||||
Status dataHolder = roomItem.GetComponent<Status>();
|
||||
dataHolder.text.text = $"[{js.SetUIText(room.SceneId)}][{js.SetUIText(room.SubjectId)}]";
|
||||
dataHolder.text.text = $"{js.SetUIText(room.SceneId)} {js.SetUIText(room.SubjectId)}";
|
||||
Debug.Log(js.SetUIText(room.SceneId));
|
||||
Debug.Log(dataHolder.text.text);
|
||||
dataHolder.SetRoomData(room.RoomId, room.SceneId, room.SubjectId, room.TemplateId, room.Status, room.ReserveDate);
|
||||
|
@ -53,13 +53,22 @@ public class Starthost : MonoBehaviour
|
||||
|
||||
private int currentLineIndex = 0; // 当前语音和文本索引
|
||||
private GameObject right;//右边图标
|
||||
|
||||
|
||||
public Button closeBtn;
|
||||
public GameObject Renyuan;
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
audioSource= GetComponent<AudioSource>();
|
||||
closeBtn.onClick.AddListener(() =>
|
||||
{
|
||||
Renyuan.SetActive(false);
|
||||
});
|
||||
Renyuan.SetActive(false);
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
// 确保对讲机图标默认隐藏
|
||||
walkieTalkieIcon.SetActive(false);
|
||||
ishost = ReadRoom.instance.isenter;
|
||||
@ -168,7 +177,8 @@ public class Starthost : MonoBehaviour
|
||||
//{
|
||||
// button.onClick.AddListener(ShowPopupPanel);
|
||||
//}
|
||||
Game.uiManager.ShowUI<Image>("Panel");
|
||||
//Game.uiManager.ShowUI<Image>("Panel");
|
||||
Renyuan.SetActive(true);
|
||||
}
|
||||
// 显示弹出界面的方法
|
||||
void ShowPopupPanel()
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -867,6 +867,7 @@ MonoBehaviour:
|
||||
isadministrator: 0
|
||||
iszongzhihui: 0
|
||||
RoleId: 0
|
||||
roomid:
|
||||
test: {fileID: 7695717545649794846}
|
||||
--- !u!114 &252707977
|
||||
MonoBehaviour:
|
||||
|
@ -32,6 +32,7 @@ public class getPlayerList : MonoBehaviour
|
||||
// 解析服务器返回的数据
|
||||
PlayerListResponse playerListResponse = JsonConvert.DeserializeObject<PlayerListResponse>(response);
|
||||
Debug.Log(playerListResponse.data[0].UserId);
|
||||
Debug.Log(playerListResponse.data[0].UserName);
|
||||
|
||||
return playerListResponse;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user