您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

43 行
1.2 KiB

using System;
using Unity.Multiplayer.Samples.BossRoom.ApplicationLifecycle.Messages;
using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure;
using UnityEngine;
using VContainer;
namespace Unity.Multiplayer.Samples.BossRoom.Client
{
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);
}
}
}