상호작용 시 모달 UI 추가(임시)

기타 디버깅 로그 제거
This commit is contained in:
2026-02-03 21:32:16 +09:00
parent 02f5aa869a
commit 965a4a25aa
22 changed files with 1082 additions and 363 deletions

View File

@@ -104,15 +104,8 @@ namespace Northbound
{
int slotIndex = i; // 클로저 캡처를 위한 로컬 변수
_quickslotActions[i].performed += ctx => OnQuickslotPressed(slotIndex);
// Debug.Log($"[BuildingQuickslotUI] QuickSlot{i + 1} 액션 바인딩 성공");
}
else
{
Debug.LogWarning($"[BuildingQuickslotUI] QuickSlot{i + 1} 액션이 null입니다. Input Actions 에셋을 확인하세요.");
}
}
Debug.Log($"[BuildingQuickslotUI] {_quickslotActions.Length}개의 퀵슬롯 액션 초기화됨 (최대 8개 키 바인딩)");
}
/// <summary>
@@ -201,8 +194,6 @@ namespace Northbound
{
CreateSlot(buildings[i], i);
}
Debug.Log($"[BuildingQuickslotUI] {slotButtons.Count}개의 건물 슬롯 생성됨");
}
/// <summary>
@@ -248,8 +239,6 @@ namespace Northbound
{
SelectBuilding(0);
}
Debug.Log("[BuildingQuickslotUI] 건설 퀵슬롯 표시됨");
}
/// <summary>
@@ -279,8 +268,6 @@ namespace Northbound
if (slot != null)
slot.SetSelected(false);
}
Debug.Log("[BuildingQuickslotUI] 건설 퀵슬롯 숨김");
}
/// <summary>
@@ -309,8 +296,6 @@ namespace Northbound
// Description Panel 업데이트
UpdateDescriptionPanel();
Debug.Log($"[BuildingQuickslotUI] 건물 선택됨: {slotButtons[index].GetBuildingName()} (인덱스: {index})");
}
/// <summary>

View File

@@ -66,7 +66,6 @@ namespace Northbound
private void OnHealthChanged(int previousValue, int newValue)
{
Debug.Log($"<color=red>[Core] 코어 체력 변경: {previousValue} → {newValue} ({newValue}/{maxHealth})</color>");
}
#region ITeamMember Implementation
@@ -94,8 +93,6 @@ namespace Northbound
int actualDamage = Mathf.Min(damage, _currentHealth.Value);
_currentHealth.Value -= actualDamage;
Debug.Log($"<color=red>[Core] 코어가 {actualDamage} 데미지를 받았습니다! 남은 체력: {_currentHealth.Value}/{maxHealth}</color>");
// 데미지 이펙트
ShowDamageEffectClientRpc();
@@ -110,8 +107,6 @@ namespace Northbound
{
if (!IsServer) return;
Debug.Log($"<color=red>[Core] 코어가 파괴되었습니다! 게임 오버!</color>");
// 파괴 이펙트
ShowDestroyEffectClientRpc();
@@ -165,8 +160,6 @@ namespace Northbound
int previousAmount = _totalResources.Value;
_totalResources.Value -= amount;
Debug.Log($"<color=yellow>[Core] {amount} 자원 소비. 남은 자원: {_totalResources.Value}/{maxStorageCapacity}</color>");
}
/// <summary>
@@ -185,8 +178,6 @@ namespace Northbound
if (amount > 0)
{
_totalResources.Value += amount;
Debug.Log($"<color=green>[Core] {amount} 자원 추가. 총 자원: {_totalResources.Value}" +
(unlimitedStorage ? "" : $"/{maxStorageCapacity}") + "</color>");
}
}
@@ -230,11 +221,11 @@ namespace Northbound
{
if (unlimitedStorage)
{
return "[E] 자원 보관 (무제한)";
return "[E] Deposit (No Limit)";
}
else
{
return $"[E] 자원 보관 ({_totalResources.Value}/{maxStorageCapacity})";
return $"[E] Deposit ({_totalResources.Value}/{maxStorageCapacity})";
}
}
@@ -269,7 +260,6 @@ namespace Northbound
int playerResourceAmount = resourceManager.GetPlayerResourceAmount(playerId);
if (playerResourceAmount <= 0)
{
Debug.Log($"플레이어 {playerId}가 건낼 자원이 없습니다.");
return;
}
@@ -292,7 +282,6 @@ namespace Northbound
if (depositAmount <= 0)
{
Debug.Log($"코어의 저장 공간이 부족합니다.");
return;
}
@@ -300,9 +289,6 @@ namespace Northbound
UpdatePlayerResourcesClientRpc(playerId);
_totalResources.Value += depositAmount;
Debug.Log($"<color=green>[Core] 플레이어 {playerId}가 {depositAmount} 자원을 건넸습니다. 코어 총 자원: {_totalResources.Value}" +
(unlimitedStorage ? "" : $"/{maxStorageCapacity}") + "</color>");
ShowDepositEffectClientRpc();
}

