备份CatanBuilding瘦身独立工程
This commit is contained in:
49
Assets/Scripts/UI/Shop/GiftPiggyBankInfoPopupPanel.cs
Normal file
49
Assets/Scripts/UI/Shop/GiftPiggyBankInfoPopupPanel.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
public class GiftPiggyBankInfoPopupPanel : MonoBehaviour
|
||||
{
|
||||
List<Image> _itemIcons;
|
||||
List<TMP_Text> _itemTexts;
|
||||
Image _progressBar;
|
||||
TMP_Text _textEnd;
|
||||
TMP_Text _textMid;
|
||||
IUIService _uiService;
|
||||
PiggyBankPackData _pbpd;
|
||||
Button _btnClose;
|
||||
private void Awake()
|
||||
{
|
||||
_itemIcons = new List<Image>();
|
||||
_itemTexts = new List<TMP_Text>();
|
||||
for (int i = 1; i <= 3; i++)
|
||||
{
|
||||
_itemIcons.Add(transform.Find($"root/info1/item/item{i}/icon_tag").GetComponent<Image>());
|
||||
_itemTexts.Add(transform.Find($"root/info1/item/item{i}/text_num").GetComponent<TMP_Text>());
|
||||
}
|
||||
_progressBar = transform.Find("root/info2/bg_bar/bar").GetComponent<Image>();
|
||||
_textEnd = transform.Find("root/info2/bg_bar/resin2/text_num").GetComponent<TMP_Text>();
|
||||
_textMid = transform.Find("root/info2/bg_bar/resin3/text_num").GetComponent<TMP_Text>();
|
||||
_uiService = GContext.container.Resolve<IUIService>();
|
||||
_pbpd = GContext.container.Resolve<PiggyBankPackData>();
|
||||
_btnClose = transform.Find("btn_close").GetComponent<Button>();
|
||||
//_progressText = transform.Find()
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
_btnClose.onClick.AddListener(() =>
|
||||
{ UIManager.Instance.DestroyUI(UITypes.GiftPiggyBankInfoPopupPanel); });
|
||||
for (int i = 0; i < _itemIcons.Count; i++)
|
||||
{
|
||||
_uiService.SetImageSprite(_itemIcons[i], $"icon_fish_rate_tag_{i + 3}");
|
||||
_itemTexts[i].text = "+" + _pbpd.FishingScoreList[i + 2].ToString();
|
||||
}
|
||||
_textEnd.text = _pbpd.Target.ToString();
|
||||
_textMid.text = _pbpd.CanBuyCount.ToString();
|
||||
_progressBar.fillAmount = 0.5f;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user