hch
2025-08-05 7674f5aee893b74cc0d616b9c40467c8846f243c
122 子 【武将】武将系统 - 武将列表界面
7个文件已修改
2个文件已添加
179 ■■■■ 已修改文件
Main/Config/Configs/PlayerPropertyConfig.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroListWin.cs 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroPosWin.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroUIManager.cs 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/KnapSack/PackManager.cs 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Message/ImgAnalysis.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Utility/UIHelper.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Config/Configs/PlayerPropertyConfig.cs
@@ -1,6 +1,6 @@
//--------------------------------------------------------
//    [Author]:           YYL
//    [  Date ]:           2025年8月5日
//    [  Date ]:           Tuesday, August 5, 2025
//--------------------------------------------------------
using System.Collections.Generic;
Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs
New file
@@ -0,0 +1,19 @@
using UnityEngine;
using System.Collections;
//07 41 通用购买Pack空间#tagCOpenPackCount
public class C0741_tagCOpenPackCount : GameNetPackBasic {
    public byte PackType;    //背包类型:rptItem, rptEquip, rptWarehouse
    public byte Count;    //购买格数
    public C0741_tagCOpenPackCount () {
        _cmd = (ushort)0x0741;
    }
    public override void WriteToBytes () {
        WriteBytes (PackType, NetDataType.BYTE);
        WriteBytes (Count, NetDataType.BYTE);
    }
}
Main/Core/NetworkPackage/ClientPack/C07_Item/C0741_tagCOpenPackCount.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0daeb1940fa9b4f49be0a222d4484650
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Main/System/HeroUI/HeroListWin.cs
@@ -17,10 +17,7 @@
    [SerializeField] Button attrOnTipBtn;
    [SerializeField] Button changeHeroPosBtn; //布阵按钮
    private List<Image> countrySelectImgList;
    private List<Image> jobSelectImgList;
    [SerializeField] HeroSelectBehaviour fiterManager;  //武将筛选
    SinglePack singlePack;
@@ -41,10 +38,12 @@
    protected override void OnPreOpen()
    {
        HeroUIManager.Instance.selectHeroListJob = 0;
        HeroUIManager.Instance.selectHeroListCountry = 0;
        singlePack = PackManager.Instance.GetSinglePack(PackType.Hero);
        heroListScroller.OnRefreshCell += OnRefreshCell;
        //需要考虑调整为武将的事件,而不是背包
        PackManager.Instance.RefreshItemEvent += RefreshPakCount;
        PackManager.Instance.gridRefreshEvent += GridRefreshEvent;
        PackManager.Instance.RefreshItemEvent += RefreshItemEvent;
        HeroUIManager.Instance.SortHeroList();
        CreateScroller();
        Refresh();
@@ -53,13 +52,25 @@
    protected override void OnPreClose()
    {
        heroListScroller.OnRefreshCell -= OnRefreshCell;
        PackManager.Instance.RefreshItemEvent -= RefreshPakCount;
        PackManager.Instance.RefreshItemEvent -= RefreshItemEvent;
        PackManager.Instance.gridRefreshEvent -= GridRefreshEvent;
    }
    public override void Refresh()
    {
        if (singlePack == null || singlePack.GetAllItems().Count <= 0)
        RefreshEmptyTip();
        OnBattleTeamAttrPer();
        RefreshPackCount();
        fiterManager.Display(0, HeroUIManager.Instance.selectHeroListJob, HeroUIManager.Instance.selectHeroListCountry, SelectJobCountry);
    }
    void RefreshEmptyTip()
    {
        if (HeroUIManager.Instance.heroSortList.Count <= 0)
        {
            heroListEmpty.SetActive(true);
            heroListScroller.SetActive(false);
@@ -69,10 +80,15 @@
            heroListEmpty.SetActive(false);
            heroListScroller.SetActive(true);
        }
    }
        OnBattleTeamAttrPer();
        RefreshPakCount(PackType.Hero, 0, 0);
    void SelectJobCountry(int job, int country)
    {
        HeroUIManager.Instance.selectHeroListJob = job;
        HeroUIManager.Instance.selectHeroListCountry = country;
        HeroUIManager.Instance.SortHeroList();
        RefreshEmptyTip();
        CreateScroller();
    }
    //上阵加成
@@ -92,7 +108,7 @@
                    valuePer += hero.GetOnBattleAddPer();
                }
            }
        }
        //上阵属性
        for (int i = 0; i < attrOnList.Count; i++)
