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.
61 lines
1.8 KiB
61 lines
1.8 KiB
using Coffee.UIEffects;
|
|
using IVDataFormat;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class PvpRewItem : MonoBehaviour
|
|
{
|
|
private TextMeshProUGUI txtCond;
|
|
|
|
private GoodsItem goodsRew;
|
|
private UIShiny shinyRew;
|
|
private GameObject goBadge;
|
|
private GameObject goClose;
|
|
private GameObject goClear;
|
|
//private GameObject goLineL;
|
|
|
|
public void InitCell()
|
|
{
|
|
Transform trfself = transform;
|
|
txtCond = trfself.Find("txtCond").GetComponent<TextMeshProUGUI>();
|
|
|
|
goodsRew = trfself.Find("GoodsItem").GetComponent<GoodsItem>();
|
|
shinyRew = goodsRew.transform.Find("icon").GetComponent<UIShiny>();
|
|
|
|
goBadge = trfself.Find("badge").gameObject;
|
|
goClose = trfself.Find("close").gameObject;
|
|
goClear = trfself.Find("clear").gameObject;
|
|
//goLineL = trfself.Find("linel").gameObject;
|
|
}
|
|
|
|
public void SetFloat(float fvalue)
|
|
{
|
|
shinyRew.effectFactor = fvalue;
|
|
}
|
|
|
|
public void SetData(int itemid)
|
|
{
|
|
//goLineL.SetActive(itemid == 0);
|
|
|
|
dPvpRew rewdata = DataHandler.GetPvpReward(itemid);
|
|
txtCond.text = FormatString.StringFormat(LocalizationText.GetText("all_trycnt"), rewdata.condValue);
|
|
|
|
goodsRew.SetGoods(rewdata.rewardType, rewdata.rewardId, rewdata.rewardCount, true);
|
|
|
|
int iavailrew = DataHandler.playPvp.availWeeklyIndex < 0 ? 0 : DataHandler.GetPvpReward(DataHandler.playPvp.availWeeklyIndex).id;
|
|
int ihaverew = DataHandler.playPvp.rewardWeekly;
|
|
goBadge.SetActive(ihaverew < rewdata.id && iavailrew >= rewdata.id);
|
|
goClear.SetActive(ihaverew >= rewdata.id);
|
|
goClose.SetActive(goClear.activeSelf);
|
|
}
|
|
|
|
public void BtnGetReward()
|
|
{
|
|
if (!goClose.activeSelf && goBadge.activeSelf)
|
|
{
|
|
SoundMgr.Instance.PlaySfx(SoundName.BtnPress);
|
|
PvpMgr.SGetReward();
|
|
}
|
|
}
|
|
|
|
}
|