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.
 
 
 
 
 
 

90 lines
3.2 KiB

using Coffee.UIEffects;
using IVDataFormat;
using TMPro;
using UnityEngine;
public class EScrPass : EScrCell
{
private GoodsItem goodsRewPaid, goodsRewFree;
private UIShiny shinyPaid, shinyFree;
private GameObject goBadgePaid, goBadgeFree;
private GameObject goClosePaid, goCloseFree;
private GameObject goClearPaid, goClearFree;
private GameObject goLockPaid;
private TextMeshProUGUI txtCond;
public override void InitCell()
{
goodsRewPaid = transform.Find("GoodsItemPaid").GetComponent<GoodsItem>();
goodsRewFree = transform.Find("GoodsItemFree").GetComponent<GoodsItem>();
shinyPaid = goodsRewPaid.transform.Find("icon").GetComponent<UIShiny>();
shinyFree = goodsRewFree.transform.Find("icon").GetComponent<UIShiny>();
goBadgePaid = transform.Find("badgePaid").gameObject;
goBadgeFree = transform.Find("badgeFree").gameObject;
goClosePaid = transform.Find("closePaid").gameObject;
goCloseFree = transform.Find("closeFree").gameObject;
goClearPaid = transform.Find("clearPaid").gameObject;
goClearFree = transform.Find("clearFree").gameObject;
goLockPaid = transform.Find("lockPaid").gameObject;
txtCond = transform.Find("txtCond").GetComponent<TextMeshProUGUI>();
}
public override void RefreshCellView()
{
SetData(itemID);
}
public override void SetFloat(float fvalue)
{
shinyPaid.effectFactor = fvalue;
shinyFree.effectFactor = fvalue;
}
public override void SetData(int itemid)
{
itemID = itemid;
dPass passdata = PassMgr.SGetPass();
dPassLevel leveldata = PassMgr.SGetLevel(itemid);
int ipageindex = PassMgr.SGetPageIndex(itemid);
int ilevelindex = PassMgr.SGetLevelIndex(itemid);
// 패스 정보.
txtCond.text = FormatString.TextConditionValue(passdata.condType, leveldata.condValue);
goodsRewPaid.SetGoods(leveldata.paidRewardType, leveldata.paidRewardId, leveldata.paidReward);
goodsRewFree.SetGoods(leveldata.freeRewardType, leveldata.freeRewardId, leveldata.freeReward);
// 유료 상태.
goLockPaid.SetActive(!passdata.isPaid[ipageindex]);
// 진행 상태.
goBadgeFree.SetActive(passdata.haveLvFrees[ipageindex] <= ilevelindex && passdata.availLevel > ilevelindex);
goBadgePaid.SetActive(passdata.haveLvPaids[ipageindex] <= ilevelindex && passdata.availLevel > ilevelindex);
// 보상 획득 상태.
goClearFree.SetActive(passdata.haveLvFrees[ipageindex] > ilevelindex);
goClearPaid.SetActive(passdata.haveLvPaids[ipageindex] > ilevelindex);
goCloseFree.SetActive(goClearFree.activeSelf);
goClosePaid.SetActive(goLockPaid.activeSelf || goClearPaid.activeSelf);
}
public void BtnGetRewardFree()
{
if (!goCloseFree.activeSelf && goBadgeFree.activeSelf)
{
SoundMgr.Instance.PlaySfx(SoundName.BtnPress);
PassMgr.SGetPassReward();
}
}
public void BtnGetRewardPaid()
{
if (!goClosePaid.activeSelf && goBadgePaid.activeSelf)
{
SoundMgr.Instance.PlaySfx(SoundName.BtnPress);
PassMgr.SGetPassReward();
}
}
}