스킬 작업 테스트 코드
This commit is contained in:
@@ -45,15 +45,17 @@ namespace TON
|
||||
|
||||
List<PlayerData> playersData = PlayerDataManager.Singleton.playersData;
|
||||
PlayerPrefs.SetInt("SelectedPlayerIndex", 0);
|
||||
HeartDataManager.Singleton.SetCurrentUserHeart();
|
||||
|
||||
PlayerDataManager.Singleton.SetCurrentUserData();
|
||||
// HeartDataManager.Singleton.();
|
||||
List<SkillData> skillDatas = SkillDataManager.Singleton.skillDatas;
|
||||
|
||||
// TODO : Custom Order After System Load
|
||||
// UIManager.Show<IngameUI>(UIList.IngameUI);
|
||||
// UIManager.Show<LobbyUI>(UIList.LobbyUI);
|
||||
UIManager.Show<ControllerUI>(UIList.ControllerUI);
|
||||
ControllerUI.Instance.Initalize();
|
||||
// UIManager.Show<IngameOptionUI>(UIList.IngameOptionUI);
|
||||
// UIManager.Show<CharaterSelectUI>(UIList.CharaterSelectUI);
|
||||
// UIManager.Show<CharaterCreateUI>(UIList.CharaterCreateUI);
|
||||
// UIManager.Show<TitleUI>(UIList.TitleUI);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
@@ -13,6 +15,57 @@ namespace TON
|
||||
public VariableJoystick joystick;
|
||||
public CharacterBase linkedCharactor { get; set; }
|
||||
|
||||
public Button[] buttons; // UI 버튼 (3개)
|
||||
[SerializeField]
|
||||
private SerializableDictionary<int, ControllerUI_SkillButton> skillButtons;
|
||||
|
||||
private List<SkillData> skillDatas;
|
||||
|
||||
|
||||
public void Initalize()
|
||||
{
|
||||
|
||||
int characterLevel = PlayerDataManager.Singleton.player.level;
|
||||
skillDatas = SkillDataManager.Singleton.skillDatas;
|
||||
|
||||
if (skillDatas != null)
|
||||
{
|
||||
Debug.Log("characterLevel ::: " + characterLevel);
|
||||
// 사용 가능한 스킬 필터링 (캐릭터 레벨보다 필요 레벨이 낮거나 같은 것만)
|
||||
List<SkillData> availableSkills = skillDatas
|
||||
.Where(skill => skill.requiredLevel <= characterLevel)
|
||||
.OrderBy(skill => skill.requiredLevel) // 필요 레벨이 낮은 순으로 정렬
|
||||
.Take(3) // 최대 3개 선택
|
||||
.ToList();
|
||||
|
||||
Debug.Log(availableSkills.Count);
|
||||
// availableSkills
|
||||
|
||||
// 버튼 설정
|
||||
for (int i = 0; i < buttons.Length; i++)
|
||||
{
|
||||
if (i < availableSkills.Count)
|
||||
{
|
||||
buttons[i].interactable = true; // 사용 가능
|
||||
|
||||
SkillData skillData = skillDatas.Find(skill => skill.slotNumber == i);
|
||||
skillButtons[i].skillData = skillData;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
buttons[i].interactable = false; // 사용 불가
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("스킬 정보 로드 오류 발생");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void OnClickJumpButton()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class ControllerUI_SkillButton : MonoBehaviour
|
||||
{
|
||||
public SkillData skillData;
|
||||
|
||||
public Image lockImage;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35c94c75c6e511048b4a77d3682e1f85
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user