少年修仙传客户端代码仓库
hch
5 天以前 600733c8f592cb9e65f2b7a3e110ac1d686e6bfe
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
using vnxbqy.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
//玩家各奖励类型领取记录信息
class FuncAwardModel : ILModel<FuncAwardModel>
{
 
    public event Action<int> onReceived; //领取状态变更回调
    public Dictionary<int, int> rewardState = new Dictionary<int, int>();
 
    public int isFuncPreNoticeOpen = 0;
 
    protected override void Init()
    {
        GameEvent.playerLoginOkEvent += OnPlayerLoginOk;
        isFuncPreNoticeOpen = int.Parse(FuncConfigConfig.Get("GameNoticeReward").Numerical3);
    }
 
    protected override void UnInit()
    {
        GameEvent.playerLoginOkEvent -= OnPlayerLoginOk;
    }
 
    //此处应改成公用
    public void UpdateAwardState(HA30C_tagMCPlayerRewardGetRecord data)
    {
        rewardState[data.RewardType] = (int)data.RewardGetRecord;
        onReceived?.Invoke(data.RewardType);
        UpdateRedPoint();
        HeroControler.Instance.FuncPush(203);
    }
 
 
    public Redpoint redpointWFQZ = new Redpoint(MainRedPoint.wfqzRedPoint);
 
    void UpdateRedPoint()
    {
        redpointWFQZ.state = RedPointState.None;
        if (TryGetAwardState(48) == 0)
        {
            redpointWFQZ.state = RedPointState.Simple;
        }
    }
 
    public void OnPlayerLoginOk()
    {
        UpdateRedPoint();
    }
 
    // -1 代表不存在
    public int TryGetAwardState(int awardType)
    {
        if (isFuncPreNoticeOpen == 0)
            return -1;
 
        if (!rewardState.ContainsKey(awardType))
            return 0;
 
        return rewardState[awardType];
    }
}