_xiaofang/xiaofang/Assets/Script/UI/PanelUI/EvacuationPanel.cs
2024-11-29 09:47:47 +08:00

39 lines
1002 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EvacuationPanel : MonoBehaviour
{
public Transform personnelContent;
public Panel panel;
public GameObject personnelPrefabs;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void SetPersonnel()
{
foreach (Transform child in personnelContent)
{
Destroy(child.gameObject);
}
foreach (var sceneEntry in panel.sceneDataDictionary)
{
GameObject item = GameObject.Instantiate<GameObject>(personnelPrefabs, personnelContent);
PersonnelItem personnelItem=item.GetComponent<PersonnelItem>();
personnelItem.sceneText.text = sceneEntry.Key;
personnelItem.personnelNum.text = sceneEntry.Value.Count.ToString();
}
}
}