hch
2025-11-26 b6012660fb854274539a032294bb9dbb0b75053c
0312 优化武将遣散,图鉴跳转,引导升星武将定位
9个文件已修改
211 ■■■■ 已修改文件
Main/System/HeroUI/HeroCollectionWin.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroDeleteHeadCell.cs 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroDeleteWin.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroListWin.cs 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroTrainWin.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroUIManager.OnTeam.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroUIManager.Reborn.cs 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroUIManager.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Scroll/ScrollerController.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroCollectionWin.cs
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@@ -114,6 +115,8 @@
    void CreateScroller()
    {
        int jumpIndex = -1;
        int index = -1;
        heroListScroller.Refresh();
        var _List = HeroUIManager.Instance.heroCollectDict.Keys.ToList();
        _List.Reverse();
@@ -128,17 +131,30 @@
            for (int j = 0; j < ids.Count; j++)
            {
                if (j % 4 == 0)
                {
                {
                    index++;
                    CellInfo cellInfo = new CellInfo();
                    cellInfo.infoInt1 = _List[i];
                    heroListScroller.AddCell(ScrollerDataType.Normal, j, cellInfo);
                }
                if (jumpIndex == -1)
                {
                    //检查每个武将
                    if (HeroUIManager.Instance.IsBookShowRedPoint(ids[j]))
                    {
                        jumpIndex = index;
                    }
                }
            }
            index++;
        }
        heroListScroller.Restart();
        heroListScroller.JumpIndex(jumpIndex);
    }
    void OnRefreshCell(ScrollerDataType type, CellView cell)
    {
        if (type == ScrollerDataType.Header)
Main/System/HeroUI/HeroDeleteHeadCell.cs
@@ -39,53 +39,9 @@
    void Click(HeroInfo hero, int index)
    {
        //上阵 锁定 觉醒 的情况
        if (hero.awakeLevel > 0)
        if (!HeroUIManager.Instance.SelectDeleteHero(hero))
        {
            SysNotifyMgr.Instance.ShowTip("HeroReborn1");
            return;
        }
        if (hero.IsInAnyTeamJustOne())
        {
            //阵容至少要有一个武将上阵
            SysNotifyMgr.Instance.ShowTip("HeroFunc3");
            return;
        }
        if (hero.isLock)
        {
            ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
            Language.Get("herocard66"), (bool isOK) =>
                {
                    if (isOK)
                    {
                        hero.ChangeLockState();
                    }
                });
            return;
        }
        if (hero.IsInAnyTeam())
        {
            ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
            Language.Get("herocard65"), (bool isOK) =>
                {
                    if (isOK)
                    {
                        hero.LeaveAllTeam();
                    }
                });
            return;
        }
        if (HeroUIManager.Instance.selectDeleteHeroList.Contains(hero.itemHero.guid))
        {
            HeroUIManager.Instance.selectDeleteHeroList.Remove(hero.itemHero.guid);
        }
        else
        {
            HeroUIManager.Instance.selectDeleteHeroList.Add(hero.itemHero.guid);
        }
        Display(index);
Main/System/HeroUI/HeroDeleteWin.cs
@@ -41,6 +41,10 @@
        HeroUIManager.Instance.SortHeroDeleteList();
        heroSelectBehaviour.Display(0, HeroUIManager.Instance.selectHeroDeleteListJob, HeroUIManager.Instance.selectHeroDeleteListCountry, SelectJobCountry);
        RefreshEmptyTip();
        //外部选中
        HeroUIManager.Instance.SelectDeleteHero(HeroManager.Instance.GetHero(HeroUIManager.Instance.jumpDeleteHeroGuid));
        CreateScroller();
    }
@@ -51,6 +55,7 @@
        PackManager.Instance.RefreshItemLockEvent -= RefreshItemLockEvent;
        ItemLogicUtility.Instance.OnGetItemShowEvent -= OnGetItemShowEvent;
        HeroUIManager.Instance.selectDeleteHeroList.Clear();
        HeroUIManager.Instance.jumpDeleteHeroGuid = "";
    }
    void CreateScroller()
@@ -64,6 +69,7 @@
            }
        }
        scroller.Restart();
        scroller.JumpIndex(FindJumpIndexByHero(HeroUIManager.Instance.jumpDeleteHeroGuid));
    }
    void OnRefreshCell(ScrollerDataType type, CellView cell)
@@ -236,8 +242,21 @@
    }
    void OnGetItemShowEvent()
    {
    {
        HeroUIManager.Instance.SortHeroDeleteList();
        CreateScroller();
    }
    int FindJumpIndexByHero(string guid)
    {
        var hero = HeroManager.Instance.GetHero(guid);
        if (hero == null)
            return -1;
        if (hero.Quality > HeroUIManager.Instance.jumpDeleteHeroQuality && !HeroUIManager.Instance.isJumpDeleteHero)
        {
            return -1;
        }
        return HeroUIManager.Instance.heroDeleteSortList.IndexOf(guid) / 5 - 1;
    }
}
Main/System/HeroUI/HeroListWin.cs
@@ -51,6 +51,7 @@
        UIManager.Instance.OnCloseWindow += OnCloseWindow;
        HeroManager.Instance.onHeroDeleteEvent += HeroDeleteEvent;
        HeroUIManager.Instance.SortHeroList();
        UIManager.Instance.OnOpenWindow += OnOpenWindow;
        CreateScroller();
        Refresh();
    }
@@ -62,6 +63,7 @@
        PackManager.Instance.gridRefreshEvent -= GridRefreshEvent;
        UIManager.Instance.OnCloseWindow -= OnCloseWindow;
        HeroManager.Instance.onHeroDeleteEvent -= HeroDeleteEvent;
        UIManager.Instance.OnOpenWindow -= OnOpenWindow;
    }
