43 lines
976 B (Stored with Git LFS)
C#
43 lines
976 B (Stored with Git LFS)
C#
using UnityEngine;
|
|
|
|
namespace Superlazy.UI
|
|
{
|
|
[DefaultExecutionOrder(-1000)]
|
|
public class SLUIRoot : MonoBehaviour
|
|
{
|
|
public static bool reset;
|
|
public static Transform t;
|
|
|
|
private void Awake()
|
|
{
|
|
var uis = SLResources.LoadAll<GameObject>("UIs");
|
|
t = transform;
|
|
|
|
foreach (var ui in uis)
|
|
{
|
|
var inst = Instantiate(ui, t);
|
|
inst.name = ui.name;
|
|
}
|
|
}
|
|
|
|
public static void ResetUI()
|
|
{
|
|
reset = true;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (reset)
|
|
{
|
|
reset = false;
|
|
|
|
for (var i = 0; i < transform.childCount; ++i)
|
|
{
|
|
var child = transform.GetChild(i);
|
|
child.gameObject.SetActive(false);
|
|
child.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |