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.
52 lines
1.2 KiB
52 lines
1.2 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class WindowRoot : MonoBehaviour
|
|
{
|
|
public bool isAlwaysActive = true;
|
|
public List<Transform> active_TransList = new List<Transform>();
|
|
public List<Transform> notActive_TransList = new List<Transform>();
|
|
|
|
public void SetActive(bool b)
|
|
{
|
|
if (this.gameObject.activeSelf != b)
|
|
{
|
|
this.gameObject.SetActive(b);
|
|
}
|
|
}
|
|
|
|
public virtual void Init()
|
|
{
|
|
//当前窗口是否在启动时激活
|
|
if (isAlwaysActive)
|
|
{
|
|
SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
SetActive(false);
|
|
}
|
|
//激活组件列表
|
|
for (int i = 0; i < active_TransList.Count; i++)
|
|
{
|
|
if (active_TransList[i] != null)
|
|
{
|
|
active_TransList[i].gameObject.SetActive(true);
|
|
|
|
}
|
|
}
|
|
//待激活组件列表
|
|
for (int i = 0; i < notActive_TransList.Count; i++)
|
|
{
|
|
if (notActive_TransList[i] != null)
|
|
{
|
|
notActive_TransList[i].gameObject.SetActive(false);
|
|
}
|
|
|
|
}
|
|
|
|
Debug.Log(this.gameObject.name);
|
|
}
|
|
}
|