임시 건설 UI 생성

기타 불필요 디버깅 로그 제거
This commit is contained in:
2026-02-03 20:23:36 +09:00
parent 775e1cffac
commit 02f5aa869a
18 changed files with 2098 additions and 653 deletions

View File

@@ -16,8 +16,12 @@ namespace Northbound
[Header("UI References")]
[SerializeField] private GameObject quickslotPanel;
[SerializeField] private GameObject descriptionPanel;
[SerializeField] private Transform slotContainer;
[SerializeField] private GameObject slotButtonPrefab;
[SerializeField] private TextMeshProUGUI buildingNameText;
[SerializeField] private TextMeshProUGUI buildingDescriptionText;
[SerializeField] private TextMeshProUGUI buildingCostText;
[Header("Settings")]
[SerializeField] private int maxSlots = 8;
@@ -65,30 +69,15 @@ namespace Northbound
quickslotPanel.SetActive(false);
}
if (descriptionPanel != null)
{
descriptionPanel.SetActive(false);
}
InitializeSlots();
}
private void Update()
{
if (quickslotPanel != null && quickslotPanel.activeSelf)
{
UpdateCostDisplays();
}
}
/// <summary>
/// 모든 슬롯의 비용 표시 업데이트
/// </summary>
public void UpdateCostDisplays()
{
foreach (var slot in slotButtons)
{
if (slot != null)
{
slot.UpdateCostDisplay();
}
}
}
/// <summary>
/// 퀵슬롯 Input Actions 초기화 및 구독 (직접 참조)
@@ -246,6 +235,11 @@ namespace Northbound
quickslotPanel.SetActive(true);
}
if (descriptionPanel != null)
{
descriptionPanel.SetActive(true);
}
// 퀵슬롯 입력 활성화
EnableQuickslotActions(true);
@@ -268,6 +262,11 @@ namespace Northbound
quickslotPanel.SetActive(false);
}
if (descriptionPanel != null)
{
descriptionPanel.SetActive(false);
}
// 퀵슬롯 입력 비활성화
DisableQuickslotActions();
@@ -308,9 +307,45 @@ namespace Northbound
buildingPlacement.SetSelectedBuilding(index);
}
// Description Panel 업데이트
UpdateDescriptionPanel();
Debug.Log($"[BuildingQuickslotUI] 건물 선택됨: {slotButtons[index].GetBuildingName()} (인덱스: {index})");
}
/// <summary>
/// Description Panel 업데이트
/// </summary>
private void UpdateDescriptionPanel()
{
if (currentSelectedIndex < 0 || currentSelectedIndex >= slotButtons.Count)
return;
var selectedSlot = slotButtons[currentSelectedIndex];
if (selectedSlot == null || selectedSlot.BuildingData == null)
return;
var buildingData = selectedSlot.BuildingData;
if (buildingNameText != null)
{
buildingNameText.text = buildingData.buildingName;
}
if (buildingDescriptionText != null)
{
buildingDescriptionText.text = buildingData.memo;
}
if (buildingCostText != null)
{
var coreResourceManager = CoreResourceManager.Instance;
bool canAfford = coreResourceManager != null && coreResourceManager.CanAfford(buildingData.mana);
string costTextT = canAfford ? $"{buildingData.mana}" : $"<color=red>{buildingData.mana}</color>";
buildingCostText.text = $"{costTextT}";
}
}
/// <summary>
/// 현재 선택된 건물 인덱스
/// </summary>

View File

@@ -14,9 +14,7 @@ namespace Northbound
{
[Header("UI References")]
[SerializeField] private Image iconImage;
[SerializeField] private TextMeshProUGUI nameText;
[SerializeField] private TextMeshProUGUI hotkeyText;
[SerializeField] private TextMeshProUGUI costText;
[SerializeField] private Image backgroundImage;
[SerializeField] private Button button;
@@ -26,6 +24,8 @@ namespace Northbound
[SerializeField] private Color hoverColor = new Color(0.3f, 0.3f, 0.3f, 1f);
private TowerData buildingData;
public TowerData BuildingData => buildingData;
private int slotIndex;
private BuildingQuickslotUI quickslotUI;
private bool isSelected = false;
@@ -53,20 +53,7 @@ namespace Northbound
UpdateVisuals();
}
/// <summary>
/// 비용 표시 업데이트 (자원 변화 시 호출)
/// </summary>
public void UpdateCostDisplay()
{
if (nameText != null && buildingData != null)
{
var coreResourceManager = CoreResourceManager.Instance;
bool canAfford = coreResourceManager != null && coreResourceManager.CanAfford(buildingData.mana);
string costTextT = canAfford ? $"{buildingData.mana}" : $"<color=red>{buildingData.mana}</color>";
nameText.text = $"{buildingData.buildingName}";
costText.text = $"Cost: {costTextT}";
}
}
/// <summary>
/// UI 업데이트
@@ -76,7 +63,6 @@ namespace Northbound
if (buildingData == null) return;
// 아이콘 설정
/*
if (iconImage != null && buildingData.icon != null)
{
iconImage.sprite = buildingData.icon;
@@ -86,17 +72,6 @@ namespace Northbound
{
iconImage.enabled = false;
}
*/
iconImage.enabled = false;
// 이름 설정
if (nameText != null)
{
var coreResourceManager = CoreResourceManager.Instance;
bool canAfford = coreResourceManager != null && coreResourceManager.CanAfford(buildingData.mana);
string costTextT = canAfford ? $"{buildingData.mana}" : $"<color=red>{buildingData.mana}</color>";
nameText.text = $"{buildingData.buildingName}";
costText.text = $"Cost: {costTextT}";
}
// 배경 색상
UpdateBackgroundColor();

