modal 개발 중
This commit is contained in:
33
Assets/Scripts/UVC/UI/Commands/ChangeLanguageCommand.cs
Normal file
33
Assets/Scripts/UVC/UI/Commands/ChangeLanguageCommand.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UVC.Locale;
|
||||
using UVC.Log;
|
||||
|
||||
namespace UVC.UI.Commands
|
||||
{
|
||||
|
||||
// 언어 변경 커맨드
|
||||
public class ChangeLanguageCommand : ICommand
|
||||
{
|
||||
private readonly string _languageCode;
|
||||
|
||||
public ChangeLanguageCommand(string languageCode)
|
||||
{
|
||||
_languageCode = languageCode;
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
LocalizationManager _localizationManager = LocalizationManager.Instance;
|
||||
if (_localizationManager != null)
|
||||
{
|
||||
_localizationManager.SetCurrentLanguage(_languageCode);
|
||||
ULog.Debug($"언어가 {_languageCode}(으)로 변경되었습니다. (Command)");
|
||||
}
|
||||
else
|
||||
{
|
||||
ULog.Error("LocalizationManager가 ChangeLanguageCommand에 전달되지 않았습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
20
Assets/Scripts/UVC/UI/Commands/DebugLogCommand.cs
Normal file
20
Assets/Scripts/UVC/UI/Commands/DebugLogCommand.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UVC/UI/Commands/DebugLogCommand.cs.meta
Normal file
2
Assets/Scripts/UVC/UI/Commands/DebugLogCommand.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30eecf77a607ebb4cb25eb2c27d24389
|
||||
@@ -1,62 +0,0 @@
|
||||
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에 전달되지 않았습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Assets/Scripts/UVC/UI/Commands/Mono.meta
Normal file
8
Assets/Scripts/UVC/UI/Commands/Mono.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6098959b5d11f8409d2e13ac60b4ee0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using UVC.Locale;
|
||||
using UVC.Log;
|
||||
|
||||
namespace UVC.UI.Commands.Mono
|
||||
{
|
||||
public class ChangeLanguageCommandMono : MonoBehaviourCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
//언어가 2개 인경우 switch 시킴
|
||||
LocalizationManager _localizationManager = LocalizationManager.Instance;
|
||||
if (_localizationManager != null)
|
||||
{
|
||||
string _languageCode = _localizationManager.CurrentLanguage;
|
||||
List<string> allLan = _localizationManager.AvailableLanguages;
|
||||
if (allLan.Count == 0)
|
||||
{
|
||||
ULog.Error("사용 가능한 언어가 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (string lang in allLan)
|
||||
{
|
||||
if(_languageCode != lang)
|
||||
{
|
||||
_languageCode = lang;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_localizationManager.SetCurrentLanguage(_languageCode);
|
||||
ULog.Debug($"언어가 {_languageCode}(으)로 변경되었습니다. (Command)");
|
||||
}
|
||||
else
|
||||
{
|
||||
ULog.Error("LocalizationManager가 ChangeLanguageCommand에 전달되지 않았습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebbb0027d30b4fc499f841193050cb79
|
||||
14
Assets/Scripts/UVC/UI/Commands/Mono/MonoBehaviourCommand.cs
Normal file
14
Assets/Scripts/UVC/UI/Commands/Mono/MonoBehaviourCommand.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace UVC.UI.Commands.Mono
|
||||
{
|
||||
public class MonoBehaviourCommand : MonoBehaviour, ICommand
|
||||
{
|
||||
// MonoCommand는 MonoBehaviour를 상속받아 Unity의 생명주기를 활용할 수 있습니다.
|
||||
// ICommand 인터페이스를 구현하여 명령 패턴을 따릅니다.
|
||||
public virtual void Execute()
|
||||
{
|
||||
// 기본 실행 로직 (필요시 override 가능)
|
||||
Debug.Log("MonoCommand executed.");
|
||||
} }
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d397ba1578c376943a1e6b9c25deafe3
|
||||
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
using UVC.Log;
|
||||
|
||||
namespace UVC.UI.Commands.Mono
|
||||
{
|
||||
public class QuitApplicationCommandMono : MonoBehaviourCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
new QuitApplicationCommand().Execute();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2480dc463c63bf945a9488183ffe66d0
|
||||
19
Assets/Scripts/UVC/UI/Commands/QuitApplicationCommand.cs
Normal file
19
Assets/Scripts/UVC/UI/Commands/QuitApplicationCommand.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
using UVC.Log;
|
||||
|
||||
namespace UVC.UI.Commands
|
||||
{
|
||||
// 애플리케이션 종료 커맨드
|
||||
public class QuitApplicationCommand : ICommand
|
||||
{
|
||||
public void Execute()
|
||||
{
|
||||
ULog.Debug("애플리케이션을 종료합니다.");
|
||||
Application.Quit();
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false; // 에디터에서 실행 중일 경우 플레이 모드 종료
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab6dafe99d95c304f8b4a697cd6f3320
|
||||
Reference in New Issue
Block a user