53 lines
1.1 KiB (Stored with Git LFS)
C#
53 lines
1.1 KiB (Stored with Git LFS)
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Superlazy.UI
|
|
{
|
|
[RequireComponent(typeof(SLUIButton))]
|
|
public class SLUIWindowsList : SLUIComponent
|
|
{
|
|
private static readonly List<SLUIButton> buttons = new List<SLUIButton>();
|
|
private SLUIButton button;
|
|
|
|
protected override void Validate()
|
|
{
|
|
button = GetComponent<SLUIButton>();
|
|
}
|
|
|
|
protected override void Init()
|
|
{
|
|
}
|
|
|
|
protected override void Enable()
|
|
{
|
|
if (button)
|
|
{
|
|
buttons.Add(button);
|
|
}
|
|
}
|
|
|
|
protected override void Disable()
|
|
{
|
|
if (button)
|
|
{
|
|
buttons.Remove(button);
|
|
}
|
|
}
|
|
|
|
public static bool OnEscape()
|
|
{
|
|
var count = buttons.Count;
|
|
if (count == 0)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
var button = buttons[count - 1];
|
|
button.ButtonAction();
|
|
|
|
if (count == 1) return true;
|
|
buttons.RemoveAt(count - 1);
|
|
return true;
|
|
}
|
|
}
|
|
} |