r2mods/ilspy_dump/ror2_csproj/RoR2.UI/UILayerSetFromParent.cs

41 lines
838 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
namespace RoR2.UI;
[RequireComponent(typeof(HGButton))]
public class UILayerSetFromParent : MonoBehaviour
{
private UILayerKey FoundLayer;
[SerializeField]
private UILayer layerToFind;
private void Awake()
{
HGButton component = GetComponent<HGButton>();
if ((object)component == null)
{
return;
}
IUILayerKeyProvider[] componentsInParent = base.gameObject.GetComponentsInParent<IUILayerKeyProvider>();
for (int i = 0; i < componentsInParent.Length; i++)
{
UILayerKey uILayerKey = componentsInParent[i].GetUILayerKey();
if ((object)uILayerKey.layer == layerToFind)
{
FoundLayer = uILayerKey;
component.requiredTopLayer = uILayerKey;
break;
}
}
}
public void SetLayerActive(bool NewActive)
{
if ((bool)FoundLayer)
{
FoundLayer.enabled = NewActive;
}
}
}