단축키, UndoRedo 개발중

This commit is contained in:
logonkhi
2025-12-22 19:49:36 +09:00
parent ac071813f4
commit 94dd7782ae
61 changed files with 5433 additions and 1628 deletions

View File

@@ -192,6 +192,7 @@ namespace UVC.UI.Toolbar.Model
/// 버튼 클릭 로직을 실행합니다.
/// 이 메서드는 일반적으로 UI 시스템(예: Unity UI의 Button.onClick 이벤트)에 의해 호출되도록 설계됩니다.
/// 버튼이 활성화(IsEnabled == true)되어 있고 ClickCommand가 할당되어 있다면, 해당 커맨드를 실행합니다.
/// IUndoableCommand인 경우 UndoRedoManager를 통해 실행하여 Undo/Redo 히스토리에 기록됩니다.
/// 파생 클래스에서 이 메서드를 재정의하여 특정 버튼 타입에 맞는 추가적인 클릭 동작을 구현할 수 있습니다.
/// </summary>
/// <param name="parameter">ClickCommand에 전달할 선택적 파라미터입니다.</param>
@@ -199,7 +200,30 @@ namespace UVC.UI.Toolbar.Model
{
if (!IsEnabled) return;
ClickCommand?.Execute(parameter); // 커맨드에 파라미터 전달
if (ClickCommand != null)
{
// IUndoableCommand인 경우 UndoRedoManager를 통해 실행
if (ClickCommand is IUndoableCommand undoableCommand)
{
// UndoRedoManager가 존재하는지 확인 (Studio 씬에서만 사용 가능)
var undoRedoManager = UnityEngine.Object.FindAnyObjectByType<UVC.Studio.Manager.UndoRedoManager>();
if (undoRedoManager != null)
{
undoRedoManager.ExecuteCommand(undoableCommand, parameter);
}
else
{
// UndoRedoManager가 없으면 직접 실행
ClickCommand.Execute(parameter);
}
}
else
{
// 일반 ICommand는 직접 실행
ClickCommand.Execute(parameter);
}
}
OnClicked?.Invoke(); // 클릭 이벤트 발생
}