You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System;
|
|
using Unity.BossRoom.ApplicationLifecycle.Messages;
|
|
using Unity.BossRoom.ConnectionManagement;
|
|
using Unity.BossRoom.Infrastructure;
|
|
using UnityEngine;
|
|
using VContainer;
|
|
|
|
namespace Unity.BossRoom.Gameplay.UI
|
|
{
|
|
public class UIQuitPanel : MonoBehaviour
|
|
{
|
|
enum QuitMode
|
|
{
|
|
ReturnToMenu,
|
|
QuitApplication
|
|
}
|
|
|
|
[SerializeField]
|
|
QuitMode m_QuitMode = QuitMode.ReturnToMenu;
|
|
|
|
[Inject]
|
|
ConnectionManager m_ConnectionManager;
|
|
|
|
[Inject]
|
|
IPublisher<QuitApplicationMessage> m_QuitApplicationPub;
|
|
|
|
public void Quit()
|
|
{
|
|
switch (m_QuitMode)
|
|
{
|
|
case QuitMode.ReturnToMenu:
|
|
m_ConnectionManager.RequestShutdown();
|
|
break;
|
|
case QuitMode.QuitApplication:
|
|
m_QuitApplicationPub.Publish(new QuitApplicationMessage());
|
|
break;
|
|
default:
|
|
throw new ArgumentOutOfRangeException();
|
|
}
|
|
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|