View File

@@ -56,7 +56,6 @@ namespace Northbound
}
float remainingCost = campCostBudget * campStrength;
Debug.Log($"[CreepCamp] Cost budget: {campCostBudget} x {campStrength:F2} = {remainingCost:F2}");
int spawnedCount = 0;

View File

@@ -0,0 +1,90 @@
using TMPro;
using UnityEngine;
namespace Northbound
{
public class InteractableModal : MonoBehaviour
{
[Header("UI References")]
[SerializeField] private GameObject modalPanel;
[SerializeField] private TextMeshProUGUI keyText;
[SerializeField] private TextMeshProUGUI interactText;
[Header("Settings")]
[SerializeField] private string defaultKey = "E";
private IInteractable _currentInteractable;
private Canvas _parentCanvas;
private void Awake()
{
_parentCanvas = GetComponentInParent<Canvas>();
}
private void Start()
{
if (modalPanel != null)
{
modalPanel.SetActive(false);
}
}
public void ShowModal(IInteractable interactable)
{
if (interactable == null)
{
HideModal();
return;
}
_currentInteractable = interactable;
if (modalPanel != null)
{
modalPanel.SetActive(true);
UpdateModalContent();
}
}
public void HideModal()
{
_currentInteractable = null;
if (modalPanel != null)
{
modalPanel.SetActive(false);
}
}
public void UpdateModalContent()
{
if (_currentInteractable == null)
return;
if (keyText != null)
{
keyText.text = defaultKey;
}
if (interactText != null)
{
string prompt = _currentInteractable.GetInteractionPrompt();
interactText.text = ExtractInteractText(prompt);
}
}
private string ExtractInteractText(string prompt)
{
if (string.IsNullOrEmpty(prompt))
return string.Empty;
int startIndex = prompt.IndexOf(']');
if (startIndex >= 0 && startIndex + 1 < prompt.Length)
{
return prompt.Substring(startIndex + 1).Trim();
}
return prompt;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7008c42d5ce774d4d894f45b8a80a590

View File

@@ -0,0 +1,96 @@
using UnityEngine;
namespace Northbound
{
public class InteractableModalManager : MonoBehaviour
{
[Header("UI Reference")]
public InteractableModal interactableModal;
[Header("References")]
[SerializeField] private PlayerInteraction playerInteraction;
private IInteractable _currentInteractable;
private void Awake()
{
if (playerInteraction == null)
{
playerInteraction = GetComponent<PlayerInteraction>();
}
if (interactableModal == null)
{
interactableModal = FindObjectOfType<InteractableModal>();
}
}
private void Start()
{
if (interactableModal != null)
{
interactableModal.HideModal();
}
}
private void Update()
{
if (playerInteraction == null)
return;
IInteractable detectedInteractable = GetDetectedInteractable();
if (detectedInteractable != _currentInteractable)
{
_currentInteractable = detectedInteractable;
if (_currentInteractable != null)
{
ShowModal(_currentInteractable);
}
else
{
HideModal();
}
}
else if (_currentInteractable != null)
{
UpdateModalContent();
}
}
private IInteractable GetDetectedInteractable()
{
var field = playerInteraction.GetType().GetField("_currentInteractable", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
if (field != null)
{
return field.GetValue(playerInteraction) as IInteractable;
}
return null;
}
private void ShowModal(IInteractable interactable)
{
if (interactableModal != null)
{
interactableModal.ShowModal(interactable);
}
}
private void HideModal()
{
if (interactableModal != null)
{
interactableModal.HideModal();
}
}
private void UpdateModalContent()
{
if (interactableModal != null)
{
interactableModal.UpdateModalContent();
}
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: fe6ae668d2ff79344bfdd618dd0d962a

View File

@@ -211,8 +211,6 @@ namespace Northbound
}
GenerateCreepCamps();
Debug.Log($"[MapGenerator] Map generation complete!");
}
#region Resource Generation
@@ -233,7 +231,6 @@ namespace Northbound
{
_generatedResources = resources;
success = true;
Debug.Log($"[MapGenerator] Successfully generated resources on attempt {attempt + 1}");
break;
}
else
@@ -401,8 +398,6 @@ namespace Northbound
{
_generatedResources[i].finalProduction *= _globalProductionMultiplier;
}
Debug.Log($"[MapGenerator] Resource fallback layout generated. Global multiplier: {_globalProductionMultiplier:F2}");
}
private void SpawnResources()
@@ -452,15 +447,12 @@ namespace Northbound
{
if (obstacles.Count == 0)
{
Debug.Log("[MapGenerator] No obstacles configured, skipping obstacle generation.");
return;
}
int totalSpawned = 0;
int targetCount = Mathf.RoundToInt(maxTotalObstacles * obstacleDensity);
Debug.Log($"[MapGenerator] Starting obstacle generation. Target: {targetCount}, Density: {obstacleDensity}");
foreach (var obstacle in obstacles)
{
if (obstacle.prefab == null)
@@ -475,7 +467,6 @@ namespace Northbound
if (TrySpawnObstacle(obstacle))
{
totalSpawned++;
Debug.Log($"[MapGenerator] Spawned min required obstacle: {obstacle.prefab.name}");
}
}
}
@@ -513,8 +504,6 @@ namespace Northbound
consecutiveFailures++;
}
}
Debug.Log($"[MapGenerator] Spawned {totalSpawned} obstacles (target: {targetCount}). Consecutive failures: {consecutiveFailures}");
}
private bool TrySpawnObstacle(ObstacleEntry obstacleEntry)
@@ -697,7 +686,7 @@ namespace Northbound
return;
}
Debug.Log($"[MapGenerator] Starting creep camp generation. Resources: {_generatedResources.Length}, Additional camps: {additionalCreepCampCount}");
int totalCampsSpawned = 0;
@@ -707,7 +696,6 @@ namespace Northbound
if (campPosition != Vector3.zero)
{
float strength = CalculateCampStrength(_generatedResources[i].position.y, isResourceCamp: true);
Debug.Log($"[MapGenerator] Spawning resource camp {i + 1} for resource at {_generatedResources[i].position}, position: {campPosition}, strength: {strength:F2} (with bonus)");
SpawnCreepCamp(campPosition, strength);
_creepCampPositions.Add(campPosition);
totalCampsSpawned++;
@@ -721,29 +709,22 @@ namespace Northbound
if (campPosition != Vector3.zero)
{
float strength = CalculateCampStrength(campPosition.z, isResourceCamp: false);
Debug.Log($"[MapGenerator] Spawning additional camp {i + 1}, position: {campPosition}, strength: {strength:F2}");
SpawnCreepCamp(campPosition, strength);
_creepCampPositions.Add(campPosition);
additionalSpawned++;
}
}
Debug.Log($"[MapGenerator] Spawned {totalCampsSpawned} resource-based camps and {additionalSpawned} additional camps. Total: {totalCampsSpawned + additionalSpawned}");
}
private void LoadCreepPrefabs()
{
Debug.Log($"[MapGenerator] LoadCreepPrefabs called, current count: {_creepPrefabs.Count}");
if (_creepPrefabs.Count > 0)
{
Debug.Log($"[MapGenerator] Skipping load, already have {_creepPrefabs.Count} prefabs");
return;
}
#if UNITY_EDITOR
string[] prefabGuids = UnityEditor.AssetDatabase.FindAssets("t:Prefab", new[] { "Assets/Prefabs/Creep" });
Debug.Log($"[MapGenerator] Found {prefabGuids.Length} prefabs in Assets/Prefabs/Creep/");
_creepPrefabs.Clear();
foreach (string guid in prefabGuids)
@@ -754,18 +735,13 @@ namespace Northbound
if (prefab != null && prefab.GetComponent<CreepDataComponent>() != null)
{
_creepPrefabs.Add(prefab);
Debug.Log($"[MapGenerator] Added creep prefab: {prefab.name}");
}
}
#else
Debug.LogWarning("[MapGenerator] Creep prefabs not loaded in build. Please assign creep prefabs manually in Inspector.");
#endif
if (_creepPrefabs.Count > 0)
{
Debug.Log($"[MapGenerator] Loaded {_creepPrefabs.Count} creep prefabs from Assets/Prefabs/Creep/");
}
else
if (_creepPrefabs.Count == 0)
{
Debug.LogWarning("[MapGenerator] No creep prefabs loaded!");
}

