2026-04-13 스킬,퀵슬롯 시스템 수정중
This commit is contained in:
43
Assets/02_Scripts/UI/SkillWindow/SkillWindowUI.cs
Normal file
43
Assets/02_Scripts/UI/SkillWindow/SkillWindowUI.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SkillWindowUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Transform _listContentRoot;
|
||||
[SerializeField] private GameObject _skillEntryPrefab;
|
||||
|
||||
private readonly List<SkillEntry> _entries = new List<SkillEntry>();
|
||||
|
||||
public void Toggle()
|
||||
{
|
||||
bool willOpen = !gameObject.activeSelf;
|
||||
gameObject.SetActive(willOpen);
|
||||
if (willOpen) Refresh();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
// 기존 엔트리 정리
|
||||
foreach (Transform child in _listContentRoot)
|
||||
Destroy(child.gameObject);
|
||||
_entries.Clear();
|
||||
|
||||
var character = GameManager.Instance.Level.CurrentCharacter;
|
||||
if (character == null) return;
|
||||
if (!character.TryGetComponent<SkillModule>(out var skillModule)) return;
|
||||
|
||||
var skills = skillModule.GetEquippedSkillDatas();
|
||||
for (int i = 0; i < skills.Count; i++)
|
||||
{
|
||||
if (skills[i] == null) continue;
|
||||
|
||||
GameObject entryObj = Instantiate(_skillEntryPrefab, _listContentRoot);
|
||||
SkillEntry entry = entryObj.GetComponent<SkillEntry>();
|
||||
if (entry != null)
|
||||
{
|
||||
entry.SetData(skills[i]);
|
||||
_entries.Add(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user