Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
//TODO: SE: Split for Stage/Local
public abstract class ListLoader<T> : MenueLoader
{
public GameObject List;
public GameObject Entry;
protected void OnEnable()
{
Clear();
Init();
}
protected void OnDisable()
{
Clear();
}
public abstract void Init();
protected virtual void Clear()
{
for (int i = 0; i < List.transform.childCount; i++)
Destroy(List.transform.GetChild(i).gameObject);
}
protected abstract void Default();
public virtual void ListButtons(List<T> list)
{
if (list.Count == 0)
Default();
else
ListButtonsWrapped(list);
}
protected abstract void ListButtonsWrapped(List<T> list);
protected void WriteInChildText(GameObject entry, string content)
{
if (content == null)
return;
entry.transform.GetChild(0).gameObject.GetComponent<TMPro.TextMeshProUGUI>().text = content;
}
}