hch
2025-09-03 c310e51244b8ea3dbc56dfecf91e9577eb1513e2
117 【武将】武将系统 - 吞噬,升级飘字显示
5个文件已修改
4个文件已添加
236 ■■■■ 已修改文件
Main/System/Hero/HeroInfo.Talent.cs 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/GiftBaseCell.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroGiftLineCell.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroGiftLineCell.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroGiftWin.cs 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroGiftWin.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroTrainWin.cs 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroUIManager.Gift.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Utility/UIHelper.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Hero/HeroInfo.Talent.cs
@@ -7,15 +7,15 @@
{
    public int heroStar
    {
        get
        {
            if (itemHero == null)
                return 0;
            return itemHero.GetUseDataFirstValue(72);
        }
    }
    {
        get
        {
            if (itemHero == null)
                return 0;
            return itemHero.GetUseDataFirstValue(72);
        }
    }
    // 75 # 英雄天赋洗炼锁定索引列表,对应71天赋ID索引
    // 77 # 英雄天赋洗炼随机ID列表
    // 79 # 英雄觉醒时随机天赋选项ID列表
@@ -61,7 +61,7 @@
                talentAttrDic[config.AttrID] = config.AttrValue * talentLvList[i];
            }
            else
            {
            {
                talentAttrDic[config.AttrID] += config.AttrValue * talentLvList[i];
            }
        }
@@ -76,13 +76,32 @@
    }
    public int GetTalentAttrPer(int attrType)
    {
        if (PlayerPropertyConfig.baseAttr2perDict.ContainsKey(attrType))
        {
            var pertype = PlayerPropertyConfig.baseAttr2perDict[attrType];
            return talentAttrDic.ContainsKey(pertype) ? talentAttrDic[pertype] : 0;
        }
        return 0;
    {
        if (PlayerPropertyConfig.baseAttr2perDict.ContainsKey(attrType))
        {
            var pertype = PlayerPropertyConfig.baseAttr2perDict[attrType];
            return talentAttrDic.ContainsKey(pertype) ? talentAttrDic[pertype] : 0;
        }
        return 0;
    }
    public int GetMaxStarCount()
    {
        if (Quality < 4)
            return HeroUIManager.normalGiftMaxCnt * HeroUIManager.Instance.maxGiftLevel;
        return HeroUIManager.giftMaxCnt * HeroUIManager.Instance.maxGiftLevel;
    }
    public int GetTotalStarCount()
    {
        //talentLvList里的元素全部相加
        return talentLvList.Sum();
    }
    public bool IsFullStar()
    {
        //检查talentLvList 所有元素都大于等于10
        return talentLvList.All(x => x >= HeroUIManager.Instance.maxGiftLevel);
    }
}
Main/System/HeroUI/GiftBaseCell.cs
@@ -160,23 +160,23 @@
    {
        if (quality == 1)
        {
            //692088
            return new Color32(105, 32, 136, 128);
            //1D0029
            return new Color32(29, 0, 41, 128);
        }
        else if (quality == 2)
        {
            //886220
            return new Color32(136, 98, 32, 128);
            //372300
            return new Color32(55, 35, 0, 128);
        }
        else if (quality == 3)
        {
            //884a20
            return new Color32(136, 74, 32, 128);
            //3A1800
            return new Color32(58, 24, 0, 128);
        }
        else if (quality == 4)
        {
            //882020
            return new Color32(136, 32, 32, 128);
            //3A0000
            return new Color32(58, 0, 0, 128);
        }
        return new Color32(0, 0, 0, 128);
    }
Main/System/HeroUI/HeroGiftLineCell.cs
New file
@@ -0,0 +1,33 @@
using System.Collections.Generic;
using UnityEngine;
public class HeroGiftLineCell : CellView
{
    [SerializeField] GiftBaseCell[] cardList;
    public void Display(int index, List<int> configList)
    {
        for (int i = 0; i < cardList.Length; i++)
        {
            if (index < configList.Count)
            {
                var giftID = configList[index];
                var giftLV = HeroUIManager.Instance.maxGiftLevel;
                cardList[i].SetActive(true);
                cardList[i].Init(giftID, giftLV, () =>
                {
                    var giftConfig = HeroTalentConfig.Get(giftID);
                    SmallTipWin.showText = Language.Get("SmallTipFomat", giftConfig.Name + " " + Language.Get("L1113", giftLV),
                    Language.Get("HeroGift5", PlayerPropertyConfig.Get(giftConfig.AttrID).Name, PlayerPropertyConfig.GetValueDescription(giftConfig.AttrID, giftConfig.AttrValue)));
                    SmallTipWin.worldPos = CameraManager.uiCamera.ScreenToWorldPoint(Input.mousePosition);
                    UIManager.Instance.OpenWindow<SmallTipWin>();
                });
            }
            else
            {
                cardList[i].SetActive(false);
            }
        }
    }
}
Main/System/HeroUI/HeroGiftLineCell.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fe49c2bc0fa1bbf4eb5389f355876ebb
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Main/System/HeroUI/HeroGiftWin.cs
New file
@@ -0,0 +1,54 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 武将天赋总览界面
/// </summary>
public class HeroGiftWin : UIBase
{
    [SerializeField] ScrollerController scroller;
    protected override void OnPreOpen()
    {
        scroller.OnRefreshCell += OnRefreshCell;
        CreateScroller();
    }
    protected override void OnPreClose()
    {
        scroller.OnRefreshCell -= OnRefreshCell;
    }
    List<int> configList = new List<int>();
    void CreateScroller()
    {
        configList = HeroTalentConfig.GetKeys().ToList();
        var totalCount = configList.Count;
        scroller.Refresh();
        for (int i = 0; i < totalCount; i++)
        {
            if (i % 5 == 0)
            {
                scroller.AddCell(ScrollerDataType.Header, i);
            }
        }
        scroller.Restart();
    }
    void OnRefreshCell(ScrollerDataType type, CellView cell)
    {
        var _cell = cell as HeroGiftLineCell;
        _cell.Display(cell.index, configList);
    }
}
Main/System/HeroUI/HeroGiftWin.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 01bd2b445a469e24281b88ed69b39166
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Main/System/HeroUI/HeroTrainWin.cs
@@ -68,6 +68,7 @@
    [SerializeField] GiftBaseCell[] giftBaseCells;
    [SerializeField] Button totalGiftBtn;
    [SerializeField] Button starUPBtn;
    [SerializeField] Text starUPBtnText;
    [SerializeField] Button washBtn;
