Exemplo n.º 1
0
 public override void Setup(ViewData data)
 {
     base.Setup(data);
     closeButton.SetListener(() => {
         Sounds.PlayOneShot(SoundName.click);
         ViewService.Remove(ViewType.X2ProfitView, BosUISettings.Instance.ViewCloseDelay);
     });
 }
Exemplo n.º 2
0
 private IEnumerator SellToInvestorsForAdImpl()
 {
     for (int i = 0; i < 4; i++)
     {
         yield return(new WaitForEndOfFrame());
     }
     Services.InvestorService.SellToInvestors(multiplier: 2);
     ViewService.Remove(ViewType.InvestorsView, BosUISettings.Instance.ViewCloseDelay);
 }
Exemplo n.º 3
0
        public override void Setup(ViewData data)
        {
            base.Setup(data);
            double cost = (double)data.UserData;

            costText.text = new CurrencyNumber(cost).AbbreviationColored("#FFFFFF", "#FFE565");
            backgroundTransform.MessageBoxAnimateIn();
            closeButton.SetListener(() => {
                Sounds.PlayOneShot(SoundName.click);
                closeButton.interactable = false;
                backgroundTransform.MessageBoxAnimateOut(() => ViewService.Remove(Type));
            });
        }
Exemplo n.º 4
0
        private IEnumerator SpawnCoinsImpl()
        {
            for (int i = 0; i < 6; i++)
            {
                GameObject instance = Instantiate <GameObject>(coinPrefab);
                instance.GetComponent <RectTransform>().SetParent(transform, false);
                instance.GetComponent <AccumulatedCoin>().StartMoving((go) => {
                    Sounds.PlayOneShot(SoundName.buyCoinUpgrade);
                    Destroy(go);
                });
                yield return(new WaitForSeconds(.15f));
            }
            yield return(new WaitForSeconds(0.7f));

            ViewService.Remove(ViewType.PromoInputView);
        }
Exemplo n.º 5
0
        private void Start()
        {
            Services.SoundService.PlayOneShot(SoundName.click);
            intallButton.SetListener(() => {
                Sounds.PlayOneShot(SoundName.click);
                Services.ZTHADService.OpenZthPage();
                intallButton.SetInteractable(false);
                ViewService.Remove(ViewType.ZTHAdView, BosUISettings.Instance.ViewCloseDelay);
            });

            closeButton.SetListener(() => {
                Sounds.PlayOneShot(SoundName.click);
                closeButton.SetInteractable(false);
                ViewService.Remove(ViewType.ZTHAdView, BosUISettings.Instance.ViewCloseDelay);
            });
            lowReward.text = ZTHADService.SmallReward.ToString();
            bigReward.text = ZTHADService.BigReward.ToString();
        }
Exemplo n.º 6
0
        public override void Start()
        {
            GetCoins.SetListener(() =>
            {
                Sounds.PlayOneShot(SoundName.click);
                GetCoins.SetInteractable(false);
                ViewService.Show(ViewType.BankView);
                ViewService.Remove(ViewType.BankNotify, BosUISettings.Instance.ViewCloseDelay);
            });

            closeButton.SetListener(() =>
            {
                Sounds.PlayOneShot(SoundName.click);
                closeButton.SetInteractable(false);
                ViewService.Remove(ViewType.BankNotify, BosUISettings.Instance.ViewCloseDelay);
            });

            CoinCount.text = Services.BankService.CoinsAccumulatedCount.ToString();
        }