@@ -78,6 +80,35 @@
        }
    }
    private void OnOpenWindow(UIBase openUI)
    {
        if (openUI is NewBieWin)
        {
            if (HeroUIManager.Instance.heroStarGuideDic.ContainsKey(NewBieCenter.Instance.guideStep))
            {
                int jumpHeroID = HeroUIManager.Instance.heroStarGuideDic[NewBieCenter.Instance.guideStep];
                heroListScroller.JumpIndex(FindJumpIndexByHeroID(jumpHeroID));
            }
        }
    }
    int FindJumpIndexByHeroID(int heroID)
    {
        int index = -1;
        foreach (var guid in HeroUIManager.Instance.heroSortList)
        {
            index++;
            var hero = HeroManager.Instance.GetHero(guid);
            if (hero == null)
                continue;
            if (hero.heroId == heroID)
            {
                return index/4 - 1;
            }
        }
        return -1;
    }
    public override void Refresh()
    {
Main/System/HeroUI/HeroTrainWin.cs
@@ -360,7 +360,7 @@
        //     SysNotifyMgr.Instance.ShowTip("UnlockHero");
        //     return;
        // }
        HeroUIManager.Instance.jumpDeleteHeroGuid = guid;
        UIManager.Instance.OpenWindow<HeroDeleteWin>();
    }
Main/System/HeroUI/HeroUIManager.OnTeam.cs
@@ -540,10 +540,11 @@
        {
            if (team.serverHeroes[i] != null)
            {
                if (team.serverHeroes[i].level < minLV)
                var hero = HeroManager.Instance.GetHero(team.serverHeroes[i].guid);
                if (hero != null && hero.heroLevel < minLV)
                {
                    minLV = team.serverHeroes[i].level;
                    minID = team.serverHeroes[i].heroId;
                    minLV = hero.heroLevel;
                    minID = hero.heroId;
                }
            }
        }
Main/System/HeroUI/HeroUIManager.Reborn.cs
@@ -22,6 +22,10 @@
    public List<string> selectDeleteHeroList { get; private set; } = new List<string>();
    public string jumpDeleteHeroGuid;
    public int jumpDeleteHeroQuality;
    public bool isJumpDeleteHero = false; //不可选中的时候是否跳转
    public Dictionary<int, long> GetHeroLVPayBack(int quality, int lv)
    {
@@ -268,5 +272,65 @@
        lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculateFightPower(false));
    }
    // 点选删除列表的武将,添加或者从列表中移除
    // 返回是否操作成功
    public bool SelectDeleteHero(HeroInfo hero)
    {
        if (hero == null)
        {
            return false;
        }
        //上阵 锁定 觉醒 的情况
        if (hero.awakeLevel > 0)
        {
            SysNotifyMgr.Instance.ShowTip("HeroReborn1");
            return false;
        }
        if (hero.IsInAnyTeamJustOne())
        {
            //阵容至少要有一个武将上阵
            SysNotifyMgr.Instance.ShowTip("HeroFunc3");
            return false;
        }
        if (hero.isLock)
        {
            ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
            Language.Get("herocard66"), (bool isOK) =>
                {
                    if (isOK)
                    {
                        hero.ChangeLockState();
                    }
                });
            return false;
        }
        if (hero.IsInAnyTeam())
        {
            ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
            Language.Get("herocard65"), (bool isOK) =>
                {
                    if (isOK)
                    {
                        hero.LeaveAllTeam();
                    }
                });
            return false;
        }
        if (selectDeleteHeroList.Contains(hero.itemHero.guid))
        {
            selectDeleteHeroList.Remove(hero.itemHero.guid);
        }
        else
        {
            selectDeleteHeroList.Add(hero.itemHero.guid);
        }
        return true;
    }
}
Main/System/HeroUI/HeroUIManager.cs
@@ -27,7 +27,7 @@
    public bool isCustonHeroFormation = false;
    public List<TeamHero> custonTeamHeroes = new List<TeamHero>();
    public Dictionary<int, int> heroStarGuideDic = new Dictionary<int, int>();
    public override void Init()
    {
        DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
@@ -72,7 +72,13 @@
        teamSortByJob = JsonMapper.ToObject<int[]>(config.Numerical2);
        onekeyGuideID = int.Parse(config.Numerical3);
        onekeyGuidePosList = JsonMapper.ToObject<int[]>(config.Numerical4);
        config = FuncConfigConfig.Get("Guide");
        heroStarGuideDic = ConfigParse.ParseIntDict(config.Numerical1);
        config = FuncConfigConfig.Get("HeroDelete");
        jumpDeleteHeroQuality = int.Parse(config.Numerical1);
        isJumpDeleteHero = int.Parse(config.Numerical2) == 1;
    }
    public void OnBeforePlayerDataInitialize()
@@ -508,6 +514,17 @@
        }
    }
    //某个武将图鉴中是否显示红点
    public bool IsBookShowRedPoint(int heroID)
    {
        var state = GetHeroBookState(heroID, HeroConfig.Get(heroID).Quality);
        if (state == 1 || state == 3 || state == 4)
        {
            return true;
        }
        return false;
    }
    void UpdateHeroBookRedpoint()
    {
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Hero))
Main/System/Scroll/ScrollerController.cs
@@ -400,6 +400,7 @@
        lastDataCnt = _data.Count;
    }
    //index 是按addcell的顺序,包含所有层级
    public void JumpIndex(int index)
    {
        if (!inited)