From 47cd76aebcbd5ea20fe63c5371c05ce41af8c48b Mon Sep 17 00:00:00 2001 From: dal4segno Date: Wed, 4 Feb 2026 13:39:53 +0900 Subject: [PATCH] =?UTF-8?q?esc(Cancel)=EB=A1=9C=20=EA=B1=B4=EC=84=A4?= =?UTF-8?q?=EB=AA=A8=EB=93=9C=20=EC=B7=A8=EC=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/BuildingPlacement.cs | 14 +++++++++++++- Assets/Scripts/BuildingQuickslotUI.cs | 10 ++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/BuildingPlacement.cs b/Assets/Scripts/BuildingPlacement.cs index 52014da..ba0ad4c 100644 --- a/Assets/Scripts/BuildingPlacement.cs +++ b/Assets/Scripts/BuildingPlacement.cs @@ -148,12 +148,24 @@ namespace Northbound private void OnCancel(InputAction.CallbackContext context) { - // 드래그 중일 때만 취소 + // 드래그 중일 때 드래그 취소 if (isDragging && isBuildModeActive) { CancelDrag(); Debug.Log("[BuildingPlacement] 드래그 건설 취소됨"); } + // 건설 모드 활성화 상태면 건설 모드 종료 + else if (isBuildModeActive) + { + isBuildModeActive = false; + if (BuildingQuickslotUI.Instance != null) + { + BuildingQuickslotUI.Instance.HideQuickslot(); + } + DestroyPreview(); + ClearDragPreviews(); + Debug.Log("[BuildingPlacement] 건설 모드 취소됨"); + } } private void OnToggleBuildMode(InputAction.CallbackContext context) diff --git a/Assets/Scripts/BuildingQuickslotUI.cs b/Assets/Scripts/BuildingQuickslotUI.cs index f4dc709..db43264 100644 --- a/Assets/Scripts/BuildingQuickslotUI.cs +++ b/Assets/Scripts/BuildingQuickslotUI.cs @@ -29,6 +29,7 @@ namespace Northbound private List slotButtons = new List(); private BuildingPlacement buildingPlacement; private int currentSelectedIndex = -1; + private int lastSelectedIndex = 0; private PlayerInputActions _inputActions; private InputAction[] _quickslotActions; @@ -234,8 +235,12 @@ namespace Northbound // 퀵슬롯 입력 활성화 EnableQuickslotActions(true); - // 기본 선택 (첫 번째 건물) - if (slotButtons.Count > 0) + // 마지막으로 선택된 건물 선택 + if (slotButtons.Count > 0 && lastSelectedIndex >= 0 && lastSelectedIndex < slotButtons.Count) + { + SelectBuilding(lastSelectedIndex); + } + else if (slotButtons.Count > 0) { SelectBuilding(0); } @@ -286,6 +291,7 @@ namespace Northbound // 새로운 선택 currentSelectedIndex = index; + lastSelectedIndex = index; slotButtons[index].SetSelected(true); // BuildingPlacement에 알림