View File

@@ -81,7 +81,6 @@ namespace Northbound
{
if (!_currentInteractable.CanInteract(OwnerClientId))
{
Debug.Log("[PlayerInteraction] Interactable no longer valid - ending interaction");
EndInteraction();
}
}
@@ -202,7 +201,6 @@ namespace Northbound
_interactionTimeoutCoroutine = null;
}
_isInteracting = false;
Debug.Log($"[PlayerInteraction] Owner {OwnerClientId} - 상호작용 완료");
}
// ========================================

View File

@@ -253,7 +253,6 @@ namespace Northbound
[Rpc(SendTo.Server, InvokePermission = RpcInvokePermission.Everyone)]
private void AssignOrGatherResourceServerRpc(ulong playerId, ulong resourceId)
{
Debug.Log($"[Resource] AssignOrGatherResourceServerRpc called - PlayerID: {playerId}, ResourceID: {resourceId}");
bool workerAssigned = false;
@@ -264,11 +263,8 @@ namespace Northbound
if (assignedWorker != null)
{
Debug.Log($"[Resource] Worker found server-side - OwnerPlayerId: {assignedWorker.OwnerPlayerId}, CurrentState: {(int)assignedWorker.CurrentState}");
if ((int)assignedWorker.CurrentState == 1) // 1 = Following
{
Debug.Log($"[Resource] ✓ Assigning worker to resource!");
assignedWorker.AssignMiningTargetServerRpc(resourceId);
workerAssigned = true;
@@ -279,10 +275,6 @@ namespace Northbound
Debug.LogWarning($"[Resource] Worker not in Following state! State: {(int)assignedWorker.CurrentState}");
}
}
else
{
Debug.Log($"[Resource] No worker found for player {playerId} in Following state");
}
}
if (!workerAssigned)
@@ -354,9 +346,9 @@ namespace Northbound
public string GetInteractionPrompt()
{
if (_currentResources.Value <= 0)
return "자원 충전 중...";
return "Recharging...";
return $"[E] {resourceName} 채집 ({_currentResources.Value}/{ActualMaxResources})";
return $"[E] {resourceName} Mining ({_currentResources.Value}/{ActualMaxResources})";
}
public string GetInteractionAnimation()
@@ -376,8 +368,6 @@ namespace Northbound
private Worker FindWorkerForPlayer(ulong playerId)
{
Debug.Log($"[Resource] FindWorkerForPlayer called - Looking for worker assigned to player {playerId}");
if (NetworkManager.Singleton == null || NetworkManager.Singleton.SpawnManager == null)
{
Debug.LogWarning($"[Resource] FindWorkerForPlayer - NetworkManager or SpawnManager is null");
@@ -396,18 +386,15 @@ namespace Northbound
if (worker != null)
{
workersFound++;
Debug.Log($"[Resource] FindWorkerForPlayer - Found worker: {worker.gameObject.name}, OwnerPlayerId: {worker.OwnerPlayerId}, State: {(int)worker.CurrentState}");
// Use worker's internal OwnerPlayerId, NOT NetworkObject.OwnerClientId!
if (worker.OwnerPlayerId == playerId && (int)worker.CurrentState == 1) // 1 = Following
{
Debug.Log($"[Resource] FindWorkerForPlayer - ✓ Found worker: {worker.gameObject.name} for player {playerId}");
return worker;
}
}
}
Debug.LogWarning($"[Resource] FindWorkerForPlayer - Checked {objectsChecked} objects, found {workersFound} workers, no matching worker in Following state!");
return null;
}
}

