yyl
2 天以前 973edc44a04dceb8b48a32ca912e6167f86189d4
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
using System;
using System.Collections;
using System.Collections.Generic;
 
using UnityEngine;
 
public partial class HeroUIManager : GameSystemManager<HeroUIManager>
{
 
    #region 图鉴和皮肤
 
    //图鉴和皮肤的激活情况
    public Dictionary<int, HB122_tagSCHeroInfo.tagSCHero> heroCollectInfoDic { get; private set; } = new Dictionary<int, HB122_tagSCHeroInfo.tagSCHero>();
 
    public int bookPer;
    public event Action OnHeroCollectEvent;
 
    public void UpdateHeroCollectInfo(HB122_tagSCHeroInfo netPack)
    {
        for (int i = 0; i < netPack.HeroCnt; i++)
        {
            heroCollectInfoDic[(int)netPack.HeroInfoList[i].HeroID] = netPack.HeroInfoList[i];
        }
        bookPer = GetHeroCollectBookPer();
        OnHeroCollectEvent?.Invoke();
    }
 
 
    public int GetHeroCollectBookPer()
    {
        int per = 0;
        foreach (var kv in heroCollectInfoDic)
        {
            var config = HeroQualityConfig.Get(HeroConfig.Get(kv.Key).Quality);
            if (kv.Value.BookInitState != 2)
                continue;
            per += config.BookInitAddPer;
            per += kv.Value.BookStarLV * config.BookStarAddPer;
            per += kv.Value.BookBreakLV * config.BookBreakLVAddPer;
        }
        return per;
    }
 
    public HB122_tagSCHeroInfo.tagSCHero GetHeroBookInfo(int heroID)
    { 
        if (heroCollectInfoDic.ContainsKey(heroID))
        {
            return heroCollectInfoDic[heroID];
        }
        return null;
    }
 
    #endregion
}