Exemplo n.º 7
0
        public override void Setup(ViewData data)
        {
            base.Setup(data);
            BackToGameData backToGameData = data.UserData as BackToGameData;

            if (backToGameData == null)
            {
                throw new System.ArgumentException(nameof(data.UserData));
            }

            /*
             * string[] cashStrings = Services.Currency.CreatePriceStringSeparated(backToGameData.Cash);
             * string[] doubleCashStrings = Services.Currency.CreatePriceStringSeparated(backToGameData.Cash * 2);
             *
             * offlineBalanceText.text = cashStrings[0];
             * BosUtils.If(() => cashStrings.Length > 1, () => offlineBalanceWordText.text = cashStrings[1], () => offlineBalanceWordText.text = string.Empty);
             *
             * doubleBalanceText.text = doubleCashStrings[0];
             * BosUtils.If(() => doubleCashStrings.Length > 1, () => doubleBalanceWordText.text = doubleCashStrings[1], () => doubleBalanceWordText.text = string.Empty);
             */

            offlineBalanceText.text = BosUtils.GetStandardCurrencyString(backToGameData.Cash);
            doubleBalanceText.text  = BosUtils.GetStandardCurrencyString(backToGameData.Cash * 2);

            TimeSpan ts = TimeSpan.FromSeconds(backToGameData.Interval);

            offlineTimeText.text = $"{(int)ts.TotalHours:D2}:{ts.Minutes:D2}:{ts.Seconds:D2}";

            continueButton.SetListener(() => {
                Sounds.PlayOneShot(SoundName.click);
                ViewService.Remove(ViewType.BackToGameView, BosUISettings.Instance.ViewCloseDelay);
            });

            watchAdButton.SetListener(() => {
                ViewService.Remove(ViewType.BackToGameView, BosUISettings.Instance.ViewCloseDelay);
                Services.AdService.WatchAd("WellcomeBack", () => {
                    Player.AddGenerationCompanyCash(backToGameData.Cash);
                    FacebookEventUtils.LogADEvent("WellcomeBack");
                });
            });
        }
Exemplo n.º 8
0
        public override void Setup(ViewData data)
        {
            base.Setup(data);

            rateButton.SetListener(() => {
                Sounds.PlayOneShot(SoundName.click);
                Services.GetService <IRateService>().Rate();
                ViewService.Remove(ViewType.RateAppView);
            });

            supportButton.SetListener(() => {
                Sounds.PlayOneShot(SoundName.click);
                Application.OpenURL(Services.ResourceService.Defaults.supportLink);
            });

            closeButton.SetListener(() => {
                Sounds.PlayOneShot(SoundName.click);
                closeButton.SetInteractable(false);
                ViewService.Remove(ViewType.RateAppView, BosUISettings.Instance.ViewCloseDelay);
            });
        }
Exemplo n.º 9
0
        public override void Setup(ViewData data)
        {
            base.Setup(data);
            GeneratorInfo generator = data.UserData as GeneratorInfo;

            if (generator == null || !generator.IsDependent)
            {
                return;
            }
            object currentNameStr    = LocalizationObj.GetString(generator.LocalData.GetName(Planets.CurrentPlanetId.Id).name);
            var    requiredGenerator = Services.GenerationService.GetGetenerator(generator.LocalData.required_id);
            object requiredNameStr   = LocalizationObj.GetString(requiredGenerator.LocalData.GetName(Planets.CurrentPlanetId.Id).name);

            titleText.text           = LocalizationObj.GetString("DEPEND.TITLE").Format(requiredNameStr);
            descriptionText.text     = LocalizationObj.GetString("DEPEND.DESC").Format(currentNameStr, requiredNameStr);
            iconImage.overrideSprite = ResourceService.GetSpriteByKey(requiredGenerator.LocalData.GetIconData(Planets.CurrentPlanetId.Id).icon_id);

            closeButton.SetListener(() => {
                Sounds.PlayOneShot(SoundName.click);
                ViewService.Remove(ViewType.DependGeneratorView);
            });
        }
Exemplo n.º 10
0
        public override void Setup(ViewData data)
        {
            base.Setup(data);
            Data = data.UserData as WaitAdData;

            updateTimer.Setup(.3f, dt => {
                if (!isAdLoaded)
                {
                    if (Appodeal.isLoaded(Appodeal.REWARDED_VIDEO))
                    {
                        isAdLoaded = true;
                        ViewService.Remove(ViewType.WaitAdView);
                        if (Data != null)
                        {
                            Services.AdService.WatchAd(Data.ContentType, Data.Action);
                        }
                    }
                }
            });
            closeButton.SetListener(() => {
                Sounds.PlayOneShot(SoundName.click);
                ViewService.Remove(ViewType.WaitAdView);
            });
        }