@@ -127,6 +128,13 @@
        });
        lvupBtn.AddListener(LVUp);
        lvupBtn.onPress.AddListener(LVUp);
        totalGiftBtn.AddListener(() =>
        {
            UIManager.Instance.OpenWindow<HeroGiftWin>();
        });
        starUPBtn.AddListener(StarUP);
    }
@@ -468,7 +476,7 @@
                addPerObject.SetActive(true);
                for (int i = 0; i < addPerText.Length; i++)
                {
                    addPerText[i].text = "+" + PlayerPropertyConfig.GetValueDescription(PlayerPropertyConfig.basePerAttrs[i], hero.qualityConfig.BreakLVAddPer);
                    addPerText[i].text = "+" + PlayerPropertyConfig.GetValueDescription(PlayerPropertyConfig.basePerAttrs[i], hero.qualityConfig.LVAddPer);
                }
                addPerObject.Play(() =>
                {
@@ -576,6 +584,30 @@
    void RefreshGift()
    {
        RefreshGiftCell();
        if (hero.GetTotalStarCount() >= hero.GetMaxStarCount())
        {
            starUPBtn.interactable = false;
            starUPBtn.SetColorful(null, false);
            starUPBtnText.text = Language.Get("HeroGift7");
        }
        else if (hero.IsFullStar())
        {
            starUPBtn.interactable = true;
            starUPBtn.SetColorful(null, false);
            starUPBtnText.text = Language.Get("HeroGift3");
        }
        else
        {
            starUPBtn.interactable = true;
            starUPBtn.SetColorful(null, true);
            starUPBtnText.text = Language.Get("HeroGift3");
        }
    }
    void RefreshGiftCell()
    {
        //传说以下只有4个
        int showCount = hero.Quality < 4 ? HeroUIManager.normalGiftMaxCnt : HeroUIManager.giftMaxCnt;
        for (int i = 0; i < giftBaseCells.Length; i++)
@@ -625,4 +657,24 @@
        }
    }
    void StarUP()
    {
        if (hero.GetTotalStarCount() >= hero.GetMaxStarCount())
        {
            return;
        }
        else if (hero.IsFullStar())
        {
            starUPBtn.interactable = true;
            starUPBtn.SetColorful(null, false);
            starUPBtnText.text = Language.Get("HeroGift3");
        }
        else
        {
            starUPBtn.interactable = true;
            starUPBtn.SetColorful(null, true);
            starUPBtnText.text = Language.Get("HeroGift3");
        }
    }
}
Main/System/HeroUI/HeroUIManager.Gift.cs
@@ -10,7 +10,7 @@
{
    public const int normalGiftMaxCnt = 4;  //传说4以下
    public const int giftMaxCnt = 8;
    public int maxGiftLevel;    //天赋最高等级,其他功能可能会增加这个上限
    public int maxGiftLevel;    //单天赋最高等级,其他功能可能会增加这个上限
    public int starLevelCanAwake;   //x星可以觉醒
    public int washItemID;
Main/Utility/UIHelper.cs
@@ -372,7 +372,7 @@
    public static readonly Color s_NavyYellow = new Color32(242, 238, 2, 255); //f2ee02
    public static readonly Color s_LightGreen = new Color32(42, 227, 55, 255);//2ae337
    public static readonly Color s_LightWhite = new Color32(245, 246, 230, 255); //f5f6e6
    public static readonly Color s_Gray = new Color32(104, 104, 104,255);  //bbbbbb
    public static readonly Color s_Gray = new Color32(187, 187, 187, 255); //bbbbbb
    public static readonly Color s_Gold = new Color32(255, 239, 71, 255);//ffef47
    public static readonly Color s_EarthYellow = new Color32(248, 152, 59, 255);//f8983b