public AdStateItem GetStateItem(AdPlacementType type) { var item = AllAdStateItems.Where(y => y.AdType == type).SingleOrDefault(); if (item == null) { item = new AdStateItem(type); AllAdStateItems.Add(item); } return(item); }
public void RegisterAdWatch(AdPlacementType type, MetaDataStateBase playerState, Action getAdRewardForTypeMethod) { AdData adData = AdData.GetAdDataForPlacementType(type); AdStateItem adStateItem = GetStateItem(adData.PlacementType); if (adData != null && (adStateItem.UseCount < adData.DailyMaxUse || adData.DailyMaxUse == 0)) { adStateItem.UseCount++; if (getAdRewardForTypeMethod != null) { getAdRewardForTypeMethod.Invoke(); } playerState.TotalAdWatchedCount++; } }