hch
3 分钟以前 c7b602ebaff6e0c61410440e96f8aeca2571b8d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
using System.Collections.Generic;
using System.Linq;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
 
public class OtherHeroDetailWin : UIBase
{
    [SerializeField] ImageEx bgImage;
    [SerializeField] ImageEx iconImage;
    [SerializeField] SkillBaseCell normalSkillCell;
    [SerializeField] SkillBaseCell angerSkillCell;
    [SerializeField] HeroShowBaseCell heroShow;
    [SerializeField] ButtonEx btnTotalAttr;
    [SerializeField] TextEx[] attrs;
    [SerializeField] GiftBaseCell[] giftBaseCells;    //天赋
    [SerializeField] ScrollRect allAttrScroll;      //培养属性 滚动区 
    [SerializeField] GameObject fetterGo;
    [SerializeField] Text[] fetterText;   //羁绊
    [SerializeField] Text[] fetterNameText;   //羁绊
    [SerializeField] Color32 nameCol;
    [SerializeField] Color32 descCol;
    [SerializeField] Color32 grayCol;
 
    [SerializeField] GameObject potential;
    [SerializeField] GameObject potentialCell; //潜能和觉醒用于创建
    [SerializeField] Transform potentialCellParent; //潜能父节点
    [SerializeField] Transform awakeCellParent; //潜能父节点
    [SerializeField] GameObject awakeGo;
    Dictionary<int, long> attrDict;
    OtherPlayerDetailManager manager { get { return OtherPlayerDetailManager.Instance; } }
    protected override void InitComponent()
    {
        awakeCellList = new List<GameObject>();
        potentialCellList = new List<GameObject>();
        btnTotalAttr.SetListener(() =>
        {
            AttributeManager.Instance.OpenTotalAttributeWin(attrDict == null ? new Dictionary<int, long>() : attrDict);
        });
    }
 
    protected override void OnPreOpen()
    {
        // 重置所有滚动区到顶部
        if (allAttrScroll != null)
            allAttrScroll.verticalNormalizedPosition = 1f;
        Display();
    }
 
    protected override void OnPreClose()
    {
    }
 
    private bool TryGetHeroInfo(BattleClickHeroData data, out HeroInfo heroInfo)
    {
        heroInfo = null;
        if (!HeroManager.Instance.HasHero(data.heroID))
            return false;
        heroInfo = HeroManager.Instance.GetHeroByID(data.heroID);
        return true;
    }
 
 
    private void Display()
    {
        attrDict = null;
        ViewHeroDetailData viewData = manager.viewHeroDetailData;
        if (viewData == null)
            return;
        switch (viewData.viewHeroType)
        {
            case 0:
                BattleClickHeroData data = manager.viewHeroDetailData.clickHeroData;
                bgImage.SetSprite(data.isMySide ? "OtherHeroDetailBGBlue" : "OtherHeroDetailBGRed");
                iconImage.SetSprite(data.isMySide ? "OtherHeroDetailIconBlue" : "OtherHeroDetailIconRed");
                if (data.isMySide)
                {
                    if (!TryGetHeroInfo(data, out HeroInfo heroInfo))
                    {
                        SysNotifyMgr.Instance.ShowTip("NoHeroFromBag");
                        DelayCloseWindow().Forget();
                        return;
                    }
                    heroInfo.CalculateFightPower();
 
                    if (data.battleName == BattleConst.WarlordPavilionBattleField)
                    {
                        FightPowerManager.Instance.djgAttrs = WarlordPavilionManager.Instance.GetAllAttrBonus();
                        attrDict = FightPowerManager.Instance.GetHeroTotalAttr(heroInfo);
                        FightPowerManager.Instance.djgAttrs.Clear();
                        DisplayByMyPack(heroInfo, data);
                    }
                    else
                    {
                        attrDict = FightPowerManager.Instance.GetHeroTotalAttr(heroInfo);
                        DisplayByMyPack(heroInfo, data);
                    }
 
                }
                else
                {
                    if (BattleManager.Instance.IsPvpBattle(data.battleName))
                    {
                        attrDict = viewData.heroData?.AttrDict;
                        DiplayByViewOtherPlayer(viewData.heroData, viewData.heroDatas);
                    }
                    else
                    {
                        attrDict = viewData.viewNPCAttr?.AttrDict;
                        DisplayByViewNPCAttr(viewData.viewNPCAttr);
                    }
 
                }
                break;
            case 1:
            default:
                bgImage.SetSprite("OtherHeroDetailBGRed");
                iconImage.SetSprite("OtherHeroDetailIconRed");
                attrDict = viewData.heroData?.AttrDict;
                DiplayByViewOtherPlayer(viewData.heroData, viewData.heroDatas);
                break;
        }
    }
 
