1
This commit is contained in:
39
Unity/Scripts/UX/Core/UXWindow.cs
Normal file
39
Unity/Scripts/UX/Core/UXWindow.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user