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.
195 lines
7.5 KiB
195 lines
7.5 KiB
using IVDataFormat;
|
|
using System.Numerics;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class GoodsItemSimple : GoodsItem
|
|
{
|
|
|
|
|
|
|
|
|
|
protected override 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>();
|
|
}
|
|
|
|
public override void ReleaseData()
|
|
{
|
|
if (imgIcon == null)
|
|
Init();
|
|
imgIcon.sprite = null;
|
|
}
|
|
|
|
public override void SetGoods(int itype, int icode, BigInteger icount, bool bpvp = false)
|
|
{
|
|
if (imgIcon == null)
|
|
Init();
|
|
imgIcon.sprite = AddressableMgr.GetIcon(itype, icode);
|
|
|
|
switch (itype)
|
|
{
|
|
case cGoods.TCurrency:
|
|
case cGoods.TExp:
|
|
case cGoods.TBagTreasure:
|
|
imgIcon.enabled = true;
|
|
imgBg.sprite = AddressableMgr.GetGradeIcon(9);
|
|
//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.enabled = true;
|
|
imgBg.sprite = AddressableMgr.GetGradeIcon(gear.rarity);// Global.CLR_RarityBack[];
|
|
if (imgRarityLatter != null)
|
|
{
|
|
imgRarityLatter.sprite = AddressableMgr.GetGradeLatterIcon(gear.rarity);
|
|
}
|
|
if (imgRarityBg != null)
|
|
{
|
|
imgRarityBg.sprite = AddressableMgr.GetGradeLatterIcon(gear.rarity);
|
|
}
|
|
imgBg.color = Color.white;
|
|
|
|
imgSpirit.enabled = false;
|
|
imgRarity.color = Color.white;
|
|
imgRarity.sprite = AddressableMgr.GetGradeLatterIcon(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;
|
|
//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.sprite = AddressableMgr.GetGradeIcon(ispiritrarity);
|
|
imgBg.color = UnityEngine.Color.white;
|
|
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.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.SysBoxes[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.sprite = AddressableMgr.GetGradeIcon(9);
|
|
//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;
|
|
}
|
|
if (bpvp)
|
|
imgBg.color = Color.clear;
|
|
}
|
|
|
|
}
|