using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using LitJson;
|
|
using UnityEngine;
|
|
//天赋
|
public partial class HeroUIManager : GameSystemManager<HeroUIManager>
|
{
|
public int normalGiftMaxCnt = 4; //初始天赋格子数
|
public const int giftMaxCnt = 8; //关联界面排版问题,暂时写死,通过觉醒可以增加上限
|
public int maxGiftLevel; //单天赋最高等级,其他功能可能会增加这个上限
|
public int starLevelCanAwake; //x星可以觉醒
|
|
public int washItemID;
|
public int[] washByLockUseCounts;
|
public int canWashStarLevel; //达到X星可以洗练
|
|
public string selectHeroGuidForGiftFunc;
|
|
void ParseGiftConfig()
|
{
|
var config = FuncConfigConfig.Get("HeroStarTalent");
|
normalGiftMaxCnt = int.Parse(config.Numerical1);
|
maxGiftLevel = int.Parse(config.Numerical2);
|
starLevelCanAwake = int.Parse(config.Numerical4);
|
|
config = FuncConfigConfig.Get("HeroWash");
|
washItemID = int.Parse(config.Numerical1);
|
washByLockUseCounts = JsonMapper.ToObject<int[]>(config.Numerical2);
|
canWashStarLevel = int.Parse(config.Numerical3);
|
}
|
|
|
//根据天赋锁状态获取消耗的材料数量
|
public int GetTalentLockUseWashCount(HeroInfo hero)
|
{
|
return washByLockUseCounts[hero.GetTalentLockCount()];
|
}
|
|
|
//天赋格子总数上限
|
public int GetGiftGirdMaxCount(int heroID)
|
{
|
//没有觉醒配置的 为默认4,否则8
|
if (HeroAwakeConfig.GetHeroAwakeConfig(heroID, 1) == null)
|
{
|
return Instance.normalGiftMaxCnt;
|
}
|
return giftMaxCnt;
|
}
|
|
|
|
//星上限由品质 和 觉醒决定
|
public int GetMaxStarCount(int heroID, int quality)
|
{
|
if (HeroAwakeConfig.GetHeroAwakeConfig(heroID, 1) == null)
|
{
|
return HeroQualityConfig.Get(quality).InitStarUpper;
|
|
}
|
|
//根据觉醒累计提升星上限
|
int addStarCount = 0;
|
for (int i = 1; i <= HeroAwakeConfig.GetMaxAwakeLV(heroID); i++)
|
{
|
addStarCount += HeroAwakeConfig.GetHeroAwakeConfig(heroID, i).AddStarUpper;
|
}
|
return HeroQualityConfig.Get(quality).InitStarUpper + addStarCount;
|
}
|
|
|
public void RefreshGiftCell(GiftBaseCell[] giftBaseCells, HeroInfo hero)
|
{
|
int showCount = GetGiftGirdMaxCount(hero.heroId);
|
for (int i = 0; i < giftBaseCells.Length; i++)
|
{
|
if (i >= showCount)
|
{
|
giftBaseCells[i].SetActive(false);
|
continue;
|
}
|
|
giftBaseCells[i].SetActive(true);
|
if (i < hero.talentIDList.Count)
|
{
|
int giftID = hero.talentIDList[i];
|
int giftLV = hero.talentLvList[i];
|
giftBaseCells[i].Init(giftID, giftLV);
|
}
|
else
|
{
|
if (i < normalGiftMaxCnt)
|
{
|
giftBaseCells[i].Init(0, 0);
|
}
|
else
|
{
|
int index = i;
|
giftBaseCells[i].Init(-1, 0, null, hero.heroId, index);
|
}
|
}
|
|
}
|
}
|
|
}
|