2024-11-29 20:05:19 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class PersonnelPanel : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public Text personelPanelText;
|
|
|
|
|
public Text personelNumText;
|
2024-11-30 10:19:52 +08:00
|
|
|
|
public Transform personelContent;
|
|
|
|
|
public Panel panelInfo;
|
|
|
|
|
public GameObject personelItem;
|
2024-11-29 20:05:19 +08:00
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2024-11-30 16:19:19 +08:00
|
|
|
|
public void CreatePeopleItem(List<SelectedInfo> peopleList)
|
2024-11-29 20:05:19 +08:00
|
|
|
|
{
|
2024-11-30 16:19:19 +08:00
|
|
|
|
foreach (Transform child in personelContent)
|
|
|
|
|
{
|
|
|
|
|
Destroy(child.gameObject);
|
|
|
|
|
}
|
|
|
|
|
foreach (var personel in peopleList)
|
|
|
|
|
{
|
|
|
|
|
CreatePersonelItem(personel, personelContent);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void CreatePersonelItem(SelectedInfo person, Transform parentTransform)
|
|
|
|
|
{
|
|
|
|
|
//Transform contentTransform = parentTransform.transform.Find("Scroll View/Viewport/Content");
|
|
|
|
|
Debug.Log("============"+ parentTransform == null);
|
|
|
|
|
|
2024-11-30 10:19:52 +08:00
|
|
|
|
// ʵ<><CAB5><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EEB2A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-11-30 16:19:19 +08:00
|
|
|
|
GameObject item = Instantiate(personelItem, parentTransform);
|
2024-11-30 10:19:52 +08:00
|
|
|
|
PersonnelInfo personnelItem = item.GetComponent<PersonnelInfo>();
|
|
|
|
|
personnelItem.nameText.text = person.name; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-11-29 20:05:19 +08:00
|
|
|
|
}
|
|
|
|
|
}
|