2025-01-27 22:11:24 -05:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
2025-02-13 02:04:41 -05:00
|
|
|
using TMPro;
|
2025-01-27 22:11:24 -05:00
|
|
|
using UnityEngine;
|
2025-03-02 02:18:28 -05:00
|
|
|
using UnityEngine.Events;
|
2025-02-13 02:04:41 -05:00
|
|
|
using UnityEngine.Serialization;
|
|
|
|
|
using UnityEngine.UI;
|
2025-01-27 22:11:24 -05:00
|
|
|
|
2025-02-13 02:04:41 -05:00
|
|
|
namespace Ichni.Editor
|
2025-01-27 22:11:24 -05:00
|
|
|
{
|
2025-02-13 02:04:41 -05:00
|
|
|
public abstract class MovableWindow : MonoBehaviour
|
2025-01-27 22:11:24 -05:00
|
|
|
{
|
2025-02-13 02:04:41 -05:00
|
|
|
public RectTransform windowRect;
|
|
|
|
|
public Button closeButton;
|
|
|
|
|
public TMP_Text title;
|
2025-03-02 02:18:28 -05:00
|
|
|
public UnityAction onCloseWindow;
|
2025-03-20 19:30:42 -04:00
|
|
|
public UnityAction onQuit;
|
2025-03-01 12:50:13 -05:00
|
|
|
|
2025-03-02 02:18:28 -05:00
|
|
|
protected void InitializeWindow(string titleText, UnityAction closeAction = null)
|
2025-03-01 12:50:13 -05:00
|
|
|
{
|
|
|
|
|
title.text = titleText;
|
2025-03-02 02:18:28 -05:00
|
|
|
onCloseWindow = closeAction;
|
2025-03-01 12:50:13 -05:00
|
|
|
closeButton.onClick.AddListener(() =>
|
|
|
|
|
{
|
2025-03-02 02:18:28 -05:00
|
|
|
onCloseWindow?.Invoke();
|
2025-03-20 19:30:42 -04:00
|
|
|
onQuit?.Invoke();
|
2025-03-02 02:18:28 -05:00
|
|
|
Destroy(gameObject);
|
2025-03-01 12:50:13 -05:00
|
|
|
});
|
2025-07-15 14:06:56 +08:00
|
|
|
StartCoroutine(WindowAnim.ShowPanelOnScale(gameObject));
|
2025-03-01 12:50:13 -05:00
|
|
|
}
|
2025-01-27 22:11:24 -05:00
|
|
|
}
|
2025-02-13 02:04:41 -05:00
|
|
|
}
|