hch
4 天以前 5825214a6017396705a4f8b7d8071f689819773f
0312 武将支持批量吞噬
7个文件已修改
148 ■■■■ 已修改文件
Main/System/Hero/HeroManager.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroGiftEatSuccessWin.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroGiftEatWin.cs 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroGiftRoleListCell.cs 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroGiftRoleListWin.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroUIManager.Talent.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroUI/HeroUIManager.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Hero/HeroManager.cs
@@ -245,4 +245,8 @@
        return heroList;
    }
    public HeroInfo GetHeroByIndex(int index)
    {
        return GetHero(PackManager.Instance.GetItemByIndex(PackType.Hero, index).guid);
    }
}
Main/System/HeroUI/HeroGiftEatSuccessWin.cs
@@ -32,10 +32,15 @@
    protected override void OnPreOpen()
    {
        HeroUIManager.Instance.selectEatHeroIndexList.Clear();
        if (string.IsNullOrEmpty(HeroUIManager.Instance.selectHeroGuidForGiftFuncForSuccessWin))
            return;
        Display();
        HeroUIManager.Instance.selectEatHeroGuid = "";
    }
    protected override void OnPreClose()
    {
        HeroUIManager.Instance.waitResponse = default;
    }
@@ -45,7 +50,7 @@
        if (hero == null)
            return;
        int beforeStarCount = hero.heroStar - 1;
        int beforeStarCount = HeroUIManager.Instance.eatBeforeStar;
        int afterStarCount = hero.heroStar;
        HeroUIManager.Instance.ShowStarImg(beforeStarCount, beforeStars);
@@ -59,7 +64,7 @@
            int id = PlayerPropertyConfig.basePerAttrs[i];
            attrPerNameArr[i].text = PlayerPropertyConfig.Get(id).Name;
            nextAttrPerTextArr[i].text = PlayerPropertyConfig.GetValueDescription(id, valuePer);
            attrPerTextArr[i].text = PlayerPropertyConfig.GetValueDescription(id, valuePer - hero.qualityConfig.StarAddPer);
            attrPerTextArr[i].text = PlayerPropertyConfig.GetValueDescription(id, valuePer - hero.qualityConfig.StarAddPer*(afterStarCount - beforeStarCount));
        }
        //天赋
Main/System/HeroUI/HeroGiftEatWin.cs
@@ -18,6 +18,9 @@
    [SerializeField] GameObject addAttrGo;
    [SerializeField] Text[] addAttrTexts;
    [SerializeField] Text addGiftTip;
    [SerializeField] GameObject addNumGo;
    [SerializeField] Text addNumText;
    [SerializeField] Button eatBtn;
