55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Samkwang
|
|
{
|
|
public class Panel_ExitProgram : MonoBehaviour
|
|
{
|
|
public Button Button_Exit;
|
|
public Button Button_Cancel;
|
|
|
|
private Panel_Effect effect;
|
|
public Action<bool> isClickUI;
|
|
|
|
public void Init()
|
|
{
|
|
var buttonDict = transform.GetChildComponentsByName<Button>();
|
|
Button_Exit = buttonDict.GetOrNull(nameof(Button_Exit));
|
|
Button_Cancel = buttonDict.GetOrNull(nameof(Button_Cancel));
|
|
|
|
Button_Exit.onClick.AddListener(OnClickExitButton);
|
|
Button_Cancel.onClick.AddListener(OnClickCancelButton);
|
|
effect = FindAnyObjectByType<Panel_Effect>(FindObjectsInactive.Include);
|
|
}
|
|
public void Open()
|
|
{
|
|
gameObject.SetActive(true);
|
|
effect.ActivePanel();
|
|
gameObject.transform.SetAsLastSibling();
|
|
isClickUI?.Invoke(true);
|
|
}
|
|
public void Close()
|
|
{
|
|
effect.DeactivePanel();
|
|
gameObject.SetActive(false);
|
|
isClickUI?.Invoke(false);
|
|
}
|
|
private void OnClickExitButton()
|
|
{
|
|
#if UNITY_EDITOR
|
|
UnityEditor.EditorApplication.isPlaying = false;
|
|
#else
|
|
Application.Quit(); // ¾îÇø®ÄÉÀÌ¼Ç Á¾·á
|
|
#endif
|
|
}
|
|
private void OnClickCancelButton()
|
|
{
|
|
Close();
|
|
}
|
|
}
|
|
}
|
|
|