Exemplo n.º 11
0
 private void CloseByErrorClose()
 {
     errorParent.MoveFromTo(new Vector2(0, 140), new Vector2(0, 1600), 0.25f, EaseType.EaseInOutSin, () => {
         ViewService.Remove(ViewType.PromoInputView);
     });
 }
Exemplo n.º 12
0
 private void Close()
 {
     HideInput(() => {
         ViewService.Remove(ViewType.PromoInputView);
     });
 }
Exemplo n.º 13
0
        public override void Setup(ViewData data)
        {
            base.Setup(data);

            ISpecialOfferService specialOfferService = Services.GetService <ISpecialOfferService>();

            playerCashRewardCountText.text = "$" + BosUtils.GetCurrencyString(specialOfferService.PlayerCashReward.ToCurrencyNumber(), string.Empty, string.Empty);
            playerCashMaxBalanceText.text  = MaxBalanceFormattedString(specialOfferService.MaxBalanceBonus);
            coinsRewardText.text           = string.Format(LocalizationObj.GetString("fmt_coins_2"), specialOfferService.CoinsReward);
            companyCashRewardText.text     = "$" + BosUtils.GetCurrencyString(specialOfferService.ComplanyCashReward.ToCurrencyNumber(), string.Empty, string.Empty);
            companyCashMaxBalanceText.text = MaxBalanceFormattedString(specialOfferService.MaxBalanceBonus);
            UpdateAvailable();
            Observable.Interval(TimeSpan.FromSeconds(1)).Subscribe(_ => {
                UpdateAvailable();
                UpdateParticles();
            }).AddTo(gameObject);



            buyButton.SetListener(() => {
                buyButton.SetInteractableWithShader(false);
                specialOfferService.BuyOffer();
            });

            closeButton.SetListener(() => {
                Sounds.PlayOneShot(SoundName.click);
                ViewService.Remove(ViewType.SpecialOfferView, BosUISettings.Instance.ViewCloseDelay);
            });

            var    planetNameData = ResourceService.PlanetNameRepository.GetPlanetNameData(Planets.CurrentPlanetId.Id);
            string planetName     = LocalizationObj.GetString(planetNameData.name);

            welcomText.text = string.Format(LocalizationObj.GetString("fmt_welcome"), planetName);
            SetPlanetSkin();
            StartCoroutine(PlusAnimatorsImpl());

            GameEvents.StoreProductPurchasedObservable.Subscribe(prod => {
                if (prod.Id == SpecialOfferService.kOfferProductId)
                {
                    closeButton.interactable = false;
                    //start emitting
                    EmitEffect(playerCashEffect, 5, playerCashEffectPoints[0], playerCashEffectPoints[1], "playercash", 0);
                    EmitEffect(companyCashEffect, 5, companyCashEffectPoints[0], companyCashEffectPoints[1], "companycash", 1);
                    EmitEffect(coinsEffect, 5, coinsEffectPoints[0], coinsEffectPoints[1], "coins", 2);
                }
            }).AddTo(gameObject);
            UpdateParticles();

            try {
                //IAPManager iapManager = FindObjectOfType<IAPManager>();
                Services.Inap.GetProductByResourceId(SpecialOfferService.kOfferProductId).Match(() => {
                    priceText.text = string.Empty;
                    return(F.None);
                }, (prod) => {
                    priceText.text = prod.metadata.localizedPriceString;
                    return(F.Some(prod));
                });
            } catch (Exception exception) {
                Debug.Log(exception.Message);
                Debug.Log(exception.StackTrace);
            }
        }
Exemplo n.º 14
0
        private IEnumerator CloseAfterEffectImpl()
        {
            yield return(new WaitForSeconds(0.3f));

            ViewService.Remove(ViewType.SpecialOfferView);
        }
Exemplo n.º 15
0
 public void ScheduleRemove()
 {
     Services.Execute(() => ViewService.Remove(ViewType.ReconnectView), 3);
 }