55 lines
2.5 KiB
C#
55 lines
2.5 KiB
C#
using UnityEngine.UI;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using asap.core;
|
|
using GameCore;
|
|
using cfg;
|
|
public class GiftBargainInfoPopupPanel : BasePanel
|
|
{
|
|
private List<Image> _itemIcons;
|
|
private List<TMP_Text> _itemTexts;
|
|
private Image _progressBar;
|
|
private TMP_Text _textProgress, _textInfo, _textTagInfo;
|
|
private IUIService _uiService;
|
|
private BargainPackData _bpd;
|
|
private Button _btnClose;
|
|
private readonly Tables _tables = GContext.container.Resolve<Tables>();
|
|
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>();
|
|
_textProgress = transform.Find("root/info2/bg_bar/text_progress").GetComponent<TMP_Text>();
|
|
_uiService = GContext.container.Resolve<IUIService>();
|
|
_bpd = GContext.container.Resolve<BargainPackData>();
|
|
_btnClose = transform.Find("btn_close").GetComponent<Button>();
|
|
_textInfo = transform.Find("root/info3/text_num").GetComponent<TMP_Text>();
|
|
_textTagInfo = transform.Find("root/info2/tag/tag_1/text_num").GetComponent<TMP_Text>();
|
|
}
|
|
protected override void Start()
|
|
{
|
|
_btnClose.onClick.AddListener(() =>
|
|
{ UIManager.Instance.DestroyUI(UITypes.GiftBargainInfoPopupPanel); });
|
|
for (int i = 0; i < _itemIcons.Count; i++)
|
|
{
|
|
_uiService.SetImageSprite(_itemIcons[i], $"icon_fish_rate_tag_{i + 3}");
|
|
_itemTexts[i].text = "+" + _bpd.FishingScoreList[i + 2].ToString();
|
|
}
|
|
int target = _tables.TbSpecialPack[_tables.TbEventPackManager[_bpd.RedirectID].VIPPackList[0][0]].EventItemRequire[1];
|
|
|
|
PlayerItemData playerItemData = GContext.container.Resolve<PlayerItemData>();
|
|
target = playerItemData.IntInflation(target, _bpd.Inflation);
|
|
|
|
_textProgress.text = $"{target / 2}/{target}";
|
|
_progressBar.fillAmount = 0.5f;
|
|
_textInfo.text = $"{_tables.TbSpecialPack[_tables.TbEventPackManager[_bpd.RedirectID].VIPPackList[0][0]].DiscountList[^1]}%";
|
|
_textTagInfo.text = $"{_tables.TbSpecialPack[_tables.TbEventPackManager[_bpd.RedirectID].VIPPackList[0][0]].DiscountList[2]}%";
|
|
base.Start();
|
|
}
|
|
}
|