public HammerTimeRunner() { Singleton <PropertyManager> .Instance.AddRootContext(this); SceneLoader instance = SceneLoader.Instance; ReactiveProperty <int> reactiveProperty = (from dur in PlayerData.Instance.BoostersEffect[5] select(int) dur + PersistentSingleton <GameSettings> .Instance.GoldenHammerInitialDuration).TakeUntilDestroy(instance).ToReactiveProperty(); ReactiveProperty <int> right = reactiveProperty.CombineLatest(PlayerData.Instance.HammerTimeBonusDuration, (int dura, int bonus) => dura + bonus).TakeUntilDestroy(instance).ToReactiveProperty(); TickerService.MasterTicks.Subscribe(delegate(long ticks) { if (PlayerData.Instance.HammerTimeElapsedTime.Value < 1728000000000L) { PlayerData.Instance.HammerTimeElapsedTime.Value += ticks; } }).AddTo(instance); UniRx.IObservable <int> source = PlayerData.Instance.HammerTimeElapsedTime.CombineLatest(right, (long ticks, int dur) => dur - (int)(ticks / 10000000)); Active = (from secs in source select secs > 0).TakeUntilDestroy(instance).ToReactiveProperty(); DurationLeft = (from seconds in source select TextUtils.FormatSecondsShort(seconds)).TakeUntilDestroy(instance).ToReadOnlyReactiveProperty(); DurationString = (from dur in reactiveProperty select PersistentSingleton <LocalizationService> .Instance.Text("Attribute.Duration") + ": " + BoosterCollectionRunner.FormatSecondsForBoosters(dur)).TakeUntilDestroy(instance).ToReadOnlyReactiveProperty(); HammerTimeEnded = (from act in Active select act && (HammerTimeActive = true) into sit select(!sit && HammerTimeActive) ? true : false).TakeUntilDestroy(instance).ToReactiveProperty(); (from elapsed in PlayerData.Instance.HammerTimeElapsedTime where elapsed < 0 select elapsed).CombineLatest(right, (long cheat, int dur) => dur).Subscribe(delegate(int dur) { PlayerData.Instance.HammerTimeElapsedTime.Value = dur; }).AddTo(instance); }
public string[] GetRewardStringAndPrefabPath(RewardData reward, bool mainType) { string str = string.Empty; if (mainType) { str = "Main_"; } string str2 = string.Empty; string str3 = "+"; str3 = ((reward.Type != RewardEnum.AddToGems) ? (str3 + BigString.ToString(reward.Amount)) : (str3 + reward.Amount.ToInt().ToString())); switch (reward.Type) { case RewardEnum.AddBoosterDailyDoubleBoost: str2 = "Booster_DailyDouble"; str3 += "X"; break; case RewardEnum.AddBoosterDamageMultiplier: str2 = "Booster_Damage"; str3 += "X"; break; case RewardEnum.AddBoosterGoldMultiplier: str2 = "Booster_Gold"; str3 += "X"; break; case RewardEnum.AddBoosterHammerDuration: str2 = "Booster_Hammer"; str3 = BoosterCollectionRunner.FormatSecondsForBoosters(reward.Amount.ToInt()); break; case RewardEnum.AddBoosterKeyDropChance: str2 = "Booster_KeyChance"; str3 += "X"; break; case RewardEnum.AddBoosterShardMultiplier: str2 = "Booster_ShardMultiplier"; str3 += "X"; break; case RewardEnum.AddBoosterBerryDropChance: str2 = "Booster_BerryChance"; str3 += "X"; break; case RewardEnum.AddChestBronze: str2 = "Chest_Bronze"; break; case RewardEnum.AddChestGold: str2 = "Chest_Gold"; break; case RewardEnum.AddChestSilver: str2 = "Chest_Silver"; break; case RewardEnum.AddToCoins: case RewardEnum.AddToCoinsSmall: case RewardEnum.AddToCoinsMedium: case RewardEnum.AddToCoinsLarge: str2 = "Coins"; break; case RewardEnum.MultiplyCoins: str2 = "Coins"; str3 += "X"; break; case RewardEnum.AddToGems: str2 = "Gems"; break; case RewardEnum.AddToRelics: str2 = "Jelly"; break; case RewardEnum.AddToSkillAutoMine: str2 = "Tornado"; break; case RewardEnum.AddToSkillGoldfinger: str2 = "Goldfinger"; break; case RewardEnum.AddToSkillTapBoost: str2 = "Dynamite"; break; case RewardEnum.AddToSkillTeamBoost: str2 = "EnchantedCreatures"; break; case RewardEnum.AddToSkillTNT: str2 = "TNT"; break; case RewardEnum.AddToSkillRandomUnlocked: str2 = "Skill"; break; case RewardEnum.AddToGearLevel: str2 = "Gear"; break; } return(new string[2] { str3, "UI/BundleItems/" + str + "BundleItem_" + str2 }); }