hch
2025-10-22 af6e207c6d185ed66125e85e18c02c63bea597f9
Main/System/HeroUI/HeroPosWin.cs
@@ -48,7 +48,7 @@
    private bool m_IsToggleOn = false;
    private bool isToggleOn
    {
    {
        get { return m_IsToggleOn; }
        set
        {
@@ -100,6 +100,7 @@
        countryOnBtn.AddListener(() =>
        {
            HeroUIManager.Instance.isCustonHeroFormation = false;
            UIManager.Instance.OpenWindow<HeroFormationWin>();
        });
@@ -114,8 +115,10 @@
        HeroUIManager.Instance.SortHeroOnTeamList();
        heroListScroller.OnRefreshCell += OnRefreshCell;
        HeroUIManager.Instance.OnTeamPosChangeEvent += TeamChangeEvent;
        TeamManager.Instance.OnTeamChange += OnTeamChange;
        SelectTiltleBtn();
        CreateScroller();
        Refresh();
        Display();
    }
    protected override void OnPreClose()
@@ -123,11 +126,25 @@
        CancelCurrentTask();
        heroListScroller.OnRefreshCell -= OnRefreshCell;
        HeroUIManager.Instance.OnTeamPosChangeEvent -= TeamChangeEvent;
        TeamManager.Instance.OnTeamChange -= OnTeamChange;
        TeamManager.Instance.GetTeam(HeroUIManager.Instance.selectTeamType).RestoreTeam();
    }
    public override void Refresh()
    void SelectTiltleBtn()
    {
        if (functionOrder == 0)
        {
            mainFBBtn.SelectBtn();
        }
        else if (functionOrder == 1)
        {
            jjcBtn.SelectBtn();
        }
    }
    public void Display()
    {
        OnBattleTeamAttrPer();
        RefreshOnTeamCountry();
@@ -143,9 +160,9 @@
        fiterManager.Display(0, HeroUIManager.Instance.selectTeamPosJob, HeroUIManager.Instance.selectTeamPosCountry, SelectJobCountry);
        fightPowerText.text = "1234k";
        fightPowerText.text = UIHelper.ReplaceLargeArtNum(FightPowerManager.Instance.GetTeamFightPower(HeroUIManager.Instance.selectTeamType, true));
    }
    void RefreshFlyHead()
@@ -176,7 +193,7 @@
    }
    void RefreshEmptyTip()
    {
    {
        if (HeroUIManager.Instance.heroOnTeamSortList.Count <= 0)
        {
            heroListEmpty.SetActive(true);
@@ -215,11 +232,11 @@
        var team = TeamManager.Instance.GetTeam(HeroUIManager.Instance.selectTeamType);
        if (team != null)
        {
            for (int i = 0; i < team.serverHeroes.Length; i++)
            for (int i = 0; i < team.tempHeroes.Length; i++)
            {
                if (team.serverHeroes[i] == null)
                if (team.tempHeroes[i] == null)
                    continue;
                var hero = HeroManager.Instance.GetHero(team.serverHeroes[i].guid);
                var hero = HeroManager.Instance.GetHero(team.tempHeroes[i].guid);
                if (hero != null)
                {
                    valuePer += hero.GetOnBattleAddPer();
@@ -230,14 +247,15 @@
        //上阵属性
        for (int i = 0; i < attrOnList.Length; i++)
        {
            attrOnList[i].text = PlayerPropertyConfig.GetFullDescription(new Int2(PlayerPropertyConfig.basePerAttrs[i], valuePer));
            string format = valuePer == 0 ? "{0}+{1}" : "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}", false);
            attrOnList[i].text = PlayerPropertyConfig.GetFullDescription(PlayerPropertyConfig.basePerAttrs[i], valuePer, format);
        }
    }
    //上阵武将国家光环激活
    void RefreshOnTeamCountry(bool playEffect = false)
    {
        Int2 result = HeroUIManager.Instance.GetMaxCountHeroCountry(HeroUIManager.Instance.selectTeamType);
        Int2 result = HeroUIManager.Instance.GetMaxCountHeroCountry(HeroUIManager.Instance.selectTeamType, true);
        var config = HeroLineupHaloConfig.GetConfig(result.x, result.y);
        if (config == null)
@@ -343,7 +361,7 @@
            else
            {
                sceneHero[i].SetActive(true);
                sceneHero[i].Display(teamHero.guid, i, flyFrom >= 0);
                sceneHero[i].Display(teamHero.guid, i, flyFrom >= 0, flyFrom != -2 ? true : false);
                //按scenePosImgs 顺序排序对应位置
                sceneHero[i].transform.position = scenePosImgs[i].transform.position;
                sceneHero[i].transform.localScale = Vector3.one;
@@ -353,6 +371,7 @@
        RefreshPosScale();
        heroListScroller.m_Scorller.RefreshActiveCellViews();
        RefreshOnTeamCountry(true);
        OnBattleTeamAttrPer();
        //表现飞入,连续点击不同头像触发的话则重置
        if (flyFrom > -1)
@@ -380,10 +399,12 @@
            sequence.onComplete = () => { flyHead.transform.localScale = Vector3.zero; };
            if (isToggleOn)
            {
            {
                ShowFetter(flyHero);
            }
        }
        fightPowerText.text = UIHelper.ReplaceLargeArtNum(FightPowerManager.Instance.GetTeamFightPower(HeroUIManager.Instance.selectTeamType, true));
    }
    void ShowFetter(HeroInfo hero)
@@ -392,7 +413,7 @@
        var fetterList = hero.GetActiveFetter(heroConfig, TeamManager.Instance.GetTeam(HeroUIManager.Instance.selectTeamType));
        for (int i = 0; i < fetterList.Count; i++)
        {
            if(!showConnectTipQueue.Contains(fetterList[i]))
            if (!showConnectTipQueue.Contains(fetterList[i]))
                showConnectTipQueue.Enqueue(fetterList[i]);
        }
@@ -451,10 +472,33 @@
        var guidList = HeroUIManager.Instance.SelectRecommend();
        var team = TeamManager.Instance.GetTeam(HeroUIManager.Instance.selectTeamType);
        team.RemoveAllHeroes();
        for (int i = 0; i < guidList.Count; i++)
        if (NewBieCenter.Instance.inGuiding && NewBieCenter.Instance.currentGuide == HeroUIManager.Instance.onekeyGuideID)
        {
            team.AddHero(HeroManager.Instance.GetHero(guidList[i]), i);
            //第二个强制排在5号位
            if (guidList.Count > 1)
            {
                team.AddHero(HeroManager.Instance.GetHero(guidList[1]), 4, true);
                guidList.RemoveAt(1);
            }
            for (int i = 0; i < guidList.Count; i++)
            {
                int index = i;
                if (i >= 4)
                {
                    index = i + 1;
                }
                team.AddHero(HeroManager.Instance.GetHero(guidList[i]), index, true);
            }
        }
        else
        {
            for (int i = 0; i < guidList.Count; i++)
            {
                team.AddHero(HeroManager.Instance.GetHero(guidList[i]), i, true);
            }
        }
        TeamChangeEvent(new List<int>() { 0, 1, 2, 3, 4, 5 }, -1, Vector3.zero);
@@ -472,12 +516,20 @@
        {
            return;
        }
        HeroUIManager.Instance.selectTeamPosJob = 0;
        HeroUIManager.Instance.selectTeamPosCountry = 0;
        HeroUIManager.Instance.SortHeroOnTeamList();
        HeroUIManager.Instance.selectTeamType = type;
        Refresh();
        HeroUIManager.Instance.SortHeroOnTeamList();
        Display();
        heroListScroller.m_Scorller.RefreshActiveCellViews();
    }
    protected void OnTeamChange(TeamType teamType)
    {
        if (HeroUIManager.Instance.selectTeamType == teamType)
        {
            HeroUIManager.Instance.SortHeroOnTeamList();
            heroListScroller.m_Scorller.RefreshActiveCellViews();
        }
    }
}