Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
 void CbOnBoosterAdFinished(bool isFinished, object cutomData)
 {
     if (!isFinished)
     {
         return;
     }
     Management.Hospital.BoosterType boosterType = (Management.Hospital.BoosterType)cutomData;
     uiHolder.StateController.GameManager.ScheduleBooster(boosterType);
     InstantiateBoostTimerUI(boosterType);
 }
Ejemplo n.º 4
0
        public void UpdateContent(Management.Hospital.BoosterType _boosterType)
        {
            boosterType = _boosterType;
            Management.Hospital.Scriptable.PopupBoosterContainer.BoosterPopupContent content = popupBoosterContainer.GetPopupContent(boosterType);

            txtTitle.text   = content.title;
            txtMessage.text = content.message;
            imgIcon.sprite  = content.icon;
            imgIcon.rectTransform.rect.Set(imgIcon.rectTransform.rect.x, imgIcon.rectTransform.rect.y, content.icon.rect.width, content.icon.rect.height);

            txtSpeedUp.text = content.speedUpMessage;
        }
Ejemplo n.º 5
0
        void CbOnTimeBooster(Management.Hospital.BoosterType type, System.TimeSpan time)
        {
            if (type != boosterType)
            {
                return;
            }
            txtTimer.text = time.Minutes.ToString() + ":" + time.Seconds.ToString();

            if (time.TotalSeconds <= 0)
            {
                Destroy(gameObject);
            }
        }
Ejemplo n.º 6
0
 public void UpdateUI(Management.Hospital.BoosterType _boosterType)
 {
     boosterType       = _boosterType;
     imgBooster.sprite = boosterContainer.GetBoosterSpr(boosterType);
 }
Ejemplo n.º 7
0
 public Sprite GetBoosterSpr(Management.Hospital.BoosterType boosterType)
 {
     return(boosterContainerList.Find(obj => obj.boosterType == boosterType).boosterSpr);
 }
Ejemplo n.º 8
0
 public BoosterPopupContent GetPopupContent(Management.Hospital.BoosterType boosterType)
 {
     return(boosterPopupContentList.Find(obj => obj.boosterType == boosterType));
 }
Ejemplo n.º 9
0
        void InstantiateBoostTimerUI(Management.Hospital.BoosterType boosterType)
        {
            UiBoosterTimer uiBoosterTimer = Instantiate(uiBooterTimerPrefab, boosterTimerParentTrans);

            uiBoosterTimer.UpdateUI(boosterType);
        }