| | |
| | | { |
| | | //<广告ID,今日已领取广告奖励次数> |
| | | private Dictionary<int, int> adsInfoDict = new Dictionary<int, int>(); |
| | | public event Action<int, int> OnAdsInfoListUpdateEvent;//ADID ADMapID |
| | | public event Action<int, int, int> OnAdsInfoListUpdateEvent;//ADID type value |
| | | public override void Init() |
| | | { |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitializeEvent; |
| | |
| | | adsInfoDict.Clear(); |
| | | } |
| | | |
| | | public void SendGetReward(int ADID) |
| | | void SendGetReward(int ADID) |
| | | { |
| | | var pack = new CA504_tagCMPlayerGetReward(); |
| | | pack.RewardType = 81; // 广告奖励 81 |
| | |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | //如果有广告SDK接入,该函数改成回调触发 |
| | | public void PlayAds(int ADID) |
| | | { |
| | | switch (ADID) |
| | |
| | | BoneFieldManager.Instance.SendBBeginFBWipeOut(BoneFieldManager.Instance.DataMapID, (int)fbInfo1.PassLineID); |
| | | break; |
| | | case 2: |
| | | |
| | | |
| | | if (!DungeonManager.Instance.TryGetFBInfoByMapID(TianziBillboradManager.Instance.DataMapID, out var fbInfo2)) |
| | | return; |
| | | SendGetReward(ADID); |
| | | BoneFieldManager.Instance.SendBBeginFBWipeOut(TianziBillboradManager.Instance.DataMapID, (int)fbInfo2.PassLineID); |
| | | break; |
| | | case 3: |
| | | case 4: |
| | | SendGetReward(ADID); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //已获取广告奖励次数 |
| | | public int GetADCntByADID(int ADID) |
| | | { |
| | | if (adsInfoDict.IsNullOrEmpty() || !adsInfoDict.ContainsKey(ADID)) |
| | |
| | | { |
| | | adsInfoDict[item.ADID] = item.ADCnt; |
| | | |
| | | int mapID = 0; |
| | | if (ADAwardConfig.HasKey(item.ADID)) |
| | | if (!ADAwardConfig.HasKey(item.ADID)) |
| | | { |
| | | ADAwardConfig aDAwardConfig = ADAwardConfig.Get(item.ADID); |
| | | mapID = aDAwardConfig.ADMapID; |
| | | continue; |
| | | } |
| | | OnAdsInfoListUpdateEvent?.Invoke(item.ADID, mapID); |
| | | ADAwardConfig aDAwardConfig = ADAwardConfig.Get(item.ADID); |
| | | var value = aDAwardConfig.ADAwardValue; |
| | | var type = aDAwardConfig.ADAwardType; |
| | | OnAdsInfoListUpdateEvent?.Invoke(item.ADID, type, value); |
| | | } |
| | | } |
| | | } |