Neg_Utils/NEG/UI/UnityUi/Buttons/OpenWindow.cs

21 lines
595 B
C#

using NEG.UI.UnityUi.Window;
using NEG.UI.UnityUi.WindowSlot;
using System;
using UnityEngine;
using NEG.UI.Window;
using NEG.UI.WindowSlot;
namespace NEG.UI.UnityUi.Buttons
{
[RequireComponent(typeof(BaseButton))]
public class OpenWindow : MonoBehaviour
{
[SerializeField] private MonoWindow window;
[Header("Open on default area slot if empty")]
[SerializeField] private MonoWindowSlot slot;
private void Awake() => GetComponent<BaseButton>().OnButtonPressed += OnClicked;
private void OnClicked() => window.Open(slot);
}
}