using System.Text; using UnityEngine; using UnityEngine.UI; /// /// 古宝TIP /// 外部查看类型 0完整tip(可切满级) 1 只有基础满级不可切换 2 只有套装 /// 内部可切换当前0 和 完整1 /// public class GubaoTipWin : UIBase { [SerializeField] ItemCell mainItemCell; [SerializeField] Text nameText; [SerializeField] Image[] starImgs; [SerializeField] Transform processRect; [SerializeField] Image processImg; [SerializeField] Text processText; [SerializeField] Image fullProcessImg; //基础属性 [SerializeField] Text[] attrBaseTexts; [SerializeField] Text specialText; //特殊属性和特权效果 [SerializeField] Button changeBtn; [SerializeField] Text changeText; [SerializeField] Transform fullRect; [SerializeField] GubaoSuiteItemCell[] suiteItemCells; [SerializeField] Text suiteNameText; [SerializeField] Text[] suiteAttrTexts; [SerializeField] Transform basePanel; [SerializeField] Transform linePanel; [SerializeField] Transform suitePanel; int gubaoID = 0; bool isFull = false; // 是否显示满级 int lv = 0; int star = 0; int quality = 0; GubaoConfig config; protected override void InitComponent() { changeBtn.AddListener(()=> { isFull = !isFull; ShowAttr(); }); } protected override void OnPreOpen() { gubaoID = functionOrder; if (GubaoManager.Instance.tipType == 0) { //未拥有只显示满级 isFull = GubaoManager.Instance.IsActive(gubaoID) ? false : true; } else if (GubaoManager.Instance.tipType == 1) { isFull = true; } Display(); } public void Display() { config = GubaoConfig.Get(gubaoID); var gbData = GubaoManager.Instance.TryGetGubaoInfo(gubaoID); lv = 0; star = 0; quality = config.GubaoQuality; if (gbData != null) { lv = gbData.GubaoLV; star = gbData.GubaoStar; } /// 外部查看类型 0完整tip(可切满级) 1 只有基础满级不可切换 2 只有套装 if (GubaoManager.Instance.tipType == 0) { basePanel.SetActive(true); //未拥有只显示满级 if (GubaoManager.Instance.IsActive(gubaoID)) { fullRect.SetActive(false); changeBtn.SetActive(true); } else { fullRect.SetActive(true); changeBtn.SetActive(false); } linePanel.SetActive(true); ShowBase(); ShowSuite(); } else if (GubaoManager.Instance.tipType == 1) { basePanel.SetActive(true); linePanel.SetActive(false); suitePanel.SetActive(false); fullRect.SetActive(true); changeBtn.SetActive(false); ShowBase(); } else if (GubaoManager.Instance.tipType == 2) { basePanel.SetActive(false); linePanel.SetActive(false); ShowSuite(); } } void ShowBase() { nameText.text = Language.Get("L1039", Language.Get($"FuncQuality{quality}")) + config.Name; nameText.color = UIHelper.GetFuncQualityColor(quality); ShowAttr(); } void ShowAttr() { changeText.text = isFull ? Language.Get("Gubao8") : Language.Get("Gubao9"); mainItemCell.Init(new ItemCellModel(config.UnlockItemID, false, 1)); mainItemCell.pieceIcon.SetActive(false); mainItemCell.countText.text = isFull ? Language.Get("L1113", GubaoLVAttrConfig.GetMaxLV(quality)) : Language.Get("L1113", lv); if (isFull || GubaoManager.Instance.IsMaxStar(gubaoID)) { processRect.SetActive(false); } else { var starConfig = GubaoStarConfig.GetConfig(config.GubaoQuality, star + 1); if (starConfig.StarUPNeedSelfCnt > 0) { processRect.SetActive(true); var cnt = VirtualPackManager.Instance.GetNoPackItemCount(config.UnlockItemID); float value = cnt * 1.0f / starConfig.StarUPNeedSelfCnt; processImg.fillAmount = value; fullProcessImg.SetActive(value >= 1); processText.text = $"{cnt}/{starConfig.StarUPNeedSelfCnt}"; } else { processRect.SetActive(false); } } int showStar = isFull ? GubaoStarConfig.GetMaxStar(quality) : star; for (int i = 0; i < starImgs.Length; i++) { if (i < showStar) { starImgs[i].SetActive(true); //循环不同图 int starIndex = showStar / starImgs.Length * starImgs.Length + i + 1; if (starIndex > showStar) { starIndex -= starImgs.Length; } starImgs[i].SetSprite($"GubaoStar{starIndex}"); } else { starImgs[i].SetActive(false); } } string format = "{0}" + UIHelper.AppendColor(TextColType.Green, "+{1}", false); //基础属性 var attrDict = !isFull ? GubaoManager.Instance.GetBaseAttrByGBID(gubaoID, true) : GubaoManager.Instance.GetBaseMaxAttrByGBID(gubaoID); for (int i = 0; i < attrBaseTexts.Length; i++) { if (i < config.BaseAttrIDList.Length) { attrBaseTexts[i].SetActive(true); attrBaseTexts[i].text = PlayerPropertyConfig.GetFullDescription(config.BaseAttrIDList[i], attrDict[config.BaseAttrIDList[i]], format); } else { attrBaseTexts[i].SetActive(false); } } //特殊属性和特权只显示一个 var specAttrDict = !isFull ? GubaoManager.Instance.GetSpecialAttrSingleLayerByGBID(gubaoID) : GubaoManager.Instance.GetSpecialMaxAttrByGBID(gubaoID); if (config.SpecEffType == 0 && config.SpecAttrID != 0) { specialText.text = PlayerPropertyConfig.GetFullDescription(config.SpecAttrID, specAttrDict[config.SpecAttrID], format); } else if (config.SpecEffType != 0 && config.SpecAttrID != 0) { //有特殊效果的 specialText.text = Language.Get("Gubao22_" + config.SpecEffType) + PlayerPropertyConfig.GetFullDescription(config.SpecAttrID, specAttrDict[config.SpecAttrID], format); } else { // 1 游历双倍奖励概率 无 增加万分率 万分率 // 2 月卡领取额外奖励 物品ID 提升百分比 百分比 //有特权效果的 非属性类 var valueDict = !isFull ? GubaoManager.Instance.GetPrivilegeValueByGBID(gubaoID, true) : GubaoManager.Instance.GetPrivilegeMaxValueByGBID(gubaoID); if (config.PowerType == 1) { specialText.text = Language.Get("Gubao23_" + config.PowerType, valueDict[config.PowerType] / 100.0); } else if (config.PowerType == 2 || config.PowerType == 3) { specialText.text = Language.Get("Gubao23_" + config.PowerType, ItemConfig.Get(config.PowerTypeValue).ItemName, valueDict[config.PowerType]); } } } void ShowSuite() { var suitID = GubaoResonanceConfig.GetSuiteIDByGubaoID(gubaoID); if (suitID == 0) { suitePanel.SetActive(false); linePanel.SetActive(false); return; } suitePanel.SetActive(true); var suitConfig = GubaoResonanceConfig.Get(suitID); suiteNameText.text = suitConfig.ResonanceName + Language.Get("HeroFates11", GubaoManager.Instance.GetSuiteActiveGBCnt(suitID), suitConfig.GubaoIDList.Length); for (int i = 0; i < suiteItemCells.Length; i++) { if (i < suitConfig.GubaoIDList.Length) { suiteItemCells[i].SetActive(true); suiteItemCells[i].DisplayByGBID(suitConfig.GubaoIDList[i]); } else { suiteItemCells[i].SetActive(false); } } var curSuiteStar = GubaoManager.Instance.GetSuiteStar(suitID); var starList = GubaoResonanceAttrConfig.GetStarList(suitID); for (int i = 0; i < suiteAttrTexts.Length; i++) { string preStr; var star = starList[i]; var attrCfg = GubaoResonanceAttrConfig.GetConfig(suitID, star); if (star == 0) { preStr = Language.Get("Gubao27"); } else { preStr = Language.Get("Gubao28", star); } if (star <= curSuiteStar) { //激活 string format = "{0}" + UIHelper.AppendColor(TextColType.Green, "+{1}", false); suiteAttrTexts[i].text = Language.Get("L1100", preStr, PlayerPropertyConfig.GetFullDescription(attrCfg.ResonanceAttrIDList[0], attrCfg.ResonanceAttrValueList[0], format)); } else { //锁定 suiteAttrTexts[i].text = UIHelper.AppendColor(TextColType.NavyGray, Language.Get("L1100", preStr, PlayerPropertyConfig.GetFullDescription(attrCfg.ResonanceAttrIDList[0], attrCfg.ResonanceAttrValueList[0]))); } } } }