Exemplo n.º 1
0
 private void Close()
 {
     HideInput(() => {
         ViewService.Remove(ViewType.PromoInputView);
     });
 }
Exemplo n.º 2
0
 private void CloseByErrorClose()
 {
     errorParent.MoveFromTo(new Vector2(0, 140), new Vector2(0, 1600), 0.25f, EaseType.EaseInOutSin, () => {
         ViewService.Remove(ViewType.PromoInputView);
     });
 }
Exemplo n.º 3
0
        public override void Setup(ViewData data)
        {
            base.Setup(data);
            closeButton.SetListener(() => {
                Services.ViewService.Remove(ViewType.MainView, BosUISettings.Instance.ViewCloseDelay);
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            soundToggle.onValueChanged.RemoveAllListeners();
            soundToggle.isOn = Services.SoundService.IsMute;
            soundToggle.SetListener(isOn => {
                Services.SoundService.SetMute(isOn);
            });

            helpToggle.onValueChanged.RemoveAllListeners();
            helpToggle.isOn = Services.TutorialService.IsPaused;
            helpToggle.SetListener(isOn => {
                Services.TutorialService.SetPaused(isOn);
                Sounds.PlayOneShot(SoundName.click);
            });

            /*
             * helpButton.SetListener(() => {
             *  Services.ViewService.Show(ViewType.HelpView, new ViewData {
             *      ViewDepth = ViewDepth + 1
             *  });
             *  Services.SoundService.PlayOneShot(SoundName.click);
             * });*/

            achievmentsButton.SetListener(() => {
                //FindObjectOfType<StoreAchievement>()?.ShowAchievementUI();
                Services.AchievmentService.ShowAchievementUI();
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            profileButton.SetListener(() => {
                Services.ViewService.Show(ViewType.ProfileView, new ViewData {
                    ViewDepth = ViewDepth + 1, UserData = ProfileViewTab.Office
                });
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            leaderBoardButton.SetListener(() => {
                Services.LegacyGameManager.GetComponent <UnityLeaderboardMediator>().ShowLeaderboardUI_Score();
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            managersButton.SetListener(() => {
                Services.ViewService.Show(ViewType.ManagersView, new ViewData {
                    UserData = 0, ViewDepth = ViewDepth + 1
                });
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            investorButton.SetListener(() => {
                Services.ViewService.ShowDelayed(ViewType.InvestorsView, BosUISettings.Instance.ViewShowDelay, new ViewData {
                    ViewDepth = ViewDepth + 1
                });
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            rewardsButton.SetListener(() => {
                Services.ViewService.Show(ViewType.RewardsView, new ViewData {
                    ViewDepth = ViewDepth + 1
                });
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            spaceshipButton.SetListener(() => {
                Services.ViewService.ShowDelayed(ViewType.BuyModuleView, BosUISettings.Instance.ViewShowDelay, new ViewData {
                    ViewDepth = ViewDepth + 1, UserData = new ModuleViewModel {
                        ScreenType = ModuleScreenType.Normal,
                        ModuleId   = 0
                    }
                });
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            upgradeButton.SetListener(() => {
                Services.ViewService.Show(ViewType.UpgradesView, new ViewData {
                    ViewDepth = ViewDepth + 1
                });
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            shopButton.SetListener(() => {
                Services.ViewService.ShowDelayed(ViewType.UpgradesView, BosUISettings.Instance.ViewShowDelay,
                                                 new ViewData {
                    ViewDepth = ViewDepth + 1,
                    UserData  = new UpgradeViewData {
                        TabName      = UpgradeTabName.Shop,
                        StoreSection = StoreItemSection.CompanyCash
                    }
                });
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            socialButton.SetListener(() => {
                Services.ViewService.Show(ViewType.SocialView, new ViewData {
                    ViewDepth = ViewDepth + 1
                });
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            adButton.SetListener(() => {
                //Services.LegacyGameUI.ShowWatchAd();
                ViewService.Show(ViewType.X2ProfitView, new ViewData {
                    ViewDepth = ViewDepth + 1
                });
                Services.SoundService.PlayOneShot(SoundName.click);
            });
            managerTimer.Setup(1, dt => Services.ViewService.Utils.UpdateManagerAlert(managerAlertObject), true);
            investorTimer.Setup(1, dt => Services.ViewService.Utils.UpdateInvestorAlert(investorAlertObject), true);
            rewardButtonTimer.Setup(0.5f, (dt) => rewardsButton.interactable = (Services.RewardsService.AvailableRewards > 0));
            upgradeTimer.Setup(1, (dt) => Services.ViewService.Utils.UpdateUpgradeAlert(upgradeAlertObject), true);
            OnAvailableRewardsChanged(0, 0);
            OnCoinsChanged(0, 0);
        }
Exemplo n.º 4
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.º 5
0
        private IEnumerator CloseAfterEffectImpl()
        {
            yield return(new WaitForSeconds(0.3f));

            ViewService.Remove(ViewType.SpecialOfferView);
        }
Exemplo n.º 6
0
 public void ScheduleRemove()
 {
     Services.Execute(() => ViewService.Remove(ViewType.ReconnectView), 3);
 }
Exemplo n.º 7
0
        public void Setup(int generatorId)
        {
            generator = Services.GenerationService.Generators.GetGeneratorInfo(generatorId);
            int researchPrice = generator.ResearchPrice(Planets);

            researchButton.SetListener(() => {
                IPlayerService playerService = Services.PlayerService;

                if (IsNeedShowDependView())
                {
                    Sounds.PlayOneShot(SoundName.click);

                    ViewService.Show(ViewType.DependGeneratorView, new ViewData {
                        ViewDepth = ViewService.NextViewDepth,
                        UserData  = generator
                    });
                }
                else if (playerService.IsEnoughCoins(researchPrice))
                {
                    playerService.RemoveCoins(researchPrice);
                    Services.GenerationService.Research(generator.GeneratorId);
                    transitionParticles.Play();
                    Analytics.CustomEvent(AnalyticsStrings.RESEARCH_ZEPPELIN);
                    Services.GetService <ISoundService>().PlayOneShot(SoundName.Poof);
                }
                else
                {
                    //notEnoughCoinsPopup.GetComponent<NotEnoughCoinsScreen>().Show(generator.Data.CoinPrice);
                    Sounds.PlayOneShot(SoundName.click);
                    Services.ViewService.Show(ViewType.CoinRequiredView, new ViewData {
                        UserData = researchPrice
                    });
                }
            });

            /*
             * if(generator.Data.Type == GeneratorType.Planet ) {
             *  PlanetNameData planetNameData = Services.ResourceService.PlanetNameRepository.GetPlanetNameData(generator.PlanetId);
             *  generatorNameText.text = Services.ResourceService.Localization.GetString(planetNameData?.name) ?? string.Empty;
             *  generatorIconImage.overrideSprite = Services.ResourceService.Sprites.GetObject(planetNameData.icon);
             * } else {
             *  generatorNameText.text = Services.ResourceService.Localization.GetString(generator.Data.Name);
             *
             * }*/
            ViewService.Utils.ApplyGeneratorName(generatorNameText, generator);

            if (generator.Data.Type == GeneratorType.Normal)
            {
                UpdateGeneratorIcon();
            }
            var currentPlanetData = Services.ResourceService.PlanetNameRepository.GetPlanetNameData(Services.PlanetService.CurrentPlanet.Id);

            bg.overrideSprite = Services.ResourceService.GetSpriteByKey(currentPlanetData.research_bg);

            priceText.text = (researchPrice != 0) ? researchPrice.ToString() : string.Empty;
            if (researchPrice != 0)
            {
                coinIconObject?.Activate();
            }
            else
            {
                coinIconObject.Deactivate();
            }


            UpdateResearchButtonInteractability();

            //autoresearch planets
            if (generator.Data.Type == GeneratorType.Planet)
            {
                AutoResearch();
            }
        }