You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
852 B
38 lines
852 B
1 year ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class DrillVideoPanel : MonoBehaviour
|
||
|
{
|
||
|
public GameObject VideoItem;
|
||
|
public Transform ItemContent;
|
||
|
private void OnEnable()
|
||
|
{
|
||
|
|
||
|
ClearContent();
|
||
|
CreatItem();
|
||
|
}
|
||
|
|
||
|
private void OnDestroy()
|
||
|
{
|
||
|
ClearContent();
|
||
|
}
|
||
|
void ClearContent()
|
||
|
{
|
||
|
for (int i = 0; i < ItemContent.childCount; i++)
|
||
|
{
|
||
|
Destroy(ItemContent.GetChild(i).gameObject);
|
||
|
}
|
||
|
}
|
||
|
void CreatItem()
|
||
|
{
|
||
|
List<VideoData> list = VideoFileCtrl.Instance.manoeuvreDatas;
|
||
|
for (int i = 0; i < list.Count; i++)
|
||
|
{
|
||
|
GameObject item= Instantiate(VideoItem,ItemContent);
|
||
|
item.name = list[i].Name;
|
||
|
item.GetComponent<VideoItem>().Set(list[i]);
|
||
|
}
|
||
|
}
|
||
|
}
|