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.
222 lines
7.7 KiB
222 lines
7.7 KiB
using IVDataFormat;
|
|
using System.Numerics;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class GoodsGuardianSlotItem : GoodsItem
|
|
{
|
|
#region UI
|
|
|
|
#endregion UI
|
|
|
|
int count = 0;
|
|
|
|
int itemId = 0;
|
|
public void PlusCount()
|
|
{
|
|
count++;
|
|
}
|
|
|
|
/*
|
|
protected virtual void Init()
|
|
{
|
|
imgBg = GetComponent<Image>();
|
|
imgIcon = transform.Find("icon").GetComponent<Image>();
|
|
imgSpirit = transform.Find("spirit").GetComponent<Image>();
|
|
imgRarity = transform.Find("rarity").GetComponent<Image>();
|
|
imgStars = transform.Find("stars").GetComponentsInChildren<Image>();
|
|
txtRarity = transform.Find("txtRarity").GetComponent<TextMeshProUGUI>();
|
|
txtCount = transform.Find("txtCount").GetComponent<TextMeshProUGUI>();
|
|
btnSelf = GetComponent<ButtonIV>();
|
|
}
|
|
|
|
public virtual void ReleaseData()
|
|
{
|
|
if (imgIcon == null)
|
|
Init();
|
|
imgIcon.sprite = null;
|
|
txtCount.text = null;
|
|
|
|
imgIcon.enabled = false;
|
|
imgBg.color = Global.CLR_RarityBack[cGoods.RNone];
|
|
imgRarity.enabled = false;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = false;
|
|
txtRarity.enabled = false;
|
|
}
|
|
|
|
public virtual void SetGoods(int itype, int icode, BigInteger icount)
|
|
{
|
|
if (imgIcon == null)
|
|
Init();
|
|
if (icount < 0L)
|
|
txtCount.text = null;
|
|
else
|
|
txtCount.text = icount.ToString();
|
|
imgIcon.sprite = AddressableMgr.GetIcon(itype, icode);
|
|
|
|
switch (itype)
|
|
{
|
|
case cGoods.TCurrency:
|
|
case cGoods.TExp:
|
|
case cGoods.TBagTreasure:
|
|
imgIcon.enabled = true;
|
|
imgBg.color = Global.CLR_RarityBack[cGoods.RNone];
|
|
imgSpirit.enabled = false;
|
|
imgRarity.enabled = false;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = false;
|
|
txtRarity.enabled = false;
|
|
break;
|
|
|
|
case cGoods.TBagWeapon:
|
|
case cGoods.TBagArmorCape:
|
|
case cGoods.TBagArmorHat:
|
|
case cGoods.TBagArmorShoes:
|
|
case cGoods.TBagAcceEar:
|
|
case cGoods.TBagAcceNeck:
|
|
case cGoods.TBagAcceRing:
|
|
dGear gear = DataHandler.GetGearEquip(itype, icode);
|
|
imgIcon.enabled = true;
|
|
imgBg.color = Global.CLR_RarityBack[gear.rarity];
|
|
imgSpirit.enabled = false;
|
|
imgRarity.color = Global.CLR_RarityFront[gear.rarity];
|
|
imgRarity.enabled = true;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = i < gear.grade;
|
|
txtRarity.text = Global.STR_Rarity[gear.rarity];
|
|
txtRarity.enabled = true;
|
|
break;
|
|
|
|
case cGoods.TPet:
|
|
imgIcon.enabled = true;
|
|
int ipetrarity = DataHandler.GetPetRarity(icode);
|
|
imgBg.color = Global.CLR_RarityBack[ipetrarity];
|
|
imgSpirit.enabled = false;
|
|
imgRarity.color = Global.CLR_RarityFront[ipetrarity];
|
|
imgRarity.enabled = true;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = false;
|
|
txtRarity.text = Global.STR_Rarity[ipetrarity];
|
|
txtRarity.enabled = true;
|
|
break;
|
|
|
|
case cGoods.TPetSpirit:
|
|
imgIcon.enabled = true;
|
|
if (icode < 0)
|
|
{
|
|
imgBg.color = Global.CLR_BackPetSpirit;
|
|
imgSpirit.enabled = false;
|
|
imgRarity.enabled = false;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = false;
|
|
txtRarity.enabled = false;
|
|
}
|
|
else
|
|
{
|
|
int ispiritrarity = DataHandler.GetPetRarity(icode);
|
|
imgBg.color = Global.CLR_RarityBack[ispiritrarity];
|
|
imgSpirit.enabled = true;
|
|
imgRarity.color = Global.CLR_RarityFront[ispiritrarity];
|
|
imgRarity.enabled = true;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = false;
|
|
txtRarity.text = Global.STR_Rarity[ispiritrarity];
|
|
txtRarity.enabled = true;
|
|
}
|
|
break;
|
|
|
|
case cGoods.TSkillActive:
|
|
case cGoods.TSkillPassive:
|
|
imgIcon.enabled = true;
|
|
int iskillrarity = DataHandler.GetSkillRarity(itype, icode);
|
|
imgBg.color = Global.CLR_RarityBack[iskillrarity];
|
|
imgSpirit.enabled = false;
|
|
imgRarity.color = Global.CLR_RarityFront[iskillrarity];
|
|
imgRarity.enabled = true;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = false;
|
|
txtRarity.text = Global.STR_Rarity[iskillrarity];
|
|
txtRarity.enabled = true;
|
|
break;
|
|
|
|
case cGoods.TCosClrHair:
|
|
case cGoods.TCosClrTop:
|
|
case cGoods.TCosClrEye:
|
|
imgIcon.enabled = false;
|
|
imgBg.color = DataHandler.GetColor(icode);
|
|
imgSpirit.enabled = false;
|
|
imgRarity.enabled = false;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = false;
|
|
txtRarity.enabled = false;
|
|
break;
|
|
|
|
case cGoods.TCosCloth:
|
|
case cGoods.TCosWeapon:
|
|
imgIcon.enabled = true;
|
|
imgBg.color = Global.CLR_BackCos;
|
|
imgSpirit.enabled = false;
|
|
imgRarity.enabled = false;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = false;
|
|
txtRarity.enabled = false;
|
|
break;
|
|
|
|
case cGoods.TBox:
|
|
dBox box = DataHandler.GetBox(icode);
|
|
imgIcon.enabled = true;
|
|
imgBg.color = Global.CLR_RarityBack[box.rarity];
|
|
imgSpirit.enabled = false;
|
|
// 희귀도 없음.
|
|
if (box.rarity <= cGoods.RNone)
|
|
{
|
|
imgRarity.enabled = false;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = false;
|
|
txtRarity.enabled = false;
|
|
}
|
|
else
|
|
{
|
|
imgRarity.color = Global.CLR_RarityFront[box.rarity];
|
|
imgRarity.enabled = true;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = i < box.grade;
|
|
txtRarity.text = Global.STR_Rarity[box.rarity];
|
|
txtRarity.enabled = true;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
imgIcon.enabled = true;
|
|
imgBg.color = Global.CLR_RarityBack[cGoods.RNone];
|
|
imgSpirit.enabled = false;
|
|
imgRarity.enabled = false;
|
|
for (int i = 0; i < imgStars.Length; i++)
|
|
imgStars[i].enabled = false;
|
|
txtRarity.enabled = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void SetData(nGoods goods)
|
|
{
|
|
if (goods == null)
|
|
return;
|
|
SetGoods(goods.propertyType, goods.propertyId, goods.propertyCount);
|
|
}
|
|
|
|
*/
|
|
|
|
public void SetItemId(int id)
|
|
{
|
|
itemId = id;
|
|
}
|
|
|
|
public new void BtnPress()
|
|
{
|
|
GuardianMgr.DelExpGear(itemId);
|
|
}
|
|
|
|
}
|