97 lines
3.1 KiB
C#
97 lines
3.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Set.Data;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
namespace UI
|
|
{
|
|
public class EmblemSelector : MonoBehaviour
|
|
{
|
|
[Header("Configuration")]
|
|
[SerializeField]
|
|
private int _defaultEmblemCount = 0;
|
|
|
|
[SerializeField]
|
|
private TraitDisplayInfo _emblemUIPrefab;
|
|
|
|
[Header("Layout")]
|
|
[SerializeField]
|
|
private Transform _traitsParent;
|
|
|
|
private Dictionary<TraitsEnum, TraitDisplayInfo> _emblemUIs =
|
|
new Dictionary<TraitsEnum, TraitDisplayInfo>();
|
|
|
|
// Trait definitions with display names
|
|
private readonly Dictionary<TraitsEnum, string> _traitDisplayInfo = new Dictionary<
|
|
TraitsEnum,
|
|
string
|
|
>
|
|
{
|
|
{ TraitsEnum.BATTLEACADEMIA, "Battle Academia" },
|
|
{ TraitsEnum.CRYSTALGAMBIT, "Crystal Gambit" },
|
|
{ TraitsEnum.LUCHADOR, "Luchador" },
|
|
{ TraitsEnum.MIGHTYMECH, "Mighty Mech" },
|
|
{ TraitsEnum.MONSTERTRAINER, "Monster Trainer" },
|
|
{ TraitsEnum.SOULFIGHTER, "Soul Fighter" },
|
|
{ TraitsEnum.STARGUARDIAN, "Star Guardian" },
|
|
{ TraitsEnum.SUPREMECELLS, "Supreme Cells" },
|
|
{ TraitsEnum.THECREW, "The Crew" },
|
|
{ TraitsEnum.WRAITH, "Wraith" },
|
|
{ TraitsEnum.MENTOR, "Mentor" },
|
|
{ TraitsEnum.PRODIGY, "Prodigy" },
|
|
{ TraitsEnum.THECHAMP, "The Champ" },
|
|
{ TraitsEnum.STANCEMASTER, "Stance Master" },
|
|
{ TraitsEnum.ROGUECAPTAIN, "Rogue Captain" },
|
|
{ TraitsEnum.BASTION, "Bastion" },
|
|
{ TraitsEnum.DUELIST, "Duelist" },
|
|
{ TraitsEnum.EDGELORD, "Edgelord" },
|
|
{ TraitsEnum.EXECUTIONER, "Executioner" },
|
|
{ TraitsEnum.HEAVYWEIGHT, "Heavyweight" },
|
|
{ TraitsEnum.JUGGERNAUT, "Juggernaut" },
|
|
{ TraitsEnum.PROTECTOR, "Protector" },
|
|
{ TraitsEnum.SNIPER, "Sniper" },
|
|
{ TraitsEnum.SORCERER, "Sorcerer" },
|
|
{ TraitsEnum.STRATEGIST, "Strategist" },
|
|
};
|
|
|
|
void Start()
|
|
{
|
|
CreateEmblemUIs();
|
|
}
|
|
|
|
private void CreateEmblemUIs()
|
|
{
|
|
foreach (var kvp in _traitDisplayInfo)
|
|
{
|
|
var trait = kvp.Key;
|
|
var traitName = kvp.Value;
|
|
|
|
TraitDisplayInfo emblemUI = Instantiate<TraitDisplayInfo>(
|
|
_emblemUIPrefab,
|
|
_traitsParent
|
|
);
|
|
emblemUI.Initialize(trait, traitName, _defaultEmblemCount);
|
|
_emblemUIs.Add(trait, emblemUI);
|
|
}
|
|
}
|
|
|
|
public Dictionary<int, int> GetEmblems()
|
|
{
|
|
Dictionary<int, int> emblems = new Dictionary<int, int>();
|
|
|
|
foreach (var kvp in _emblemUIs)
|
|
{
|
|
var trait = kvp.Key;
|
|
var emblemUI = kvp.Value;
|
|
|
|
int emblemCount = emblemUI.GetEmblemCount();
|
|
emblems[(int)trait] = emblemCount;
|
|
|
|
}
|
|
return emblems;
|
|
}
|
|
|
|
}
|
|
}
|