    void DisplayByMyPack(HeroInfo heroInfo, BattleClickHeroData data)
    {
        if (heroInfo == null)
            return;
        HeroConfig heroConfig = heroInfo?.heroConfig;
        if (heroConfig == null || data.teams == null || !data.isMySide)
            return;
 
        int heroID = heroConfig.HeroID;
        int skinID = heroConfig?.SkinIDList[0] ?? 0;
        int lv = heroInfo.heroLevel;
        int star = heroInfo.heroStar;
        int quality = heroConfig.Quality;
        int breakLevel = heroInfo.breakLevel;
        int awakeLevel = heroInfo.awakeLevel;
        int atkSkillID = heroConfig.AtkSkillID;
        int angerSkillID = heroConfig.AngerSkillID;
        List<int> talentIDList = heroInfo.talentIDList;
        List<int> talentLvList = heroInfo.talentLvList;
        int[] FetterIDList = heroConfig.FetterIDList;
 
        DisplaySkill(heroID, atkSkillID, angerSkillID);
        DisplayHeroShow(heroID, skinID, breakLevel, star, awakeLevel, lv);
        DisplayAttr(attrDict);
        DisplayGiftBaseCell(heroID, awakeLevel, talentIDList, talentLvList);
        DisplayFetter(data.teams, FetterIDList);
        DisplayPotential(heroID, breakLevel);
        RefreshAwake(heroID, quality, awakeLevel);
 
        ForceRefreshLayout();
 
    }
 
    void DisplayByViewNPCAttr(ViewNPCAttr viewNPCAttr)
    {
        if (viewNPCAttr == null)
            return;
 
        int heroID = (int)viewNPCAttr.HeroID;
        if (!HeroConfig.HasKey(heroID))
            return;
 
        HeroConfig heroConfig = HeroConfig.Get(heroID);
        int skinID = heroConfig?.SkinIDList[0] ?? 0;
        int lv = viewNPCAttr.LV;
        int star = viewNPCAttr.Star;
        int quality = heroConfig.Quality;
        int breakLevel = viewNPCAttr.BreakLV;
        int awakeLevel = viewNPCAttr.AwakeLV;
        int atkSkillID = heroConfig.AtkSkillID;
        int angerSkillID = heroConfig.AngerSkillID;
        List<int> talentIDList = null;
        List<int> talentLvList = null;
        int[] FetterIDList = heroConfig.FetterIDList;
 
        DisplaySkill(heroID, atkSkillID, angerSkillID);
        DisplayHeroShow(heroID, skinID, breakLevel, star, awakeLevel, lv);
        DisplayAttr(attrDict);
        DisplayGiftBaseCell(heroID, awakeLevel, talentIDList, talentLvList);
        DisplayFetter(teams: null, FetterIDList);
        DisplayPotential(heroID, breakLevel);
        RefreshAwake(heroID, quality, awakeLevel);
        ForceRefreshLayout();
    }
 
