备份CatanBuilding瘦身独立工程
This commit is contained in:
55
Assets/Scripts/MiniBP/UI/MiniBattlePassFirstPanel.cs
Normal file
55
Assets/Scripts/MiniBP/UI/MiniBattlePassFirstPanel.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using DG.Tweening;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MiniBattlePassFirstPanel : MiniBattlePassPanel
|
||||
{
|
||||
TMP_Text text_num;
|
||||
protected Button btn_claim_n;
|
||||
protected Button btn_claim_gray_n;
|
||||
protected override int showCount => 4;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
text_num = transform.Find("root/total_prize/reward/text_num").GetComponent<TMP_Text>();
|
||||
btn_claim_n = transform.Find("root/bottom/buy/btn_claim/btn_green").GetComponent<Button>();
|
||||
btn_claim_gray_n = transform.Find("root/bottom/buy/btn_claim_gray/btn_green").GetComponent<Button>();
|
||||
}
|
||||
protected override void Start()
|
||||
{
|
||||
btn_claim_n.onClick.AddListener(ClickClaimAll);
|
||||
text_num.text = $"x{ConvertTools.GetNumberString(miniBP.ItemCountShow[0])}";
|
||||
base.Start();
|
||||
}
|
||||
|
||||
protected override void RefreshPanel()
|
||||
{
|
||||
base.RefreshPanel();
|
||||
if (!miniBP.IsVip)
|
||||
{
|
||||
btn_claim_n.gameObject.SetActive(miniBP.Data.NRIndexs.Count <= miniBP.rewardIndex);
|
||||
btn_claim_gray_n.gameObject.SetActive(miniBP.Data.NRIndexs.Count > miniBP.rewardIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void JumpToIndex()
|
||||
{
|
||||
int index = miniBP.Data.showIndex;
|
||||
float startPos = 1 - (index * 1f / (miniBPItemDatas.Count - showCount));
|
||||
if (startPos > 1f) startPos = 1f;
|
||||
if (startPos < 0f) startPos = 0f;
|
||||
scrollRect.verticalNormalizedPosition = startPos;
|
||||
if (miniBP.rewardIndex > index)
|
||||
{
|
||||
miniBP.SetOldLevel();
|
||||
float endPos = 1 - (miniBP.rewardIndex * 1f / (miniBPItemDatas.Count - showCount));
|
||||
if (endPos > 1f) endPos = 1f;
|
||||
if (endPos < 0f) endPos = 0f;
|
||||
scrollRect.DOVerticalNormalizedPos(endPos, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user