using System.Collections.Generic;
|
using System.Linq;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
|
/// <summary>
|
/// 武将培养界面
|
/// </summary>
|
public class HeroTrainWin : UIBase
|
{
|
[SerializeField] RawImage bgTexture;
|
[SerializeField] Button showFuncBtn; //只显示立绘时点击,显示功能
|
[SerializeField] Transform funcForm;
|
[SerializeField] UIHeroController roleLhModel; //展示英雄立绘
|
[SerializeField] Button rightBtn;
|
[SerializeField] Button leftBtn;
|
[SerializeField] UIHeroController roleXsModel; //像素
|
[SerializeField] UIEffectPlayer lvupEffect;
|
[SerializeField] Image jobImg;
|
[SerializeField] Text jobPosNameText;
|
[SerializeField] Text descText;
|
[SerializeField] Text fightPowerText; //由客户端自己预算的战力
|
[SerializeField] Button lockBtn;
|
[SerializeField] Image lockImg;
|
[SerializeField] Image unLockImg;
|
[SerializeField] HeroConnectionCell connetionForm; //羁绊
|
[SerializeField] Button resetBtn;
|
[SerializeField] Button deleteBtn;
|
[SerializeField] Button seeLhBtn; //查看立绘
|
[SerializeField] SkillBaseCell normalSkillCell;
|
[SerializeField] SkillBaseCell angerSkillCell;
|
[SerializeField] Button awakeBtn;
|
|
[SerializeField] Button closeBtn; //关闭按钮
|
[SerializeField] Button starBtn; //显示星级文字
|
[SerializeField] List<Image> starImgList;
|
[SerializeField] Text nameText;
|
[SerializeField] UIEffectPlayer nameEffect;
|
[SerializeField] Image countryImg;
|
[SerializeField] Text awakeLVText;
|
|
//属性区
|
[SerializeField] ScrollRect allAttrScroll;
|
[SerializeField] Button attrBtn;
|
[SerializeField] Image unfoldImg; //展开时按钮的图标
|
[SerializeField] Image foldImg; //收起时按钮的图标
|
bool unfoldState = false;//是否展开
|
[SerializeField] Transform foldPos;
|
[SerializeField] Transform unfoldPos; //展开时的位置
|
[SerializeField] RectTransform attrPanel; //显示的属性栏
|
[SerializeField] RectTransform attrScroll;
|
[SerializeField] RichText inheritText; //武将继承描述
|
[SerializeField] Text[] inheritAttrText; //武将会继承的属性
|
[SerializeField] RichText heroAddPerText; //主公(上阵)加成描述
|
[SerializeField] Text[] heroAddAttrPerText; //主公(上阵)加成
|
[SerializeField] Text[] addPerText; //增加百分比(飘动)
|
[SerializeField] PositionTween addPerObject;
|
[SerializeField] Image lvupMoneyIcon;
|
[SerializeField] Text lvupMoneyText;
|
[SerializeField] Text lvupBtnText;
|
[SerializeField] LongPressButton lvupBtn; //升级 突破
|
[SerializeField] Button allAttrBtn;
|
|
[SerializeField] GameObject potentialCell; //潜能和觉醒用于创建
|
[SerializeField] Transform potentialCellParent; //潜能父节点
|
List<GameObject> potentialCellList; //潜能
|
[SerializeField] Transform awakeCellParent; //潜能父节点
|
[SerializeField] GameObject awakeGo;
|
List<GameObject> awakeCellList; //觉醒
|
|
[SerializeField] GameObject fetterGo;
|
[SerializeField] Text[] fetterText; //羁绊
|
[SerializeField] Text[] fetterNameText; //羁绊
|
|
|
//天赋
|
[SerializeField] GiftBaseCell[] giftBaseCells;
|
[SerializeField] Button totalGiftBtn;
|
[SerializeField] Button starUPBtn;
|
[SerializeField] Text starUPBtnText;
|
[SerializeField] Button washBtn;
|
|
//冻结处理
|
[SerializeField] Button freezeTipBtn;
|
[SerializeField] GameObject freezeTipGo;
|
[SerializeField] Text freezeStarText;
|
[SerializeField] Text freezeAawkeLVText;
|
[SerializeField] List<Image> starImgFreezeList;
|
|
//伪红点用图片代替
|
[SerializeField] Image redpointAwake;
|
[SerializeField] Image redpointGift;
|
[SerializeField] Image redpointLVUP;
|
|
string guid;
|
HeroInfo hero;
|
|
|
|
protected override void InitComponent()
|
{
|
showFuncBtn.AddListener(() =>
|
{
|
funcForm.SetActive(true);
|
});
|
seeLhBtn.AddListener(() =>
|
{
|
funcForm.SetActive(false);
|
});
|
closeBtn.AddListener(CloseWindow);
|
rightBtn.AddListener(() =>
|
{
|
ChangeHero(1);
|
});
|
leftBtn.AddListener(() =>
|
{
|
ChangeHero(-1);
|
});
|
|
lockBtn.AddListener(() => { hero.ChangeLockState(); });
|
resetBtn.AddListener(() =>
|
{
|
HeroUIManager.Instance.ResetBtnClick(hero);
|
});
|
deleteBtn.AddListener(DeleteHero);
|
awakeBtn.AddListener(() =>
|
{
|
HeroUIManager.Instance.selectAwakeHeroGuid = guid;
|
UIManager.Instance.OpenWindow<HeroAwakeWin>();
|
});
|
inheritText.OnClick = () =>
|
{
|
SmallTipWin.showText = Language.Get("herocard47");
|
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
|
UIManager.Instance.OpenWindow<SmallTipWin>();
|
};
|
heroAddPerText.OnClick = () =>
|
{
|
SmallTipWin.showText = Language.Get("herocard48");
|
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
|
UIManager.Instance.OpenWindow<SmallTipWin>();
|
};
|
attrBtn.AddListener(() =>
|
{
|
unfoldState = !unfoldState;
|
RefreshFoldState();
|
});
|
|
allAttrBtn.AddListener(() =>
|
{
|
UIManager.Instance.OpenWindow<HeroAllAttrWin>(hero.itemHero.gridIndex);
|
});
|
lvupBtn.AddListener(LVUp);
|
lvupBtn.onPress.AddListener(LVUp);
|
|
totalGiftBtn.AddListener(() =>
|
{
|
UIManager.Instance.OpenWindow<HeroGiftWin>();
|
});
|
|
starUPBtn.AddListener(StarUP);
|
washBtn.AddListener(Wash);
|
|
starBtn.AddListener(() =>
|
{
|
SmallTipWin.showText = Language.Get("HeroGift14", hero.heroStar);
|
SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
|
UIManager.Instance.OpenWindow<SmallTipWin>();
|
});
|
|
potentialCellList = new List<GameObject>();
|
awakeCellList = new List<GameObject>();
|
|
freezeTipBtn.AddListener(() =>
|
{
|
freezeTipGo.SetActive(!freezeTipGo.activeSelf);
|
});
|
}
|
|
|
protected override void OnPreOpen()
|
{
|
PackManager.Instance.RefreshItemLockEvent += RefreshItemLockEvent;
|
HeroManager.Instance.onHeroChangeEvent += RefreshHeroEvent;
|
UIManager.Instance.OnCloseWindow += OnCloseWindow;
|
TeamManager.Instance.OnTeamChange += TeamPosChangeEvent;
|
guid = HeroUIManager.Instance.selectHeroGuid;
|
hero = HeroManager.Instance.GetHero(guid);
|
unfoldState = false;
|
addPerObject.SetActive(false);
|
allAttrScroll.verticalNormalizedPosition = 1;
|
Display();
|
}
|
|
protected override void OnPreClose()
|
{
|
PackManager.Instance.RefreshItemLockEvent -= RefreshItemLockEvent;
|
HeroManager.Instance.onHeroChangeEvent -= RefreshHeroEvent;
|
UIManager.Instance.OnCloseWindow -= OnCloseWindow;
|
TeamManager.Instance.OnTeamChange -= TeamPosChangeEvent;
|
}
|
|
private void OnCloseWindow(UIBase closeUI)
|
{
|
//其他界面删除武将会影响逻辑
|
if (closeUI is HeroDeleteWin)
|
{
|
HeroUIManager.Instance.SortHeroList();
|
if (HeroManager.Instance.GetHero(guid) == null)
|
{
|
CloseWindow();
|
}
|
}
|
}
|
|
public void Display()
|
{
|
bgTexture.SetTexture2D("countryBG" + hero.heroConfig.Country);
|
roleLhModel.Create(hero.SkinID, 1, motionName: "", isLh: true);
|
roleXsModel.Create(hero.SkinID, 1);
|
jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(hero.heroConfig.Class));
|
jobPosNameText.text = HeroUIManager.Instance.GetJobName(hero.heroConfig.Class);
|
descText.text = hero.heroConfig.Desc;
|
fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculatePower());
|
PlayerMainDate.Instance.AddPowerNotOnTeam(hero);
|
lockImg.SetActive(hero.isLock);
|
unLockImg.SetActive(!hero.isLock);
|
|
RefreshConn();
|
normalSkillCell.Init(hero.heroConfig.AtkSkillID, () =>
|
{
|
UIManager.Instance.OpenWindow<HeroSkillWin>(hero.heroId);
|
}, true);
|
angerSkillCell.Init(hero.heroConfig.AngerSkillID, () =>
|
{
|
UIManager.Instance.OpenWindow<HeroSkillWin>(hero.heroId);
|
}, true);
|
|
awakeBtn.SetActive(HeroAwakeConfig.CanAwake(hero.heroId, 1));
|
|
RefreshName();
|
RefreshFoldState();
|
RefreshAttr();
|
RefreshAllPotential();
|
RefreshFetter();
|
RefreshGift();
|
RefreshAwake();
|
RefreshFreeze();
|
RefreshRedImg();
|
|
HeroUIManager.Instance.RemoveNewHero(hero.heroId);
|
}
|
|
void RefreshItemLockEvent(PackType type, string guid, bool lockState)
|
{
|
if (type != PackType.Hero)
|
return;
|
lockImg.SetActive(hero.isLock);
|
unLockImg.SetActive(!hero.isLock);
|
}
|
|
void RefreshHeroEvent(HeroInfo hero)
|
{
|
Display();
|
}
|
|
void RefreshConn()
|
{
|
if (hero.heroConfig.FetterIDList.Length > 0)
|
{
|
connetionForm.SetActive(true);
|
connetionForm.Display(hero.heroConfig.FetterIDList[0], Language.Get("herocard38") + "\n", true, guid);
|
}
|
else
|
{
|
connetionForm.SetActive(false);
|
}
|
|
}
|
|
void ChangeHero(int changeValue)
|
{
|
var index = HeroUIManager.Instance.heroSortList.IndexOf(guid);
|
if (index == -1)
|
return;
|
allAttrScroll.verticalNormalizedPosition = 1;
|
int resultIndex = index + changeValue;
|
//循环处理
|
if (resultIndex < 0)
|
{
|
resultIndex = HeroUIManager.Instance.heroSortList.Count - 1;
|
}
|
else if (resultIndex > HeroUIManager.Instance.heroSortList.Count - 1)
|
{
|
resultIndex = 0;
|
}
|
guid = HeroUIManager.Instance.heroSortList[resultIndex];
|
hero = HeroManager.Instance.GetHero(guid);
|
Display();
|
}
|
|
|
|
|
|
void DeleteHero()
|
{
|
// if (hero.isLock)
|
// {
|
// SysNotifyMgr.Instance.ShowTip("UnlockHero");
|
// return;
|
// }
|
|
UIManager.Instance.OpenWindow<HeroDeleteWin>();
|
}
|
|
void RefreshStars()
|
{
|
for (int i = 0; i < starImgList.Count; i++)
|
{
|
if (hero.heroStar == 0 && i == 0)
|
{
|
// 无星级 特殊处理
|
starImgList[i].SetActive(true);
|
starImgList[i].SetSprite("herostar" + hero.heroStar);
|
}
|
else if ((hero.heroStar - 1) % starImgList.Count >= i)
|
{
|
starImgList[i].SetActive(true);
|
starImgList[i].SetSprite("herostar" + (((hero.heroStar - 1) / starImgList.Count) + 1) * starImgList.Count);
|
}
|
else
|
{
|
starImgList[i].SetActive(false);
|
}
|
}
|
}
|
|
void RefreshName()
|
{
|
RefreshStars();
|
nameText.text = hero.breakLevel == 0 ? hero.heroConfig.Name : Language.Get("herocardbreaklv", hero.heroConfig.Name, hero.breakLevel);
|
|
nameText.color = UIHelper.GetUIColorByFunc(hero.Quality);
|
|
if (hero.Quality >= 4)
|
{
|
nameEffect.SetActive(true);
|
nameEffect.Play(hero.Quality == 4 ? 0 : 1);
|
}
|
else
|
{
|
nameEffect.SetActive(false);
|
}
|
countryImg.SetSprite(HeroUIManager.Instance.GetCountryIconName(hero.heroConfig.Country));
|
if (hero.awakeLevel == 0)
|
{
|
awakeLVText.text = Language.Get("L1094") + hero.heroLevel;
|
awakeLVText.GetComponent<OutlineEx>().colorType = QualityTextColType.itemcucao;
|
}
|
else
|
{
|
awakeLVText.text = Language.Get("L1094") + hero.heroLevel + " " + Language.Get("herocard12", hero.awakeLevel);
|
awakeLVText.GetComponent<OutlineEx>().colorType = QualityTextColType.red;
|
}
|
}
|
|
void RefreshFoldState()
|
{
|
if (!unfoldState)
|
{
|
foldImg.SetActive(true);
|
unfoldImg.SetActive(false);
|
attrPanel.localPosition = foldPos.localPosition;
|
attrScroll.sizeDelta = new Vector2(attrScroll.rect.width, 445);
|
}
|
else
|
{
|
foldImg.SetActive(false);
|
unfoldImg.SetActive(true);
|
attrPanel.localPosition = unfoldPos.localPosition;
|
attrScroll.sizeDelta = new Vector2(attrScroll.rect.width, 933);
|
}
|
}
|
|
void RefreshAttr()
|
{
|
inheritAttrText[0].text = PlayerPropertyConfig.GetFullDescription(new Int2(PlayerPropertyConfig.inheritAttrs[0], hero.heroConfig.AtkInheritPer));
|
inheritAttrText[1].text = PlayerPropertyConfig.GetFullDescription(new Int2(PlayerPropertyConfig.inheritAttrs[1], hero.heroConfig.DefInheritPer));
|
inheritAttrText[2].text = PlayerPropertyConfig.GetFullDescription(new Int2(PlayerPropertyConfig.inheritAttrs[2], hero.heroConfig.HPInheritPer));
|
|
//上阵属性
|
int valuePer = hero.GetOnBattleAddPer();
|
for (int i = 0; i < heroAddAttrPerText.Length; i++)
|
{
|
heroAddAttrPerText[i].text = PlayerPropertyConfig.GetFullDescription(new Int2(PlayerPropertyConfig.basePerAttrs[i], valuePer));
|
}
|
|
|
|
//区分突破和最大等级
|
if (!HeroUIManager.Instance.IsLVMax(hero))
|
{
|
lvupBtnText.text = Language.Get("L1109");
|
lvupMoneyIcon.SetActive(true);
|
|
if (HeroUIManager.Instance.IsLVMaxByBreakLevel(hero))
|
{
|
lvupBtnText.text = Language.Get("L1111");
|
var breakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(hero.Quality, hero.breakLevel);
|
lvupMoneyIcon.SetOrgSprite(ItemConfig.Get(breakConfig.UPCostItem[0]).IconKey);
|
lvupMoneyText.text = UIHelper.ShowUseItem(PackType.Item, breakConfig.UPCostItem[0], breakConfig.UPCostItem[1]);
|
}
|
else
|
{
|
lvupBtnText.text = Language.Get("L1109");
|
var lvupConfig = HeroQualityLVConfig.GetQualityLVConfig(hero.Quality, hero.heroLevel);
|
lvupMoneyIcon.SetOrgSprite(ItemConfig.Get(lvupConfig.UPCostItem[0]).IconKey);
|
lvupMoneyText.text = UIHelper.ShowUseItem(PackType.Item, lvupConfig.UPCostItem[0], lvupConfig.UPCostItem[1]);
|
}
|
lvupBtn.SetInteractable(true);
|
|
}
|
else
|
{
|
lvupBtnText.text = Language.Get("L1110");
|
lvupBtn.SetInteractable(false);
|
lvupMoneyIcon.SetActive(false);
|
|
}
|
}
|
|
void LVUp()
|
{
|
int itemID = 0;
|
long needCount = 0;
|
if (HeroUIManager.Instance.IsLVMaxByBreakLevel(hero))
|
{
|
//突破
|
if (!UIManager.Instance.IsOpened<HeroLVBreakWin>())
|
{
|
HeroUIManager.Instance.selectHeroGuid = guid;
|
UIManager.Instance.OpenWindow<HeroLVBreakWin>();
|
}
|
}
|
else
|
{
|
//升级
|
var lvupConfig = HeroQualityLVConfig.GetQualityLVConfig(hero.Quality, hero.heroLevel);
|
itemID = lvupConfig.UPCostItem[0];
|
needCount = lvupConfig.UPCostItem[1];
|
if (ItemLogicUtility.CheckItemCount(PackType.Item, itemID, needCount, 2))
|
{
|
var pack = new CB230_tagCSHeroLVUP();
|
pack.ItemIndex = (ushort)hero.itemHero.gridIndex;
|
GameNetSystem.Instance.SendInfo(pack);
|
//预显示
|
lvupEffect.Play();
|
addPerObject.SetActive(true);
|
for (int i = 0; i < addPerText.Length; i++)
|
{
|
addPerText[i].text = "+" + PlayerPropertyConfig.GetValueDescription(PlayerPropertyConfig.basePerAttrs[i], hero.qualityConfig.LVAddPer);
|
}
|
addPerObject.Play(() =>
|
{
|
addPerObject.SetActive(false);
|
});
|
HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculatePower(false));
|
}
|
|
}
|
|
}
|
|
void RefreshAllPotential()
|
{
|
if (!HeroBreakConfig.configDics.ContainsKey(hero.heroId))
|
return;
|
|
var list = HeroBreakConfig.configDics[hero.heroId].Keys.ToList();
|
|
list.Sort();
|
|
for (int i = 0; i < list.Count; i++)
|
{
|
var nextQualityBreakConfig = HeroBreakConfig.GetHeroBreakConfig(hero.heroId, i + 1);
|
if (nextQualityBreakConfig == null)
|
break;
|
List<string> attrStrArr = new List<string>();
|
for (int j = 0; j < nextQualityBreakConfig.AttrIDList.Length; j++)
|
{
|
if (nextQualityBreakConfig.AttrIDList[j] == 0)
|
continue;
|
string format = i < hero.breakLevel ? "{0}" + UIHelper.AppendColor(TextColType.Green, "+{1}") : "{0}+{1}";
|
attrStrArr.Add((string.IsNullOrEmpty(nextQualityBreakConfig.SkillIName) ? string.Empty : Language.Get("equipQualityFormat", nextQualityBreakConfig.SkillIName)) +
|
PlayerPropertyConfig.GetFullDescription(nextQualityBreakConfig.AttrIDList[j], nextQualityBreakConfig.AttrValueList[j], format));
|
}
|
|
if (nextQualityBreakConfig.SkillID != 0)
|
{
|
var skill = SkillConfig.Get(nextQualityBreakConfig.SkillID);
|
if (skill != null)
|
{
|
attrStrArr.Add(Language.Get("equipQualityFormat", skill.SkillName) + skill.Description);
|
}
|
else
|
{
|
Debug.LogError("未配置技能" + nextQualityBreakConfig.SkillID);
|
}
|
}
|
if (i >= potentialCellList.Count)
|
{
|
potentialCellList.Add(Instantiate(potentialCell, potentialCellParent));
|
}
|
var go = potentialCellList[i];
|
var descText = go.GetComponent<Text>();
|
var nameText = go.GetComponent<Text>("skillname");
|
go.SetActive(true);
|
if (i < hero.breakLevel)
|
{
|
nameText.text = Language.Get("herocard63", i + 1);
|
descText.text = string.Join(Language.Get("L1112"), attrStrArr);
|
}
|
else
|
{
|
//置灰
|
nameText.text = UIHelper.AppendColor(TextColType.NavyGray, Language.Get("herocard63", i + 1));
|
descText.text = UIHelper.AppendColor(TextColType.NavyGray, UIHelper.RemoveColor(string.Join(Language.Get("L1112"), attrStrArr)));
|
}
|
}
|
|
}
|
|
//羁绊
|
void RefreshFetter()
|
{
|
if (hero.heroConfig.FetterIDList.Length == 0)
|
{
|
fetterGo.SetActive(false);
|
return;
|
}
|
fetterGo.SetActive(true);
|
|
for (int i = 0; i < fetterText.Length; i++)
|
{
|
if (i < hero.heroConfig.FetterIDList.Length)
|
{
|
fetterText[i].SetActive(true);
|
var fetterID = hero.heroConfig.FetterIDList[i];
|
HeroFetterConfig fetterConfig = HeroFetterConfig.Get(fetterID);
|
List<string> heroNames = new List<string>();
|
bool isAllCollect = true; //是否全收集
|
foreach (var tmpHeroID in fetterConfig.HeroIDList)
|
{
|
heroNames.Add(HeroConfig.Get(tmpHeroID).Name);
|
if (HeroManager.Instance.GetHeroCountByID(tmpHeroID) == 0)
|
{
|
isAllCollect = false;
|
}
|
}
|
var attrStr = string.Join(Language.Get("SplitString1"), heroNames) + Language.Get("herocard38");
|
|
for (int j = 0; j < fetterConfig.AttrIDList.Length; j++)
|
{
|
string format = !isAllCollect ? "{0}+{1}" : "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}");
|
attrStr += Language.Get("L1112") + PlayerPropertyConfig.GetFullDescription(fetterConfig.AttrIDList[j], fetterConfig.AttrValueList[j], format);
|
}
|
fetterText[i].text = attrStr;
|
fetterText[i].color = UIHelper.GetUIColor(isAllCollect ? TextColType.NavyBrown : TextColType.NavyGray);
|
fetterNameText[i].text = fetterConfig.FetterName;
|
fetterNameText[i].color = UIHelper.GetUIColor(isAllCollect ? TextColType.NavyBrown : TextColType.NavyGray);
|
|
}
|
else
|
{
|
fetterText[i].SetActive(false);
|
}
|
}
|
}
|
|
void RefreshGift()
|
{
|
HeroUIManager.Instance.RefreshGiftCell(giftBaseCells, hero);
|
|
if (hero.heroStar >= HeroUIManager.Instance.GetMaxStarCount(hero.heroId, hero.Quality))
|
{
|
starUPBtnText.text = Language.Get("HeroGift7");
|
starUPBtn.SetInteractable(false);
|
}
|
else
|
{
|
starUPBtnText.text = Language.Get("HeroGift3");
|
starUPBtn.SetInteractable(true);
|
}
|
|
}
|
|
|
|
void StarUP()
|
{
|
if (hero.heroStar >= HeroUIManager.Instance.GetMaxStarCount(hero.heroId, hero.Quality))
|
{
|
return;
|
}
|
else if (hero.IsFullStar())
|
{
|
SysNotifyMgr.Instance.ShowTip("HeroGift1");
|
return;
|
}
|
|
HeroUIManager.Instance.selectHeroGuidForGiftFunc = hero.itemHero.guid;
|
UIManager.Instance.OpenWindow<HeroGiftEatWin>();
|
}
|
|
void Wash()
|
{
|
if (hero.heroStar < HeroUIManager.Instance.canWashStarLevel)
|
{
|
SysNotifyMgr.Instance.ShowTip("HeroGift2", HeroUIManager.Instance.canWashStarLevel);
|
return;
|
}
|
|
HeroUIManager.Instance.selectWashHeroGUID = hero.itemHero.guid;
|
UIManager.Instance.OpenWindow<HeroGiftWashWin>();
|
|
}
|
|
|
void RefreshAwake()
|
{
|
if (!HeroAwakeConfig.CanAwake(hero.heroId, 1))
|
{
|
awakeGo.SetActive(false);
|
return;
|
}
|
awakeGo.SetActive(true);
|
|
var maxLV = HeroAwakeConfig.GetMaxAwakeLV(hero.heroId);
|
var starCnt = HeroQualityConfig.Get(hero.Quality).InitStarUpper;
|
for (int i = 1; i <= maxLV; i++)
|
{
|
if (i > awakeCellList.Count)
|
{
|
awakeCellList.Add(Instantiate(potentialCell, awakeCellParent));
|
}
|
var go = awakeCellList[i - 1];
|
var descText = go.GetComponent<Text>();
|
var nameText = go.GetComponent<Text>("skillname");
|
go.SetActive(true);
|
|
var config = HeroAwakeConfig.GetHeroAwakeConfig(hero.heroId, i);
|
|
int type = config.UnlockTalentSlot != 0 ? 1 : config.SkillID != 0 ? 2 : 3;
|
var awakeStr = string.Empty;
|
if (type == 1)
|
{
|
starCnt += config.AddStarUpper;
|
awakeStr = Language.Get("HeroAwake8", config.UnlockTalentSlot, starCnt);
|
}
|
else if (type == 2)
|
{
|
var skill = SkillConfig.Get(config.SkillID);
|
awakeStr = Language.Get("equipQualityFormat", skill.SkillName) + skill.Description;
|
}
|
else
|
{
|
for (int k = 0; k < config.AttrIDList.Length; k++)
|
{
|
awakeStr += (string.IsNullOrEmpty(config.SkillIName) ? string.Empty : Language.Get("equipQualityFormat", config.SkillIName)) +
|
PlayerPropertyConfig.GetFullDescription(config.AttrIDList[k], config.AttrValueList[k], "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}"))
|
+ (k == config.AttrIDList.Length - 1 ? "" : "\n");
|
}
|
}
|
|
if (i - 1 < hero.awakeLevel)
|
{
|
nameText.text = Language.Get("herocard12", i) + Language.Get("L1096");
|
descText.text = awakeStr;
|
}
|
else
|
{
|
//置灰
|
nameText.text = UIHelper.AppendColor(TextColType.NavyGray, Language.Get("herocard12", i) + Language.Get("L1096"));
|
descText.text = UIHelper.AppendColor(TextColType.NavyGray, UIHelper.RemoveColor(awakeStr));
|
}
|
}
|
}
|
|
void TeamPosChangeEvent(TeamType teamType)
|
{
|
if (teamType != TeamType.Story)
|
return;
|
fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculatePower());
|
}
|
|
void RefreshFreeze()
|
{
|
//至少需要觉醒到多少级
|
int needAwakeLV = HeroUIManager.Instance.GetAwakeLVByStarLV(hero.heroId, hero.heroStarMaxBefore);
|
if (hero.awakeLevel < needAwakeLV)
|
{
|
freezeTipBtn.SetActive(true);
|
//星级
|
for (int i = 0; i < starImgFreezeList.Count; i++)
|
{
|
if ((hero.heroStarMaxBefore - 1) % starImgFreezeList.Count >= i)
|
{
|
starImgFreezeList[i].SetActive(true);
|
starImgFreezeList[i].SetSprite("herostar" + (((hero.heroStarMaxBefore - 1) / starImgFreezeList.Count) + 1) * starImgFreezeList.Count);
|
}
|
else
|
{
|
starImgFreezeList[i].SetActive(false);
|
}
|
}
|
freezeStarText.text = Language.Get("HeroAwake16", hero.heroStarMaxBefore);
|
freezeAawkeLVText.text = Language.Get("HeroAwake17", needAwakeLV);
|
|
}
|
else
|
{
|
freezeTipBtn.SetActive(false);
|
}
|
|
freezeTipGo.SetActive(false);
|
}
|
|
void RefreshRedImg()
|
{
|
redpointAwake.SetActive(false);
|
redpointGift.SetActive(false);
|
redpointLVUP.SetActive(false);
|
if (!hero.IsInTeamByTeamType(TeamType.Story))
|
{
|
return;
|
}
|
|
|
var heroCnt = PackManager.Instance.GetItemCountByID(PackType.Hero, hero.heroId);
|
var itemPack = PackManager.Instance.GetSinglePack(PackType.Item);
|
|
//5星后才能觉醒
|
if (hero.heroStar >= HeroUIManager.Instance.starLevelCanAwake)
|
{
|
//判断觉醒材料是否足够
|
var maxAwakeLV = HeroAwakeConfig.GetMaxAwakeLV(hero.heroId);
|
if (hero.awakeLevel < maxAwakeLV)
|
{
|
var config = HeroQualityAwakeConfig.GetQualityAwakeConfig(hero.Quality, hero.awakeLevel);
|
if (itemPack.GetCountById(config.UPCostItem[0]) >= config.UPCostItem[1])
|
{
|
redpointAwake.SetActive(true);
|
}
|
}
|
}
|
|
if (heroCnt > 1)
|
{
|
redpointGift.SetActive(true);
|
}
|
|
var maxBreakLV = HeroBreakConfig.GetMaxBreakLv(hero.heroId);
|
if (hero.breakLevel < maxBreakLV)
|
{
|
if (HeroUIManager.Instance.IsLVMaxByBreakLevel(hero))
|
{
|
var breakConfig = HeroQualityBreakConfig.GetQualityBreakConfig(hero.Quality, hero.breakLevel);
|
if (itemPack.GetCountById(breakConfig.UPCostItem[0]) >= breakConfig.UPCostItem[1])
|
{
|
redpointLVUP.SetActive(true);
|
return;
|
}
|
}
|
}
|
|
if (!HeroUIManager.Instance.IsLVMax(hero))
|
{
|
var lvupConfig = HeroQualityLVConfig.GetQualityLVConfig(hero.Quality, hero.heroLevel);
|
if (itemPack.GetCountById(lvupConfig.UPCostItem[0]) >= lvupConfig.UPCostItem[1])
|
{
|
redpointLVUP.SetActive(true);
|
}
|
}
|
}
|
}
|