Files
MinFt/Client/Assets/Scripts/UI/Rod/FishingRodAscendPopupPanel.cs
Liubing\LB 3d8d4d18f3 first commit
先修复一下,错误的场景

删除不必要的钓场资产

修复into场景

update:更新meta文件,修复报错

update:修复资源

修复第一章节建造

修复建造第三章

update:删除多余内容

update:更新README.md

update:还原图标

update:更新README

update:更新配置
2026-04-28 02:17:22 +08:00

123 lines
4.9 KiB
C#

using asap.core;
using cfg;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class FishingRodAscendPopupPanel : MonoBehaviour
{
Tables _tables;
Button btn_confirm;
//星级影响最大等级
TMP_Text text_num_before;
TMP_Text text_num_after;
//
RodAttributeInfoRoot rodAttributeInfoRoot;
Image perk_bg;
Image perk_icon;
TMP_Text text_level;
TMP_Text text_info;
RodItem rodItem;
RodItemData currentRodItemData;
RodAscend curRodAscend;
public void Awake()
{
_tables = GContext.container.Resolve<Tables>();
text_num_before = transform.Find("root/content/level/num/text_num").GetComponent<TMP_Text>();
text_num_after = transform.Find("root/content/level/num/text_after").GetComponent<TMP_Text>();
rodAttributeInfoRoot = transform.Find("root/content").GetComponent<RodAttributeInfoRoot>();
text_level = transform.Find("root/content/skill/perk/bg/text_level").GetComponent<TMP_Text>();
perk_bg = transform.Find("root/content/skill/perk/bg").GetComponent<Image>();
perk_icon = transform.Find("root/content/skill/perk/bg/icon").GetComponent<Image>();
text_info = transform.Find("root/content/skill/text_info").GetComponent<TMP_Text>();
rodItem = transform.Find("root/content/rod").GetComponent<RodItem>();
btn_confirm = transform.Find("root/content/btn_confirm/btn_green").GetComponent<Button>();
}
private void Start()
{
btn_confirm.onClick.AddListener(() => { UIManager.Instance.DestroyUI(gameObject.name); });
}
public void SetCurData(RodItemData currentRodItemData, Sprite sprite)
{
this.currentRodItemData = currentRodItemData;
rodItem.Init(currentRodItemData);
perk_bg.sprite = sprite;
Init();
}
void Init()
{
IUIService uiService = GContext.container.Resolve<IUIService>();
RodData rodData = currentRodItemData.config;
curRodAscend = _tables.TbRodAscend.GetOrDefault(rodData.AscendID);
var dataMap = _tables.TbRodBasicStats.DataMap;
RodBasicStats rodBasicStats;
PlayerFishData playerFishData = GContext.container.Resolve<PlayerFishData>();
int star = playerFishData.GetRodPiece(rodData.ID);
RodLevelup rodLevelup = _tables.TbRodLevelup.GetOrDefault(rodData.LevelupID);
List<int> Millestones = rodLevelup.Millestones;
int perkIDListCount = curRodAscend.PerkIDList.Count;
int[] lv = playerFishData.GetPerkLevel(perkIDListCount, star, curRodAscend.DefaultPerk, curRodAscend.PerkUnlockOrder);
int index = curRodAscend.PerkUnlockOrder[star - 1] - 1;
int perkID = curRodAscend.PerkIDList[index];
var rodEngancePerk = _tables.TbRodAscendPerk.GetOrDefault(perkID);
int level = lv[index];
text_level.text = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePopupPanel_1", level);
List<string> PerkDataList = curRodAscend.PerkDataList[index];
if (level > PerkDataList.Count)
{
Debug.LogError($"钓竿ID:{rodData.ID}的{perkID}第{level}阶提升属性不存在");
return;
}
string perkValue = PerkDataList[level - 1];
text_info.text = PlayerFishData.GetPerkDesc(rodEngancePerk.PerkType, rodEngancePerk.Desc_l10n_key, perkValue);
GContext.container.Resolve<IUIService>().SetImageSprite(perk_icon, rodEngancePerk.Icon, BasePanel.PanelName);
text_num_after.gameObject.SetActive(true);
if (star == Millestones.Count)
{
text_num_before.text = Millestones[star - 1].ToString();
text_num_after.text = rodLevelup.MaxLevel.ToString();
}
else
{
text_num_before.text = Millestones[star - 1].ToString();
text_num_after.text = Millestones[star].ToString();
}
var values = playerFishData.GetRodAttribute(rodData.ID, starAdd: -1);
var values2 = playerFishData.GetRodAttribute(rodData.ID);
for (int i = 0; i < values.Count; i++)
{
rodBasicStats = dataMap[i + 1];
rodAttributeInfoRoot.rodAttributes[i].gameObject.SetActive(true);
rodAttributeInfoRoot.rodAttributes[i].icon.sprite = uiService.GetSprite(rodBasicStats.Icon);
rodAttributeInfoRoot.rodAttributes[i].text_name.text = LocalizationMgr.GetText(rodBasicStats.Title_l10n_key);
var curValue = values[i];
var nextValue = values2[i];
if (curValue != nextValue)
{
rodAttributeInfoRoot.rodAttributes[i].gameObject.SetActive(true);
rodAttributeInfoRoot.rodAttributes[i].text_num.text = curValue.ToString();
rodAttributeInfoRoot.rodAttributes[i].text_after.text = nextValue.ToString();
}
else
{
rodAttributeInfoRoot.rodAttributes[i].gameObject.SetActive(false);
}
}
}
}