You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
3.8 KiB
127 lines
3.8 KiB
using IVDataFormat;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
|
|
public class EScrSkill : EScrCell
|
|
{
|
|
private RectTransform rtrfSelect;
|
|
|
|
private GoodsItem[] goodsItems;
|
|
private RectTransform[] rtrfGoodsItems;
|
|
private GameObject[] goSets;
|
|
private Image[] imgLocks;
|
|
private Image[] imgLvBgs;
|
|
private TextMeshProUGUI[] txtLvs;
|
|
|
|
|
|
public override void InitCell()
|
|
{
|
|
Transform trfself = transform;
|
|
rtrfSelect = trfself.Find("select").GetComponent<RectTransform>();
|
|
|
|
imgLocks = trfself.Find("locks").GetComponentsInChildren<Image>(true);
|
|
imgLvBgs = trfself.Find("lvs").GetComponentsInChildren<Image>(true);
|
|
txtLvs = trfself.Find("lvs").GetComponentsInChildren<TextMeshProUGUI>(true);
|
|
goodsItems = trfself.GetComponentsInChildren<GoodsItem>(true);
|
|
|
|
rtrfGoodsItems = new RectTransform[goodsItems.Length];
|
|
for (int i = 0; i < rtrfGoodsItems.Length; i++)
|
|
{
|
|
rtrfGoodsItems[i] = goodsItems[i].GetComponent<RectTransform>();
|
|
}
|
|
|
|
Image[] sets = trfself.Find("sets").GetComponentsInChildren<Image>(true);
|
|
goSets = new GameObject[sets.Length];
|
|
for (int i = 0; i < sets.Length; i++)
|
|
{
|
|
goSets[i] = sets[i].gameObject;
|
|
goSets[i].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_equiping");
|
|
}
|
|
}
|
|
|
|
public override void Localize()
|
|
{
|
|
for (int i = 0; i < goSets.Length; i++)
|
|
{
|
|
goSets[i].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_equiping");
|
|
}
|
|
}
|
|
|
|
public override void RefreshCellView()
|
|
{
|
|
SetData(itemID);
|
|
}
|
|
|
|
public override void SetData(int itemid)
|
|
{
|
|
itemID = itemid;
|
|
int iselectindex = -1;
|
|
|
|
for (int i = 0; i < goodsItems.Length; i++)
|
|
{
|
|
int key = SkillMgr.SGetSkillId(iType, itemid, i);
|
|
if (key < 0)
|
|
{
|
|
goodsItems[i].gameObject.SetActive(false);
|
|
goodsItems[i].ReleaseData();
|
|
imgLvBgs[i].enabled = false;
|
|
txtLvs[i].text = null;
|
|
imgLocks[i].enabled = false;
|
|
goSets[i].SetActive(false);
|
|
continue;
|
|
}
|
|
|
|
int irarity = 0;
|
|
bool bhave = false;
|
|
int ilv = 0;
|
|
|
|
// 액티브.
|
|
if (iType == cGoods.TSkillActive)
|
|
{
|
|
dSkillActive data = DataHandler.GetSkillActive(key);
|
|
irarity = data.rarity;
|
|
bhave = data.level > 0;
|
|
ilv = data.level;
|
|
goSets[i].SetActive(SkillMgr.SIsSetSkill(key));
|
|
}
|
|
// 패시브.
|
|
else
|
|
{
|
|
dSkillPassive data = DataHandler.GetSkillPassive(key);
|
|
irarity = data.rarity;
|
|
bhave = data.level > 0;
|
|
ilv = data.level;
|
|
goSets[i].SetActive(false);
|
|
}
|
|
|
|
goodsItems[i].gameObject.SetActive(true);
|
|
goodsItems[i].SetGoods(iType, key, 0L);
|
|
imgLvBgs[i].color = Global.CLR_RarityFront[irarity];
|
|
imgLvBgs[i].enabled = true;
|
|
txtLvs[i].text = FormatString.TextLv(ilv);
|
|
imgLocks[i].enabled = !bhave;
|
|
|
|
if (SkillMgr.SIsSelectSkill(key))
|
|
iselectindex = i;
|
|
}
|
|
|
|
if (iselectindex >= 0)
|
|
{
|
|
rtrfSelect.anchoredPosition = rtrfGoodsItems[iselectindex].anchoredPosition;
|
|
rtrfSelect.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
rtrfSelect.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
public void OnBtnSelect(int ichildindex)
|
|
{
|
|
SoundMgr.PlaySfx(SoundName.BtnPress);
|
|
|
|
SkillMgr.SSelectSkill(iType, itemID, ichildindex);
|
|
}
|
|
}
|