| | |
| | | //<广告ID,今日已领取广告奖励次数> |
| | | private Dictionary<int, int> adsInfoDict = new Dictionary<int, int>(); |
| | | public event Action<int, int, int> OnAdsInfoListUpdateEvent;//ADID type value |
| | | public Dictionary<int, Redpoint> redPointDict = new Dictionary<int, Redpoint>(); |
| | | public override void Init() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin += OnBeforePlayerDataInitializeEvent; |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += UpdateRedpoint; |
| | | |
| | | var keys = ADAwardConfig.GetKeys(); |
| | | for (int i = 0; i < keys.Count; i++) |
| | | { |
| | | var config = ADAwardConfig.Get(keys[i]); |
| | | if (config.RedpointID == 0) |
| | | { |
| | | continue; |
| | | } |
| | | redPointDict[keys[i]] = new Redpoint(config.ParentRedpointID, config.RedpointID); |
| | | } |
| | | } |
| | | |
| | | public override void Release() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEventOnRelogin -= OnBeforePlayerDataInitializeEvent; |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= UpdateRedpoint; |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitializeEvent() |
| | |
| | | var value = aDAwardConfig.ADAwardValue; |
| | | var type = aDAwardConfig.ADAwardType; |
| | | OnAdsInfoListUpdateEvent?.Invoke(item.ADID, type, value); |
| | | |
| | | UpdateRedpoint(); |
| | | |
| | | } |
| | | } |
| | | |
| | | void UpdateRedpoint() |
| | | { |
| | | foreach (var key in redPointDict.Keys) |
| | | { |
| | | redPointDict[key].state = RedPointState.None; |
| | | |
| | | var config = ADAwardConfig.Get(key); |
| | | if (!FuncOpen.Instance.IsFuncOpen(config.FuncID)) |
| | | { |
| | | continue; |
| | | } |
| | | if (GetADCntByADID(key) < config.ADCntMax) |
| | | { |
| | | redPointDict[key].state = RedPointState.Simple; |
| | | } |
| | | } |
| | | } |
| | | } |