Compare commits
2 Commits
42970af621
...
8d21922e2f
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d21922e2f | |||
| 7a62e6c631 |
@@ -17,6 +17,7 @@ MonoBehaviour:
|
||||
duration: 1
|
||||
level: 1
|
||||
isDebuff: 0
|
||||
showInUI: 0
|
||||
statModifiers: []
|
||||
periodicInterval: 0
|
||||
periodicValue: 0
|
||||
|
||||
@@ -17,6 +17,7 @@ MonoBehaviour:
|
||||
duration: 3
|
||||
level: 1
|
||||
isDebuff: 1
|
||||
showInUI: 1
|
||||
statModifiers: []
|
||||
periodicInterval: 0
|
||||
periodicValue: 0
|
||||
|
||||
@@ -17,6 +17,7 @@ MonoBehaviour:
|
||||
duration: 2
|
||||
level: 1
|
||||
isDebuff: 1
|
||||
showInUI: 1
|
||||
statModifiers: []
|
||||
periodicInterval: 0
|
||||
periodicValue: 0
|
||||
|
||||
@@ -17,6 +17,7 @@ MonoBehaviour:
|
||||
duration: 4
|
||||
level: 1
|
||||
isDebuff: 0
|
||||
showInUI: 1
|
||||
statModifiers: []
|
||||
periodicInterval: 0
|
||||
periodicValue: 0
|
||||
|
||||
@@ -17,6 +17,7 @@ MonoBehaviour:
|
||||
duration: 0
|
||||
level: 1
|
||||
isDebuff: 1
|
||||
showInUI: 1
|
||||
statModifiers: []
|
||||
periodicInterval: 0
|
||||
periodicValue: 0
|
||||
|
||||
@@ -17,6 +17,7 @@ MonoBehaviour:
|
||||
duration: 1.5
|
||||
level: 1
|
||||
isDebuff: 0
|
||||
showInUI: 1
|
||||
statModifiers: []
|
||||
periodicInterval: 0
|
||||
periodicValue: 0
|
||||
|
||||
@@ -17,6 +17,7 @@ MonoBehaviour:
|
||||
duration: 10
|
||||
level: 1
|
||||
isDebuff: 0
|
||||
showInUI: 0
|
||||
statModifiers: []
|
||||
periodicInterval: 0
|
||||
periodicValue: 0
|
||||
|
||||
@@ -17,6 +17,7 @@ MonoBehaviour:
|
||||
duration: 10
|
||||
level: 1
|
||||
isDebuff: 1
|
||||
showInUI: 0
|
||||
statModifiers: []
|
||||
periodicInterval: 0
|
||||
periodicValue: 0
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -65,6 +65,9 @@ namespace Colosseum.Abnormalities
|
||||
[Tooltip("디버프 여부")]
|
||||
public bool isDebuff = false;
|
||||
|
||||
[Tooltip("플레이어 HUD의 이상상태 UI에 표시할지 여부")]
|
||||
public bool showInUI = true;
|
||||
|
||||
[Header("스탯 수정자")]
|
||||
[Tooltip("스탯에 적용할 수정자 목록")]
|
||||
public List<AbnormalityStatModifier> statModifiers = new List<AbnormalityStatModifier>();
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Colosseum.Enemy;
|
||||
using Colosseum.Player;
|
||||
using Colosseum.Skills;
|
||||
using Colosseum.UI;
|
||||
using Colosseum.Abnormalities;
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@@ -18,6 +21,18 @@ namespace Colosseum.Editor
|
||||
private const string HealSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_치유.asset";
|
||||
private const string AreaHealSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_광역치유.asset";
|
||||
private const string ShieldSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_보호막.asset";
|
||||
private const string SlashSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_베기.asset";
|
||||
private const string PierceSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_찌르기.asset";
|
||||
private const string SpinSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_회전베기.asset";
|
||||
private const string DashSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_돌진.asset";
|
||||
private const string ProjectileSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_투사체.asset";
|
||||
private const string TauntSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_도발.asset";
|
||||
private const string GuardSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_방어태세.asset";
|
||||
private const string IronWallSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_철벽.asset";
|
||||
private const string EvadeSkillPath = "Assets/_Game/Data/Skills/Data_Skill_Player_구르기.asset";
|
||||
private const string StunAbnormalityPath = "Assets/_Game/Data/Abnormalities/Data_Abnormality_Player_Stun.asset";
|
||||
private const string SilenceAbnormalityPath = "Assets/_Game/Data/Abnormalities/Data_Abnormality_Player_Silence.asset";
|
||||
private const string MarkAbnormalityPath = "Assets/_Game/Data/Abnormalities/Data_Abnormality_Player_집행자의낙인.asset";
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Cast Local Skill 3")]
|
||||
private static void CastLocalSkill3()
|
||||
@@ -129,6 +144,118 @@ namespace Colosseum.Editor
|
||||
Debug.Log($"[Debug] 보스 위협 요약\n{builder}");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Apply Local Stun")]
|
||||
private static void ApplyLocalStun()
|
||||
{
|
||||
ApplyLocalAbnormality(StunAbnormalityPath);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Apply Local Silence")]
|
||||
private static void ApplyLocalSilence()
|
||||
{
|
||||
ApplyLocalAbnormality(SilenceAbnormalityPath);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Apply Local Mark")]
|
||||
private static void ApplyLocalMark()
|
||||
{
|
||||
ApplyLocalAbnormality(MarkAbnormalityPath);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Log HUD Abnormality Summary")]
|
||||
private static void LogHudAbnormalitySummary()
|
||||
{
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
Debug.LogWarning("[Debug] 플레이 모드에서만 사용할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerHUD playerHud = Object.FindFirstObjectByType<PlayerHUD>();
|
||||
if (playerHud == null)
|
||||
{
|
||||
Debug.LogWarning("[Debug] PlayerHUD를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log($"[Debug] HUD 이상상태 요약 | {playerHud.CurrentAbnormalitySummary}");
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Apply Tank Loadout")]
|
||||
private static void ApplyTankLoadout()
|
||||
{
|
||||
ApplyLoadout(
|
||||
"탱커",
|
||||
SlashSkillPath,
|
||||
TauntSkillPath,
|
||||
GuardSkillPath,
|
||||
DashSkillPath,
|
||||
IronWallSkillPath,
|
||||
PierceSkillPath,
|
||||
EvadeSkillPath);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Apply Support Loadout")]
|
||||
private static void ApplySupportLoadout()
|
||||
{
|
||||
ApplyLoadout(
|
||||
"지원",
|
||||
SlashSkillPath,
|
||||
HealSkillPath,
|
||||
AreaHealSkillPath,
|
||||
ShieldSkillPath,
|
||||
DashSkillPath,
|
||||
ProjectileSkillPath,
|
||||
EvadeSkillPath);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Apply DPS Loadout")]
|
||||
private static void ApplyDpsLoadout()
|
||||
{
|
||||
ApplyLoadout(
|
||||
"딜러",
|
||||
SlashSkillPath,
|
||||
PierceSkillPath,
|
||||
SpinSkillPath,
|
||||
DashSkillPath,
|
||||
ProjectileSkillPath,
|
||||
ShieldSkillPath,
|
||||
EvadeSkillPath);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Colosseum/Debug/Log Local Skill Loadout")]
|
||||
private static void LogLocalSkillLoadout()
|
||||
{
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
Debug.LogWarning("[Debug] 플레이 모드에서만 사용할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerSkillInput localSkillInput = FindLocalSkillInput();
|
||||
if (localSkillInput == null)
|
||||
{
|
||||
Debug.LogWarning("[Debug] 로컬 PlayerSkillInput을 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
string[] slotNames = { "L", "R", "1", "2", "3", "4", "Ctrl" };
|
||||
int[] slotOrder = { 0, 1, 2, 3, 4, 5, 6 };
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int i = 0; i < slotOrder.Length; i++)
|
||||
{
|
||||
SkillData skill = localSkillInput.GetSkill(slotOrder[i]);
|
||||
builder.Append(slotNames[i]);
|
||||
builder.Append(": ");
|
||||
builder.Append(skill != null ? skill.SkillName : "(비어 있음)");
|
||||
|
||||
if (i < slotOrder.Length - 1)
|
||||
builder.Append(" | ");
|
||||
}
|
||||
|
||||
Debug.Log($"[Debug] 로컬 스킬 구성 | {builder}");
|
||||
}
|
||||
|
||||
private static PlayerSkillInput FindLocalSkillInput()
|
||||
{
|
||||
PlayerSkillInput[] skillInputs = Object.FindObjectsByType<PlayerSkillInput>(FindObjectsInactive.Exclude, FindObjectsSortMode.None);
|
||||
@@ -153,6 +280,17 @@ namespace Colosseum.Editor
|
||||
return null;
|
||||
}
|
||||
|
||||
private static AbnormalityManager FindLocalAbnormalityManager()
|
||||
{
|
||||
PlayerNetworkController localNetworkController = FindLocalNetworkController();
|
||||
if (localNetworkController == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return localNetworkController.GetComponent<AbnormalityManager>();
|
||||
}
|
||||
|
||||
private static void CastLocalSkill(int slotIndex)
|
||||
{
|
||||
if (!EditorApplication.isPlaying)
|
||||
@@ -196,5 +334,62 @@ namespace Colosseum.Editor
|
||||
localSkillInput.SetSkill(TemporaryDebugSlotIndex, skill);
|
||||
localSkillInput.DebugCastSkill(TemporaryDebugSlotIndex);
|
||||
}
|
||||
|
||||
private static void ApplyLocalAbnormality(string assetPath)
|
||||
{
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
Debug.LogWarning("[Debug] 플레이 모드에서만 사용할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
AbnormalityManager abnormalityManager = FindLocalAbnormalityManager();
|
||||
if (abnormalityManager == null)
|
||||
{
|
||||
Debug.LogWarning("[Debug] 로컬 AbnormalityManager를 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
AbnormalityData abnormality = AssetDatabase.LoadAssetAtPath<AbnormalityData>(assetPath);
|
||||
if (abnormality == null)
|
||||
{
|
||||
Debug.LogWarning($"[Debug] 이상상태 에셋을 찾지 못했습니다: {assetPath}");
|
||||
return;
|
||||
}
|
||||
|
||||
abnormalityManager.ApplyAbnormality(abnormality, abnormalityManager.gameObject);
|
||||
}
|
||||
|
||||
private static void ApplyLoadout(string loadoutName, params string[] skillPaths)
|
||||
{
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
Debug.LogWarning("[Debug] 플레이 모드에서만 사용할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerSkillInput localSkillInput = FindLocalSkillInput();
|
||||
if (localSkillInput == null)
|
||||
{
|
||||
Debug.LogWarning("[Debug] 로컬 PlayerSkillInput을 찾지 못했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
List<SkillData> skills = new List<SkillData>(skillPaths.Length);
|
||||
for (int i = 0; i < skillPaths.Length; i++)
|
||||
{
|
||||
SkillData skill = AssetDatabase.LoadAssetAtPath<SkillData>(skillPaths[i]);
|
||||
if (skill == null)
|
||||
{
|
||||
Debug.LogWarning($"[Debug] 스킬 에셋을 찾지 못했습니다: {skillPaths[i]}");
|
||||
return;
|
||||
}
|
||||
|
||||
skills.Add(skill);
|
||||
}
|
||||
|
||||
localSkillInput.SetSkills(skills);
|
||||
Debug.Log($"[Debug] {loadoutName} 프리셋을 적용했습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using Unity.Netcode;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Colosseum.Skills;
|
||||
using Colosseum.Weapons;
|
||||
@@ -14,9 +16,11 @@ namespace Colosseum.Player
|
||||
[RequireComponent(typeof(PlayerActionState))]
|
||||
public class PlayerSkillInput : NetworkBehaviour
|
||||
{
|
||||
private const int ExpectedSkillSlotCount = 7;
|
||||
|
||||
[Header("Skill Slots")]
|
||||
[Tooltip("각 슬롯에 등록할 스킬 데이터 (6개 + 추가 슬롯)")]
|
||||
[SerializeField] private SkillData[] skillSlots = new SkillData[7];
|
||||
[SerializeField] private SkillData[] skillSlots = new SkillData[ExpectedSkillSlotCount];
|
||||
|
||||
[Header("References")]
|
||||
[Tooltip("SkillController (없으면 자동 검색)")]
|
||||
@@ -32,8 +36,15 @@ namespace Colosseum.Player
|
||||
|
||||
public SkillData[] SkillSlots => skillSlots;
|
||||
|
||||
/// <summary>
|
||||
/// 스킬 슬롯 구성이 변경되었을 때 호출됩니다.
|
||||
/// </summary>
|
||||
public event Action OnSkillSlotsChanged;
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
EnsureSkillSlotCapacity();
|
||||
|
||||
if (!IsOwner)
|
||||
{
|
||||
enabled = false;
|
||||
@@ -99,6 +110,16 @@ namespace Colosseum.Player
|
||||
CleanupInputActions();
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
EnsureSkillSlotCapacity();
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
EnsureSkillSlotCapacity();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (IsOwner && inputActions != null)
|
||||
@@ -107,6 +128,28 @@ namespace Colosseum.Player
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 기존 프리팹이나 씬 직렬화 데이터가 6칸으로 남아 있어도
|
||||
/// 긴급 회피 슬롯까지 포함한 7칸 구성을 항상 보장합니다.
|
||||
/// </summary>
|
||||
private void EnsureSkillSlotCapacity()
|
||||
{
|
||||
if (skillSlots != null && skillSlots.Length == ExpectedSkillSlotCount)
|
||||
return;
|
||||
|
||||
SkillData[] resizedSlots = new SkillData[ExpectedSkillSlotCount];
|
||||
if (skillSlots != null)
|
||||
{
|
||||
int copyCount = Mathf.Min(skillSlots.Length, resizedSlots.Length);
|
||||
for (int i = 0; i < copyCount; i++)
|
||||
{
|
||||
resizedSlots[i] = skillSlots[i];
|
||||
}
|
||||
}
|
||||
|
||||
skillSlots = resizedSlots;
|
||||
}
|
||||
|
||||
private void CleanupInputActions()
|
||||
{
|
||||
if (inputActions != null)
|
||||
@@ -227,6 +270,8 @@ namespace Colosseum.Player
|
||||
/// </summary>
|
||||
public SkillData GetSkill(int slotIndex)
|
||||
{
|
||||
EnsureSkillSlotCapacity();
|
||||
|
||||
if (slotIndex < 0 || slotIndex >= skillSlots.Length)
|
||||
return null;
|
||||
return skillSlots[slotIndex];
|
||||
@@ -237,10 +282,37 @@ namespace Colosseum.Player
|
||||
/// </summary>
|
||||
public void SetSkill(int slotIndex, SkillData skill)
|
||||
{
|
||||
EnsureSkillSlotCapacity();
|
||||
|
||||
if (slotIndex < 0 || slotIndex >= skillSlots.Length)
|
||||
return;
|
||||
|
||||
skillSlots[slotIndex] = skill;
|
||||
OnSkillSlotsChanged?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 전체 스킬 슬롯을 한 번에 갱신합니다.
|
||||
/// </summary>
|
||||
public void SetSkills(IReadOnlyList<SkillData> skills)
|
||||
{
|
||||
EnsureSkillSlotCapacity();
|
||||
|
||||
if (skills == null)
|
||||
return;
|
||||
|
||||
int count = Mathf.Min(skillSlots.Length, skills.Count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
skillSlots[i] = skills[i];
|
||||
}
|
||||
|
||||
for (int i = count; i < skillSlots.Length; i++)
|
||||
{
|
||||
skillSlots[i] = null;
|
||||
}
|
||||
|
||||
OnSkillSlotsChanged?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -237,6 +237,9 @@ namespace Colosseum.UI
|
||||
|
||||
foreach (var abnormality in abnormalities)
|
||||
{
|
||||
if (abnormality?.Data == null || !abnormality.Data.showInUI)
|
||||
continue;
|
||||
|
||||
var slot = GetSlot();
|
||||
if (slot == null) continue;
|
||||
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
using Colosseum.Abnormalities;
|
||||
using Colosseum.Player;
|
||||
|
||||
namespace Colosseum.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// 플레이어 HUD - 체력/마나 바 관리
|
||||
/// 플레이어 HUD - 체력/마나 바와 이상상태 요약 관리
|
||||
/// </summary>
|
||||
public class PlayerHUD : MonoBehaviour
|
||||
{
|
||||
@@ -13,11 +19,27 @@ namespace Colosseum.UI
|
||||
[SerializeField] private StatBar healthBar;
|
||||
[SerializeField] private StatBar manaBar;
|
||||
|
||||
[Header("Abnormality Summary")]
|
||||
[Tooltip("이상상태 요약 텍스트 (비어 있으면 런타임에 자동 생성)")]
|
||||
[SerializeField] private TMP_Text abnormalitySummaryText;
|
||||
|
||||
[Tooltip("이상상태 요약 텍스트를 자동 생성할지 여부")]
|
||||
[SerializeField] private bool autoCreateAbnormalitySummary = true;
|
||||
|
||||
[Header("Target")]
|
||||
[Tooltip("자동으로 로컬 플레이어 찾기")]
|
||||
[SerializeField] private bool autoFindPlayer = true;
|
||||
|
||||
private PlayerNetworkController targetPlayer;
|
||||
private AbnormalityManager targetAbnormalityManager;
|
||||
private float abnormalityRefreshTimer;
|
||||
|
||||
private const float AbnormalityRefreshInterval = 0.1f;
|
||||
|
||||
/// <summary>
|
||||
/// 현재 HUD에 표시 중인 이상상태 요약 문자열
|
||||
/// </summary>
|
||||
public string CurrentAbnormalitySummary => abnormalitySummaryText != null ? abnormalitySummaryText.text : string.Empty;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -25,6 +47,8 @@ namespace Colosseum.UI
|
||||
{
|
||||
FindLocalPlayer();
|
||||
}
|
||||
|
||||
EnsureAbnormalitySummaryText();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -34,6 +58,16 @@ namespace Colosseum.UI
|
||||
{
|
||||
FindLocalPlayer();
|
||||
}
|
||||
|
||||
if (targetAbnormalityManager != null)
|
||||
{
|
||||
abnormalityRefreshTimer += Time.deltaTime;
|
||||
if (abnormalityRefreshTimer >= AbnormalityRefreshInterval)
|
||||
{
|
||||
abnormalityRefreshTimer = 0f;
|
||||
UpdateAbnormalitySummary();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
@@ -63,12 +97,14 @@ namespace Colosseum.UI
|
||||
UnsubscribeFromEvents();
|
||||
|
||||
targetPlayer = player;
|
||||
targetAbnormalityManager = targetPlayer != null ? targetPlayer.GetComponent<AbnormalityManager>() : null;
|
||||
|
||||
// 새 타겟 구독
|
||||
SubscribeToEvents();
|
||||
|
||||
// 초기 값 설정
|
||||
UpdateStatBars();
|
||||
UpdateAbnormalitySummary();
|
||||
}
|
||||
|
||||
private void SubscribeToEvents()
|
||||
@@ -78,15 +114,30 @@ namespace Colosseum.UI
|
||||
targetPlayer.OnHealthChanged += HandleHealthChanged;
|
||||
targetPlayer.OnManaChanged += HandleManaChanged;
|
||||
targetPlayer.OnShieldChanged += HandleShieldChanged;
|
||||
|
||||
if (targetAbnormalityManager != null)
|
||||
{
|
||||
targetAbnormalityManager.OnAbnormalityAdded += HandleAbnormalityAdded;
|
||||
targetAbnormalityManager.OnAbnormalityRemoved += HandleAbnormalityRemoved;
|
||||
targetAbnormalityManager.OnAbnormalitiesChanged += HandleAbnormalitiesChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void UnsubscribeFromEvents()
|
||||
{
|
||||
if (targetPlayer == null) return;
|
||||
if (targetPlayer != null)
|
||||
{
|
||||
targetPlayer.OnHealthChanged -= HandleHealthChanged;
|
||||
targetPlayer.OnManaChanged -= HandleManaChanged;
|
||||
targetPlayer.OnShieldChanged -= HandleShieldChanged;
|
||||
}
|
||||
|
||||
targetPlayer.OnHealthChanged -= HandleHealthChanged;
|
||||
targetPlayer.OnManaChanged -= HandleManaChanged;
|
||||
targetPlayer.OnShieldChanged -= HandleShieldChanged;
|
||||
if (targetAbnormalityManager != null)
|
||||
{
|
||||
targetAbnormalityManager.OnAbnormalityAdded -= HandleAbnormalityAdded;
|
||||
targetAbnormalityManager.OnAbnormalityRemoved -= HandleAbnormalityRemoved;
|
||||
targetAbnormalityManager.OnAbnormalitiesChanged -= HandleAbnormalitiesChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleHealthChanged(float oldValue, float newValue)
|
||||
@@ -113,6 +164,21 @@ namespace Colosseum.UI
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleAbnormalityAdded(ActiveAbnormality abnormality)
|
||||
{
|
||||
UpdateAbnormalitySummary();
|
||||
}
|
||||
|
||||
private void HandleAbnormalityRemoved(ActiveAbnormality abnormality)
|
||||
{
|
||||
UpdateAbnormalitySummary();
|
||||
}
|
||||
|
||||
private void HandleAbnormalitiesChanged()
|
||||
{
|
||||
UpdateAbnormalitySummary();
|
||||
}
|
||||
|
||||
private void UpdateStatBars()
|
||||
{
|
||||
if (targetPlayer == null) return;
|
||||
@@ -127,5 +193,93 @@ namespace Colosseum.UI
|
||||
manaBar.SetValue(targetPlayer.Mana, targetPlayer.MaxMana);
|
||||
}
|
||||
}
|
||||
|
||||
private void EnsureAbnormalitySummaryText()
|
||||
{
|
||||
if (abnormalitySummaryText != null || !autoCreateAbnormalitySummary)
|
||||
return;
|
||||
|
||||
if (transform is not RectTransform parentRect)
|
||||
return;
|
||||
|
||||
GameObject summaryObject = new GameObject("AbnormalitySummaryText", typeof(RectTransform));
|
||||
summaryObject.transform.SetParent(parentRect, false);
|
||||
|
||||
RectTransform rectTransform = summaryObject.GetComponent<RectTransform>();
|
||||
rectTransform.anchorMin = new Vector2(1f, 1f);
|
||||
rectTransform.anchorMax = new Vector2(1f, 1f);
|
||||
rectTransform.pivot = new Vector2(1f, 1f);
|
||||
rectTransform.anchoredPosition = new Vector2(-24f, -120f);
|
||||
rectTransform.sizeDelta = new Vector2(320f, 180f);
|
||||
|
||||
TextMeshProUGUI summaryText = summaryObject.AddComponent<TextMeshProUGUI>();
|
||||
summaryText.fontSize = 18f;
|
||||
summaryText.alignment = TextAlignmentOptions.TopRight;
|
||||
summaryText.textWrappingMode = TextWrappingModes.NoWrap;
|
||||
summaryText.richText = true;
|
||||
summaryText.text = string.Empty;
|
||||
|
||||
TMP_FontAsset summaryFont = healthBar != null && healthBar.FontAsset != null
|
||||
? healthBar.FontAsset
|
||||
: manaBar != null ? manaBar.FontAsset : null;
|
||||
|
||||
if (summaryFont != null)
|
||||
{
|
||||
summaryText.font = summaryFont;
|
||||
}
|
||||
else if (TMP_Settings.defaultFontAsset != null)
|
||||
{
|
||||
summaryText.font = TMP_Settings.defaultFontAsset;
|
||||
}
|
||||
|
||||
abnormalitySummaryText = summaryText;
|
||||
}
|
||||
|
||||
private void UpdateAbnormalitySummary()
|
||||
{
|
||||
if (abnormalitySummaryText == null)
|
||||
{
|
||||
EnsureAbnormalitySummaryText();
|
||||
}
|
||||
|
||||
if (abnormalitySummaryText == null)
|
||||
return;
|
||||
|
||||
if (targetAbnormalityManager == null)
|
||||
{
|
||||
abnormalitySummaryText.text = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
IReadOnlyList<ActiveAbnormality> activeAbnormalities = targetAbnormalityManager.ActiveAbnormalities;
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < activeAbnormalities.Count; i++)
|
||||
{
|
||||
ActiveAbnormality abnormality = activeAbnormalities[i];
|
||||
if (abnormality?.Data == null || !abnormality.Data.showInUI)
|
||||
continue;
|
||||
|
||||
if (builder.Length > 0)
|
||||
builder.AppendLine();
|
||||
|
||||
string color = abnormality.Data.isDebuff ? "#FF7070" : "#70D0FF";
|
||||
builder.Append("<color=");
|
||||
builder.Append(color);
|
||||
builder.Append(">");
|
||||
builder.Append(abnormality.Data.abnormalityName);
|
||||
|
||||
if (!abnormality.Data.IsPermanent)
|
||||
{
|
||||
builder.Append(" ");
|
||||
builder.Append(Mathf.CeilToInt(Mathf.Max(0f, abnormality.RemainingDuration)));
|
||||
builder.Append("s");
|
||||
}
|
||||
|
||||
builder.Append("</color>");
|
||||
}
|
||||
|
||||
abnormalitySummaryText.text = builder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,14 @@ namespace Colosseum.UI
|
||||
FindLocalPlayer();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (playerSkillInput != null)
|
||||
{
|
||||
playerSkillInput.OnSkillSlotsChanged -= HandleSkillSlotsChanged;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 자식 슬롯을 자동 수집해 프리팹 중첩 구조 변경에도 참조가 유지되도록 합니다.
|
||||
/// </summary>
|
||||
@@ -212,10 +220,9 @@ namespace Colosseum.UI
|
||||
{
|
||||
if (player.IsOwner)
|
||||
{
|
||||
playerSkillInput = player;
|
||||
SetPlayer(player);
|
||||
networkController = player.GetComponent<PlayerNetworkController>();
|
||||
Debug.Log($"[SkillQuickSlotUI] Found local player: {player.name}");
|
||||
InitializeSlots();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -294,8 +301,19 @@ namespace Colosseum.UI
|
||||
/// </summary>
|
||||
public void SetPlayer(PlayerSkillInput player)
|
||||
{
|
||||
if (playerSkillInput != null)
|
||||
{
|
||||
playerSkillInput.OnSkillSlotsChanged -= HandleSkillSlotsChanged;
|
||||
}
|
||||
|
||||
playerSkillInput = player;
|
||||
networkController = player?.GetComponent<PlayerNetworkController>();
|
||||
|
||||
if (playerSkillInput != null)
|
||||
{
|
||||
playerSkillInput.OnSkillSlotsChanged += HandleSkillSlotsChanged;
|
||||
}
|
||||
|
||||
InitializeSlots();
|
||||
}
|
||||
|
||||
@@ -312,5 +330,10 @@ namespace Colosseum.UI
|
||||
string keyLabel = displayIndex < keyLabels.Length ? keyLabels[displayIndex] : (displayIndex + 1).ToString();
|
||||
skillSlots[displayIndex].Initialize(slotIndex, skill, keyLabel);
|
||||
}
|
||||
|
||||
private void HandleSkillSlotsChanged()
|
||||
{
|
||||
InitializeSlots();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace Colosseum.UI
|
||||
private float displayValue;
|
||||
private float bonusValue;
|
||||
|
||||
/// <summary>
|
||||
/// 현재 바가 사용하는 폰트 에셋
|
||||
/// </summary>
|
||||
public TMP_FontAsset FontAsset => valueText != null ? valueText.font : null;
|
||||
|
||||
/// <summary>
|
||||
/// 바 값 설정
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user