@@ -120,18 +136,29 @@
        heroListScroller.Restart();
    }
    void RefreshPakCount(PackType type, int index, int itemID)
    void RefreshItemEvent(PackType type, int index, int itemID)
    {
        if (type != PackType.Hero)
            return;
        if (singlePack == null)
            return;
        RefreshPackCount();
    }
    void RefreshPackCount()
    {
        int count = singlePack.GetAllItems().Count;
        heroPackText.text = UIHelper.AppendColor(count > singlePack.unlockedGridCount ? TextColType.Red : TextColType.NavyBrown,
                            string.Format("{0}/{1}", count, singlePack.unlockedGridCount));
    }
    void GridRefreshEvent(PackType type)
    {
        if (type != PackType.Hero)
            return;
        RefreshPackCount();
    }
}
Main/System/HeroUI/HeroPosWin.cs
@@ -136,16 +136,7 @@
        RefreshFlyHead();
        RefreshConn();
        if (HeroManager.Instance.GetHeroCount() == 0)
        {
            heroListEmpty.SetActive(true);
            heroListScroller.SetActive(false);
        }
        else
        {
            heroListEmpty.SetActive(false);
            heroListScroller.SetActive(true);
        }
        RefreshEmptyTip();
        showConnTipToggleBtn.isOn = isToggleOn;
@@ -181,6 +172,21 @@
        HeroUIManager.Instance.selectTeamPosCountry = country;
        HeroUIManager.Instance.SortHeroOnTeamList();
        CreateScroller();
        RefreshEmptyTip();
    }
    void RefreshEmptyTip()
    {
        if (HeroUIManager.Instance.heroOnTeamSortList.Count <= 0)
        {
            heroListEmpty.SetActive(true);
            heroListScroller.SetActive(false);
        }
        else
        {
            heroListEmpty.SetActive(false);
            heroListScroller.SetActive(true);
        }
    }
    void OnRefreshCell(ScrollerDataType type, CellView cell)
Main/System/HeroUI/HeroUIManager.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using dnlib.DotNet;
using UnityEngine;
@@ -11,6 +12,8 @@
{
    #region 武将列表界面
    public List<string> heroSortList { get; private set; } = new List<string>();  //上阵为主线的列表
    public int selectHeroListJob = 0;    //武将列表界面 筛选职业
    public int selectHeroListCountry = 0;    //武将列表界面筛选国家
    #endregion
@@ -46,18 +49,27 @@
            return;
        }
        var buyInfo = PackManager.Instance.BuyPackGirdNeedData(PackType.Hero);
        ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
        Language.Get("HeroPack1", GeneralDefine.MoneyDisplayModel[1],1, 1), (bool isOK)=>
        {
        });
        Language.Get("HeroPack1", UIHelper.GetIconNameWithMoneyType(buyInfo[0]), buyInfo[1], buyInfo[2]),
            (bool isOK) =>
            {
                if (isOK)
                {
                    if (UIHelper.GetMoneyCnt(buyInfo[0]) < (ulong)buyInfo[1])
                    {
                        SysNotifyMgr.Instance.ShowTip("LackMoney",buyInfo[0]);
                        return;
                    }
                    PackManager.Instance.BuyPackGird(PackType.Hero);
                }
            });
    }
    //刷新时机, 打开武将界面 或者 关闭功能界面
    public void SortHeroList()
    {
        heroSortList = HeroManager.Instance.GetHeroGuidList();
        heroSortList = HeroManager.Instance.GetHeroGuidList(selectHeroListJob, selectHeroListCountry);
        heroSortList.Sort(CmpHero);
    }
