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.
32 lines
783 B
32 lines
783 B
2 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class ExerciseVideoPanel : MonoBehaviour
|
||
|
{
|
||
|
public GameObject VideoItem;
|
||
|
public Transform ItemContent;
|
||
|
private void OnEnable()
|
||
|
{
|
||
|
ClearContent();
|
||
|
CreatItem();
|
||
|
}
|
||
|
void ClearContent()
|
||
|
{
|
||
|
for (int i = 0; i < ItemContent.childCount; i++)
|
||
|
{
|
||
|
Destroy(ItemContent.GetChild(i).gameObject);
|
||
|
}
|
||
|
}
|
||
|
void CreatItem()
|
||
|
{
|
||
|
List<VideoData> list = VideoFileCtrl.Instance.PracticeDatas;
|
||
|
for (int i = 0; i < list.Count; i++)
|
||
|
{
|
||
|
GameObject item = Instantiate(VideoItem, ItemContent);
|
||
|
item.name = list[i].Name;
|
||
|
item.GetComponent<VideoItem>().Set(list[i]);
|
||
|
}
|
||
|
}
|
||
|
}
|