public override void OnEvent(IBosServiceCollection context, TutorialEventData data) { Func <bool> isValid = () => IsActive && isDialogShowed && data.EventName == TutorialEventName.ViewOpened; BosUtils.If(isValid, trueAction: () => { if ((ViewType)data.UserData == ViewType.PlanetsView) { RemoveFinger(context, "planets"); ForceTutorialDialog(context, new TutorialDialogData { Texts = GetLocalizationStrings(context, "lbl_tut_37"), OnOk = () => { Finger(context, "moon", 10); } }); } }, falseAction: () => { }); BosUtils.If(() => IsActive && isDialogShowed && data.EventName == TutorialEventName.OpenPlanetClicked, trueAction: () => { if ((int)data.UserData == 1) { RemoveFinger(context, "moon"); CompleteSelf(context); } }, falseAction: () => { }); }
public override void OnUpdate(IBosServiceCollection context, float deltaTime) { if (IsActive) { guardTimer.Update(deltaTime); } }
public override bool IsValid(IBosServiceCollection context) { var boostState = context.GetService <IX20BoostService>().State; return(context.TutorialService.IsStateCompleted(TutorialStateName.BuyBus) && (boostState == BoostState.Active || boostState == BoostState.ReadyToActivate)); }
protected bool IsStandardDialogCondition(IBosServiceCollection context) { return(context.ViewService.ModalCount == 0 && context.ViewService.LegacyCount == 0 && (!context.ViewService.Exists(ViewType.TutorialDialogView)) && context.GameModeService.GameModeName == GameModeName.Game); }
public override string GetValidationDescription(IBosServiceCollection services) { var sb = GetBaseValidationDescription(); sb.AppendLine($"Product Notifier Available Product(IsProductAvailable): {IsProductAvailable}"); return(sb.ToString()); }
private void RemoveCost(IBosServiceCollection services, CostType type, double cost) { if (currencyRemovers.ContainsKey(type)) { currencyRemovers[type](services, cost); } }
public override void OnEnter(IBosServiceCollection context) { if (!IsOnEntered) { SetStage(START_STAGE); if (!isDialogShowed) { isDialogShowed = true; context.Execute(() => { context.ViewService.Show(ViewType.TutorialDialogView, () => { return(IsStandardDialogCondition(context)); }, (go) => { /* UnityEngine.Debug.Log($"view {go.name} is showed")*/ }, new ViewData { UserData = new TutorialDialogData { Texts = context.ResourceService.Localization.GetString("lbl_tut_11").WrapToList(), OnOk = () => { context.TutorialService.CreateFinger(kPositionMiniGames, new TutorialFingerData { Id = kPositionMiniGames, IsTooltipVisible = false, Position = Vector2.zero }); } } }); }, 5); } IsOnEntered = true; } }
public override void OnUpdate(IBosServiceCollection context, float deltaTime) { if (IsActive) { if (Stage == START_STAGE) { if (IsValid(context)) { /* * Finger(context, "profile", 10); * SetStage(FINGER_ON_PROFILE_SHOWED_STAGE);*/ //show first dialog SetStage(DIALOG_FIRST_STAGE); } } else if (Stage == DIALOG_FIRST_STAGE) { if (isNeedShowFirstDialog) { if (context.GameModeService.IsGame) { ShowFirstDialog(services); } } } } }
public override string GetValidationDescription(IBosServiceCollection services) { var sb = GetBaseValidationDescription(); sb.AppendLine($"Is TutorialStateName.BuyBus completed: {services.TutorialService.IsStateCompleted(TutorialStateName.BuyBus)}"); return(sb.ToString()); }
public bool UpdateBroke(float interval, float brokeSpeed, int minLiveCount, IBosServiceCollection services) { BrokeCounter += interval * brokeSpeed * services.TimeChangeService.TimeMult; bool isBroked = false; if (LiveCount <= minLiveCount) { BrokeCounter = 0f; } else { int diff = LiveCount - minLiveCount; int brokeI = (int)BrokeCounter; int toBroke = Mathf.Min(diff, brokeI); if (toBroke > 0) { bool isSuccess = Broke(toBroke); if (isSuccess) { isBroked = true; } BrokeCounter -= brokeI; } } return(isBroked); }
protected List <string> GetLocalizationStrings(IBosServiceCollection context, params string[] keys) { List <string> result = new List <string>(); keys.ToList().ForEach(s => result.Add(context.ResourceService.Localization.GetString(s))); return(result); }
public override void OnEnter(IBosServiceCollection context) { if (!IsOnEntered) { IsOnEntered = true; } }
public PlanetInfo(int id, IBosServiceCollection services) { this.Id = id; this.services = services; this.planetService = services.GetService <IPlanetService>(); UpdateData(); }
public override bool IsValid(IBosServiceCollection services) { bool isModuleNotOpened = IsModuleNotOpened(services); bool isEnoughCurrencyToBuyModule = IsEnoughCurrencyForModule(services); return(isEnoughCurrencyToBuyModule && isModuleNotOpened); }
public void ForceStart(IBosServiceCollection context) { IsCompleted = false; IsActive = true; Stage = 0; IsOnEntered = false; OnEnter(context); }
private IEnumerator FingerDelayedImpl(IBosServiceCollection context, string positionName, string tooltipText, Vector2 tooltipPosition, float tooltipScale, float tooltipWidth, float timeout = -1, Action onShow = null) { yield return(new WaitUntil(() => IsStandardFingerCondition(context))); Finger(context, positionName, tooltipText, tooltipPosition, tooltipScale, tooltipWidth, timeout); onShow?.Invoke(); }
private bool IsMoonOpening(IBosServiceCollection services) { IPlanetService planets = services.PlanetService; var moonPlanet = planets.GetPlanet(PlanetConst.MOON_ID); return(moonPlanet.State == PlanetState.Opening || moonPlanet.State == PlanetState.ReadyToOpen); }
public override string GetValidationDescription(IBosServiceCollection services) { var sb = GetBaseValidationDescription(); sb.AppendLine($"Is Module not opened => {IsModuleNotOpened(services)}"); sb.AppendLine($"Is Enough currencies for module => {IsEnoughCurrencyForModule(services)}"); return(sb.ToString()); }
protected void Finger(IBosServiceCollection context, string positionName, float timeout = -1) { context.TutorialService.CreateFinger(positionName, new TutorialFingerData { Id = positionName, IsTooltipVisible = false, Timeout = timeout }); }
public override string GetValidationDescription(IBosServiceCollection services) { var sb = GetBaseValidationDescription(); var boostState = services.GetService <IX20BoostService>().State; sb.AppendTutorialStateCompletedCondition(TutorialStateName.BuyBus); sb.AppendLine($"x20 boost is Active or ReadyToActivate: { boostState == BoostState.Active || boostState == BoostState.ReadyToActivate}"); return(sb.ToString()); }
public void AddMaxEfficiency(double value, IBosServiceCollection services) { double oldValue = MaxEfficiency; MaxEfficiency += value; if (oldValue != MaxEfficiency) { GameEvents.OnMaxEfficiencyChanged(oldValue, MaxEfficiency, this); } }
private void MoveToRepeatFingerState(IBosServiceCollection services) { services.TutorialService.RemoveFinger(kMegaBoostPosition); //CompleteSelf(context); if (Stage == STAGE_START) { UnityEngine.Debug.Log($"Set MegaboostState Stage to VALID".Attrib(bold: true, italic: true, color: "g", size: 20)); SetStage(STAGE_SHOW_FINGER_OB_BUTTON); } }
public override void OnEnter(IBosServiceCollection context) { this.services = context; if(!IsOnEntered ) { if (Stage == 0) { context.RunCoroutine(ShowFingerOnRickshawCountButtonImpl()); SetStage(STAGE_WAIT_CLICK); } IsOnEntered = true; } }
public override string GetValidationDescription(IBosServiceCollection services) { var sb = GetBaseValidationDescription(); sb.AppendLine($"is enough currencies for planet: {IsEnoughCurrenciesForPlanet(services)}"); sb.AppendLine($"is module opened: {IsModuleOpened(services)}"); sb.AppendLine($"is planet closed: {IsPlanetLocked(services)}"); sb.AppendTutorialStateCompletedCondition(TutorialStateName.SpaceShip); return(sb.ToString()); }
public override void Setup(IBosServiceCollection services) { base.Setup(services); UnityEngine.Debug.Log($"PlaySlot State Initialized".Attrib(bold: true, italic: true, color: "g", size: 20)); if (!IsInitialized) { GameEvents.TutorialEventObservable.Subscribe(args => { if (args.EventName == TutorialEventName.WheelCompleted) { if (Stage == CHEST_TAB_STAGE) { //remove previous finger //show finger on CHEST TAB UnityEngine.Debug.Log($"Tutorial event: {args.EventName}".Attrib(bold: true, italic: true, color: "g", size: 20)); Finger(services, kTutorialPositionChestTab, timeout: 10); SetStage(CHEST_CLICK_STAGE); } } else if (args.EventName == TutorialEventName.ChestTabOpened) { if (Stage == CHEST_CLICK_STAGE) { //remove previous finger //show finger on CHEST UnityEngine.Debug.Log($"Tutorial event: {args.EventName}".Attrib(bold: true, italic: true, color: "g", size: 20)); RemoveFinger(services, kTutorialPositionChestTab); Finger(services, kTutorialPositionChest, timeout: 10); SetStage(WAIT_FOR_CHEST); } } else if (args.EventName == TutorialEventName.ChestOpened) { if (Stage == WAIT_FOR_CHEST) { //remove previous finger UnityEngine.Debug.Log($"Tutorial event: {args.EventName}".Attrib(bold: true, italic: true, color: "g", size: 20)); RemoveFinger(services, kTutorialPositionChest); SetStage(END_STAGE); } } else if (args.EventName == TutorialEventName.ViewHided) { ViewType viewType = (ViewType)args.UserData; if (viewType == ViewType.MiniGameView) { if (Stage > 0) { CompleteSelf(services); } } } }).AddTo(services.Disposables); IsInitialized = true; } }
public static double GetUnitPriceForMechanicSecretaryPrice(GeneratorInfo generator, int unitCount) { IBosServiceCollection Services = GameServices.Instance; int ownedCount = Services.TransportService.GetUnitTotalCount(generator.GeneratorId) - unitCount; if (ownedCount <= 0) { ownedCount = 1; } return(Services.GenerationService.CalculatePrice(unitCount, ownedCount, generator)); }
public override void OnEnter(IBosServiceCollection context) { if (!IsOnEntered) { if (Stage == START_STAGE) { SetStage(DIALOG_FIRST); } IsOnEntered = true; } }
protected void ForceTutorialDialog(IBosServiceCollection context, TutorialDialogData data, System.Func <IBosServiceCollection, bool> additionalShowPredicate = null) { context.ViewService.Show(ViewType.TutorialDialogView, () => { return((additionalShowPredicate == null) || additionalShowPredicate(context)); }, (viewObj) => { UDBG.Log($"opened dialog on state => {Name}".Colored(ConsoleTextColor.lightblue)); }, new ViewData { UserData = data }); }
public override bool IsValid(IBosServiceCollection context) { context.PlayerService.ProductNotifier.AvailableProduct.Match(() => { IsProductAvailable = false; return(F.None); }, prod => { IsProductAvailable = true; return(F.Some(prod)); }); return(IsProductAvailable); }
public void Setup(IBosServiceCollection services) { this.services = services; ProductAvailability = availabilitySubject.ToReadOnlyReactiveProperty(new ProductAvailableInfo { IsAvailableForCurrentCash = false, IsAvailableForTotalCash = false }); Observable.Interval(TimeSpan.FromSeconds(4)).Subscribe(_ => { UpdateState(); }).AddTo(services.Disposables); //GameEvents.ProductPurchasedObservable.Subscribe(prod => UpdateState()).AddTo(services.Disposables); //GameEvents.OfficialTransferObservable.Value.Subscribe(info => UpdateState()).AddTo(services.Disposables); //GameEvents.UnofficialTransferObservable.Value.Subscribe(info => UpdateState()).AddTo(services.Disposables); }