View File

@@ -44,12 +44,10 @@ namespace Northbound
{
creepPrefabs.Clear();
creepPrefabs.AddRange(prefabs);
Debug.Log($"[CreepCamp] SetCreepPrefabs called with {prefabs.Count} prefabs. Current count: {creepPrefabs.Count}");
}
private void SpawnCreeps()
{
Debug.Log($"[CreepCamp] Starting creep spawn at Z={_zPosition:F1}, strength={campStrength:F2}x, prefabs={creepPrefabs.Count}");
if (creepPrefabs.Count == 0)
{
@@ -88,13 +86,11 @@ namespace Northbound
continue;
}
Debug.Log($"[CreepCamp] Spawning {selectedCreep.name} (cost: {creepData.cost}, remaining: {remainingCost:F2})");
SpawnCreep(selectedCreep);
remainingCost -= creepData.cost;
spawnedCount++;
}
Debug.Log($"[CreepCamp] Spawned {spawnedCount} creeps at Z={_zPosition:F1} with strength {campStrength:F2}x");
}
private GameObject SelectCreepByCost(float remainingCost)

View File

@@ -55,8 +55,6 @@ namespace Northbound
{
navAgent.speed = creepData.moveSpeed;
}
Debug.Log($"[CreepDataComponent] Applied data for {creepData.id} ({creepData.memo})", this);
}
}
}

View File

