public override void Install(Dictionary <string, object> parameters) { if (parameters != null && parameters.ContainsKey("GearSetGearIndex")) { m_gearSetGearIndex = (int)parameters["GearSetGearIndex"]; } GearSetRunner gearSetRunner = (GearSetRunner)Singleton <PropertyManager> .Instance.GetContext("GearSetRunner", base.transform); GearRunner gearRunner = gearSetRunner.GearRunners[m_gearSetGearIndex]; Add("GearRunner", gearRunner); Add("GearViewRunner", Singleton <GearCollectionRunner> .Instance.GetOrCreateGearViewRunner(gearRunner.GearIndex)); }
public void UpgradeGear(int gear) { GearRunner orCreateGearRunner = Singleton <GearCollectionRunner> .Instance.GetOrCreateGearRunner(gear); if (orCreateGearRunner.UpgradeAvailable.Value && !orCreateGearRunner.MaxLevelReached.Value) { if (orCreateGearRunner.Level.Value == 0) { GearUnlockTriggered.SetValueAndForceNotify(orCreateGearRunner.GearIndex); } CraftingRequirement gearUpgradeCost = Singleton <EconomyHelpers> .Instance.GetGearUpgradeCost(orCreateGearRunner.GearIndex, orCreateGearRunner.Level.Value); Singleton <FundRunner> .Instance.RemoveFromFunds(gearUpgradeCost); orCreateGearRunner.Level.Value++; } }
public void ShowInfo(int gearIndex) { if (m_currentGearIndex != gearIndex) { base.transform.DestroyChildrenImmediate(); GearRunner orCreateGearRunner = Singleton <GearCollectionRunner> .Instance.GetOrCreateGearRunner(gearIndex); Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.Add("GearIndex", gearIndex); dictionary.Add("GearSetIndex", orCreateGearRunner.SetIndex); m_prevInfo = Singleton <PropertyManager> .Instance.Instantiate(m_gearInfoPrefab, Vector3.zero, Quaternion.identity, dictionary); m_prevInfo.transform.SetParent(base.transform, worldPositionStays: false); } else { m_prevInfo.gameObject.SetActive(value: true); } m_currentGearIndex = gearIndex; }
public GearViewRunner(int gearIndex) { SceneLoader instance = SceneLoader.Instance; GearConfig config = PersistentSingleton <Economies> .Instance.Gears[gearIndex]; LocalizedName = new ReactiveProperty <string>(PersistentSingleton <LocalizationService> .Instance.Text("Gear.Name." + gearIndex)); LocalizedDesc = new ReactiveProperty <string>(PersistentSingleton <LocalizationService> .Instance.Text("Gear.Name.Desc." + gearIndex)); GearRunner gearRunner = Singleton <GearCollectionRunner> .Instance.GetOrCreateGearRunner(gearIndex); int chunkUnlockLevel = PersistentSingleton <Economies> .Instance.GearSets[gearRunner.SetIndex].ChunkUnlockLevel; LocalizedChunkLevelRequirement = new ReactiveProperty <string>(PersistentSingleton <LocalizationService> .Instance.Text("Prestige.ChunkLevelRequirement", chunkUnlockLevel)); Boost1Text = (from amount in gearRunner.Boost1Amount select(gearRunner.Level.Value <= 0) ? config.Boost1.Mult.Amount : amount into amount select BonusTypeHelper.GetAttributeText(config.Boost1.Mult.BonusType, amount)).TakeUntilDestroy(instance).ToReactiveProperty(); Boost2Text = (from amount in gearRunner.Boost2Amount select(gearRunner.Level.Value <= 0) ? config.Boost2.Mult.Amount : amount into amount select BonusTypeHelper.GetAttributeText(config.Boost2.Mult.BonusType, amount)).TakeUntilDestroy(instance).ToReactiveProperty(); Show = (from show in Singleton <GearSetCollectionRunner> .Instance.MaxSetsToShow select show > gearRunner.SetIndex).TakeUntilDestroy(instance).ToReactiveProperty(); ShowPrestige = Show.CombineLatest(gearRunner.UpgradeAfterPrestigeAvailable, (bool show, bool avail) => show && avail).TakeUntilDestroy(instance).ToReadOnlyReactiveProperty(); Boost1Step = new ReactiveProperty <string>(BonusTypeHelper.GetStepText(config.Boost1.Mult.BonusType, config.Boost1.LevelUpAmount)); Boost2Step = new ReactiveProperty <string>(BonusTypeHelper.GetStepText(config.Boost2.Mult.BonusType, config.Boost2.LevelUpAmount)); BundleBoost1 = (from comb in BundleBuyAmount.CombineLatest(gearRunner.Level, (int amount, int lvl) => new { amount, lvl }) select(comb.lvl != 0) ? GetBonusAmount(config.Boost1, comb.amount, initial: false) : GetBonusAmount(config.Boost1, comb.amount, initial: true) into amount select BonusTypeHelper.GetAttributeText(config.Boost1.Mult.BonusType, amount)).TakeUntilDestroy(instance).ToReactiveProperty(); BundleBoost2 = (from comb in BundleBuyAmount.CombineLatest(gearRunner.Level, (int amount, int lvl) => new { amount, lvl }) select(comb.lvl != 0) ? GetBonusAmount(config.Boost2, comb.amount, initial: false) : GetBonusAmount(config.Boost2, comb.amount, initial: true) into amount select BonusTypeHelper.GetAttributeText(config.Boost2.Mult.BonusType, amount)).TakeUntilDestroy(instance).ToReactiveProperty(); }
private string GetPrefabPath() { GearRunner gearRunner = (GearRunner)Singleton <PropertyManager> .Instance.GetContext("GearRunner", base.transform); return("UI/GearItemProfiles/GearProfile." + gearRunner.GearIndex); }
public void UpgradeGearWithoutLimit(int gear, int levels) { GearRunner orCreateGearRunner = Singleton <GearCollectionRunner> .Instance.GetOrCreateGearRunner(gear); orCreateGearRunner.Level.Value += levels; }
private void SetNewBundle() { List <BundleTierConfig> bundles = PersistentSingleton <Economies> .Instance.BundleTiers; int value = PlayerData.Instance.LifetimeBundles.Value; if (value == 0 || PlayerData.Instance.LifetimePrestiges.Value == 0) { bundles = PersistentSingleton <Economies> .Instance.BundleTiers.FindAll((BundleTierConfig s) => s.BundleTier == 1); } else { switch (value) { case 1: bundles = PersistentSingleton <Economies> .Instance.BundleTiers.FindAll((BundleTierConfig s) => s.BundleTier == 2); break; case 2: bundles = PersistentSingleton <Economies> .Instance.BundleTiers.FindAll((BundleTierConfig s) => s.BundleTier == 3); break; } } int currentBundle = (int)bundles[UnityEngine.Random.Range(0, bundles.Count)].ProductEnum; if (PersistentSingleton <Economies> .Instance.IAPs.Find((IAPConfig s) => s.ProductEnum == (IAPProductEnum)currentBundle).Reward.Type == RewardEnum.AddToGearLevel) { BundleTierConfig bundleTierConfig = PersistentSingleton <Economies> .Instance.BundleTiers.Find((BundleTierConfig s) => s.ProductEnum == m_iapConfig.ProductEnum); List <GearSetRunner> list = new List <GearSetRunner>(); for (int j = 0; j < BundleTiersToGearSets.GetLength(1); j++) { if (BundleTiersToGearSets[bundleTierConfig.BundleTier - 1, j] != -1) { GearSetRunner orCreateGearSetRunner = Singleton <GearSetCollectionRunner> .Instance.GetOrCreateGearSetRunner(BundleTiersToGearSets[bundleTierConfig.BundleTier - 1, j]); if (orCreateGearSetRunner != null) { list.Add(orCreateGearSetRunner); } } } GearRunner gearRunner = Singleton <GearSetCollectionRunner> .Instance.GetRandomUnlockableGear(list); if (gearRunner == null) { gearRunner = Singleton <GearSetCollectionRunner> .Instance.GetRandomHighestGear(list); } if (gearRunner != null) { PlayerData.Instance.CurrentBundleGearIndex.Value = gearRunner.GearIndex; } else { int i; for (i = bundles.Count - 1; i >= 0; i--) { IAPConfig iAPConfig = PersistentSingleton <Economies> .Instance.IAPs.Find((IAPConfig s) => s.ProductEnum == bundles[i].ProductEnum); if (iAPConfig.Reward.Type == RewardEnum.AddToGearLevel) { bundles.Remove(bundles[i]); } } if (bundles.Count == 0) { bundles.Add(PersistentSingleton <Economies> .Instance.BundleTiers.Find((BundleTierConfig s) => s.ProductEnum == IAPProductEnum.bundle1)); } currentBundle = (int)bundles[UnityEngine.Random.Range(0, bundles.Count)].ProductEnum; } } PlayerData.Instance.BundleTimeStamp.Value = ServerTimeService.NowTicks(); PlayerData.Instance.CurrentBundleEnum.SetValueAndForceNotify(currentBundle); if (PersistentSingleton <GameAnalytics> .Instance != null) { PersistentSingleton <GameAnalytics> .Instance.NewBundle.Value = (IAPProductEnum)currentBundle; } }
public void DebugGiveGear(int gear) { GearRunner orCreateGearRunner = Singleton <GearCollectionRunner> .Instance.GetOrCreateGearRunner(gear); orCreateGearRunner.Level.Value++; }