View File

@@ -77,7 +77,6 @@ namespace Northbound
if (collectedAmount <= 0)
{
Debug.Log($"플레이어 {playerId}의 인벤토리가 가득 찼습니다.");
_isCollected = false;
return;
}
@@ -85,8 +84,6 @@ namespace Northbound
resourceManager.AddResource(playerId, collectedAmount);
UpdatePlayerResourcesClientRpc(playerId);
Debug.Log($"플레이어 {playerId}가 {collectedAmount} {resourceName}을(를) 획득했습니다.");
ShowPickupEffectClientRpc();
Invoke(nameof(DestroyPickup), 0.1f);
}
@@ -129,7 +126,7 @@ namespace Northbound
public string GetInteractionPrompt()
{
return $"[E] {resourceName} 획득 (+{resourceAmount})";
return $"[E] {resourceName} Get (+{resourceAmount})";
}
public string GetInteractionAnimation()

View File

@@ -113,7 +113,6 @@ namespace Northbound
if (cores.Length > 0)
{
_core = cores[0];
Debug.Log($"[Worker] 코어 찾음: {_core.name}");
}
}
@@ -466,9 +465,9 @@ namespace Northbound
{
var coreResourceManager = CoreResourceManager.Instance;
if (coreResourceManager != null && !coreResourceManager.CanAfford(recruitmentCost))
return $"자원 부족 (필요: {recruitmentCost})";
return $"Resource Required: {recruitmentCost})";
return $"[E] 워커 채용 - 비용: {recruitmentCost}";
return $"[E] Recruit Worker: {recruitmentCost}";
}
else if (NetworkManager.Singleton != null && _ownerPlayerId.Value == NetworkManager.Singleton.LocalClientId)
{
@@ -480,9 +479,9 @@ namespace Northbound
WorkerState.WaitingForResource => "자원 대기 중",
_ => "대기 중"
};
return $"워커 (가방: {_currentBagResources.Value}/{maxBagCapacity}) - {stateText}";
return $"Worker (Bag: {_currentBagResources.Value}/{maxBagCapacity}) - {stateText}";
}
return "다른 플레이어의 워커";
return "Not My Worker";
}
public string GetInteractionAnimation()