    void DiplayByViewOtherPlayer(OtherPlayerDetailManager.RolePlusData.HeroData heroData,
    List<OtherPlayerDetailManager.RolePlusData.HeroData> heroDatas)
    {
        if (heroDatas.IsNullOrEmpty() || heroData == null)
            return;
 
        int heroID = heroData.HeroID;
        if (!HeroConfig.HasKey(heroID))
            return;
 
        HeroConfig heroConfig = HeroConfig.Get(heroID);
 
        int skinID = heroData.SkinID;
        int lv = heroData.LV;
        int star = heroData.Star;
        int quality = heroConfig.Quality;
        int breakLevel = manager.GetBreakLevel(heroData);
        int awakeLevel = manager.GetAwakeLevel(heroData);
        int atkSkillID = heroConfig.AtkSkillID;
        int angerSkillID = heroConfig.AngerSkillID;
        List<int> talentIDList = manager.GetTalentIDList(heroData);
        List<int> talentLvList = manager.GetTalentLvList(heroData);
        int[] FetterIDList = heroConfig.FetterIDList;
 
        DisplaySkill(heroID, atkSkillID, angerSkillID);
        DisplayHeroShow(heroID, skinID, breakLevel, star, awakeLevel, lv);
        DisplayAttr(attrDict);
        DisplayGiftBaseCell(heroID, awakeLevel, talentIDList, talentLvList);
        DisplayFetter(heroDatas, FetterIDList);
        DisplayPotential(heroID, breakLevel);
        RefreshAwake(heroID, quality, awakeLevel);
 
        ForceRefreshLayout();
    }
 
 
    List<GameObject> awakeCellList;   //觉醒
    void RefreshAwake(int heroID, int quality, int awakeLevel)
    {
 
        if (!HeroAwakeConfig.CanAwake(heroID, 1))
        {
            awakeGo.SetActive(false);
            return;
        }
        awakeGo.SetActive(true);
 
        var maxLV = HeroAwakeConfig.GetMaxAwakeLV(heroID);
        var starCnt = HeroQualityConfig.Get(quality).InitStarUpper;
        for (int i = 1; i <= maxLV; i++)
        {
            if (i > awakeCellList.Count)
            {
                awakeCellList.Add(Instantiate(potentialCell, awakeCellParent));
            }
            var go = awakeCellList[i - 1];
            var descText = go.GetComponent<Text>();
            var nameText = go.GetComponent<Text>("skillname");
            go.SetActive(true);
 
            var config = HeroAwakeConfig.GetHeroAwakeConfig(heroID, i);
 
            int type = config.UnlockTalentSlot != 0 ? 1 : config.SkillID != 0 ? 2 : 3;
            var awakeStr = string.Empty;
            if (type == 1)
            {
                starCnt += config.AddStarUpper;
                awakeStr = Language.Get("HeroAwake8", config.UnlockTalentSlot, starCnt);
            }
            else if (type == 2)
            {
                var skill = SkillConfig.Get(config.SkillID);
                if (skill != null)
                {
                    awakeStr = Language.Get("L1039", skill.SkillName) + skill.Description;
                }
                else
                {
                    Debug.LogError($"heroId:{heroID} 觉醒技能ID:{config.SkillID} 配置错误技能不存在");
                }
            }
            else
            {
                for (int k = 0; k < config.AttrIDList.Length; k++)
                {
                    awakeStr += (string.IsNullOrEmpty(config.SkillIName) ? string.Empty : Language.Get("L1039", config.SkillIName)) +
                    PlayerPropertyConfig.GetFullDescription(config.AttrIDList[k], config.AttrValueList[k], "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}"))
                    + (k == config.AttrIDList.Length - 1 ? "" : "\n");
                }
            }
 
            if (i - 1 < awakeLevel)
            {
                nameText.text = Language.Get("herocard12", i) + Language.Get("L1096");
                descText.text = awakeStr;
            }
            else
            {
                //置灰
                nameText.text = UIHelper.AppendColor(TextColType.NavyGray, Language.Get("herocard12", i) + Language.Get("L1096"));
                descText.text = UIHelper.AppendColor(TextColType.NavyGray, UIHelper.RemoveColor(awakeStr));
            }
        }
    }
 
    List<GameObject> potentialCellList;   //潜能
    void DisplayPotential(int heroID, int breakLevel)
    {
        if (!HeroBreakConfig.configDics.ContainsKey(heroID))
        {
            potential.SetActive(false);
            return;
        }
        potential.SetActive(true);
 
        var list = HeroBreakConfig.configDics[heroID].Keys.ToList();
 
        list.Sort();
 
        for (int i = 0; i < list.Count; i++)
        {
            var nextQualityBreakConfig = HeroBreakConfig.GetHeroBreakConfig(heroID, i + 1);
            if (nextQualityBreakConfig == null)
                break;
            List<string> attrStrArr = new List<string>();
            for (int j = 0; j < nextQualityBreakConfig.AttrIDList.Length; j++)
            {
                if (nextQualityBreakConfig.AttrIDList[j] == 0)
                    continue;
                string format = i < breakLevel ? "{0}" + UIHelper.AppendColor(TextColType.Green, "+{1}") : "{0}+{1}";
                attrStrArr.Add((string.IsNullOrEmpty(nextQualityBreakConfig.SkillIName) ? string.Empty : Language.Get("L1039", nextQualityBreakConfig.SkillIName)) +
                PlayerPropertyConfig.GetFullDescription(nextQualityBreakConfig.AttrIDList[j], nextQualityBreakConfig.AttrValueList[j], format));
            }
 
            if (nextQualityBreakConfig.SkillID != 0)
            {
                var skill = SkillConfig.Get(nextQualityBreakConfig.SkillID);
                if (skill != null)
                {
                    attrStrArr.Add(Language.Get("L1039", skill.SkillName) + skill.Description);
                }
                else
                {
                    Debug.LogError("未配置技能" + nextQualityBreakConfig.SkillID);
                }
            }
            if (i >= potentialCellList.Count)
            {
                potentialCellList.Add(Instantiate(potentialCell, potentialCellParent));
            }
            var go = potentialCellList[i];
            var descText = go.GetComponent<Text>();
            var nameText = go.GetComponent<Text>("skillname");
            go.SetActive(true);
            if (i < breakLevel)
            {
                nameText.text = Language.Get("herocard63", i + 1);
                descText.text = string.Join("\n", attrStrArr);
            }
            else
            {
                //置灰
                nameText.text = UIHelper.AppendColor(TextColType.NavyGray, Language.Get("herocard63", i + 1));
                descText.text = UIHelper.AppendColor(TextColType.NavyGray, UIHelper.RemoveColor(string.Join("\n", attrStrArr)));
            }
        }
    }
    private void DisplayAttr(Dictionary<int, long> attrDict)
    {
        if (attrDict.IsNullOrEmpty())
            return;
        var baseAttrIDList = PlayerPropertyConfig.playerPropertyDict[PlayerPropertyConfig.baseType];
        var fightAttrIDList = PlayerPropertyConfig.playerPropertyDict[PlayerPropertyConfig.fightType];
        var antiAttrIDList = PlayerPropertyConfig.playerPropertyDict[PlayerPropertyConfig.fightAntiType];
        var totalAttrIDList = baseAttrIDList.Concat(fightAttrIDList).Concat(antiAttrIDList).ToList();
 
        for (int i = 0; i < attrs.Length; i++)
        {
            if (i < totalAttrIDList.Count)
            {
 
                attrs[i].SetActive(true);
                int attrId = totalAttrIDList[i];
                if (PlayerPropertyConfig.HasKey(attrId))
                {
                    PlayerPropertyConfig config = PlayerPropertyConfig.Get(attrId);
                    long attrValue = attrDict.ContainsKey(attrId) ? attrDict[attrId] : 0;
                    attrs[i].text = Language.Get("OtherPlayerDetail15", config.Name, PlayerPropertyConfig.GetValueDescription(attrId, attrValue));
                }
                else
                {
                    attrs[i].SetActive(false);
                }
 
            }
            else
            {
                attrs[i].SetActive(false);
            }
        }
    }
 
    private bool HasFetterHero(List<BattleObject> teams, int heroID)
    {
        if (teams.IsNullOrEmpty())
        {
            return false;
        }
        for (int i = 0; i < teams.Count; i++)
        {
            if (!(teams[i] is HeroBattleObject heroObj) || heroObj.teamHero == null)
            {
                continue;
            }
            if (heroObj.teamHero.heroId == heroID)
            {
                return true;
            }
        }
        return false;
    }
 
    private bool HasFetterHero(List<OtherPlayerDetailManager.RolePlusData.HeroData> heroDatas, int heroID)
    {
        if (heroDatas.IsNullOrEmpty())
        {
            return false;
        }
        for (int i = 0; i < heroDatas.Count; i++)
        {
            if (heroDatas[i].HeroID == heroID)
            {
                return true;
            }
        }
        return false;
    }
 
    private void DisplayFetter(List<BattleObject> teams, int[] FetterIDList)
    {
        if (FetterIDList.IsNullOrEmpty() || teams.IsNullOrEmpty())
        {
            fetterGo.SetActive(false);
            return;
        }
 
        for (int i = 0; i < fetterText.Length; i++)
        {
            if (i < FetterIDList.Length)
            {
                fetterText[i].SetActive(true);
                var fetterID = FetterIDList[i];
                HeroFetterConfig fetterConfig = HeroFetterConfig.Get(fetterID);
                List<string> heroNames = new List<string>();
                bool isAllCollect = true; //是否全收集
                foreach (var tmpHeroID in fetterConfig.HeroIDList)
                {
                    heroNames.Add(HeroConfig.Get(tmpHeroID).Name);
                    bool hasFetterHero = HasFetterHero(teams, tmpHeroID);
                    if (!hasFetterHero)
                    {
                        isAllCollect = false;
                    }
                }
                fetterGo.SetActive(isAllCollect);
                var attrStr = string.Join(Language.Get("SplitString1"), heroNames) + Language.Get("herocard38");
 
                for (int j = 0; j < fetterConfig.AttrIDList.Length; j++)
                {
                    string format = !isAllCollect ? "{0}+{1}" : "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}");
                    attrStr += Language.Get("L1112") + PlayerPropertyConfig.GetFullDescription(fetterConfig.AttrIDList[j], fetterConfig.AttrValueList[j], format);
                }
                fetterText[i].text = attrStr;
                fetterText[i].color = isAllCollect ? descCol : grayCol;
                fetterNameText[i].text = fetterConfig.FetterName;
                fetterNameText[i].color = isAllCollect ? nameCol : grayCol;
 
            }
            else
            {
                fetterText[i].SetActive(false);
            }
        }
    }
 
    private void DisplayFetter(List<OtherPlayerDetailManager.RolePlusData.HeroData> heroDatas, int[] FetterIDList)
    {
        if (FetterIDList.IsNullOrEmpty() || heroDatas.IsNullOrEmpty())
        {
            fetterGo.SetActive(false);
            return;
        }
 
        for (int i = 0; i < fetterText.Length; i++)
        {
            if (i < FetterIDList.Length)
            {
                fetterText[i].SetActive(true);
                var fetterID = FetterIDList[i];
                HeroFetterConfig fetterConfig = HeroFetterConfig.Get(fetterID);
                List<string> heroNames = new List<string>();
                bool isAllCollect = true; //是否全收集
                foreach (var tmpHeroID in fetterConfig.HeroIDList)
                {
                    heroNames.Add(HeroConfig.Get(tmpHeroID).Name);
                    bool hasFetterHero = HasFetterHero(heroDatas, tmpHeroID);
                    if (!hasFetterHero)
                    {
                        isAllCollect = false;
                    }
                }
                fetterGo.SetActive(isAllCollect);
                var attrStr = string.Join(Language.Get("SplitString1"), heroNames) + Language.Get("herocard38");
 
                for (int j = 0; j < fetterConfig.AttrIDList.Length; j++)
                {
                    string format = !isAllCollect ? "{0}+{1}" : "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}");
                    attrStr += Language.Get("L1112") + PlayerPropertyConfig.GetFullDescription(fetterConfig.AttrIDList[j], fetterConfig.AttrValueList[j], format);
                }
                fetterText[i].text = attrStr;
                fetterText[i].color = isAllCollect ? descCol : grayCol;
                fetterNameText[i].text = fetterConfig.FetterName;
                fetterNameText[i].color = isAllCollect ? nameCol : grayCol;
 
            }
            else
            {
                fetterText[i].SetActive(false);
            }
        }
    }
 
    private void DisplayGiftBaseCell(int heroID, int awakeLevel, List<int> talentIDList, List<int> talentLvList)
    {
        int showCount = HeroUIManager.Instance.GetGiftGirdMaxCount(heroID);
 
        if (talentIDList == null || talentLvList == null)
        {
            for (int i = 0; i < giftBaseCells.Length; i++)
            {
                if (i >= showCount)
                {
                    giftBaseCells[i].SetActive(false);
                    continue;
                }
 
                giftBaseCells[i].SetActive(true);
                //非对比的显示
                if (i < HeroUIManager.Instance.normalGiftMaxCnt)
                {
                    giftBaseCells[i].Init(0, 0);
                }
                else
                {
                    giftBaseCells[i].Init(-1, 0, 0, heroID, i);
                }
            }
            return;
        }
 
 
        for (int i = 0; i < giftBaseCells.Length; i++)
        {
            if (i >= showCount)
            {
                giftBaseCells[i].SetActive(false);
                continue;
            }
 
            giftBaseCells[i].SetActive(true);
            if (i < talentIDList.Count)
            {
                int giftID = talentIDList[i];
                int giftLV = talentLvList[i];
                int state = 0; //0:不显示 1:新增 2:提升
                giftBaseCells[i].Init(giftID, giftLV, state, heroID, i, awakeLevel);
            }
            else
            {
                //非对比的显示
                if (i < HeroUIManager.Instance.normalGiftMaxCnt)
                {
                    giftBaseCells[i].Init(0, 0);
                }
                else
                {
                    giftBaseCells[i].Init(-1, 0, 0, heroID, i);
                }
            }
 
        }
    }
    private void DisplayHeroShow(int heroID, int skinID, int breakLevel, int star, int awakeLevel, int lv)
    {
        heroShow.Init(heroID, skinID, breakLevel, star, awakeLevel, lv);
    }
 
    private void DisplaySkill(int heroID, int atkSkillID, int angerSkillID)
    {
        if (!HeroConfig.HasKey(heroID) || !SkillConfig.HasKey(atkSkillID) || !SkillConfig.HasKey(angerSkillID))
        {
            normalSkillCell.SetActive(false);
            angerSkillCell.SetActive(false);
            return;
        }
        normalSkillCell.SetActive(true);
        angerSkillCell.SetActive(true);
        normalSkillCell.Init(atkSkillID, () =>
        {
            UIManager.Instance.OpenWindow<HeroSkillWin>(heroID);
        }, true);
        angerSkillCell.Init(angerSkillID, () =>
        {
            UIManager.Instance.OpenWindow<HeroSkillWin>(heroID);
        }, true);
    }
    /// <summary>
    /// 强制刷新Layout,解决嵌套Layout和ContentSizeFitter的重叠问题
    /// </summary>
    async UniTask ForceRefreshLayout()
    {
        await UniTask.DelayFrame(2);
        // 刷新所有Layout组件
        var layouts = allAttrScroll.GetComponentsInChildren<LayoutGroup>(true);
        foreach (var layout in layouts)
        {
            LayoutRebuilder.ForceRebuildLayoutImmediate(layout.GetComponent<RectTransform>());
        }
        await UniTask.DelayFrame(2);
        // 刷新所有Layout组件
        foreach (var layout in layouts)
        {
            LayoutRebuilder.ForceRebuildLayoutImmediate(layout.GetComponent<RectTransform>());
        }
        // Layout刷新完成后重新设置滚动位置
        if (allAttrScroll != null)
            allAttrScroll.verticalNormalizedPosition = 1f;
    }
}