data package 정리
This commit is contained in:
@@ -26,8 +26,8 @@ namespace UVC.UI.Commands
|
||||
}
|
||||
|
||||
// 제네릭 ActionCommand<T>는 이미 파라미터를 생성자에서 받으므로,
|
||||
// ICommand.Execute(object parameter)를 구현할 때 해당 파라미터를 사용하지 않거나,
|
||||
// 혹은 Execute(object) 호출 시 전달된 파라미터로 내부 _parameter를 덮어쓰는 등의 정책을 정해야 합니다.
|
||||
// ICommand.Start(object parameter)를 구현할 때 해당 파라미터를 사용하지 않거나,
|
||||
// 혹은 Start(object) 호출 시 전달된 파라미터로 내부 _parameter를 덮어쓰는 등의 정책을 정해야 합니다.
|
||||
// 또는, ICommand<T> 인터페이스를 고려할 수도 있습니다 (아래 2번 방법).
|
||||
public class ActionCommand<T> : ICommand<T> // ICommand<T>를 구현
|
||||
{
|
||||
@@ -49,18 +49,18 @@ namespace UVC.UI.Commands
|
||||
_useDefaultParameterForParameterlessExecute = useDefaultForParameterless;
|
||||
}
|
||||
|
||||
// ICommand<T>의 Execute(T parameter) 구현
|
||||
// ICommand<T>의 Start(T parameter) 구현
|
||||
public void Execute(T parameter)
|
||||
{
|
||||
_action.Invoke(parameter);
|
||||
}
|
||||
|
||||
// ICommand<T> 인터페이스에 의해 추가된 파라미터 없는 Execute()
|
||||
// 기본 구현은 Execute(default(T))를 호출합니다.
|
||||
// ICommand<T> 인터페이스에 의해 추가된 파라미터 없는 Start()
|
||||
// 기본 구현은 Start(default(T))를 호출합니다.
|
||||
// 이 메서드는 ICommand<T>의 기본 인터페이스 메서드에 의해 제공되므로,
|
||||
// 여기서 명시적으로 재정의할 필요는 없습니다. (void ICommand<T>.Execute() => Execute(default(T));)
|
||||
// 여기서 명시적으로 재정의할 필요는 없습니다. (void ICommand<T>.Start() => Start(default(T));)
|
||||
// 만약 다른 동작을 원한다면 여기서 재정의할 수 있습니다.
|
||||
// public new void Execute() // 'new'는 인터페이스의 기본 구현을 숨기기 위함이 아님.
|
||||
// public new void Start() // 'new'는 인터페이스의 기본 구현을 숨기기 위함이 아님.
|
||||
// {
|
||||
// if (_useDefaultParameterForParameterlessExecute)
|
||||
// {
|
||||
@@ -69,12 +69,12 @@ namespace UVC.UI.Commands
|
||||
// else
|
||||
// {
|
||||
// // 또는 예외를 발생시키거나, 로깅 후 아무것도 하지 않음
|
||||
// Debug.LogWarning($"ActionCommand<{typeof(T).Name}>의 파라미터 없는 Execute()가 호출되었으나, 기본 파라미터 사용이 설정되지 않았습니다.");
|
||||
// Debug.LogWarning($"ActionCommand<{typeof(T).Name}>의 파라미터 없는 Start()가 호출되었으나, 기본 파라미터 사용이 설정되지 않았습니다.");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// ICommand의 Execute(object parameter = null) 구현
|
||||
// ICommand의 Start(object parameter = null) 구현
|
||||
void ICommand.Execute(object parameter) // 명시적 인터페이스 구현
|
||||
{
|
||||
if (parameter is T typedParameter)
|
||||
@@ -96,7 +96,7 @@ namespace UVC.UI.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"ActionCommand<{typeof(T).Name}>.Execute(object): 잘못된 파라미터 타입입니다. 기대: {typeof(T).Name}, 실제: {parameter.GetType().Name}");
|
||||
Debug.LogError($"ActionCommand<{typeof(T).Name}>.Start(object): 잘못된 파라미터 타입입니다. 기대: {typeof(T).Name}, 실제: {parameter.GetType().Name}");
|
||||
// 예외를 발생시킬 수도 있습니다: throw new ArgumentException("잘못된 파라미터 타입입니다.", nameof(parameter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace UVC.UI.Commands
|
||||
{
|
||||
string targetLanguage = _languageCode;
|
||||
|
||||
// Execute 호출 시 전달된 파라미터가 있다면 그것을 우선 사용
|
||||
// Start 호출 시 전달된 파라미터가 있다면 그것을 우선 사용
|
||||
if (parameter is string langCodeFromParam && !string.IsNullOrEmpty(langCodeFromParam))
|
||||
{
|
||||
targetLanguage = langCodeFromParam;
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
{
|
||||
void Execute(T parameter);
|
||||
|
||||
void Execute() => Execute(default(T)); // 기본 Execute 구현 제공 가능
|
||||
void Execute() => Execute(default(T)); // 기본 Start 구현 제공 가능
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UVC.Data;
|
||||
using UVC.Data.Core;
|
||||
using UVC.Factory.Component;
|
||||
using UVC.Locale;
|
||||
using UVC.Log;
|
||||
|
||||
Reference in New Issue
Block a user