人员配置

This commit is contained in:
huyulong 2025-01-02 16:00:45 +08:00
parent 79ac436c2e
commit 844aa91cb0
2 changed files with 15 additions and 4 deletions

View File

@ -14,8 +14,11 @@ public class Personnelpreparation : MonoBehaviour
// 定义一个事件,用于在子物体状态变化时触发重新排序
public UnityEvent onStatusChanged;
public PlayerStatisticsResponse playerStatisticsResponse;
//public getPlayerList userInfo;
// Start is called before the first frame update
public getPlayerList userInfo;
public Sprite ready;
public Sprite Nready;
// Start is called before the first frame upd
// ate
void Start()
{
instance = this;
@ -60,11 +63,19 @@ public class Personnelpreparation : MonoBehaviour
GameObject ob = Instantiate(item);
ob.transform.SetParent(scrollView.content.transform, false);
subObjects.Add(ob.transform);
if(playerStatisticsResponse.Data[i].IsReady)
{
ob.transform.Find("Image").GetComponent<Image>().sprite = ready;
}
else
{
ob.transform.Find("Image").GetComponent<Image>().sprite = Nready;
}
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();
ob.transform.Find("Text (Legacy)").GetComponent<Text>().text = playerStatisticsResponse.Data[i].UserName.ToString();
}
}

View File

@ -29,7 +29,7 @@ public class getPlayerList : MonoBehaviour
string response = await web.SendRequest(web.URL + "/admin/companyUser/player/list", "GET", "{}", CreateHeaders());
Debug.Log("»ñÈ¡ÑÝÁ·Õ˺ÅÁбí" + response);
// 解析服务器返回的数据
// 解析服务器返回的数据
PlayerListResponse playerListResponse = JsonConvert.DeserializeObject<PlayerListResponse>(response);
Debug.Log(playerListResponse.data[0].UserId);
Debug.Log(playerListResponse.data[0].UserName);