View File

@@ -44,7 +44,6 @@ namespace Northbound
private void OnWorkerCountChanged(int previousValue, int newValue)
{
Debug.Log($"[WorkerSpawner] 워커 수 변경: {previousValue} → {newValue}");
}
#region IInteractable Implementation
@@ -122,16 +121,14 @@ namespace Northbound
return;
}
// IMPORTANT: Spawn as server-owned so server can modify worker's NetworkVariables
workerNetObj.Spawn();
_lastSpawnTime = Time.time;
_workerCount.Value++;
// IMPORTANT: Spawn as server-owned so server can modify worker's NetworkVariables
workerNetObj.Spawn();
_lastSpawnTime = Time.time;
_workerCount.Value++;
ShowSpawnEffectClientRpc(spawnPosition);
ShowSpawnEffectClientRpc(spawnPosition);
Debug.Log($"[WorkerSpawner] Worker spawned (server-owned) and assigned to player {playerId} (Total: {_workerCount.Value}/{maxWorkers})");
ScheduleWorkerAssignment(playerId, workerNetObj.NetworkObjectId);
ScheduleWorkerAssignment(playerId, workerNetObj.NetworkObjectId);
}
private void ScheduleWorkerAssignment(ulong playerId, ulong workerNetObjectId)
@@ -179,7 +176,6 @@ namespace Northbound
if (worker != null)
{
playerInteraction.assignedWorker = worker;
Debug.Log($"[WorkerSpawner] Worker assigned to player {playerId}'s PlayerInteraction");
}
}
}
@@ -199,15 +195,15 @@ namespace Northbound
public string GetInteractionPrompt()
{
if (_workerCount.Value >= maxWorkers)
return $"워커 수 최대 ({_workerCount.Value}/{maxWorkers})";
return $"Worker ({_workerCount.Value}/{maxWorkers})";
float cooldownRemaining = Mathf.Max(0, spawnCooldown - (Time.time - _lastSpawnTime));
if (cooldownRemaining > 0)
return $"워커 생성 대기 중 ({cooldownRemaining:F1}s)";
return $"Waiting Worker... ({cooldownRemaining:F1}s)";
var coreResourceManager = CoreResourceManager.Instance;
if (coreResourceManager != null && !coreResourceManager.CanAfford(recruitmentCost))
return $"자원 부족 (필요: {recruitmentCost})";
return $"Resource Required: {recruitmentCost})";
return $"{interactionPrompt} ({_workerCount.Value}/{maxWorkers}) - 비용: {recruitmentCost}";
}