private void UpdateState(AuditorState state) { switch (state) { case AuditorState.MoveToLoad: { //progressParent.Deactivate(); //countText.Deactivate(); progressParent.Activate(); countText.Activate(); rectTransform.localScale = new Vector3(-1, 1, 1); countText.GetComponent <RectTransform>().localScale = new Vector3(-1, 1, 1); animator.SetTrigger(animNames[Direction.Right]); rectTransform.anchoredPosition = Vector2.Lerp(rightPosition, leftPosition, Auditor.NormalizedTimer); } break; case AuditorState.Loading: { animator.SetTrigger(animNames[Direction.StayLeft]); progressParent.Activate(); countText.Activate(); rectTransform.localScale = Vector3.one; countText.GetComponent <RectTransform>().localScale = Vector3.one; rectTransform.anchoredPosition = leftPosition; } break; case AuditorState.MoveToUnload: { progressParent.Activate(); countText.Activate(); rectTransform.localScale = Vector3.one; countText.GetComponent <RectTransform>().localScale = Vector3.one; animator.SetTrigger(animNames[Direction.Right]); rectTransform.anchoredPosition = Vector2.Lerp(leftPosition, rightPosition, Auditor.NormalizedTimer); } break; case AuditorState.Unloading: { progressParent.Activate(); countText.Activate(); animator.SetTrigger(animNames[Direction.StayRight]); rectTransform.anchoredPosition = rightPosition; rectTransform.localScale = Vector3.one; countText.GetComponent <RectTransform>().localScale = Vector3.one; } break; default: { rectTransform.localScale = Vector3.one; countText.GetComponent <RectTransform>().localScale = Vector3.one; animator.SetTrigger(animNames[Direction.StayRight]); progressParent.Deactivate(); countText.Deactivate(); rectTransform.anchoredPosition = rightPosition; } break; } }
private void Setup() { Construct(); switch (boostService.State) { case BoostState.FirstCharger: { progressBack.Activate(); progressFill.overrideSprite = orangeSprite; readyToActivateText.Deactivate(); activateText.Activate(); activateText.text = Services.ResourceService.Localization.GetString("boost"); timerText.Activate(); button.interactable = false; videoAdIconImage.Deactivate(); x20Image.gameObject.Activate(); } break; case BoostState.Active: { progressBack.Activate(); progressFill.fillAmount = 1.0f; progressFill.overrideSprite = orangeSprite; readyToActivateText.Deactivate(); activateText.Activate(); activateText.text = Services.ResourceService.Localization.GetString("boost"); timerText.Activate(); button.interactable = true; videoAdIconImage.Deactivate(); x20Image.gameObject.Activate(); } break; case BoostState.ReadyToActivate: { progressBack.Deactivate(); readyToActivateText.Activate(); readyToActivateText.text = Services.ResourceService.Localization.GetString("megaboost"); activateText.Deactivate(); timerText.Deactivate(); button.interactable = true; videoAdIconImage.Deactivate(); x20Image.gameObject.Activate(); } break; case BoostState.Locked: { progressBack.Activate(); progressFill.overrideSprite = greenSprite; readyToActivateText.Deactivate(); activateText.Activate(); activateText.text = Services.ResourceService.Localization.GetString("unlocknow"); timerText.Activate(); button.interactable = true; videoAdIconImage.Activate(); x20Image.gameObject.Deactivate(); } break; } }
private void UpdateTimer(IX2ProfitService service, Material buttonMaterial, int _enabledPropId) { int interval = service.AvailableAfterInterval; if (interval == 0) { nameWithoutTimer.Activate(); nameWithTimer.Deactivate(); if (buttonMaterial != null) { buttonMaterial.SetInt(_enabledPropId, 1); } } else { nameWithoutTimer.Deactivate(); nameWithTimer.Activate(); TimeSpan ts = TimeSpan.FromSeconds(interval); timerText.text = $"{ts.Hours:D2}:{ts.Minutes:D2}:{ts.Seconds:D2}"; if (buttonMaterial != null) { buttonMaterial.SetInt(_enabledPropId, 0); } } }
private void UpdateView() { string securitiesText = NumberMinifier.PrettyAbbreviatedValue(Math.Floor(Services.PlayerService.Securities.Value)); CurrentInvestorsText.text = securitiesText; AllInvestors.text = NumberMinifier.PrettyAbbreviatedValue(Math.Floor(Services.InvestorService.CalcInvestoreByMoney())); double targetInvestors = Services.InvestorService.GetSecuritiesCountFromInvestors(); string investorString = NumberMinifier.PrettyAbbreviatedValue(Math.Floor(targetInvestors)); ClaimButton.interactable = targetInvestors >= 1; ClaimButtonAd.interactable = targetInvestors >= 1; TargetInvestorsText.text = investorString; ButtonImage.sprite = targetInvestors >= 1 ? ActiveSprite : NoActiveSprite; var isCanClaim = ViewService.Utils.IsInvestorSellStateOk(Services.InvestorService.SellState); ClaimButton.gameObject.SetActive(isCanClaim); ClaimButtonAd.gameObject.SetActive(!isCanClaim); NextCliamTime.Deactivate(); RemainingTime.Deactivate(); if (Services.InvestorService.TriesCount <= 0) { statusText.Activate(); } else { statusText.Deactivate(); } Debug.Log($"target investors => {targetInvestors}".BoldItalic().Colored(ConsoleTextColor.navy)); }
public virtual void SetText(string inText) { if (!LoaderText.IsActive()) { LoaderText.Activate(); } LoaderText.SetText(inText); }
public void SetVersion(string versionInfo) { if (!VersionText.IsActive()) { VersionText.Activate(); } VersionText.SetText("Content Version: " + versionInfo); }
private void UpdateNextLevelControls() { IBankService bankService = Services.GetService <IBankService>(); ILocalizationRepository localization = Services.ResourceService.Localization; int currentLevel = bankService.CurrentBankLevel; if (bankService.IsMaxLevel(currentLevel)) { nextLevelControlsParent.Deactivate(); maxLevelText.Activate(); } else { nextLevelControlsParent.Activate(); maxLevelText.Deactivate(); openBankNextLevelLabel.text = string.Format(localization.GetString("lbl_next_level_bank_desc"), bankService.NextLevel); BankLevelData bankLevelData = Services.ResourceService.BankLevelRepository.GetBankLevelData(bankService.NextLevel); ProfitInterval profitInterval = AdjustProfitInterval(bankLevelData.Profit, (int)bankLevelData.ProfitInterval); string profitString = profitInterval.Profit.ToString().Size(72).Colored("#fde090"); string intervalString = UpdateTimeText(profitInterval.Interval).Size(72).Colored("#00fdf7"); nextLevelProfit.text = profitString + " " + intervalString; /* * if (bankLevelData.Profit.IsWhole()) { * string profitString = ((int)bankLevelData.Profit).ToString().Size(80).Colored("#fde090"); * int hours = TimeSpan.FromSeconds(bankLevelData.ProfitInterval).Hours; * string intervalString = UpdateTimeText(hours).Size(72).Colored("#00fdf7"); * nextLevelProfit.text = profitString + " " + intervalString; * } else { * string profitString = ((int)(bankLevelData.Profit * 2)).ToString().Size(80).Colored("#fde090"); * int hours = TimeSpan.FromSeconds(bankLevelData.ProfitInterval * 2).Hours; * string intervalString = UpdateTimeText(hours).Size(72).Colored("#00fdf7"); * nextLevelProfit.text = profitString + " " + intervalString; * }*/ openNextLevelPriceText.text = bankLevelData.LevelPriceCoins.ToString(); openNextLevelButton.SetListener(() => { if (IsAllowBuyNextLevel(bankLevelData)) { StartCoroutine(OpenEffectImpl()); Services.GetService <ISoundService>().PlayOneShot(SoundName.buyCoins); } else { ViewService.Show(ViewType.CoinRequiredView, new ViewData { UserData = bankLevelData.LevelPriceCoins, ViewDepth = GetComponentInParent <BankView>().ViewDepth + 1 }); Sounds.PlayOneShot(SoundName.click); } }); openNextLevelButton.interactable = (!bankService.IsMaxLevel(bankService.CurrentBankLevel)); } }
private void UpdateReadytOpenPlanetView() { actionButton.Activate(); actionButton.interactable = true; SetButtonGrayed(false); actionButtonName.Activate(); actionButtonName.text = Services.ResourceService.Localization.GetString("btn_launch"); progressParent.Deactivate(); priceParent.Deactivate(); buttonRocketImage.Activate(); moduleCollection.Deactivate(); //buttonRocketImage.overrideSprite = context.EndOpenedSprite; actionButton.SetListener(() => { Services.GetService <IPlanetService>().SetOpened(planetId); actionButton.GetComponent <Animator>()?.SetTrigger("click"); Services.ViewService.Remove(ViewType.PlanetsView); GameEvents.OnTutorialEvent(new TutorialEventData(TutorialEventName.OpenPlanetClicked, Planet.Id)); }); }
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); } }
protected override void FillInner(GeneratorInfo generatorInfo) { var service = Services.GetService <IX2ProfitService>(); Observable.Interval(TimeSpan.FromSeconds(1)).Subscribe(_ => { int interval = service.AvailableAfterInterval; if (interval == 0) { Timer.Deactivate(); } else { Timer.Activate(); var ts = TimeSpan.FromSeconds(interval); Timer.text = $"{ts.Hours:D2}:{ts.Minutes:D2}:{ts.Seconds:D2}"; } }).AddTo(gameObject); }
protected override void FillInner(GeneratorInfo generatorInfo) { if (IsTransportBoost) { CoinUpgradeId = 870 + generatorInfo.GeneratorId; var generatorIconData = ResourceService .GeneratorLocalData .GetLocalData(generatorInfo.GeneratorId) .GetIconData(Planets.CurrentPlanet.Id); var generatorSprite = ResourceService.GetSpriteByKey(generatorIconData.icon_id); Icon.sprite = generatorSprite; } var shopItem = GetShopItem(); if (shopItem == null) { UnityEngine.Debug.LogError("Id not exist : " + CoinUpgradeId); } var boostInfo = GetBoostInfo(generatorInfo); if (boostInfo != null) { var count = boostInfo.Count; if (count > 1) { CountText.Activate(); CountText.text = count.ToString(); } else { CountText.Deactivate(); } } else { CountText.Deactivate(); } }
private IEnumerator InternalPull() { yield return(new WaitForSeconds(1f)); slotText.text = $"{cashInfo.TaxPercentInt}%"; yield return(new WaitForSeconds(1)); slotText.Activate(); animationObject.Deactivate(); GetComponent <AudioSource>().Stop(); yield return(new WaitForSeconds(0.8f)); RewardText.text = Services.Currency.CreatePriceString(cashInfo.RemainValue); Services.PlayerService.FinishTransferCashOfficially(cashInfo); particles.Activate(); Services.SoundService.PlayOneShot(SoundName.buyGenerator); yield return(new WaitForSeconds(1.2f)); winViewObject.SetActive(true); particles.Deactivate(); }
protected override void FillInner(GeneratorInfo generatorInfo) { var boosts = GetBootInfo(); if (boosts != null && boosts.Count > 0) { var count = boosts.Count; if (count > 1) { CountText.Activate(); CountText.text = count.ToString(); } else { CountText.Deactivate(); } Observable.Interval(TimeSpan.FromSeconds(1)).Subscribe(_ => { var endTime = boosts.Min(val => val.EndTime); int interval = endTime - TimeService.UnixTimeInt; if (interval == 0) { Timer.Deactivate(); } else { Timer.Activate(); var ts = TimeSpan.FromSeconds(interval); Timer.text = $"{ts.Hours:D2}:{ts.Minutes:D2}:{ts.Seconds:D2}"; } }).AddTo(gameObject); } else { Timer.Deactivate(); CountText.Deactivate(); } }
private IEnumerator InternalPull() { yield return(new WaitForSeconds(1f)); var rollbackInfo = Services.ManagerService.CurrentRollbackInfo; slotText.text = $"{rollbackInfo.RollbackPercentInt}%"; yield return(new WaitForSeconds(1)); slotText.Activate(); Anim.Deactivate(); GetComponent <AudioSource>().Stop(); yield return(new WaitForSeconds(0.8f)); var payed = GameServices.Instance.GetService <IManagerService>().FinishRollback(); RewardText.text = Services.Currency.CreatePriceString(payed, false, " "); particles.Activate(); Services.SoundService.PlayOneShot(SoundName.buyGenerator); yield return(new WaitForSeconds(1.2f)); win.SetActive(true); particles.Deactivate(); }
public void Setup(ShipModuleInfo module) { this.module = module; ModuleNameData moduleNameData = Services.ResourceService.ModuleNameRepository.GetModuleNameData(module.Id); moduleNameText.text = Services.ResourceService.Localization.GetString(moduleNameData.name); switch (module.State) { case ShipModuleState.Opened: { currencyIconImage.Deactivate(); currencyText.Deactivate(); planetImage.Deactivate(); buyButton.Deactivate(); } break; case ShipModuleState.Available: { currencyIconImage.Activate(); currencyText.Activate(); planetImage.Deactivate(); buyButton.Activate(); } break; case ShipModuleState.Locked: { currencyIconImage.Activate(); currencyText.Activate(); planetImage.Activate(); buyButton.Activate(); } break; } currencyIconImage.overrideSprite = Services.ResourceService.GetCurrencySprite(module.CurrencyType); currencyText.text = BosUtils.GetCurrencyString(Currency.Create(module.CurrencyType, module.Price)); PlanetNameData planetNameData = Services.ResourceService.PlanetNameRepository.GetPlanetNameData(module.Data.PlanetId); if (planetNameData != null) { planetImage.overrideSprite = Services.ResourceService.GetSpriteByKey(planetNameData.icon); } else { planetImage.overrideSprite = Services.ResourceService.Sprites.FallbackSprite; } buyButton.SetListener(() => { var status = Services.GetService <IShipModuleService>().BuyModule(module.Id); switch (status) { case ModuleTransactionState.Success: { Services.SoundService.PlayOneShot(SoundName.buyUpgrade); Setup(module); } break; case ModuleTransactionState.NotEnoughCurrency: { if (module.CurrencyType == CurrencyType.Coins) { Services.ViewService.Show(ViewType.CoinRequiredView, new ViewData { UserData = (int)module.Price }); } } break; } }); IShipModuleService moduleService = Services.GetService <IShipModuleService>(); updateTimer.Setup(0.5f, (deltaTime) => { ModuleTransactionState moduleTransactionState; if (moduleService.IsAllowBuyModule(module.Id, out moduleTransactionState)) { buyButton.interactable = true; } else if (moduleTransactionState == ModuleTransactionState.NotEnoughCurrency && module.CurrencyType == CurrencyType.Coins) { buyButton.interactable = true; } else { buyButton.interactable = false; } }, true); MoveObject(module); }
public void SetDataYesNo(string displayText, Action yesImplementation, Action noImplementation, EPanelSize dSize = EPanelSize.MediumPortrait, bool reset = false, bool shouldUseAcceptAndDecline = false, UIType uiType = UIType.NormalView) { if (reset) { ResetFormat(); } DescriptionPanel.Activate(); ImageOnlyPanel.Deactivate(); Description.SetText(displayText); OnClickYes = yesImplementation; OnClickNo = noImplementation; OnClickOk = null; OnClickClose = null; if (YesButton != null) { if (shouldUseAcceptAndDecline) { YesButton.GetComponentInChildren <Text>().SetText("Accept"); } YesButton.Activate(); } if (NoButton != null) { if (shouldUseAcceptAndDecline) { NoButton.GetComponentInChildren <Text>().SetText("Decline"); } NoButton.Activate(); } if (OKButton != null) { OKButton.Deactivate(); } if (CloseButton != null) { CloseButton.Deactivate(); } Description.Activate(); ImageAnnouncement.Deactivate(); AdjustDialogSize(dSize); switch (uiType) { case UIType.StackedView: { ViewController.ActivateWithStackView(this); } break; case UIType.NormalView: { ViewController.ActivateWithNormalView(this); } break; case UIType.BaseView: { Debug.LogWarning("base type is not supported"); } break; } }
public void Setup(double cashCount, int coinCount, bool success) { //var colorAnimator = backgroundImage.gameObject.GetOrAdd<ColorAnimator>(); //var scaleAnimator = backFrameTransform.gameObject.GetOrAdd<Vector3Animator>(); /* * Vector3AnimationData scaleData = new Vector3AnimationData { * StartValue = Vector3.zero, * EndValue = Vector3.one, * Duration = 0.2f, * AnimationMode = BosAnimationMode.Single, * EaseType = EaseType.EaseInOutQuintic, * Target = backFrameTransform.gameObject, * OnStart = (s, o) => backFrameTransform.localScale = s, * OnUpdate = (s, t, o) => backFrameTransform.localScale = s, * OnEnd = (s, o) => { * backFrameTransform.localScale = s; * } * }; * * ColorAnimationData colorData = new ColorAnimationData { * StartValue = new Color(0, 0, 0, 0), * EndValue = new Color(0, 0, 0, 0.7f), * Duration = 0.5f, * AnimationMode = BosAnimationMode.Single, * EaseType = EaseType.EaseInOutQuad, * Target = backgroundImage.gameObject, * OnStart = (c, o) => backgroundImage.color = c, * OnUpdate = (c, t, o) => backgroundImage.color = c, * OnEnd = (c, o) => { * backgroundImage.color = c; * scaleAnimator.StartAnimation(scaleData); * } * }; * colorAnimator.StartAnimation(colorData);*/ FloatAnimationData alphaData = new FloatAnimationData { StartValue = 0, EndValue = 1, Duration = 0.3f, AnimationMode = BosAnimationMode.Single, EaseType = EaseType.Linear, Target = gameObject, OnStart = (v, o) => canvasGroup.alpha = v, OnUpdate = (v, t, o) => canvasGroup.alpha = v, OnEnd = (v, o) => canvasGroup.alpha = v }; GetComponent <FloatAnimator>().StartAnimation(alphaData); cashText.text = BosUtils.GetCurrencyString(new CurrencyNumber(cashCount), "#FFFFFF", "#FFDF5F"); coinText.text = coinCount.ToString(); if (!success) { contentParent.Deactivate(); failText.Activate(); } else { failText.Deactivate(); } okButton.SetListener(() => { if (Services != null) { Services.SoundService.PlayOneShot(SoundName.click); backgroundImage.Deactivate(); if (success) { Services.PlayerService.AddGenerationCompanyCash(cashCount); if (coinCount > 0) { Services.PlayerService.AddCoins(coinCount); } } SceneManager.UnloadSceneAsync(6); } else { backgroundImage.Deactivate(); } }); }