using System; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; public class BeautyMMUpgradeWin : UIBase { [SerializeField] Text titleText; [SerializeField] Text title2Text; [SerializeField] ImageEx roleImg; [SerializeField] Text[] talentTexts; int mmID; BeautyConfig mmConfig; protected override void OnPreOpen() { mmID = functionOrder; Display(); } void Display() { mmConfig = BeautyConfig.Get(mmID); var skinID = BeautyMMManager.Instance.GetUsedSkinID(mmID); var skinConfig = BeautySkinConfig.Get(skinID); roleImg.SetOrgSprite(skinConfig.BigRole, "BeautyMMBigRole"); roleImg.SetNativeSize(); var mmData = BeautyMMManager.Instance.GetBeautyMMData(mmID); int rank = 0; if (mmData != null) { rank = mmData.LV / BeautyMMManager.Instance.needLVForTalent; } titleText.text = Language.Get($"BeautyMMLVName{rank}"); title2Text.text = Language.Get($"BeautyMMLVName{rank + 1}"); ShowTalent(); } void ShowTalent() { //先显示天赋属性,再显示天赋特性 var attrs = BeautyMMManager.Instance.GetMMTalentAttrForUI(mmID, true); int talentIndex = 0; if (attrs.IsNullOrEmpty()) { talentIndex = 0; } else { foreach (var attr in attrs) { if (talentIndex < talentTexts.Length) { talentTexts[talentIndex].SetActive(true); string format = "{0}" + UIHelper.AppendColor(TextColType.Green, "+{1}"); talentTexts[talentIndex].text = PlayerPropertyConfig.GetFullDescription(attr.Key, attr.Value, format); } else { break; } talentIndex++; } } var talentValue = BeautyMMManager.Instance.GetMMTalentEffectForUI(mmID); for (int i = talentIndex; i < talentTexts.Length; i++) { if (i == talentIndex && mmConfig.EffType != 0) { //天赋效果约定最多一个 talentTexts[talentIndex].SetActive(true); switch (mmConfig.EffType) { case 1: talentTexts[i].text = Language.Get($"BeautyMMTalent1", talentValue); break; case 2: talentTexts[i].text = Language.Get($"BeautyMMTalent2", talentValue / 100, ItemConfig.Get(mmConfig.EffTypeValue).ItemName); break; case 3: talentTexts[i].text = Language.Get($"BeautyMMTalent3", talentValue); break; case 4: talentTexts[i].text = Language.Get($"BeautyMMTalent4", ItemConfig.Get(mmConfig.EffTypeValue).ItemName, talentValue); break; } } else { talentTexts[i].SetActive(false); } } } }