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.
216 lines
7.2 KiB
216 lines
7.2 KiB
using IVDataFormat;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
|
|
public class EScrGuardienAwakenGear : EScrCell
|
|
{
|
|
private RectTransform rtrfSelect;
|
|
//private RectTransform rtrfSet;
|
|
|
|
private GoodsItem[] goodsItems;
|
|
private RectTransform[] rtrfGoodsItems;
|
|
private GameObject[] objBadges;
|
|
private Image[] imgLocks;
|
|
private Transform[] trfExps;
|
|
private TextMeshProUGUI[] txtExps;
|
|
|
|
|
|
public override void InitCell()
|
|
{
|
|
Transform trfself = transform;
|
|
rtrfSelect = trfself.Find("select").GetComponent<RectTransform>();
|
|
//rtrfSet = trfself.Find("set").GetComponent<RectTransform>();
|
|
//rtrfSet.GetChild(0).Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_equiping");
|
|
|
|
Transform trfbadges = trfself.Find("badges");
|
|
objBadges = new GameObject[4];
|
|
objBadges[0] = trfbadges.Find("badge0").gameObject;
|
|
objBadges[1] = trfbadges.Find("badge1").gameObject;
|
|
objBadges[2] = trfbadges.Find("badge2").gameObject;
|
|
objBadges[3] = trfbadges.Find("badge3").gameObject;
|
|
txtExps = new TextMeshProUGUI[4];
|
|
trfExps = new Transform[4];
|
|
|
|
|
|
|
|
imgLocks = trfself.Find("locks").GetComponentsInChildren<Image>(true);
|
|
goodsItems = trfself.GetComponentsInChildren<GoodsItem>(true);
|
|
Transform trfexp;
|
|
trfexp = trfself.Find("exps");
|
|
rtrfGoodsItems = new RectTransform[goodsItems.Length];
|
|
|
|
for (int i = 0; i < rtrfGoodsItems.Length; i++)
|
|
{
|
|
rtrfGoodsItems[i] = goodsItems[i].GetComponent<RectTransform>();
|
|
trfExps[i] = trfexp.GetChild(i);
|
|
txtExps[i] = new TextMeshProUGUI();
|
|
txtExps[i] = trfExps[i].Find("txt").GetComponent<TextMeshProUGUI>();
|
|
}
|
|
}
|
|
|
|
public override void Localize()
|
|
{
|
|
//rtrfSet.GetChild(0).Find("txt").GetComponent<TextMeshProUGUI>().text = LocalizationText.GetText("all_equiping");
|
|
}
|
|
|
|
public override void RefreshCellView()
|
|
{
|
|
SetData(itemID);
|
|
}
|
|
|
|
public override void SetData(int itemid)
|
|
{
|
|
itemID = itemid;
|
|
|
|
for(int i = 0; i < goodsItems.Length; i++)
|
|
{
|
|
switch (itemID)
|
|
{
|
|
case 0:
|
|
iType = cGoods.TBagWeapon;
|
|
break;
|
|
case 1:
|
|
iType = cGoods.TBagArmorCape;
|
|
break;
|
|
case 2:
|
|
iType = cGoods.TBagArmorHat;
|
|
break;
|
|
case 3:
|
|
iType = cGoods.TBagArmorShoes;
|
|
break;
|
|
case 4:
|
|
iType = cGoods.TBagAcceEar;
|
|
break;
|
|
case 5:
|
|
iType = cGoods.TBagAcceNeck;
|
|
break;
|
|
case 6:
|
|
iType = cGoods.TBagAcceRing;
|
|
break;
|
|
}
|
|
}
|
|
|
|
int iselectindex = -1;
|
|
int isetindex = -1;
|
|
dGear gearequip = DataHandler.GetGearEquip(iType, DataHandler.GetEquipedGear(iType));
|
|
int ilasthavekey = DataHandler.GetGearLastHaveId(iType);
|
|
int iequipkey;
|
|
int iequipunit;
|
|
if (gearequip == null)
|
|
{
|
|
iequipkey = 0;
|
|
iequipunit = 0;
|
|
}
|
|
else
|
|
{
|
|
iequipkey = gearequip.id;
|
|
iequipunit = gearequip.rarity * 100 + gearequip.grade;
|
|
}
|
|
|
|
for (int i = 0; i < goodsItems.Length; i++)
|
|
{
|
|
int key = 25 + i;//GuardianMgr.SGetGearId(iType, itemid, i);
|
|
if (key < 0)
|
|
{
|
|
goodsItems[i].gameObject.SetActive(false);
|
|
goodsItems[i].ReleaseData();
|
|
imgLocks[i].enabled = false;
|
|
objBadges[i].SetActive(false);
|
|
trfExps[i].gameObject.SetActive(false);
|
|
continue;
|
|
}
|
|
|
|
if(itemID < 4)
|
|
{
|
|
switch (key)
|
|
{
|
|
case 25:
|
|
txtExps[i].text = FormatString.CombineAll("exp + ", DataHandler.Const.firstGradeEquipExp.ToString());
|
|
break;
|
|
case 26:
|
|
txtExps[i].text = FormatString.CombineAll("exp + ", DataHandler.Const.secondGradeEquipExp.ToString());
|
|
break;
|
|
case 27:
|
|
txtExps[i].text = FormatString.CombineAll("exp + ", DataHandler.Const.thirdGradeEquipExp.ToString());
|
|
break;
|
|
case 28:
|
|
txtExps[i].text = FormatString.CombineAll("exp + ", DataHandler.Const.fourthGradeEquipExp.ToString());
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
switch (key)
|
|
{
|
|
case 25:
|
|
txtExps[i].text = FormatString.CombineAll("exp + ", DataHandler.Const.firstGradeAccExp.ToString());
|
|
break;
|
|
case 26:
|
|
txtExps[i].text = FormatString.CombineAll("exp + ", DataHandler.Const.secondGradeAccExp.ToString());
|
|
break;
|
|
case 27:
|
|
txtExps[i].text = FormatString.CombineAll("exp + ", DataHandler.Const.thirdGradeAccExp.ToString());
|
|
break;
|
|
case 28:
|
|
txtExps[i].text = FormatString.CombineAll("exp + ", DataHandler.Const.fourthGradeAccExp.ToString());
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
dGear data = DataHandler.GetGearEquip(iType, key);
|
|
int iunit = data.rarity * 100 + data.grade;
|
|
|
|
goodsItems[i].gameObject.SetActive(true);
|
|
goodsItems[i].SetGoods(iType, key, data.count);
|
|
imgLocks[i].enabled = data.count <= 0;//!data.have;
|
|
//objBadges[i].SetActive(data.have && (DataHandler.IsGearNew(iType, key) || (key == ilasthavekey && iequipunit < iunit)));
|
|
|
|
if (BagMgr.SIsSelectGear(key))
|
|
iselectindex = i;
|
|
if (key == iequipkey)
|
|
isetindex = i;
|
|
|
|
}
|
|
|
|
if (iselectindex >= 0)
|
|
{
|
|
rtrfSelect.anchoredPosition = rtrfGoodsItems[iselectindex].anchoredPosition;
|
|
rtrfSelect.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
rtrfSelect.gameObject.SetActive(false);
|
|
}
|
|
|
|
if (isetindex >= 0)
|
|
{
|
|
//rtrfSet.anchoredPosition = rtrfGoodsItems[isetindex].anchoredPosition;
|
|
//rtrfSet.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
//rtrfSet.gameObject.SetActive(false);
|
|
}
|
|
|
|
}
|
|
|
|
int startRareity = 25;
|
|
|
|
public void OnBtnSelect(int ichildindex)
|
|
{
|
|
SoundMgr.Instance.PlaySfx(SoundName.BtnPress);
|
|
|
|
//BagMgr.SSelectGear(iType, itemID, ichildindex);
|
|
GuardianMgr.plusMinusGear(iType, itemID, ichildindex);
|
|
dGear data = DataHandler.GetGearEquip(iType, startRareity + ichildindex);
|
|
if (data.count > 0)
|
|
{
|
|
data.count = data.count - 1;//갯수 추가와 감산
|
|
//SetData(itemID);
|
|
GuardianMgr.SetExpGear(itemID, ichildindex, data);
|
|
}
|
|
}
|
|
}
|