@@ -1,176 +0,0 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
namespace Northbound.Editor
{
public class NetworkUIBuilder
{
[MenuItem("GameObject/Network/Create Network Join UI")]
public static void CreateNetworkJoinUI()
{
Canvas canvas = FindOrCreateCanvas();
GameObject panel = CreatePanel(canvas.transform);
InputField ipInput = CreateInputField(panel.transform, "IP Input", "127.0.0.1", 150);
InputField portInput = CreateInputField(panel.transform, "Port Input", "7777", 100);
Button joinButton = CreateButton(panel.transform, "Join", new Vector2(0, -80));
Button hostButton = CreateButton(panel.transform, "Host", new Vector2(-60, -80));
Button disconnectButton = CreateButton(panel.transform, "Disconnect", new Vector2(60, -80));
Text statusText = CreateStatusText(panel.transform);
NetworkJoinUI networkJoinUI = panel.AddComponent<NetworkJoinUI>();
networkJoinUI.SetUIReferences(panel, ipInput, portInput, joinButton, hostButton, disconnectButton, statusText);
Selection.activeGameObject = panel;
Debug.Log("[NetworkUIBuilder] Network Join UI created!");
}
private static Canvas FindOrCreateCanvas()
{
Canvas[] canvases = Object.FindObjectsByType<Canvas>(FindObjectsSortMode.None);
if (canvases.Length > 0)
{
return canvases[0];
}
GameObject canvasObj = new GameObject("NetworkCanvas");
Canvas canvas = canvasObj.AddComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvasObj.AddComponent<CanvasScaler>();
canvasObj.AddComponent<GraphicRaycaster>();
return canvas;
}
private static GameObject CreatePanel(Transform parent)
{
GameObject panel = new GameObject("NetworkJoinPanel");
panel.transform.SetParent(parent, false);
RectTransform rect = panel.AddComponent<RectTransform>();
rect.anchorMin = new Vector2(0.5f, 0.5f);
rect.anchorMax = new Vector2(0.5f, 0.5f);
rect.pivot = new Vector2(0.5f, 0.5f);
rect.sizeDelta = new Vector2(300, 250);
rect.anchoredPosition = Vector2.zero;
Image image = panel.AddComponent<Image>();
image.color = new Color(0.1f, 0.1f, 0.1f, 0.95f);
return panel;
}
private static InputField CreateInputField(Transform parent, string name, string placeholder, float width)
{
GameObject fieldObj = new GameObject(name);
fieldObj.transform.SetParent(parent, false);
RectTransform rect = fieldObj.AddComponent<RectTransform>();
rect.anchorMin = new Vector2(0.5f, 0.5f);
rect.anchorMax = new Vector2(0.5f, 0.5f);
rect.pivot = new Vector2(0.5f, 0.5f);
rect.sizeDelta = new Vector2(width, 30);
int yPos = name.Contains("IP") ? 80 : 40;
rect.anchoredPosition = new Vector2(0, yPos);
Image bgImage = fieldObj.AddComponent<Image>();
bgImage.color = new Color(0.2f, 0.2f, 0.2f, 1f);
InputField inputField = fieldObj.AddComponent<InputField>();
inputField.textComponent = CreateTextComponent(fieldObj.transform, "");
inputField.text = placeholder;
inputField.contentType = InputField.ContentType.Standard;
Text placeholderText = CreateTextComponent(fieldObj.transform, placeholder);
placeholderText.color = new Color(0.5f, 0.5f, 0.5f, 0.5f);
inputField.placeholder = placeholderText;
Text label = CreateTextComponent(parent, name.ToUpper());
RectTransform labelRect = label.GetComponent<RectTransform>();
labelRect.anchoredPosition = new Vector2(-width / 2 - 30, yPos);
return inputField;
}
private static Button CreateButton(Transform parent, string text, Vector2 position)
{
GameObject buttonObj = new GameObject(text + "Button");
buttonObj.transform.SetParent(parent, false);
RectTransform rect = buttonObj.AddComponent<RectTransform>();
rect.anchorMin = new Vector2(0.5f, 0.5f);
rect.anchorMax = new Vector2(0.5f, 0.5f);
rect.pivot = new Vector2(0.5f, 0.5f);
rect.sizeDelta = new Vector2(80, 30);
rect.anchoredPosition = position;
Image bgImage = buttonObj.AddComponent<Image>();
bgImage.color = new Color(0.3f, 0.5f, 0.8f, 1f);
Button button = buttonObj.AddComponent<Button>();
Text buttonText = CreateTextComponent(buttonObj.transform, text);
buttonText.alignment = TextAnchor.MiddleCenter;
return button;
}
private static Text CreateTextComponent(Transform parent, string text)
{
GameObject textObj = new GameObject("Text");
textObj.transform.SetParent(parent, false);
RectTransform rect = textObj.AddComponent<RectTransform>();
rect.anchorMin = Vector2.zero;
rect.anchorMax = Vector2.one;
rect.offsetMin = Vector2.zero;
rect.offsetMax = Vector2.zero;
Text textComponent = textObj.AddComponent<Text>();
textComponent.text = text;
textComponent.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
textComponent.fontSize = 14;
textComponent.color = Color.white;
textComponent.alignment = TextAnchor.MiddleCenter;
return textComponent;
}
private static Text CreateStatusText(Transform parent)
{
GameObject textObj = new GameObject("StatusText");
textObj.transform.SetParent(parent, false);
RectTransform rect = textObj.AddComponent<RectTransform>();
rect.anchorMin = new Vector2(0.5f, 0.5f);
rect.anchorMax = new Vector2(0.5f, 0.5f);
rect.pivot = new Vector2(0.5f, 0.5f);
rect.sizeDelta = new Vector2(280, 30);
rect.anchoredPosition = new Vector2(0, -120);
Text textComponent = textObj.AddComponent<Text>();
textComponent.text = "Not connected";
textComponent.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
textComponent.fontSize = 12;
textComponent.color = Color.yellow;
textComponent.alignment = TextAnchor.MiddleCenter;
return textComponent;
}
[MenuItem("GameObject/Network/Create Network Helper")]
public static void CreateNetworkHelper()
{
GameObject helperObj = new GameObject("NetworkConnectionHelper");
helperObj.AddComponent<NetworkConnectionHelper>();
Selection.activeGameObject = helperObj;
Debug.Log("[NetworkUIBuilder] Network Connection Helper created!");
}
}
}

View File

@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 010611d682d1a064caa47bc3667f0675

View File

@@ -151,7 +151,6 @@ namespace Northbound
if (core != null)
{
_corePosition = new Vector2(core.transform.position.x, core.transform.position.z);
Debug.Log($"[MapGenerator] Found Core at {_corePosition}");
}
else
{
@@ -163,7 +162,6 @@ namespace Northbound
if (resources.Length > 0)
{
_initialResourcePosition = new Vector2(resources[0].transform.position.x, resources[0].transform.position.z);
Debug.Log($"[MapGenerator] Found initial Resource at {_initialResourcePosition}");
}
else
{
@@ -175,7 +173,6 @@ namespace Northbound
if (barracks != null)
{
_barracksPosition = new Vector2(barracks.transform.position.x, barracks.transform.position.z);
Debug.Log($"[MapGenerator] Found Worker Hall at {_barracksPosition}");
}
else
{
@@ -425,8 +422,7 @@ namespace Northbound
}
resource.InitializeQuality(_generatedResources[i].qualityModifier);
Debug.Log($"[MapGenerator] Spawned resource at {_generatedResources[i].position} with quality: {_generatedResources[i].qualityModifier:F1}% (Actual Max: {resource.ActualMaxResources}, Actual Recharge: {resource.ActualRechargeAmount})");
NetworkObject networkObj = resourceObj.GetComponent<NetworkObject>();
if (networkObj != null)
{
@@ -446,7 +442,6 @@ namespace Northbound
totalProduction += _generatedResources[i].finalProduction;
}
Debug.Log($"[MapGenerator] Spawned {_generatedResources.Length} additional resources (plus initial at {_initialResourcePosition}). Total production: {totalProduction:F2} mana/min. Global multiplier: {_globalProductionMultiplier:F2}");
}
#endregion