public override void OnEnable() { TryReachCashContent.SetActive(false); if (Services.InvestorService.TriesCount > 0) { descriptionText.text = LocalizationObj.GetString("lbl_investor_lock_2"); raiseStatusButton.Deactivate(); double requiredCash = Services.InvestorService.GetCompanyCashRequiredToSellInvestors(); if (requiredCash.Approximately(0.0)) { requiredCashText.text = string.Empty; } else { requiredCashText.text = $"{BosUtils.GetCurrencyString(new CurrencyNumber(requiredCash), "#FFE759", "#FFE759")}"; TryReachCashContent.SetActive(true); } } else { descriptionText.text = LocalizationObj.GetString("lbl_investor_locked_view"); raiseStatusButton.Activate(); requiredCashText.text = string.Empty; } raiseStatusButton.SetListener(() => { //Services.ViewService.ShowDelayed(ViewType.ProductsView, BosUISettings.Instance.ViewShowDelay); Services.ViewService.ShowDelayed(ViewType.ProfileView, BosUISettings.Instance.ViewShowDelay, new ViewData { UserData = ProfileViewTab.StatusGoods }); Services.SoundService.PlayOneShot(SoundName.click); }); }
private void UpdateOpeningPlanetView() { actionButton.Activate(); actionButton.interactable = true; SetButtonGrayed(false); actionButtonName.Activate(); actionButtonName.text = LocalizationObj.GetString("btn_speedup"); buttonRocketImage.Activate(); priceParent.Deactivate(); progressParent.Activate(); UpdateOpeningFilling(); moduleCollection.Deactivate(); actionButton.SetListener(() => { /* * Services.AdService.WatchAd("SpeedUpPlanet", () => { * planet.ApplySpeedMult(); * });*/ ShowFlyingModuleView(); actionButton.GetComponent <Animator>()?.SetTrigger("click"); Services.GetService <ISoundService>().PlayOneShot(SoundName.click); GameEvents.OnTutorialEvent(new TutorialEventData(TutorialEventName.OpenPlanetClicked, Planet.Id)); if (!isExpanded) { Expand(); } }); }
public override void Setup(ViewData data) { base.Setup(data); string fmtTime = LocalizationObj.GetString("lbl_bank_full_2"); string fullStr = string.Format(fmtTime, (int)TimeSpan.FromSeconds(Services.BankService.TimerFromLastCollect).TotalHours); timeText.text = fullStr; }
private void UpdateModuleName() { var planetLocalData = ResourceService.PlanetNameRepository.GetPlanetNameData(planetView.planetId); if (planetLocalData.IsModuleRequired) { moduleNameText.text = LocalizationObj.GetString(ResourceService.ModuleNameRepository.GetModuleNameId(planetLocalData.module_id)); } else { ClearModuleName(); } }
public override void Setup(ViewData data) { base.Setup(data); double securitiesCount = Services.InvestorService.GetSecuritiesCountFromInvestors(); double div1000 = Math.Floor(securitiesCount / 1000); if (div1000 == 0) { div1000 = 1; } int roundedCount = (int)(div1000 * 1000); descriptionText.text = LocalizationObj.GetString("lbl_first_investor_desc").Format(roundedCount); }
private void UpdateAdButton() { if (generator != null) { int countToRepair = CountToAdRepair(); if (countToRepair > 0) { adButtonText.text = string.Format(LocalizationObj.GetString("btn_repair_mech_ad"), countToRepair); adButton.interactable = true; } else { adButtonText.text = LocalizationObj.GetString("btn_no_repair"); adButton.interactable = false; } } }
private void UpdateAdButton() { if (generator != null) { int countToHandle = CountToHandleWithAd(); if (countToHandle > 0) { adButton.interactable = true; adButtonText.text = string.Format(LocalizationObj.GetString("btn_handle_report_ad"), countToHandle); } else { adButton.interactable = false; adButtonText.text = LocalizationObj.GetString("btn_no_reports"); } } }
private void UpdateAvailable() { ISpecialOfferService specialOfferService = Services.GetService <ISpecialOfferService>(); if (specialOfferService.IsExpired || specialOfferService.IsCompleted) { expireText.Deactivate(); buyButton.SetInteractableWithShader(false); } else { expireText.Activate(); TimeSpan timeSpan = TimeSpan.FromSeconds(specialOfferService.ExpireInterval); string timeString = timeSpan.Minutes.ToString("00") + ":" + timeSpan.Seconds.ToString("00"); expireText.text = string.Format(LocalizationObj.GetString("fmt_offer_expire"), timeString).ToUpper(); buyButton.SetInteractableWithShader(true); } }
private void DrawModulePurchased() { actionButton.Activate(); actionButton.SetListener(() => OnFlyPlanetClick()); actionButtonName.Activate(); actionButtonName.text = LocalizationObj.GetString("lbl_simple_fly"); SetButtonGrayed(IsAllowBuy() ? false : true); buttonRocketImage.Activate(); priceParent.Activate(); UpdatePrice(); progressParent.Deactivate(); moduleCollection.Deactivate(); modulePriceSection.Deactivate(); }
private void SetupNormalView() { titleText.text = LocalizationObj.GetString("lbl_modules_title"); normalBackground.Activate(); flightView.Deactivate(); UpdateCompletedState(); dots.ToggleActivity(true); if (isSwipeEnabled) { this.currentModule = Services.GetService <IShipModuleService>().GetModule((int)Model.ModuleId); EnableDot((int)Model.ModuleId); moduleView.Setup(currentModule); } else { moduleView?.Deactivate(); dots.ToggleActivity(false); } }
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); }); }
private void SetupWithPlanet(PlanetInfo planet) { titleText.text = string.Format(LocalizationObj.GetString("fmt_fly2"), LocalizationObj.GetString(planet.LocalData.name)); UpdateTimerText(planet); adButton.Activate(); adButton.SetListener(() => { Services.AdService.WatchAd("SpeedUpPlanet", () => { planet.ApplySpeedMult(); }); Sounds.PlayOneShot(SoundName.click); }); planetIds.ForEach(pi => { if (pi.planetId == planet.Id) { pi.icon.Activate(); } else { pi.icon.Deactivate(); } }); }
/* * private void ViewWhenModuleNotPurchasedCollapsed() * { * actionButton.Activate(); * actionButton.SetListener(() => { * ExpandClickAction(); * }); * SetButtonGrayed(false); * * actionButtonName.Activate(); * actionButtonName.text = LocalizationObj.GetString("btn_change"); * * buttonRocketImage.Activate(); * * priceParent.Deactivate(); * progressParent.Deactivate(); * moduleCollection.Deactivate(); * modulePriceSection.Deactivate(); * * } * * private void ViewWhenModulePurchasedCollapsed() * { * actionButton.Activate(); * actionButton.SetListener(() => ExpandClickAction()); * SetButtonGrayed(false); * * actionButtonName.Activate(); * actionButtonName.text = LocalizationObj.GetString("lbl_simple_fly"); * * buttonRocketImage.Activate(); * * priceParent.Deactivate(); * progressParent.Deactivate(); * moduleCollection.Deactivate(); * modulePriceSection.Deactivate(); * }*/ private void DrawModuleNotPurchased() { actionButton.Activate(); actionButton.SetListener(() => { OnBuyModuleClick(); }); if (IsAllowBuyModuleForCurrentPlanet()) { SetButtonGrayed(false); actionButtonName.text = LocalizationObj.GetString("lbl_simple_buy"); } else { SetButtonGrayed(true); actionButtonName.text = LocalizationObj.GetString("lbl_hide"); } actionButtonName.Deactivate(); buttonRocketImage.Deactivate(); priceParent.Deactivate(); progressParent.Deactivate(); moduleCollection.Activate(); modulePriceSection.Activate(); }
private void UpdateSpeedTextWithValue(int val) { speedText.text = string.Format(LocalizationObj.GetString("lbl_speed_mult_q"), val); }
public void ScheduleLocalNotifications() { if (isCleared) { // secretary notify if (ResourceService != null && ResourceService.IsLoaded && Planets != null && Planets.IsLoaded) { //reports push if (Planets?.IsMoonOpened ?? false) { ScheduleNotification(new Notification { Title = LocalizationObj.GetString("GAME.TITLE"), Content = LocalizationObj.GetString("nt_secr"), Delay = TimeSpan.FromHours(6) }); } //broken transport push /*if (Planets?.IsMarsOpened ?? false) { * ScheduleNotification(new Notification { * Title = LocalizationObj.GetString("GAME.TITLE"), * Content = LocalizationObj.GetString("nt_mech"), * Delay = TimeSpan.FromHours(10) * }); * }*/ } // bank notify Services.BankService.TimeToFullBank.Match(() => { //UDBG.Log($"Bank not opened...Push not sended"); return(F.None); }, interval => { ScheduleNotification(new Notification { Title = LocalizationObj.GetString("GAME.TITLE"), Content = LocalizationObj.GetString("nt_bank_is_full"), Delay = TimeSpan.FromSeconds(CalculateNonInvasiveTime((int)TimeSpan.FromHours(14).TotalSeconds)) }); //UDBG.Log($"Schedule bank notification after {interval.ToString()}"); return(F.Some(interval)); }); // daily bonus streak notify ScheduleNotification(new Notification() { Delay = TimeSpan.FromSeconds(CalculateNonInvasiveTime((int)TimeSpan.FromHours(23).TotalSeconds)), Content = Services.ResourceService.Localization.GetString("lbl_note_1"), Title = Services.ResourceService.Localization.GetString("GAME.TITLE") }); if (Services.InvestorService.GetSecuritiesCountFromInvestors() > 1000 && Services.InvestorService.TriesCount > 0) { ScheduleNotification(new Notification() { Delay = TimeSpan.FromSeconds(CalculateNonInvasiveTime((int)TimeSpan.FromHours(48).TotalSeconds)), Content = Services.ResourceService.Localization.GetString("lbl_note_4"), Title = Services.ResourceService.Localization.GetString("GAME.TITLE") }); } for (int i = 1; i < 11; i++) { ScheduleNotification(new Notification { Title = LocalizationObj.GetString("GAME.TITLE"), Content = LocalizationObj.GetString("nt_12hrs"), Delay = TimeSpan.FromSeconds(CalculateNonInvasiveTime((int)TimeSpan.FromHours(96 * i).TotalSeconds)), }); } isCleared = false; } }
public void Setup(BosCoinUpgradeData data, BosItemList <BosCoinUpgradeData, ShopCoinUpgradeView> parent) { this.Data = data; this.Parent = parent; if (data.GeneratorId < 0) { nameText.text = data.Name.GetLocalizedString(); } else { var generatorLocalData = ResourceService.GeneratorLocalData.GetLocalData(data.GeneratorId); string generatorName = LocalizationObj.GetString(generatorLocalData.GetName(Planets.CurrentPlanetId.Id).name); string sourceFmt = LocalizationObj.GetString(data.Name); string result = sourceFmt.Replace("{0}", generatorName); nameText.text = result; } descriptionText.text = data.Description.GetLocalizedString(); priceText.text = data.Price.ToString(); BgSimple.gameObject.SetActive(data.UpgradeType != UpgradeType.Enhance); BgSpecial.gameObject.SetActive(data.UpgradeType == UpgradeType.Enhance); if (data.Icon.IsValid) { iconImage.overrideSprite = data.Icon.GetSprite(); } else { var generatorLocalData = Services.ResourceService.GeneratorLocalData.GetLocalData(data.GeneratorId); var iconData = generatorLocalData.GetIconData(Services.PlanetService.CurrentPlanet.Id); if (iconData.icon_id.IsValid()) { iconImage.overrideSprite = Services.ResourceService.GetSpriteByKey(iconData.icon_id); } else { iconImage.overrideSprite = Services.ResourceService.Sprites.FallbackSprite; } } buyButton.SetListener(() => { var result = Services.GetService <IStoreService>().Purchase(data); switch (result) { case TransactionState.DontEnoughCurrency: { //NotEnoughCoinsScreen.Instance.Show(data.Price); Services.ViewService.Show(ViewType.CoinRequiredView, new ViewData { UserData = data.Price }); } break; case TransactionState.AlreadyPurchased: { parent.Remove(this); } break; case TransactionState.Success: { if (data.IsOneTime) { buyButton.interactable = false; } } break; } Debug.Log($"Purchase state => {result}"); }); }
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); } }
private string MaxBalanceFormattedString(int count) { return("x" + count.ToString().Size(28).Colored("#ff9712") + " " + LocalizationObj.GetString("lbl_max_balance")); }
private string ConstructSpeedUpText() => LocalizationObj.GetString("lbl_30m");