[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

@@ -55,6 +55,12 @@ namespace Colosseum.UI
return;
}
Debug.Log($"[AbnormalitySlotUI] Initialize: {abnormality.Data.abnormalityName}, icon: {abnormality.Data.icon?.name ?? "null"}");
Debug.Log($"[AbnormalitySlotUI] UI References - iconImage: {(iconImage != null ? "OK" : "NULL")}, durationFill: {(durationFill != null ? "OK" : "NULL")}, durationText: {(durationText != null ? "OK" : "NULL")}, backgroundImage: {(backgroundImage != null ? "OK" : "NULL")}");
// Cooltime 요소 활성화 (부모 게임오브젝트들이 비활성화되어 있을 수 있음)
EnableDurationElements();
// 아이콘 설정
if (iconImage != null)
{
@@ -68,6 +74,11 @@ namespace Colosseum.UI
effectNameText.text = abnormality.Data.abnormalityName;
}
else
{
Debug.LogWarning("[AbnormalitySlotUI] effectNameText is null");
}
// 배경 색상 설정 (버프/디버프 구분)
if (backgroundImage != null)
{
@@ -79,104 +90,63 @@ namespace Colosseum.UI
}
/// <summary>
/// 화면 표시 업데이트
/// UI 표시 업데이트
/// </summary>
/// <param name="remainingDuration">남은 시간</param>
/// <param name="totalDuration">전체 시간</param>
/// <param name="remainingDuration">남은 지속 시간</param>
/// <param name="totalDuration">전체 지속 시간</param>
public void UpdateDisplay(float remainingDuration, float totalDuration)
{
// 지속 시간 채우기 업데이트
if (durationFill != null)
// 지속 시간 채우기 이미지 업데이트 (시간이 지날수록 채워짐)
if (durationFill != null && totalDuration > 0)
{
if (totalDuration > 0f)
{
float fillAmount = Mathf.Clamp01(remainingDuration / totalDuration);
durationFill.fillAmount = fillAmount;
durationFill.enabled = true;
}
else
{
// 영구 효과
durationFill.fillAmount = 1f;
}
durationFill.fillAmount = 1f - (remainingDuration / totalDuration);
}
// 남은 시간 텍스트 업데이트
// 남은 시간 텍스트 업데이트 (정수만 표시)
if (durationText != null)
{
if (totalDuration > 0f)
if (remainingDuration > 60f)
{
if (remainingDuration >= 60f)
{
durationText.text = $"{remainingDuration / 60f:F0}m";
}
else if (remainingDuration >= 1f)
{
durationText.text = $"{remainingDuration:F0}s";
}
else
{
durationText.text = $"{remainingDuration:F1}s";
}
durationText.text = $"{(int)(remainingDuration / 60f)}:{(int)(remainingDuration % 60f):D2}";
}
else if (remainingDuration > 0f)
{
durationText.text = $"{Mathf.CeilToInt(remainingDuration)}";
}
else
{
// 영구 효과
durationText.text = "∞";
durationText.text = string.Empty;
}
}
}
/// <summary>
/// 프레임마다 호출하여 추적 중인 효과 업데이트
/// 지속 시간 관련 UI 요소들의 부모 게임오브젝트를 활성화합니다.
/// </summary>
private void Update()
private void EnableDurationElements()
{
if (trackedAbnormality == null)
// durationFill의 모든 부모 게임오브젝트 활성화
if (durationFill != null)
{
gameObject.SetActive(false);
return;
Transform parent = durationFill.transform.parent;
while (parent != null && parent != transform)
{
parent.gameObject.SetActive(true);
parent = parent.parent;
}
}
UpdateDisplay(trackedAbnormality.RemainingDuration, trackedAbnormality.Data.duration);
// durationText의 모든 부모 게임오브젝트 활성화
if (durationText != null)
{
Transform parent = durationText.transform.parent;
while (parent != null && parent != transform)
{
parent.gameObject.SetActive(true);
parent = parent.parent;
}
}
}
/// <summary>
/// 툴팁 표시용 정보 반환
/// </summary>
public string GetTooltipText()
{
if (trackedAbnormality?.Data == null) return string.Empty;
var data = trackedAbnormality.Data;
string tooltip = $"<b>{data.abnormalityName}</b>\n";
if (!data.IsPermanent)
{
tooltip += $"지속 시간: {trackedAbnormality.RemainingDuration:F1}초\n";
}
else
{
tooltip += "영구 효과\n";
}
if (data.HasPeriodicEffect)
{
tooltip += $"주기적 효과: {data.periodicValue:+0}/ {data.periodicInterval}초\n";
}
if (data.HasControlEffect)
{
tooltip += $"제어 효과: {data.controlType}\n";
}
foreach (var mod in data.statModifiers)
{
string sign = mod.value >= 0 ? "+" : "";
tooltip += $"{mod.statType}: {sign}{mod.value}\n";
}
return tooltip;
}
}
}