39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
using UnityEngine.Events;
|
|
namespace BITKit.UX
|
|
{
|
|
public interface IWindowComponent : IActivable { }
|
|
public class UXWindow : UXElement<VisualElement>
|
|
{
|
|
IWindowComponent[] components;
|
|
public override void Set(bool active)
|
|
{
|
|
try
|
|
{
|
|
visualElement.style.display = (active) ? DisplayStyle.Flex : DisplayStyle.None;
|
|
}
|
|
catch (System.Exception)
|
|
{
|
|
BIT4Log.Warnning(gameObject);
|
|
throw;
|
|
}
|
|
foreach (var x in components)
|
|
{
|
|
x.SetActive(active);
|
|
}
|
|
}
|
|
public override void OnStart()
|
|
{
|
|
base.OnStart();
|
|
components = GetComponentsInChildren<IWindowComponent>(true);
|
|
|
|
if(visualElement is null)
|
|
{
|
|
Debug.Log($"{transform.name} bind failure");
|
|
}
|
|
}
|
|
}
|
|
} |