Main/System/KnapSack/PackManager.cs
@@ -35,7 +35,6 @@
    //读表数据
    public Dictionary<int, int> PackMaxCountDict = new Dictionary<int, int>(); //背包类型:背包格子最大数量
    public Dictionary<int, int> PackInitCountDict = new Dictionary<int, int>(); //背包类型:初始数量
    public int initBagGridCount { get; private set; } //初始物品背包格子数
    public int[] itemPackSortTyps { get; private set; }    //背包物品的按类型排序
    public List<string> composeItemGuidList = new List<string>();  //合成列表物品guid
@@ -266,9 +265,28 @@
        }
    }
    //购买所需信息 [货币类型,货币数量,购买格数]
    public int[] BuyPackGirdNeedData(PackType packType)
    {
        return null;
        var curPackGirdCnt = GetSinglePack(packType).unlockedGridCount;
        if (curPackGirdCnt >= PackMaxCountDict[(int)packType])
            return null;
        int buyTimes = 0;
        PackGirdServerBuyCountDict.TryGetValue((int)packType, out buyTimes);
        var moneyType = openGirdMoneyDict[(int)packType];
        var moneyCntList = openGirdMoneyValueDict[(int)packType];
        var money = moneyCntList[Math.Min(buyTimes, moneyCntList.Length - 1)];
        var girdCntList = openGirdCountDict[(int)packType];
        var buyGirdCnt = girdCntList[Math.Min(buyTimes, girdCntList.Length - 1)];
        return new[] {moneyType, money, buyGirdCnt};
    }
    public void BuyPackGird(PackType packType)
    {
        var netPack = new C0741_tagCOpenPackCount();
        netPack.PackType = (byte)packType;
        GameNetSystem.Instance.SendInfo(netPack);
    }
    public void UpdateUnlockedGridCount(H0724_tagRolePackCanUseCount useCount)
@@ -483,7 +501,6 @@
        autoUseItemIDs = JsonMapper.ToObject<int[]>(FuncConfigConfig.Get("AutoUseItem").Numerical1);
        var config= FuncConfigConfig.Get("InitBagCellCount");
        initBagGridCount = int.Parse(config.Numerical1);
        PackInitCountDict = ConfigParse.ParseIntDict(config.Numerical2);
        config = FuncConfigConfig.Get("PackageSortPriority");
        itemPackSortTyps = ConfigParse.GetMultipleStr<int>(config.Numerical1);
Main/System/Message/ImgAnalysis.cs
@@ -177,9 +177,9 @@
    private void InverseToRichText()
    {
        m_StringBuilder.Append("<color=#00000000><quad ");
        m_StringBuilder.Append(string.Format("size={0} ", presentImgInfo.height* presentImgInfo.scale));
        float ratio = (float)Math.Round((float)presentImgInfo.width / presentImgInfo.height * presentImgInfo.scale, 1);
        m_StringBuilder.Append(string.Format("width={0} ", ratio));
        m_StringBuilder.Append(string.Format("size={0} ", presentImgInfo.height));  // 占位像素
        float ratio = 1f;
        m_StringBuilder.Append(string.Format("width={0} ", ratio)); //基础size的缩放比率
        m_StringBuilder.Append(string.Format("index={0}", presentImgInfo.index));
        m_StringBuilder.Append("/></color>");
    }
Main/Utility/UIHelper.cs
@@ -80,6 +80,11 @@
        _image.SetSprite(iconKey);
    }
    public static string GetIconNameWithMoneyType(int moneyType)
    {
        return StringUtility.Contact("Money_Type_", moneyType);
    }
    /// <summary>
    /// 分离字符串插入空格
    /// </summary>