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.
 
 
 
 
 
 

190 lines
7.7 KiB

using IVDataFormat;
using System.Numerics;
using UnityEngine;
public class GoodsItemRewardList : GoodsItem
{
public override void SetGoods(int itype, int icode, BigInteger icount, bool bpvp = false)
{
if (imgIcon == null)
Init();
if (icount < 0L)
txtCount.text = null;
else
txtCount.text = FormatString.BigIntString1(icount);
imgIcon.sprite = AddressableMgr.GetIcon(itype, icode);
txtCount.gameObject.SetActive(true);
switch (itype)
{
case cGoods.TAdsRemove:
imgIcon.enabled = true;
imgBg.sprite = AddressableMgr.GetGradeIcon(9);
imgBg.color = Global.CLR_RarityBack[cGoods.RNone];
txtCount.gameObject.SetActive(false);
imgRarity.enabled = false;
for (int i = 0; i < imgStars.Length; i++)
imgStars[i].enabled = false;
txtRarity.enabled = false;
break;
case cGoods.TCurrency:
case cGoods.TExp:
imgBg.sprite = AddressableMgr.GetGradeIcon(9);
//imgBg.color = Global.CLR_RarityBack[cGoods.RNone];
imgIcon.enabled = true;
imgSpirit.enabled = false;
imgRarity.enabled = false;
for (int i = 0; i < imgStars.Length; i++)
imgStars[i].enabled = false;
txtRarity.enabled = false;
break;
case cGoods.TBagTreasure:
imgIcon.enabled = true;
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;
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.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 = new Color(1f, 1f, 1f);
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:
int ipetrarity = DataHandler.GetPetRarity(icode);
imgBg.color = Global.CLR_RarityBack[ipetrarity];
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;
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];
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];
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;
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];
txtCount.text = FormatString.TextIntPer((int)icount);
imgIcon.enabled = true;
imgBg.color = Global.CLR_RarityBack[box.rarity];
if (box.rarity <= cGoods.RNone)
{
imgRarity.enabled = false;
for (int i = 0; i < imgStars.Length; i++)
imgStars[i].enabled = false;
txtRarity.enabled = false;
}
else
{
imgIcon.enabled = true;
imgBg.sprite = AddressableMgr.GetGradeIcon(box.rarity);
if (imgRarityLatter != null)
{
imgRarityLatter.sprite = AddressableMgr.GetGradeLatterIcon(box.rarity);
}
if (imgRarityBg != null)
{
imgRarityBg.sprite = AddressableMgr.GetGradeLatterIcon(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];
}
break;
case cGoods.TEventTrade:
case cGoods.TEventRaise:
case cGoods.TEventRoulette:
txtCount.text = FormatString.TextIntPer((int)icount);
imgIcon.enabled = true;
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;
break;
default:
imgIcon.enabled = true;
imgBg.sprite = AddressableMgr.GetGradeIcon(9);
//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;
break;
}
if (bpvp)
imgBg.color = Color.clear;
}
}