@@ -35,16 +38,24 @@
    protected override void OnPreOpen()
    {
        HeroUIManager.Instance.SelectEatHeroEvent += Display;
        HeroUIManager.Instance.selectEatHeroIndexList.Clear();
        UIManager.Instance.OnCloseWindow += OnCloseWindow;
        Display();
    }
    protected override void OnPreClose()
    {
        HeroUIManager.Instance.selectEatHeroGuid = "";
        HeroUIManager.Instance.SelectEatHeroEvent -= Display;
        HeroUIManager.Instance.selectEatHeroIndexList.Clear();
        UIManager.Instance.OnCloseWindow -= OnCloseWindow;
    }
    void OnCloseWindow(UIBase win)
    {
        if (win is HeroGiftRoleListWin || win is HeroGiftEatSuccessWin)
        {
            Display();
        }
    }
    public void Display()
    {
@@ -52,7 +63,7 @@
        heroShow.Init(hero.heroId, hero.SkinID, hero.breakLevel, hero.heroStar, hero.awakeLevel, hero.heroLevel);
        HeroUIManager.Instance.RefreshGiftCell(giftCells, hero);
        if (string.IsNullOrEmpty(HeroUIManager.Instance.selectEatHeroGuid))
        if (HeroUIManager.Instance.selectEatHeroIndexList.IsNullOrEmpty())
        {
            addHeroBtn.SetActive(true);
            addHeroGo.SetActive(false);
@@ -65,7 +76,7 @@
            addHeroGo.SetActive(true);
            addTip.SetActive(false);
            addAttrGo.SetActive(true);
            var addHero = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectEatHeroGuid);
            var addHero = HeroManager.Instance.GetHeroByIndex(HeroUIManager.Instance.selectEatHeroIndexList[0]);
            addHeroShow.Init(addHero.heroId, addHero.SkinID, addHero.breakLevel, addHero.heroStar, addHero.awakeLevel, addHero.heroLevel);
            HeroUIManager.Instance.RefreshGiftCell(addGiftCells, addHero);
            for (int i = 0; i < addAttrTexts.Length; i++)
@@ -76,11 +87,21 @@
            }
            addGiftTip.SetActive(!hero.IsFullGift());
        }
        if (HeroUIManager.Instance.selectEatHeroIndexList.IsNullOrEmpty())
        {
            addNumGo.SetActive(false);
        }
        else
        {
            addNumGo.SetActive(true);
            addNumText.text = "x" + HeroUIManager.Instance.selectEatHeroIndexList.Count;
        }
    }
    void EatHero()
    {
        if (HeroUIManager.Instance.selectEatHeroGuid == "")
        if (HeroUIManager.Instance.selectEatHeroIndexList.IsNullOrEmpty())
        {
            SysNotifyMgr.Instance.ShowTip("HeroGift3");
            return;
@@ -100,8 +121,7 @@
            return;
        }
        var eatHero = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectEatHeroGuid);
        if (hero == null || eatHero == null)
        if (hero == null)
            return;
@@ -119,16 +139,24 @@
            return;
        }
        for (int i = 0; i < HeroUIManager.Instance.selectEatHeroIndexList.Count; i++)
        {
            var eatHero = HeroManager.Instance.GetHeroByIndex(HeroUIManager.Instance.selectEatHeroIndexList[i]);
            if (eatHero == null)
                continue;
        var pack = new CB231_tagCSHeroStarUP();
        pack.ItemIndex = (ushort)hero.itemHero.gridIndex;
        pack.UseItemIndex = (ushort)eatHero.itemHero.gridIndex;
        GameNetSystem.Instance.SendInfo(pack);
            var pack = new CB231_tagCSHeroStarUP();
            pack.ItemIndex = (ushort)hero.itemHero.gridIndex;
            pack.UseItemIndex = (ushort)eatHero.itemHero.gridIndex;
            GameNetSystem.Instance.SendInfo(pack);
        }
        HeroUIManager.Instance.eatHeroIDForResult = hero.heroId;
        HeroUIManager.Instance.selectHeroGuidForGiftFuncForSuccessWin = HeroUIManager.Instance.selectHeroGuidForGiftFunc;
        HeroUIManager.Instance.heroBeforeGiftIDList = new List<int>(hero.talentIDList);
        HeroUIManager.Instance.heroBeforeGiftLevelList = new List<int>(hero.talentLvList);
        HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculateFightPower(false));
        HeroUIManager.Instance.eatBeforeStar = hero.heroStar;
        //设置个等待回复的标识 显示成功界面
        HeroUIManager.Instance.waitResponse = new WaitHeroFuncResponse()
Main/System/HeroUI/HeroGiftRoleListCell.cs
@@ -8,6 +8,7 @@
    [SerializeField] HeroShowBaseCell addHeroShow;
    [SerializeField] GiftBaseCell[] addGiftCells;
    [SerializeField] Image onTeamImg;
    [SerializeField] Toggle selectToggle;
    public void Display(int index)
    {
@@ -18,6 +19,9 @@
        HeroUIManager.Instance.RefreshGiftCell(addGiftCells, hero);
        onTeamImg.SetActive(hero.IsInAnyTeam());
        int girdIndex = hero.itemHero.gridIndex;
        selectToggle.isOn = HeroUIManager.Instance.selectEatHeroIndexList.Contains(girdIndex);
    }
    void AddHero(int index)
