public void GetReward(string surfacingId, ShowResult showResult, System.Func <AdsData> callAdsData) { switch (showResult) { case ShowResult.Finished: Debug.Log($"Get Reward"); GetReward(); break; case ShowResult.Skipped: Debug.Log($"Skip Reward"); GetReward(); break; case ShowResult.Failed: Debug.LogWarning("The ad did not finish due to an error."); break; default: break; } void GetReward() { AdsDetail _adsDetai = callAdsData.Invoke().SetAdsDetail(surfacingId); Debug.Log($"_currencyDetail: {_adsDetai.currencyReward.eCurrency} --- {_adsDetai.currencyReward.unit} --- {AdsController.presentEAdsReward}"); AdsController.callBackPresentAdsBtn?.Invoke(_adsDetai); } }
void AdsFinish(AdsDetail adsDetail) { if (adsDetail.isGotten) { adsButton.SetButtonReady(!adsDetail.isGotten); } SetCountGetReward($"{adsDetail.presentCount}/{adsDetail.maxCount}"); }
public AdsDetail SetAdsDetail(AdsDetail adsDetail, EAdsReward eAdsReward) { if (eAdsReward.Equals(EAdsReward.NonConsumable)) { adsDetail.isGotten = true; } else if (eAdsReward.Equals(EAdsReward.Consumable)) { if (!adsDetail.isGotten) { adsDetail.isGotten = ++adsDetail.presentCount > adsDetail.maxCount; } } if (Currency.CurrencyController.instance) { Currency.CurrencyController.instance.SetCurrency(adsDetail.currencyReward.eCurrency, adsDetail.currencyReward.unit); } return(adsDetail); }
public AdsDetail SetAdsDetail(string id) { AdsDetail _adsDetai = adsDetails.Where(item => item.id.Equals(id)).First(); if (_adsDetai.eAdsReward.Equals(EAdsReward.NonConsumable)) { _adsDetai.isGotten = true; } else if (_adsDetai.eAdsReward.Equals(EAdsReward.Consumable)) { if (!_adsDetai.isGotten) { _adsDetai.isGotten = ++_adsDetai.presentCount >= _adsDetai.maxCount; } } if (Currency.CurrencyController.instance) { Currency.CurrencyController.instance.SetCurrency(_adsDetai.currencyReward.eCurrency, _adsDetai.currencyReward.unit); } return(_adsDetai); }