55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using Cysharp.Threading.Tasks;
|
|
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace AZTECHWB.UI
|
|
{
|
|
public class ExitProgramPanel : UIPanel
|
|
{
|
|
public Button Button_Exit;
|
|
public Button Button_Cancel;
|
|
public Button Button_Close;
|
|
|
|
private LayerPanel layerPanel;
|
|
|
|
public override async UniTask Init()
|
|
{
|
|
Button_Exit = GetElement<Button>(nameof(Button_Exit));
|
|
Button_Cancel = GetElement<Button>(nameof(Button_Cancel));
|
|
Button_Close = GetElement<Button>(nameof(Button_Close));
|
|
|
|
Button_Exit.onClick.AddListener(OnClickExitButton);
|
|
Button_Cancel.onClick.AddListener(OnClickCancelButton);
|
|
Button_Close.onClick.AddListener(OnClickCancelButton);
|
|
layerPanel = FindAnyObjectByType<LayerPanel>(FindObjectsInactive.Include);
|
|
|
|
await UniTask.CompletedTask;
|
|
}
|
|
public override void Open()
|
|
{
|
|
gameObject.SetActive(true);
|
|
layerPanel.Open();
|
|
gameObject.transform.SetAsLastSibling();
|
|
}
|
|
public override void Close()
|
|
{
|
|
layerPanel.Close();
|
|
gameObject.SetActive(false);
|
|
}
|
|
private void OnClickExitButton()
|
|
{
|
|
#if UNITY_EDITOR
|
|
UnityEditor.EditorApplication.isPlaying = false;
|
|
#else
|
|
Application.Quit(); // ¾îÇø®ÄÉÀÌ¼Ç Á¾·á
|
|
#endif
|
|
}
|
|
private void OnClickCancelButton()
|
|
{
|
|
Close();
|
|
}
|
|
}
|
|
}
|
|
|