54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class PersonnelPanel : MonoBehaviour
|
|
{
|
|
public Text personelPanelText;
|
|
public Text personelNumText;
|
|
public Text lockText;
|
|
public GameObject lockBg;
|
|
public Transform personelContent;
|
|
public GameObject personelItem;
|
|
public GameObject firstLablePrefab;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
public void CreatePeopleItem(List<SelectedInfo> peopleList)
|
|
{
|
|
foreach (Transform child in personelContent)
|
|
{
|
|
Destroy(child.gameObject);
|
|
}
|
|
foreach (var personel in peopleList)
|
|
{
|
|
CreatePersonelItem(personel, personelContent);
|
|
}
|
|
}
|
|
public void CreatePersonelItem(SelectedInfo person, Transform parentTransform)
|
|
{
|
|
// 实例化一个人员项并将其作为场景面板的子物体
|
|
GameObject item = Instantiate(personelItem, parentTransform);
|
|
PersonnelInfo personnelItem = item.GetComponent<PersonnelInfo>();
|
|
personnelItem.nameText.text = person.name; // 设置姓名
|
|
}
|
|
public void CreateSceneItem(SelectedInfo person, Transform parentTransform)
|
|
{
|
|
GameObject item = Instantiate(personelItem, parentTransform);
|
|
PersonnelInfo personnelItem = item.GetComponent<PersonnelInfo>();
|
|
}
|
|
public void OnClickBtn()
|
|
{
|
|
transform.gameObject.SetActive(false);
|
|
}
|
|
}
|