[UI] 이상 상태 슬롯 UI 개선

- 지속 시간 표시가 주기적으로 업데이트되도록 수정
- fill 이미지가 시간이 지날수록 채워지도록 변경
- 남은 시간 정수로만 표시
- 비활성화된 Cooltime 요소 자동 활성화
- Animator Controller 제거로 UI 정상 표시

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 02:40:44 +09:00
parent ec99e302ed
commit 3d3591784f
3 changed files with 116 additions and 128 deletions

View File

@@ -42,6 +42,8 @@ namespace Colosseum.UI
private void Start()
{
Debug.Log("[AbnormalityListUI] Start() called");
if (autoFindPlayer)
{
// 로컬 플레이어 찾기
@@ -50,6 +52,10 @@ namespace Colosseum.UI
// 슬롯 풀 초기화
InitializeSlotPool();
Debug.Log($"[AbnormalityListUI] slotPrefab: {(slotPrefab != null ? slotPrefab.name : "NULL")}");
Debug.Log($"[AbnormalityListUI] buffContainer: {(buffContainer != null ? buffContainer.name : "NULL")}");
Debug.Log($"[AbnormalityListUI] debuffContainer: {(debuffContainer != null ? debuffContainer.name : "NULL")}");
}
private void OnDestroy()
@@ -65,6 +71,12 @@ namespace Colosseum.UI
private void Update()
{
// 타겟이 없으면 주기적으로 플레이어 찾기
if (targetManager == null && autoFindPlayer && Time.frameCount % 30 == 0)
{
FindLocalPlayer();
}
// 주기적으로 UI 갱신 (성능 최적화를 위해 매 프레임이 아닌 일정 간격으로)
if (Time.frameCount % 10 == 0) // 10프레임마다 한 번
{
@@ -78,14 +90,20 @@ namespace Colosseum.UI
private void FindLocalPlayer()
{
var playerObjects = FindObjectsByType<AbnormalityManager>(FindObjectsSortMode.None);
Debug.Log($"[AbnormalityListUI] Found {playerObjects.Length} AbnormalityManager(s)");
foreach (var manager in playerObjects)
{
// 네트워크 오브젝트인 경우 로컬 플레이어 확인
if (manager.TryGetComponent<Unity.Netcode.NetworkObject>(out var netObj) && netObj.IsOwner)
if (manager.TryGetComponent<Unity.Netcode.NetworkObject>(out var netObj))
{
SetTarget(manager);
return;
Debug.Log($"[AbnormalityListUI] Checking {manager.gameObject.name}, IsOwner: {netObj.IsOwner}");
if (netObj.IsOwner)
{
Debug.Log($"[AbnormalityListUI] Setting target to local player: {manager.gameObject.name}");
SetTarget(manager);
return;
}
}
}
@@ -93,8 +111,13 @@ namespace Colosseum.UI
// 첫 번째 플레이어 사용 (싱글플레이어용)
if (playerObjects.Length > 0)
{
Debug.Log($"[AbnormalityListUI] No local player found, using first manager: {playerObjects[0].gameObject.name}");
SetTarget(playerObjects[0]);
}
else
{
Debug.LogWarning("[AbnormalityListUI] No AbnormalityManager found!");
}
}
/// <summary>
@@ -103,6 +126,8 @@ namespace Colosseum.UI
/// <param name="manager">추적할 AbnormalityManager</param>
public void SetTarget(AbnormalityManager manager)
{
Debug.Log($"[AbnormalityListUI] SetTarget called with: {(manager != null ? manager.gameObject.name : "null")}");
// 기존 구독 해제
if (targetManager != null)
{
@@ -119,6 +144,7 @@ namespace Colosseum.UI
targetManager.OnAbnormalityAdded += OnAbnormalityAdded;
targetManager.OnAbnormalityRemoved += OnAbnormalityRemoved;
targetManager.OnAbnormalitiesChanged += OnAbnormalitiesChanged;
Debug.Log("[AbnormalityListUI] Events subscribed successfully");
}
// 즉시 UI 갱신
@@ -193,6 +219,7 @@ namespace Colosseum.UI
/// </summary>
private void OnAbnormalityAdded(ActiveAbnormality abnormality)
{
Debug.Log($"[AbnormalityListUI] OnAbnormalityAdded event received: {abnormality.Data.abnormalityName}");
ForceRefreshUI();
}
@@ -201,6 +228,7 @@ namespace Colosseum.UI
/// </summary>
private void OnAbnormalityRemoved(ActiveAbnormality abnormality)
{
Debug.Log($"[AbnormalityListUI] OnAbnormalityRemoved event received: {abnormality.Data.abnormalityName}");
ForceRefreshUI();
}
@@ -209,6 +237,7 @@ namespace Colosseum.UI
/// </summary>
private void OnAbnormalitiesChanged()
{
Debug.Log("[AbnormalityListUI] OnAbnormalitiesChanged event received");
ForceRefreshUI();
}
@@ -217,7 +246,11 @@ namespace Colosseum.UI
/// </summary>
public void ForceRefreshUI()
{
if (targetManager == null) return;
if (targetManager == null)
{
Debug.LogWarning("[AbnormalityListUI] ForceRefreshUI called but targetManager is null");
return;
}
// 모든 슬롯 반환
foreach (var slot in activeSlots.ToArray())
@@ -229,15 +262,23 @@ namespace Colosseum.UI
// 활성화된 이상 상태 표시
var abnormalities = targetManager.ActiveAbnormalities;
Debug.Log($"[AbnormalityListUI] ForceRefreshUI: {abnormalities.Count} abnormalities found");
foreach (var abnormality in abnormalities)
{
var slot = GetSlot();
if (slot == null) continue;
if (slot == null)
{
Debug.LogWarning("[AbnormalityListUI] Could not get slot from pool");
continue;
}
// 버프/디버프에 따라 적절한 컨테이너에 배치
Transform container = abnormality.Data.isDebuff ? debuffContainer : buffContainer;
if (container == null) container = transform;
Debug.Log($"[AbnormalityListUI] Adding slot for: {abnormality.Data.abnormalityName}, isDebuff: {abnormality.Data.isDebuff}, container: {container.name}");
slot.transform.SetParent(container, false);
slot.Initialize(abnormality);
slot.gameObject.SetActive(true);
@@ -261,6 +302,24 @@ namespace Colosseum.UI
{
ForceRefreshUI();
}
// 활성 슬롯들의 지속 시간 업데이트
UpdateSlotDurations();
}
/// <summary>
/// 모든 활성 슬롯의 지속 시간 업데이트
/// </summary>
private void UpdateSlotDurations()
{
foreach (var slot in activeSlots)
{
if (slot != null && slot.TrackedAbnormality != null)
{
var abnormality = slot.TrackedAbnormality;
slot.UpdateDisplay(abnormality.RemainingDuration, abnormality.Data.duration);
}
}
}
/// <summary>