Files
back_cantanBuilding/Assets/Scripts/UI/Rod/FishingRodRewardSettlementPopupPanel.cs
2026-05-26 16:15:54 +08:00

56 lines
1.9 KiB
C#

using asap.core;
using cfg;
using GameCore;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class FishingRodRewardSettlementPopupPanel : MonoBehaviour
{
TMP_Text level_text_num_before;
TMP_Text level_text_num_after;
TMP_Text text_num_before;
TMP_Text text_num_after;
Button btn_close;
private void Awake()
{
level_text_num_before = transform.Find("root/bg_title/leve_change/text_num_before").GetComponent<TMP_Text>();
level_text_num_after = transform.Find("root/bg_title/leve_change/text_num_after").GetComponent<TMP_Text>();
text_num_before = transform.Find("root/bg_info/change/text_num_before").GetComponent<TMP_Text>();
text_num_after = transform.Find("root/bg_info/change/text_num_after").GetComponent<TMP_Text>();
btn_close = transform.Find("btn_close").GetComponent<Button>();
}
private void Start()
{
btn_close.onClick.AddListener(() => { UIManager.Instance.DestroyUI(UITypes.FishingRodRewardSettlementPopupPanel); });
}
public void Show(int oldLevel)
{
int allScore = GContext.container.Resolve<PlayerFishData>().GetRodAllScore();
var dataList = GContext.container.Resolve<Tables>().TbRodLevelupStats.DataList;
int count = dataList.Count;
int level = count;
float PointBonus = 0;
float oldPointBonus = 0;
for (int i = 0; i < count; i++)
{
if (allScore < dataList[i].Count)
{
level = i;
break;
}
PointBonus += dataList[i].PointBonus;
if (i < oldLevel)
{
oldPointBonus += dataList[i].PointBonus;
}
}
text_num_before.text = oldPointBonus.ToPercentageString();
text_num_after.text = PointBonus.ToPercentageString();
level_text_num_before.text = oldLevel.ToString();
level_text_num_after.text = level.ToString();
}
}