先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
133 lines
5.2 KiB
C#
133 lines
5.2 KiB
C#
using asap.core;
|
|
using cfg;
|
|
// using com.fpnn;
|
|
using GameCore;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class item_perk : MonoBehaviour
|
|
{
|
|
public Perk perk;
|
|
public TMP_Text text_name;
|
|
public TMP_Text text_type;
|
|
public GameObject text_actived;
|
|
public GameObject text_current;
|
|
public GameObject text_notactived;
|
|
public GameObject info_notactived;
|
|
List<GameObject> _list = new List<GameObject>();
|
|
|
|
public void Show(int rodID, int index, int addLevel)
|
|
{
|
|
for (int i = 0; i < _list.Count; i++)
|
|
{
|
|
Destroy(_list[i]);
|
|
}
|
|
_list.Clear();
|
|
Tables _tables = GContext.container.Resolve<Tables>();
|
|
RodData rodData = _tables.TbRodData.GetOrDefault(rodID);
|
|
RodAscend rodAscend = _tables.TbRodAscend.GetOrDefault(rodData.AscendID);
|
|
|
|
var unlockstars = rodAscend.PerkUnlockOrder;
|
|
int star = GContext.container.Resolve<PlayerFishData>().GetRodPiece(rodData.ID);
|
|
int perkID = rodAscend.PerkIDList[index];
|
|
RodAscendPerk rodEngancePerk = _tables.TbRodAscendPerk.GetOrDefault(perkID);
|
|
text_name.text = LocalizationMgr.GetText(rodEngancePerk.Title_l10n_key);
|
|
text_type.gameObject.SetActive(rodEngancePerk.DuelPerk);
|
|
|
|
int curLv = 0;
|
|
List<int> starList = new List<int>();
|
|
for (int i = 0; i < rodAscend.DefaultPerk.Count; i++)
|
|
{
|
|
if (rodAscend.DefaultPerk[i] == index + 1)
|
|
{
|
|
curLv++;
|
|
starList.Add(0);
|
|
}
|
|
}
|
|
for (int i = 0; i < unlockstars.Count; i++)
|
|
{
|
|
if (unlockstars[i] == index + 1)
|
|
{
|
|
starList.Add(i + 1);
|
|
if (i < star)
|
|
{
|
|
curLv++;
|
|
}
|
|
}
|
|
}
|
|
if (addLevel >= 0)
|
|
{
|
|
curLv += addLevel;
|
|
List<string> PerkDataList = rodAscend.PerkDataList[index];
|
|
|
|
string perkValue = PerkDataList[curLv - 1];
|
|
string text_level = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePopupPanel_1", curLv);
|
|
string text_info = PlayerFishData.GetPerkDesc(rodEngancePerk.PerkType, rodEngancePerk.Desc_l10n_key, perkValue);
|
|
GameObject text_go = Instantiate(text_current, transform);
|
|
|
|
text_go.SetActive(true);
|
|
text_go.GetComponent<TMP_Text>().text = $"{text_level}: {text_info}";
|
|
_list.Add(text_go);
|
|
}
|
|
else
|
|
{
|
|
ShowList(curLv, index, starList, rodData, rodAscend, rodEngancePerk);
|
|
}
|
|
perk.SetData(perkID, curLv, rodData.Quality);
|
|
}
|
|
void ShowList(int curLv, int index, List<int> starList, RodData rodData, RodAscend rodAscend, RodAscendPerk rodEngancePerk)
|
|
{
|
|
if (curLv == 0)
|
|
{
|
|
string perkValue = rodAscend.PerkDataList[index][0];
|
|
string text_level = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePopupPanel_1", 1);
|
|
string text_info = PlayerFishData.GetPerkDesc(rodEngancePerk.PerkType, rodEngancePerk.Desc_l10n_key, perkValue);
|
|
GameObject text_go = Instantiate(text_notactived, transform);
|
|
GameObject info_go = Instantiate(info_notactived, transform);
|
|
info_go.SetActive(true);
|
|
StarItemRoot starItemRoot = info_go.transform.Find("conditions/text_info/star").GetComponent<StarItemRoot>();
|
|
starItemRoot.SetStar(starList[0], rodAscend.MaxAscent);
|
|
_list.Add(info_go);
|
|
text_go.SetActive(true);
|
|
text_go.GetComponent<TMP_Text>().text = $"{text_level}:{text_info}";
|
|
_list.Add(text_go);
|
|
}
|
|
else
|
|
{
|
|
for (int i = curLv - 1; i < starList.Count && i < curLv + 1; i++)
|
|
{
|
|
List<string> PerkDataList = rodAscend.PerkDataList[index];
|
|
if (i >= PerkDataList.Count)
|
|
{
|
|
Debug.LogError($"钓竿ID:{rodData.ID}的{rodEngancePerk.ID}第{i + 1}阶提升属性不存在");
|
|
break;
|
|
}
|
|
string perkValue = PerkDataList[i];
|
|
string text_level = LocalizationMgr.GetFormatTextValue("UI_PlayerGradePopupPanel_1", i + 1);
|
|
string text_info = PlayerFishData.GetPerkDesc(rodEngancePerk.PerkType, rodEngancePerk.Desc_l10n_key, perkValue);
|
|
GameObject text_go = null;
|
|
if (i == curLv - 1)
|
|
{
|
|
//当前
|
|
text_go = Instantiate(text_current, transform);
|
|
}
|
|
else
|
|
{
|
|
//未拥有
|
|
text_go = Instantiate(text_notactived, transform);
|
|
GameObject info_go = Instantiate(info_notactived, transform);
|
|
info_go.SetActive(true);
|
|
StarItemRoot starItemRoot = info_go.transform.Find("conditions/text_info/star").GetComponent<StarItemRoot>();
|
|
starItemRoot.SetStar(starList[i], rodAscend.MaxAscent);
|
|
_list.Add(info_go);
|
|
}
|
|
text_go.SetActive(true);
|
|
text_go.GetComponent<TMP_Text>().text = $"{text_level}: {text_info}";
|
|
_list.Add(text_go);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|