备份CatanBuilding瘦身独立工程
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using GameCore;
|
||||
using cfg;
|
||||
|
||||
public class EventLuckyTriplePackContentView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private RewardItemNew[] rewards;
|
||||
[SerializeField] private Button btnBuy;
|
||||
[SerializeField] private TMP_Text textPrice, textDiscount;
|
||||
|
||||
public void Init(EventLuckyTriplePackContentData data, System.Action onBuy)
|
||||
{
|
||||
btnBuy.onClick.AddListener(() => onBuy());
|
||||
int idx = 0;
|
||||
while (idx < data.Rewards.Length)
|
||||
{
|
||||
rewards[idx].SetData(data.Rewards[idx]);
|
||||
idx++;
|
||||
}
|
||||
while (idx < rewards.Length)
|
||||
{
|
||||
rewards[idx].gameObject.SetActive(false);
|
||||
idx++;
|
||||
}
|
||||
textPrice.text = data.TextPrice;
|
||||
textDiscount.text = (data.Discount * 100).ToString("0.") + "%";
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
rewards = new RewardItemNew[4];
|
||||
for (int i = 1; i <= 4; i++)
|
||||
rewards[i - 1] = transform.Find($"Item/reward/reward{i}").GetComponent<RewardItemNew>();
|
||||
btnBuy = transform.Find("Item/btn_buy/btn_green").GetComponent<Button>();
|
||||
textPrice = transform.Find("Item/btn_buy/btn_green/Ani_Container/p_text").GetComponent<TMP_Text>();
|
||||
textDiscount = transform.Find("Item/tag_more/text_best").GetComponent<TMP_Text>();
|
||||
}
|
||||
}
|
||||
|
||||
public class EventLuckyTriplePackContentData
|
||||
{
|
||||
public string TextPrice;
|
||||
public ItemData[] Rewards;
|
||||
public float Discount;
|
||||
public int DropId;
|
||||
public IAPItemList IAPItemList;
|
||||
}
|
||||
Reference in New Issue
Block a user