feat: 스킬 편집 UI 내의 스킬 슬롯, 스킬 정보 클릭 액션 적용

This commit is contained in:
aube.lee
2025-02-11 16:34:06 +09:00
parent f03359ec4a
commit 4f7d0616ce
24 changed files with 2053 additions and 1495 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace TON
@@ -8,13 +9,16 @@ namespace TON
public class SkillScrollViewController : MonoBehaviour
{
public ScrollRect scrollRect;
public float space = 10f;
public GameObject uiPrefab;
public SkillInformationItem skillInfoPrefab;
public List<RectTransform> uiPrefabList = new List<RectTransform>();
public List<SkillInformationItem> createSkillInfo = new List<SkillInformationItem>();
public int playerLevel;
private SkillInformationItem selectedSkillInfo;
private void Start()
{
scrollRect = GetComponent<ScrollRect>();
@@ -31,8 +35,16 @@ namespace TON
for (int i = 0; i < skillDatas.Count; i++)
{
SkillData skillData = skillDatas[i];
GameObject skillInfoItem = Instantiate(uiPrefab, scrollRect.content);
skillInfoItem.GetComponent<SkillInformationItem>().Initalize(skillData, playerLevel);
SkillInformationItem skillInfoItem = Instantiate(skillInfoPrefab, scrollRect.content);
skillInfoItem.gameObject.SetActive(true);
skillInfoItem.Initalize(skillData, playerLevel);
createSkillInfo.Add(skillInfoItem);
if (playerLevel < skillData.requiredLevel)
{
skillInfoItem.GetComponent<Button>().interactable = false;
}
RectTransform rectTransform = skillInfoItem.GetComponent<RectTransform>();
@@ -43,5 +55,26 @@ namespace TON
scrollRect.content.sizeDelta = new Vector2(scrollRect.content.sizeDelta.x, y);
}
public void OnClickSkillInfo()
{
GameObject selectedSlotGameObject = EventSystem.current.currentSelectedGameObject;
selectedSkillInfo = selectedSlotGameObject.GetComponent<SkillInformationItem>();
string selectSkillId = selectedSkillInfo.SelectedSkillInfo();
// SkillSettingUI.Instance.OnClickSkillInfo(selectSkillId);
Debug.Log($"OnClickSkillInfo() : {createSkillInfo.Count}");
foreach (var skillInfo in createSkillInfo)
{
Debug.Log($"OnClickSkillInfo() : {selectSkillId} , {skillInfo.skillId}");
Debug.Log(skillInfo.skillId != selectSkillId);
if (skillInfo.skillId != selectSkillId)
{
skillInfo.UnselectedSkillInfo();
}
}
}
}
}