@@ -69,7 +73,8 @@
            return;
        }
        int maxStarCnt = HeroUIManager.Instance.GetMaxStarCount(hero.heroId, hero.Quality);
        int girdIndex = hero.itemHero.gridIndex;
        if (hero.heroStar > 0)
        {
            ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"),
@@ -77,16 +82,41 @@
                {
                    if (isOK)
                    {
                        HeroUIManager.Instance.selectEatHeroGuid = HeroUIManager.Instance.heroEatList[index];
                        UIManager.Instance.CloseWindow<HeroGiftRoleListWin>();
                        SelectHero(girdIndex, maxStarCnt);
                    }
                });
            return;
        }
        HeroUIManager.Instance.selectEatHeroGuid = HeroUIManager.Instance.heroEatList[index];
        UIManager.Instance.CloseWindow<HeroGiftRoleListWin>();
        SelectHero(girdIndex, maxStarCnt);
    }
    void SelectHero(int girdIndex, int maxStarCnt)
    {
        if (!selectToggle.isOn)
        {
            if (HeroUIManager.Instance.selectEatHeroIndexList.Count >= maxStarCnt)
            {
                SysNotifyMgr.Instance.ShowTip("HeroGiftEat1");
                return;
            }
            if (!HeroUIManager.Instance.selectEatHeroIndexList.Contains(girdIndex))
            {
                HeroUIManager.Instance.selectEatHeroIndexList.Add(girdIndex);
                selectToggle.isOn = true;
            }
        }
        else
        {
            if (HeroUIManager.Instance.selectEatHeroIndexList.Contains(girdIndex))
            {
                HeroUIManager.Instance.selectEatHeroIndexList.Remove(girdIndex);
                selectToggle.isOn = false;
            }
        }
    }
}
Main/System/HeroUI/HeroGiftRoleListWin.cs
@@ -11,8 +11,19 @@
    [SerializeField] ScrollerController scroller;
    [SerializeField] GameObject emptyGo;
    [SerializeField] Button cancelBtn;
    [SerializeField] Button okBtn;
    protected override void InitComponent()
    {
        cancelBtn.AddListener(()=>
        {
            HeroUIManager.Instance.selectEatHeroIndexList.Clear();
            CloseWindow();
        });
        okBtn.AddListener(CloseWindow);
    }
    protected override void OnPreOpen()
    {
Main/System/HeroUI/HeroUIManager.Talent.cs
@@ -20,23 +20,15 @@
    public string selectHeroGuidForGiftFunc;//武将主体GUID
    public int eatBeforeStar = 0;
    public int eatHeroIDForResult; //等待吞噬结果武将ID 为了弹成功界面使用
    public string selectHeroGuidForGiftFuncForSuccessWin;   //等待服务器返回的武将GUID 显示成功界面内容
    public List<int> heroBeforeGiftIDList = new List<int>();    //会有重复的ID,不要用字典
    public List<int> heroBeforeGiftLevelList = new List<int>();
    public event Action SelectEatHeroEvent;
    string m_SelectEatHeroGuid; //被吞噬武将GUID
    public string selectEatHeroGuid
    {
        get { return m_SelectEatHeroGuid; }
        set
        {
            m_SelectEatHeroGuid = value;
            SelectEatHeroEvent?.Invoke();
        }
    }
    public List<int> selectEatHeroIndexList = new List<int>(); //被选中的吞噬武将背包索引列表
    #region 洗炼
    public string selectWashHeroGUID; //被洗练武将GUID
@@ -45,7 +37,7 @@
    #endregion
    public List<string> heroEatList = new List<string>();
    void ParseGiftConfig()
    {
Main/System/HeroUI/HeroUIManager.cs
@@ -149,7 +149,17 @@
        }
        else if (waitResponse.type == HeroFuncType.Gift)
        {
            UIManager.Instance.OpenWindow<HeroGiftEatSuccessWin>();
            // 客户端自己做的批量吞噬需等待多个吞噬结果,这里需要return
            if (!UIManager.Instance.IsOpened<HeroGiftEatSuccessWin>())
            {
                UIManager.Instance.OpenWindow<HeroGiftEatSuccessWin>();
            }
            else
            {
                var ui = UIManager.Instance.GetUI<HeroGiftEatSuccessWin>();
                ui.Display();
            }
            return;
        }
        else if (waitResponse.type == HeroFuncType.Awake)
        {