Files
XRLib/Assets/Scripts/UVC/UI/Commands/MenuCommands.cs

63 lines
1.7 KiB
C#
Raw Normal View History

using System;
using UnityEngine;
using UVC.Locale;
using UVC.Log;
namespace UVC.UI.Commands
{
// 간단한 디버그 로그 출력 커맨드
public class DebugLogCommand : ICommand
{
private readonly string _message;
public DebugLogCommand(string message)
{
_message = message;
}
public void Execute()
{
ULog.Debug(_message);
}
}
// 애플리케이션 종료 커맨드
public class QuitApplicationCommand : ICommand
{
public void Execute()
{
ULog.Debug("애플리케이션을 종료합니다.");
Application.Quit();
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false; // 에디터에서 실행 중일 경우 플레이 모드 종료
#endif
}
}
// 언어 변경 커맨드
public class ChangeLanguageCommand : ICommand
{
private readonly string _languageCode;
private readonly LocalizationManager _localizationManager;
public ChangeLanguageCommand(string languageCode, LocalizationManager localizationManager)
{
_languageCode = languageCode;
_localizationManager = localizationManager;
}
public void Execute()
{
if (_localizationManager != null)
{
_localizationManager.SetCurrentLanguage(_languageCode);
ULog.Debug($"언어가 {_languageCode}(으)로 변경되었습니다. (Command)");
}
else
{
ULog.Error("LocalizationManager가 ChangeLanguageCommand에 전달되지 않았습니다.");
}
}
}
}