void CbOnAddBooster(Management.Hospital.BoosterType boosterType) { if (uiBoostersList == null) { uiBoostersList = new List <UiBooster>(); } // Don't add booster if its already running // Or the booster Notification is not already added if (!UiHolder.StateController.GameManager.CanAddBooster(boosterType) || uiBoostersList.Count(obj => obj.BoosterType == boosterType) >= 1) { return; } if (!Management.Services.AdvertisementManager.Instance.IsRewardedAdAvailable()) { if (!Management.Services.AdvertisementManager.Instance.CheckIfCanLoadRewardedAds()) { return; } } UiBooster booster = Instantiate(uiBoosterPrefab, boosterParentTrans); booster.UpdateBooster(boosterType, CbOnBoosterCallbackClicked); uiBoostersList.Add(booster); }
void PopupCallbackTimeBooster(int result, object data) { Management.Hospital.BoosterType boosterType = (Management.Hospital.BoosterType)data; popupTimeBoosterInstance.Close(); UiBooster uiBooster = uiBoostersList.Find(obj => obj.BoosterType == boosterType); uiBoostersList.Remove(uiBooster); uiBooster.Remove(); switch (result) { case 0: break; case 1: UiHolder.ignoreTouchWhenNotificationClicked = true; if (Management.Services.AdvertisementManager.Instance.IsRewardedAdAvailable()) { Management.Services.AdvertisementManager.Instance.ShowRewardedVideoAds(boosterType, CbOnBoosterAdFinished); } else { uiHolder.ShowInternetConnectionErrorPopup(); } StartCoroutine(ResetIgnoreTouch()); break; } }
private void CbOnBoosterCallbackClicked(UiBooster uiBooster) { PopupTimeBooster popupTimeBoosterPrefab = (PopupTimeBooster)UiHolder.PopupContainer.GetPopupPrefab(PopupType.TIME_BOOSTER); popupTimeBoosterInstance = Instantiate(popupTimeBoosterPrefab); popupTimeBoosterInstance.Initilize(UiHolder, PopupCallbackTimeBooster); popupTimeBoosterInstance.UpdateContent(uiBooster.BoosterType); }