hch
2025-09-04 a11398257b98ae3cf977e22700c98735afec96ef
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
using System;
using System.Collections;
using System.Collections.Generic;
using LitJson;
 
using UnityEngine;
 
//天赋
public partial class HeroUIManager : GameSystemManager<HeroUIManager>
{
    public int normalGiftMaxCnt = 4;  //初始天赋格子数
    public const int giftMaxCnt = 8;    //关联界面排版问题,暂时写死,通过觉醒可以增加上限
    public int maxGiftLevel;    //单天赋最高等级,其他功能可能会增加这个上限
    public int starLevelCanAwake;   //x星可以觉醒
 
    public int washItemID;
    public int[] washByLockUseCounts;
    public int canWashStarLevel;   //达到X星可以洗练
 
    public string selectHeroGuidForGiftFunc;
 
    void ParseGiftConfig()
    {
        var config = FuncConfigConfig.Get("HeroStarTalent");
        normalGiftMaxCnt = int.Parse(config.Numerical1);
        maxGiftLevel = int.Parse(config.Numerical2);
        starLevelCanAwake = int.Parse(config.Numerical4);
 
        config = FuncConfigConfig.Get("HeroWash");
        washItemID = int.Parse(config.Numerical1);
        washByLockUseCounts = JsonMapper.ToObject<int[]>(config.Numerical2);
        canWashStarLevel = int.Parse(config.Numerical3);
    }
 
 
    //根据天赋锁状态获取消耗的材料数量
    public int GetTalentLockUseWashCount(HeroInfo hero)
    {
        return washByLockUseCounts[hero.GetTalentLockCount()];
    }
 
 
    //天赋格子总数上限 
    public int GetGiftGirdMaxCount(int heroID)
    {
        //没有觉醒配置的 为默认4,否则8
        if (HeroAwakeConfig.GetHeroAwakeConfig(heroID, 1) == null)
        {
            return Instance.normalGiftMaxCnt;
        }
        return giftMaxCnt;
    }
 
 
 
    //星上限由品质 和 觉醒决定
    public int GetMaxStarCount(int heroID, int quality)
    {
        if (HeroAwakeConfig.GetHeroAwakeConfig(heroID, 1) == null)
        {
            return HeroQualityConfig.Get(quality).InitStarUpper;
 
        }
 
        //根据觉醒累计提升星上限
        int addStarCount = 0;
        for (int i = 1; i <= HeroAwakeConfig.GetMaxAwakeLV(heroID); i++)
        {
            addStarCount += HeroAwakeConfig.GetHeroAwakeConfig(heroID, i).AddStarUpper;
        }
        return HeroQualityConfig.Get(quality).InitStarUpper + addStarCount;
    }
    
 
    public void RefreshGiftCell(GiftBaseCell[] giftBaseCells, HeroInfo hero)
    {
        int showCount = GetGiftGirdMaxCount(hero.heroId);
        for (int i = 0; i < giftBaseCells.Length; i++)
        {
            if (i >= showCount)
            {
                giftBaseCells[i].SetActive(false);
                continue;
            }
 
            giftBaseCells[i].SetActive(true);
            if (i < hero.talentIDList.Count)
            {
                int giftID = hero.talentIDList[i];
                int giftLV = hero.talentLvList[i];
                giftBaseCells[i].Init(giftID, giftLV);
            }
            else
            {
                if (i < normalGiftMaxCnt)
                {
                    giftBaseCells[i].Init(0, 0);
                }
                else
                {
                    int index = i;
                    giftBaseCells[i].Init(-1, 0, null, hero.heroId, index);
                }
            }
 
        }
    }
 
}