public void ClaimReward() { RewardType currentRewardType = RewardPigRescuePopup.CurrentRewardType; int currentRewardCount = RewardPigRescuePopup.CurrentRewardCount; GameProgress.DeleteKey("PigRescueRewardType", GameProgress.Location.Local); GameProgress.DeleteKey("PigRescueRewardCount", GameProgress.Location.Local); if (currentRewardType == RewardPigRescuePopup.RewardType.None || currentRewardCount <= 0) { return; } switch (currentRewardType) { case RewardPigRescuePopup.RewardType.Turbo: GameProgress.AddTurboCharge(currentRewardCount); break; case RewardPigRescuePopup.RewardType.Glue: GameProgress.AddSuperGlue(currentRewardCount); break; case RewardPigRescuePopup.RewardType.Magnet: GameProgress.AddSuperMagnet(currentRewardCount); break; case RewardPigRescuePopup.RewardType.Nightvision: GameProgress.AddNightVision(currentRewardCount); break; case RewardPigRescuePopup.RewardType.Supermechanic: GameProgress.AddBluePrints(currentRewardCount); break; } base.StartCoroutine(this.ClaimSequence()); }
private void GiveReward(DailyRewardBundle rewardBundle) { if (rewardBundle == null) { return; } List <DailyReward> list = rewardBundle.GetRewards(RewardSystem.CurrentRewardStatus.PendingRewardLevel); if (list == null) { return; } for (int i = 0; i < list.Count; i++) { DailyReward dailyReward = list[i]; string customTypeOfGain = "Odyssey daily reward"; switch (dailyReward.prize) { case PrizeType.SuperGlue: GameProgress.AddSuperGlue(dailyReward.prizeCount); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperGlueSingle, dailyReward.prizeCount, customTypeOfGain); } break; case PrizeType.SuperMagnet: GameProgress.AddSuperMagnet(dailyReward.prizeCount); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperMagnetSingle, dailyReward.prizeCount, customTypeOfGain); } break; case PrizeType.TurboCharge: GameProgress.AddTurboCharge(dailyReward.prizeCount); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.TurboChargeSingle, dailyReward.prizeCount, customTypeOfGain); } break; case PrizeType.SuperMechanic: GameProgress.AddBluePrints(dailyReward.prizeCount); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.BlueprintSingle, dailyReward.prizeCount, customTypeOfGain); } break; case PrizeType.NightVision: GameProgress.AddNightVision(dailyReward.prizeCount); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.NightVisionSingle, dailyReward.prizeCount, customTypeOfGain); } break; } } }
private void RewardPowerup(LootCrateRewards.Powerup powerup) { switch (powerup) { case LootCrateRewards.Powerup.Magnet: GameProgress.AddSuperMagnet(1); break; case LootCrateRewards.Powerup.Superglue: GameProgress.AddSuperGlue(1); break; case LootCrateRewards.Powerup.Turbo: GameProgress.AddTurboCharge(1); break; case LootCrateRewards.Powerup.Supermechanic: GameProgress.AddBluePrints(1); break; case LootCrateRewards.Powerup.NightVision: GameProgress.AddNightVision(1); break; } }
private void GiveGift() { int num = this.m_random.Next(0, 3); string customTypeOfGain = "Branded reward"; switch (num) { default: if (!WPFMonoBehaviour.levelManager.m_SuperGlueAllowed) { this.GiveGift(); } else { this.superGlueButton.SetActive(true); GameProgress.AddSuperGlue(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperGlueSingle, 1, customTypeOfGain); } } break; case 1: if (!WPFMonoBehaviour.levelManager.m_TurboChargeAllowed) { this.GiveGift(); } else { this.turboChargeButton.SetActive(true); GameProgress.AddTurboCharge(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.TurboChargeSingle, 1, customTypeOfGain); } } break; case 2: if (!WPFMonoBehaviour.levelManager.m_SuperMagnetAllowed) { this.GiveGift(); } else { this.superMagnetButton.SetActive(true); GameProgress.AddSuperMagnet(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperMagnetSingle, 1, customTypeOfGain); } } break; } }
protected override bool HandleUIEvent(UIEvent data) { UIEvent.Type type = data.type; if (type == UIEvent.Type.ReplayLevel) { base.StopRunningContraption(); this.levelManager.SetGameState(LevelManager.GameState.Building); return(true); } if (type != UIEvent.Type.NextLevel && type != UIEvent.Type.LevelSelection) { return(false); } if (this.levelManager.gameState != LevelManager.GameState.PausedWhileRunning) { if (this.levelManager.gameState == LevelManager.GameState.PausedWhileBuilding) { if (this.levelManager.ContraptionProto.HasSuperGlue) { GameProgress.AddSuperGlue(1); } if (this.levelManager.ContraptionProto.HasSuperMagnet) { GameProgress.AddSuperMagnet(1); } if (this.levelManager.ContraptionProto.HasTurboCharge) { GameProgress.AddTurboCharge(1); } if (this.levelManager.ContraptionProto.HasNightVision) { GameProgress.AddNightVision(1); } } else if (this.levelManager.gameState == LevelManager.GameState.Completed) { } } if (GameTime.IsPaused()) { GameTime.Pause(false); } if (data.type == UIEvent.Type.NextLevel) { CakeRaceMenu.FindNewPlayer = true; } this.levelManager.SetGameState(LevelManager.GameState.Undefined); Singleton <GameManager> .Instance.LoadCakeRaceMenu(true); return(true); }
protected void LoadContraptionFromSlot(int slotIndex) { if (this.ContraptionProto) { if (this.ContraptionProto.HasTurboCharge) { GameProgress.AddTurboCharge(1); EventManager.Send(new InGameBuildMenu.ApplyTurboChargeEvent(GameProgress.TurboChargeCount(), false)); } if (this.ContraptionProto.HasNightVision) { GameProgress.AddNightVision(1); EventManager.Send(new InGameBuildMenu.ApplyNightVisionEvent(GameProgress.NightVisionCount(), false)); } if (this.ContraptionProto.HasSuperGlue) { GameProgress.AddSuperGlue(1); EventManager.Send(new InGameBuildMenu.ApplySuperGlueEvent(GameProgress.SuperGlueCount(), false)); } if (this.ContraptionProto.HasSuperMagnet) { GameProgress.AddSuperMagnet(1); EventManager.Send(new InGameBuildMenu.ApplySuperMagnetEvent(GameProgress.SuperMagnetCount(), false)); } foreach (BasePart basePart in this.ContraptionProto.Parts) { this.ContraptionProto.DataSet.AddPart(basePart.m_coordX, basePart.m_coordY, (int)basePart.m_partType, basePart.customPartIndex, basePart.m_gridRotation, basePart.m_flipped); } this.ContraptionProto.SaveContraption(this.GetCurrentContraptionName()); this.levelManager.ConstructionUI.ClearContraption(); this.Destroy(this.ContraptionProto.gameObject); this.ContraptionProto = null; } this.CurrentContraptionIndex = slotIndex; Vector3 position = (!this.levelStart) ? Vector3.zero : this.levelStart.transform.position; if (this.gameData.m_contraptionPrefab) { Transform transform = UnityEngine.Object.Instantiate(this.gameData.m_contraptionPrefab, position, Quaternion.identity); this.ContraptionProto = transform.GetComponent <Contraption>(); } this.levelManager.ConstructionUI.SetCurrentContraption(); this.BuildContraption(WPFPrefs.LoadContraptionDataset(this.GetCurrentContraptionName())); foreach (ConstructionUI.PartDesc partDesc in this.levelManager.ConstructionUI.PartDescriptors) { EventManager.Send(new PartCountChanged(partDesc.part.m_partType, partDesc.CurrentCount)); } this.levelManager.ConstructionUI.SetMoveButtonStates(); this.levelManager.SetGameState(LevelManager.GameState.Building); }
public void AddLootCrate(LootCrateType lootCrateType, int amount, LootCrate.AnalyticData data, bool fromQueue = false, int xp = 0) { if (this.lootcrateRewardQueue == null) { this.lootcrateRewardQueue = new Queue <LootCrateRewardQueueElement>(); } if (this.lootCrateAnimation != null) { if (this.lootCrateAnimationInstance == null) { this.lootCrateAnimationInstance = UnityEngine.Object.Instantiate <GameObject>(this.lootCrateAnimation, Vector3.up * 1000f, Quaternion.identity); } else { this.lootCrateAnimationInstance.SetActive(true); } this.lootCrateAnimationInstance.transform.parent = base.transform; LootCrateRewardQueueElement lootCrateRewardQueueElement = null; if (!fromQueue) { bool flag = this.lootcrateRewardQueue.Count == 0; for (int i = 0; i < amount; i++) { lootCrateRewardQueueElement = new LootCrateRewardQueueElement(lootCrateType, data, xp); this.lootcrateRewardQueue.Enqueue(lootCrateRewardQueueElement); } if (!flag) { return; } } else { lootCrateRewardQueueElement = this.lootcrateRewardQueue.Peek(); } this.closeButton.SetActive(false); this.closeButtonGfx.SetActive(false); this.crateOpened = false; LootCrateRewards.SlotRewards[] randomRewards = LootCrateRewards.GetRandomRewards(lootCrateType); if (randomRewards == null) { return; } int num = 0; LootCrateButton componentInChildren = this.lootCrateAnimationInstance.GetComponentInChildren <LootCrateButton>(); componentInChildren.GainedXP = lootCrateRewardQueueElement.xp; componentInChildren.Init(lootCrateType); LootCrateButton lootCrateButton = componentInChildren; lootCrateButton.onOpeningDone = (Action)Delegate.Combine(lootCrateButton.onOpeningDone, new Action(delegate() { base.StartCoroutine(this.CrateOpened()); })); base.StartCoroutine(this.DelayIntro(componentInChildren, Vector3.forward * -1f)); List <BasePart> list = new List <BasePart>(); int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; List <int> list2 = new List <int>(); for (int j = 0; j < randomRewards.Length; j++) { int num8 = UnityEngine.Random.Range(0, randomRewards.Length); int num9 = randomRewards.Length; while (list2.Contains(num8) && num9 >= 0) { if (++num8 >= randomRewards.Length) { num8 = 0; } num9--; } if (num9 >= 0) { list2.Add(num8); LootCrateRewards.SlotRewards reward = randomRewards[num8]; LootCrateRewards.Reward type = reward.Type; switch (type) { case LootCrateRewards.Reward.Part: { bool isDuplicatePart = false; int num10 = 0; int num11 = 10; BasePart randomLootCrateRewardPartFromTier; do { randomLootCrateRewardPartFromTier = CustomizationManager.GetRandomLootCrateRewardPartFromTier(reward.PartTier, false); num11--; }while (list.Contains(randomLootCrateRewardPartFromTier) && num11 > 0); list.Add(randomLootCrateRewardPartFromTier); if (CustomizationManager.IsPartUnlocked(randomLootCrateRewardPartFromTier)) { num10 = Singleton <GameConfigurationManager> .Instance.GetValue <int>("part_salvage_rewards", randomLootCrateRewardPartFromTier.m_partTier.ToString()); GameProgress.AddScrap(num10); num2 += num10; num7++; isDuplicatePart = true; } else { CustomizationManager.UnlockPart(randomLootCrateRewardPartFromTier, lootCrateType.ToString() + "_crate"); } componentInChildren.SetIcon(num, randomLootCrateRewardPartFromTier.m_constructionIconSprite.gameObject, string.Empty, (int)reward.PartTier, isDuplicatePart, true); componentInChildren.SetScrapIcon(num, this.scrapIcons[0], num10.ToString()); BasePart.PartTier partTier = reward.PartTier; if (partTier != BasePart.PartTier.Common) { if (partTier != BasePart.PartTier.Rare) { if (partTier == BasePart.PartTier.Epic) { num6++; } } else { num5++; } } else { num4++; } break; } case LootCrateRewards.Reward.Powerup: { GameObject iconPrefab = this.powerUpIcons[reward.Powerup - LootCrateRewards.Powerup.Magnet]; string customTypeOfGain = lootCrateType.ToString() + " crate"; switch (reward.Powerup) { case LootCrateRewards.Powerup.Magnet: GameProgress.AddSuperMagnet(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperMagnetSingle, 1, customTypeOfGain); } break; case LootCrateRewards.Powerup.Superglue: GameProgress.AddSuperGlue(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperGlueSingle, 1, customTypeOfGain); } break; case LootCrateRewards.Powerup.Turbo: GameProgress.AddTurboCharge(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.TurboChargeSingle, 1, customTypeOfGain); } break; case LootCrateRewards.Powerup.Supermechanic: GameProgress.AddBluePrints(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.BlueprintSingle, 1, customTypeOfGain); } break; case LootCrateRewards.Powerup.NightVision: GameProgress.AddNightVision(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.NightVisionSingle, 1, customTypeOfGain); } break; } componentInChildren.SetIcon(num, iconPrefab, string.Empty, 0, false, true); break; } case LootCrateRewards.Reward.Dessert: if (reward.GoldenCupcake) { GameObject gameObject = WPFMonoBehaviour.gameData.m_desserts[WPFMonoBehaviour.gameData.m_desserts.Count - 1]; Dessert component = gameObject.GetComponent <Dessert>(); GameProgress.AddDesserts(component.saveId, 1); componentInChildren.SetIcon(num, this.dessertIcons[1], string.Empty, 0, false, true); } else { GameObject gameObject2 = WPFMonoBehaviour.gameData.m_desserts[UnityEngine.Random.Range(0, WPFMonoBehaviour.gameData.m_desserts.Count - 1)]; Dessert component2 = gameObject2.GetComponent <Dessert>(); GameProgress.AddDesserts(component2.saveId, reward.Desserts); componentInChildren.SetIcon(num, this.dessertIcons[0], reward.Desserts.ToString(), 0, false, true); } num3 += reward.Desserts; break; case LootCrateRewards.Reward.Scrap: { GameProgress.AddScrap(reward.Scrap); num2 += reward.Scrap; GameObject scrapRewardContainer = componentInChildren.SetIcon(num, this.scrapIcons[0], reward.Scrap.ToString(), 0, false, true); LootRewardElement component3 = scrapRewardContainer.GetComponent <LootRewardElement>(); if (component3 != null) { LootRewardElement lootRewardElement = component3; lootRewardElement.onRewardOpened = (Action)Delegate.Combine(lootRewardElement.onRewardOpened, new Action(delegate() { ScrapButton.Instance.AddParticles(scrapRewardContainer, reward.Scrap, 0f, (float)reward.Scrap); })); } break; } case LootCrateRewards.Reward.Coin: { GameProgress.AddSnoutCoins(reward.Coins); GameObject coinRewardContainer = componentInChildren.SetIcon(num, this.coinIcons[0], reward.Coins.ToString(), 0, false, true); LootRewardElement component4 = coinRewardContainer.GetComponent <LootRewardElement>(); if (component4 != null) { LootRewardElement lootRewardElement2 = component4; lootRewardElement2.onRewardOpened = (Action)Delegate.Combine(lootRewardElement2.onRewardOpened, new Action(delegate() { SnoutButton.Instance.AddParticles(coinRewardContainer, reward.Scrap, 0f, (float)reward.Scrap); })); } break; } } num++; } } if (lootCrateRewardQueueElement != null && num > 0) { lootCrateRewardQueueElement.SetRewarded(); int @int = GameProgress.GetInt(lootCrateType.ToString() + "_crates_collected", 0, GameProgress.Location.Local, null); GameProgress.SetInt(lootCrateType.ToString() + "_crates_collected", @int + 1, GameProgress.Location.Local); } EventManager.Send(new LootCrateDelivered(lootCrateType)); int value = GameProgress.GetInt("Total_parts_scrapped", 0, GameProgress.Location.Local, null) + num7; GameProgress.SetInt("Total_parts_scrapped", value, GameProgress.Location.Local); int value2 = GameProgress.GetInt("Total_parts_received", 0, GameProgress.Location.Local, null) + num4 + num5 + num6; GameProgress.SetInt("Total_parts_received", value2, GameProgress.Location.Local); } }
protected override bool HandleUIEvent(UIEvent data) { switch (data.type) { case UIEvent.Type.Building: this.levelManager.ConstructionUI.transform.position = this.levelManager.StartingPosition; this.levelManager.ContraptionProto.transform.position = this.levelManager.StartingPosition; this.levelManager.ConstructionUI.CheckUnlockedParts(); break; case UIEvent.Type.LevelSelection: if (this.levelManager.gameState == LevelManager.GameState.PausedWhileBuilding) { if (this.levelManager.ContraptionProto.HasSuperGlue) { GameProgress.AddSuperGlue(1); } if (this.levelManager.ContraptionProto.HasSuperMagnet) { GameProgress.AddSuperMagnet(1); } if (this.levelManager.ContraptionProto.HasTurboCharge) { GameProgress.AddTurboCharge(1); } if (this.levelManager.ContraptionProto.HasNightVision) { GameProgress.AddNightVision(1); } } break; case UIEvent.Type.NextLevel: break; case UIEvent.Type.Pause: break; case UIEvent.Type.Blueprint: if (GameProgress.GetBool("PermanentBlueprint", false, GameProgress.Location.Local, null)) { if (this.levelManager.m_threeStarContraption.Count == 1) { GameProgress.SetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available", true, GameProgress.Location.Local); } this.levelManager.SetGameState(LevelManager.GameState.AutoBuilding); } break; case UIEvent.Type.ReplayLevel: break; case UIEvent.Type.ContinueFromPause: break; case UIEvent.Type.CloseMechanicInfo: this.levelManager.SetGameState(LevelManager.GameState.Building); break; case UIEvent.Type.CloseMechanicInfoAndUseMechanic: this.levelManager.SetGameState(LevelManager.GameState.Building); Singleton <GuiManager> .Instance.IsEnabled = false; this.levelManager.UseBlueprint = true; break; case UIEvent.Type.SuperBlueprint: if (this.levelManager.SuperBluePrintsAllowed && this.levelManager.m_threeStarContraption.Count > 0 && this.levelManager.gameState == LevelManager.GameState.Building && WPFMonoBehaviour.ingameCamera.IsShowingBuildGrid(1f)) { bool flag = GameProgress.GetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available", false, GameProgress.Location.Local, null); int num = GameProgress.BluePrintCount(); if (num == 0 && !flag) { Singleton <GuiManager> .Instance.IsEnabled = true; this.levelManager.ShowPurchaseDialog(IapManager.InAppPurchaseItemType.BlueprintSingle); } else { if (!flag && num > 0) { GameProgress.SetBluePrintCount(--num); GameProgress.SetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available", true, GameProgress.Location.Local); flag = true; GameProgress.Save(); EventManager.Send(new InGameBuildMenu.AutoBuildEvent(num, true)); } GameObject superBuildSelection = this.levelManager.InGameGUI.BuildMenu.SuperBuildSelection; if (flag && !superBuildSelection.gameObject.activeSelf) { GameObject autoBuildButton = this.levelManager.InGameGUI.BuildMenu.AutoBuildButton; autoBuildButton.SetActive(false); superBuildSelection.SetActive(true); } if (flag) { EventManager.Send(new UIEvent(UIEvent.Type.RotateSuperBluePrints)); } } } break; case UIEvent.Type.RotateSuperBluePrints: { int count = this.levelManager.m_threeStarContraption.Count; string text = "ABCDEFGH"; this.levelManager.CurrentSuperBluePrint++; if (this.levelManager.CurrentSuperBluePrint >= count) { this.levelManager.CurrentSuperBluePrint = 0; } GameObject superBuildSelection2 = this.levelManager.InGameGUI.BuildMenu.SuperBuildSelection; if (superBuildSelection2 != null) { Transform transform = superBuildSelection2.transform.Find("AmountText"); Transform transform2 = superBuildSelection2.transform.Find("AmountTextShadow"); if (transform.GetComponent <TextMesh>().text == string.Empty) { this.levelManager.CurrentSuperBluePrint = 0; } transform.GetComponent <TextMesh>().text = text[this.levelManager.CurrentSuperBluePrint].ToString(); transform2.GetComponent <TextMesh>().text = text[this.levelManager.CurrentSuperBluePrint].ToString(); } this.levelManager.SetGameState(LevelManager.GameState.SuperAutoBuilding); if (!this.levelManager.FirstTime) { this.levelManager.FastBuilding = true; } else { this.levelManager.FirstTime = false; } break; } case UIEvent.Type.CloseMechanicInfoAndUseSuperMechanic: this.levelManager.SetGameState(LevelManager.GameState.Building); if (this.levelManager.SuperBluePrintsAllowed && this.levelManager.m_threeStarContraption.Count > 0) { Singleton <GuiManager> .Instance.IsEnabled = false; this.levelManager.UseSuperBlueprint = true; } else { Singleton <GuiManager> .Instance.IsEnabled = true; } break; } return(false); }
public override LevelManager.GameState SetGameState(LevelManager.GameState currentState, LevelManager.GameState newState) { LevelManager.GameState gameState = currentState; switch (newState) { case LevelManager.GameState.Building: if (GameTime.IsPaused()) { GameTime.Pause(false); } if (currentState == LevelManager.GameState.Running || currentState == LevelManager.GameState.PausedWhileRunning) { base.StopRunningContraption(); this.retries++; if (this.retries == 3 && !this.levelManager.m_sandbox && !this.tutorialBookOpened) { int num = GameProgress.GetInt("Tutorial_Promotion_Count", 0, GameProgress.Location.Local, null); if (num < 3 && !GameProgress.IsLevelCompleted(Singleton <GameManager> .Instance.CurrentSceneName) && GameProgress.GetInt(this.TutorialPromotionCount, 0, GameProgress.Location.Local, null) == 0) { this.openTutorial = true; num++; GameProgress.SetInt("Tutorial_Promotion_Count", num, GameProgress.Location.Local); GameProgress.SetInt(this.TutorialPromotionCount, 1, GameProgress.Location.Local); } } bool @bool = GameProgress.GetBool(Singleton <GameManager> .Instance.CurrentSceneName + "_autobuild_available", false, GameProgress.Location.Local, null); bool bool2 = GameProgress.GetBool("PermanentBlueprint", false, GameProgress.Location.Local, null); if (!this.levelManager.m_sandbox && this.retries % 5 == 0 && AdvertisementHandler.GetRewardNativeTexture() != null) { int @int = GameProgress.GetInt("branded_reward_gifts_today", 0, GameProgress.Location.Local, null); int num2 = 2; if (Singleton <GameConfigurationManager> .IsInstantiated() && Singleton <GameConfigurationManager> .Instance.HasValue("branded_reward_gift_count", "count")) { num2 = Singleton <GameConfigurationManager> .Instance.GetValue <int>("branded_reward_gift_count", "count"); } if (@int < num2) { if (!GameProgress.HasKey("branded_reward_gift_time", GameProgress.Location.Local, null)) { GameProgress.SetInt("branded_reward_gift_time", Singleton <TimeManager> .Instance.CurrentEpochTime, GameProgress.Location.Local); } GameProgress.SetInt("branded_reward_gifts_today", @int + 1, GameProgress.Location.Local); this.openMechanicGift = true; } } } if (this.levelManager.m_toolboxOpenUponShopActivation) { this.levelManager.InGameGUI.BuildMenu.ToolboxButton.OnPressed(); } this.levelManager.SetupDynamicObjects(); base.ContraptionProto.SetVisible(true); if (this.levelManager.ConstructionUI) { this.levelManager.ConstructionUI.SetEnabled(true, true); } if (GameProgress.GetString("REPLAY_LEVEL", string.Empty, GameProgress.Location.Local, null) == SceneManager.GetActiveScene().name&& LightManager.enabledLightPositions != null && LightManager.enabledLightPositions.Count > 0) { PointLightSource[] array = UnityEngine.Object.FindObjectsOfType <PointLightSource>(); for (int i = 0; i < array.Length; i++) { if (LightManager.enabledLightPositions.Contains(array[i].transform.position)) { array[i].isEnabled = true; } } GameProgress.SetString("REPLAY_LEVEL", string.Empty, GameProgress.Location.Local); } break; case LevelManager.GameState.Preview: this.levelManager.m_previewSpeed = 1f; this.levelManager.m_previewTime = 0f; base.ContraptionProto.SetVisible(false); if (this.levelManager.ConstructionUI) { this.levelManager.ConstructionUI.SetEnabled(false, true); } break; case LevelManager.GameState.PreviewMoving: this.levelManager.m_previewTime = 0f; base.ContraptionProto.SetVisible(false); if (this.levelManager.ConstructionUI) { this.levelManager.ConstructionUI.SetEnabled(false, true); } this.levelManager.SetupDynamicObjects(); break; case LevelManager.GameState.PreviewWhileBuilding: if (this.levelManager.EggRequired) { this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_eggTransportGoal); } else if (this.levelManager.PumpkinRequired) { this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_pumpkinTransportGoal); } else { this.levelManager.InGameGUI.PreviewMenu.SetGoal(base.gameData.m_basicGoal); } this.levelManager.InGameGUI.PreviewMenu.SetChallenges(this.levelManager.Challenges); if (this.levelManager.ConstructionUI) { this.levelManager.ConstructionUI.SetEnabled(false, true); } this.levelManager.PreviewCenter = base.ContraptionProto.transform.position; this.levelManager.m_previewDragging = false; break; case LevelManager.GameState.PreviewWhileRunning: this.levelManager.PreviewCenter = base.ContraptionRunning.transform.position; GameTime.Pause(true); this.levelManager.m_previewDragging = false; break; case LevelManager.GameState.Running: if (GameTime.IsPaused()) { GameTime.Pause(false); } this.levelManager.TimeElapsed = 0f; this.levelManager.PartsInGoal.Clear(); this.levelManager.TimeStarted = false; this.levelManager.PigStartPosition = base.ContraptionProto.FindPig().transform.position; if (this.levelManager.ConstructionUI) { this.levelManager.ConstructionUI.SetEnabled(false, false); } base.ContraptionRunning = base.ContraptionProto.Clone(); base.ContraptionProto.SetVisible(false); if (base.ContraptionProto.HasRegularGlue) { if (!base.ContraptionProto.HasGluedParts) { GameProgress.AddSuperGlue(1); } base.ContraptionProto.RemoveSuperGlue(); } if (base.ContraptionProto.HasSuperMagnet) { base.ContraptionProto.HasSuperMagnet = false; } if (base.ContraptionProto.HasNightVision) { this.levelManager.LightManager.ToggleNightVision(); base.ContraptionProto.HasNightVision = false; } base.ContraptionRunning.StartContraption(); if (base.ContraptionProto.HasTurboCharge) { base.ContraptionProto.HasTurboCharge = false; } base.ContraptionRunning.SaveContraption(base.GetCurrentContraptionName()); break; case LevelManager.GameState.Continue: if (GameTime.IsPaused()) { GameTime.Pause(false); } if (gameState == LevelManager.GameState.Building || gameState == LevelManager.GameState.PausedWhileBuilding) { newState = LevelManager.GameState.Building; } else if (gameState == LevelManager.GameState.CustomizingPart) { newState = LevelManager.GameState.CustomizingPart; } else if (!this.levelManager.HasCompleted && gameState == LevelManager.GameState.LootCrateOpening) { newState = LevelManager.GameState.Running; } else { newState = ((!this.levelManager.HasCompleted) ? LevelManager.GameState.Running : LevelManager.GameState.Completed); } break; case LevelManager.GameState.Completed: this.levelManager.InGameGUI.ShowCurrentMenu(false); base.ContraptionRunning.TurnOffAllPoweredParts(); this.levelManager.PlayVictorySound(); if (this.levelManager.EggRequired) { this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_eggTransportGoal); } else if (this.levelManager.PumpkinRequired) { this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_pumpkinTransportGoal); } else { this.levelManager.InGameGUI.LevelCompleteMenu.SetGoal(base.gameData.m_basicGoal); } this.levelManager.InGameGUI.LevelCompleteMenu.SetChallenges(this.levelManager.Challenges); break; case LevelManager.GameState.PausedWhileRunning: GameTime.Pause(true); break; case LevelManager.GameState.PausedWhileBuilding: GameTime.Pause(true); break; case LevelManager.GameState.AutoBuilding: this.levelManager.StartAutoBuild(this.levelManager.m_oneStarContraption); break; case LevelManager.GameState.ShowingUnlockedParts: GameTime.Pause(false); this.levelManager.UnlockedParts = new List <ConstructionUI.PartDesc>(this.levelManager.ConstructionUI.UnlockedParts); this.levelManager.UnlockedPartIndex = -1; this.levelManager.PartShowTimer = 0f; break; case LevelManager.GameState.Snapshot: GameTime.Pause(true); this.levelManager.InGameGUI.ShowCurrentMenu(false); WPFMonoBehaviour.ingameCamera.TakeSnapshot(new Action(this.levelManager.HandleSnapshotFinished)); break; case LevelManager.GameState.SuperAutoBuilding: this.levelManager.StartAutoBuild(this.levelManager.m_threeStarContraption[this.levelManager.CurrentSuperBluePrint]); if (Singleton <SocialGameManager> .IsInstantiated()) { Singleton <SocialGameManager> .Instance.ReportAchievementProgress("grp.CHIPS_FOR_WHIPS", 100.0); } break; } currentState = newState; return(currentState); }
private void OnGUI() { if (!this.skinInitialized) { this.cheatSkin = GUI.skin; float dpi = Screen.dpi; if (dpi > 1f) { this.cheatSkin.label.fontSize = Mathf.FloorToInt(0.1f * dpi + 2f); this.cheatSkin.button.fontSize = Mathf.FloorToInt(0.1f * dpi + 2f); } else { this.cheatSkin.label.fontSize = Mathf.FloorToInt(15f); this.cheatSkin.button.fontSize = Mathf.FloorToInt(15f); } this.cheatSkin.button.wordWrap = true; GUI.skin.verticalScrollbar.fixedWidth = (float)Screen.width * 0.05f; GUI.skin.verticalScrollbarThumb.fixedWidth = (float)Screen.width * 0.05f; this.skinInitialized = true; } this.scrollbarPosition = GUILayout.BeginScrollView(this.scrollbarPosition, new GUILayoutOption[] { GUILayout.Width((float)Screen.width), GUILayout.Height((float)Screen.height - (float)Screen.height * 0.1f) }); this.BeginGrid(); int gameModeIndex = UserSettings.GetInt("game_mode", 0); if (gameModeIndex >= 0 && gameModeIndex < CheatsUtility.gameModeNames.Count) { this.DrawButton("Toggle game mode:\n" + CheatsUtility.gameModeNames[gameModeIndex], delegate { gameModeIndex++; if (gameModeIndex >= CheatsUtility.gameModeNames.Count) { gameModeIndex = 0; } if (gameModeIndex == 0) { UserSettings.DeleteKey("game_mode"); } else { UserSettings.SetInt("game_mode", gameModeIndex); } }); } this.DrawButton("Reset progress", delegate { GameProgress.DeleteAll(); GameProgress.InitializeGameProgressData(); GameProgress.Save(); UserSettings.DeleteAll(); UserSettings.Save(); if (Singleton <DailyChallenge> .IsInstantiated() && Singleton <DailyChallenge> .Instance.Initialized) { Singleton <DailyChallenge> .Instance.ForceNewChallenge(); } }); this.DrawButton("1-star all levels", delegate { foreach (Episode episode in WPFMonoBehaviour.gameData.m_episodeLevels) { for (int i = 0; i < episode.LevelInfos.Count; i++) { this.SetStarsCompletion(episode.LevelInfos[i], 1); } } }); this.DrawButton("3-stars all but one", delegate { foreach (Episode episode in WPFMonoBehaviour.gameData.m_episodeLevels) { int num = UnityEngine.Random.Range(0, episode.LevelInfos.Count - 3); for (int i = 0; i < episode.LevelInfos.Count - 2; i++) { if (i != num) { this.SetStarsCompletion(episode.LevelInfos[i], 3); } } } }); this.DrawButton("3-stars all", delegate { foreach (Episode episode in WPFMonoBehaviour.gameData.m_episodeLevels) { for (int i = 0; i < episode.LevelInfos.Count; i++) { this.SetStarsCompletion(episode.LevelInfos[i], 3); } } }); this.DrawButton("Sandbox all starboxes", delegate { foreach (SandboxLevels.LevelData levelData in WPFMonoBehaviour.gameData.m_sandboxLevels.Levels) { for (int i = 0; i < levelData.m_starBoxCount; i++) { if (i < 10) { GameProgress.AddSandboxStar(levelData.SceneName, "StarBox0" + i, false); } else { GameProgress.AddSandboxStar(levelData.SceneName, "StarBox" + i, false); } } } }); this.DrawButton("Unlimited Sandbox Parts", delegate { IEnumerator enumerator = Enum.GetValues(typeof(BasePart.PartType)).GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; BasePart.PartType partType = (BasePart.PartType)obj; if (partType != BasePart.PartType.Unknown && partType != BasePart.PartType.ObsoleteWheel && partType != BasePart.PartType.JetEngine) { int sandboxPartCount = GameProgress.GetSandboxPartCount(partType); GameProgress.AddSandboxParts(partType, 99 - sandboxPartCount, false); } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } }); if (Application.targetFrameRate == 60) { this.DrawButton("Set low target FPS", delegate { Application.targetFrameRate = 25; }); } else { this.DrawButton("Set default target FPS", delegate { Application.targetFrameRate = 60; }); } this.DrawButton("Unlock all levels", delegate { GameProgress.SetBool("UnlockAllLevels", true, GameProgress.Location.Local); }); this.DrawButton("Restore IAPs", delegate { Singleton <IapManager> .Instance.RestorePurchasedItems(); }); this.DrawButton("Reset IAPs", delegate { GameProgress.SetBool("ResetIAPs", true, GameProgress.Location.Local); }); this.DrawButton("Add 10 Autobuilds", delegate { GameProgress.AddBluePrints(10); }); this.DrawButton("Add Wooden crate", delegate { GameProgress.AddLootcrate(LootCrateType.Wood, 1); }); this.DrawButton("Add Metal crate", delegate { GameProgress.AddLootcrate(LootCrateType.Metal, 1); }); this.DrawButton("Add Golden crate", delegate { GameProgress.AddLootcrate(LootCrateType.Gold, 1); }); this.DrawButton("Add 10 Glue, Magnet, Turbo and NightVision", delegate { GameProgress.AddSuperGlue(10); GameProgress.AddSuperMagnet(10); GameProgress.AddTurboCharge(10); GameProgress.AddNightVision(10); }); this.DrawButton("Unlock all sandboxes", delegate { GameProgress.UnlockButton("EpisodeButtonSandbox"); foreach (SandboxLevels.LevelData levelData in WPFMonoBehaviour.gameData.m_sandboxLevels.Levels) { if (!(levelData.m_identifier == "S-F") && !(levelData.m_identifier == "S-M")) { GameProgress.SetSandboxUnlocked(levelData.m_identifier, true); } } }); this.DrawButton("Unlock Field of Dreams", delegate { GameProgress.SetSandboxUnlocked("S-F", true); }); this.DrawButton("Unlock Little Pig Adventure", delegate { GameProgress.SetSandboxUnlocked("S-M", true); }); this.DrawButton("Unlock iOS Full version", delegate { GameProgress.SetFullVersionUnlocked(true); }); this.DrawButton("Mimic 1.8.0 install version. Game needs to be restarted.", delegate { GameProgress.SetString("InstallVersion", "1.8.0", GameProgress.Location.Local); GameProgress.DeleteKey("LastKnownVersion", GameProgress.Location.Local); }); this.DrawButton("Unlock & 3-star Race Levels except for last", delegate { List <RaceLevels.LevelData> levels = WPFMonoBehaviour.gameData.m_raceLevels.Levels; for (int i = 0; i < levels.Count - 1; i++) { GameProgress.SetInt(levels[i].m_identifier + "_stars", 3, GameProgress.Location.Local); GameProgress.SetBestTime(levels[i].SceneName, 10f); GameProgress.SetRaceLevelUnlocked(levels[i].m_identifier, true); } }); this.DrawButton("Add some desserts", delegate { int count = WPFMonoBehaviour.gameData.m_desserts.Count; int num = UnityEngine.Random.Range(1, count); for (int i = 0; i < num; i++) { string name = WPFMonoBehaviour.gameData.m_desserts[UnityEngine.Random.Range(0, count)].name; GameProgress.AddDesserts(name, UnityEngine.Random.Range(1, 6)); } }); this.DrawButton("Enable basic mechanic", delegate { GameProgress.SetBool("PermanentBlueprint", true, GameProgress.Location.Local); }); this.DrawButton("Test Force Update. You must relaunch the app manually", delegate { GameProgress.SetInt(CheatsUtility.versionStatusCheat, 3, GameProgress.Location.Local); }); this.DrawButton("Test Optional Update. You must relaunch the app manually", delegate { GameProgress.SetInt(CheatsUtility.versionStatusCheat, 1, GameProgress.Location.Local); }); this.DrawButton("Unlock All Free Levels", delegate { GameProgress.SetBool("UnlockAllFreeLevels", true, GameProgress.Location.Local); }); if (Singleton <RewardSystem> .IsInstantiated()) { string text = "Reward Timer Toggle\nReward time / Reset time\n"; switch (Singleton <RewardSystem> .Instance.GetTimerMode()) { case 0: text += "24h / 48h"; break; case 1: text += "15m / 30m"; break; case 2: text += "5m / 15m"; break; case 3: text += "1m / 1m 15s"; break; case 4: text += "5s / 10s"; break; } this.DrawButton(text, delegate { Singleton <RewardSystem> .Instance.ChangeTimerMode(); }); } this.DrawButton("Reset snout intro", delegate { GameProgress.SetInt("show_count_snout_intro", 0, GameProgress.Location.Local); }); this.DrawButton("Add 1000 snout coins", delegate { GameProgress.AddSnoutCoins(1000); }); this.DrawButton("Add 100 scrap", delegate { GameProgress.AddScrap(100); }); this.DrawButton("Unlock all custom parts", delegate { this.UnlockParts(BasePart.PartTier.Common); this.UnlockParts(BasePart.PartTier.Rare); this.UnlockParts(BasePart.PartTier.Epic); this.UnlockParts(BasePart.PartTier.Legendary); }); this.DrawButton("Unlock all Common parts", delegate { this.UnlockParts(BasePart.PartTier.Common); }); this.DrawButton("Unlock all Rare parts", delegate { this.UnlockParts(BasePart.PartTier.Rare); }); this.DrawButton("Unlock all Epic parts", delegate { this.UnlockParts(BasePart.PartTier.Epic); }); this.DrawButton("Unlock all Legendary parts", delegate { this.UnlockParts(BasePart.PartTier.Legendary); }); this.DrawButton("Unlock all craftable items", delegate { this.UnlockParts(BasePart.PartTier.Common, CustomizationManager.PartFlags.Locked | CustomizationManager.PartFlags.Craftable); this.UnlockParts(BasePart.PartTier.Rare, CustomizationManager.PartFlags.Locked | CustomizationManager.PartFlags.Craftable); this.UnlockParts(BasePart.PartTier.Epic, CustomizationManager.PartFlags.Locked | CustomizationManager.PartFlags.Craftable); this.UnlockParts(BasePart.PartTier.Legendary, CustomizationManager.PartFlags.Locked | CustomizationManager.PartFlags.Craftable); }); this.DrawButton("Reset Workshop Tutorial", delegate { GameProgress.DeleteKey("Workshop_Tutorial", GameProgress.Location.Local); }); this.DrawButton("Reset Crate Craze popup", delegate { GameProgress.SetBool("CrateCrazeSale_shown", false, GameProgress.Location.Local); }); bool processPurchases = GameProgress.GetBool("Process_purchases", true, GameProgress.Location.Local, null); this.DrawButton((!processPurchases) ? "Don't process purchases" : "Do process purchases", delegate { GameProgress.SetBool("Process_purchases", !processPurchases, GameProgress.Location.Local); }); this.DrawButton("CRASH CLIENT", delegate { string text2 = null; text2 = text2.ToString(); }); this.DrawButton("Force Garbage Collection", delegate { GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); }); bool fastNotifications = GameProgress.GetBool("fast_notifications", false, GameProgress.Location.Local, null); this.DrawButton((!fastNotifications) ? "Use faster notification schedule" : "Use realtime notification schedule", delegate { GameProgress.SetBool("fast_notifications", !fastNotifications, GameProgress.Location.Local); }); if (GameProgress.HasKey("notification_clicked", GameProgress.Location.Local, null)) { this.DrawButton("Clicked notification:\n" + GameProgress.GetString("notification_clicked", "null", GameProgress.Location.Local, null), null); } this.DrawButton("Clear PlayerPrefs", delegate { PlayerPrefs.DeleteAll(); }); this.DrawButton("Get all but one customizations", delegate { for (int i = 1; i < 4; i++) { List <BasePart> allTierParts = CustomizationManager.GetAllTierParts((BasePart.PartTier)i, CustomizationManager.PartFlags.Locked | CustomizationManager.PartFlags.Craftable | CustomizationManager.PartFlags.Rewardable); for (int j = 0; j < allTierParts.Count - 1; j++) { CustomizationManager.UnlockPart(allTierParts[j], "Cheat"); } } }); this.DrawButton("Reset level to 1", delegate { GameProgress.SetInt("player_level", 1, GameProgress.Location.Local); GameProgress.SetInt("player_experience", 0, GameProgress.Location.Local); GameProgress.SetInt("player_pending_experience", -1, GameProgress.Location.Local); }); this.DrawButton("Set level to 5", delegate { GameProgress.SetInt("player_level", 5, GameProgress.Location.Local); GameProgress.SetInt("player_experience", 0, GameProgress.Location.Local); GameProgress.SetInt("player_pending_experience", -1, GameProgress.Location.Local); }); this.DrawButton("Force local game configuration '" + GameProgress.GetBool("ForceLocalGameConfiguration", false, GameProgress.Location.Local, null) + "' (requires restart)", delegate { }); if (GameProgress.HasKey("cup_advance_cheat", GameProgress.Location.Local, null)) { this.DrawButton(string.Concat(new object[] { "Current cup:\n", CakeRaceMenu.GetCurrentLeaderboardCup().ToString(), "\nNext cup:\n", (PlayFabLeaderboard.Leaderboard)GameProgress.GetInt("cup_advance_cheat", 1, GameProgress.Location.Local, null) }), delegate { }); int rankCheat = GameProgress.GetInt("cup_rank_cheat", 0, GameProgress.Location.Local, null); this.DrawButton((!GameProgress.HasKey("cup_rank_cheat", GameProgress.Location.Local, null)) ? "Enable rank cheat" : ("Current Rank:\n" + rankCheat.ToString() + "\nLower rank?"), delegate { switch (rankCheat) { case 1: case 2: break; case 3: rankCheat = 5; goto IL_E6; default: if (rankCheat == 50) { rankCheat = 100; goto IL_E6; } if (rankCheat == 100) { rankCheat = 250; goto IL_E6; } if (rankCheat == 250) { rankCheat = 500; goto IL_E6; } if (rankCheat != 500) { rankCheat = 1; goto IL_E6; } break; case 5: rankCheat = 10; goto IL_E6; case 10: rankCheat = 50; goto IL_E6; } rankCheat++; IL_E6: GameProgress.SetInt("cup_rank_cheat", rankCheat, GameProgress.Location.Local); }); } else { this.DrawButton("Current cup:\n" + CakeRaceMenu.GetCurrentLeaderboardCup().ToString() + "\nAdvance to next Cup", delegate { int value = (int)(1 + CakeRaceMenu.GetCurrentLeaderboardCup()); value = Mathf.Clamp(value, (int)PlayFabLeaderboard.LowestCup(), (int)PlayFabLeaderboard.HighestCup()); GameProgress.SetInt("cup_advance_cheat", value, GameProgress.Location.Local); if (GameProgress.HasKey("cup_rank_cheat", GameProgress.Location.Local, null)) { GameProgress.DeleteKey("cup_rank_cheat", GameProgress.Location.Local); } }); } this.DrawButton("Reset cup cheats", delegate { if (GameProgress.HasKey("cup_advance_cheat", GameProgress.Location.Local, null)) { GameProgress.DeleteKey("cup_advance_cheat", GameProgress.Location.Local); } if (GameProgress.HasKey("cup_rank_cheat", GameProgress.Location.Local, null)) { GameProgress.DeleteKey("cup_rank_cheat", GameProgress.Location.Local); } GameProgress.SetInt("cake_race_current_cup", CakeRaceMenu.GetCupIndexFromPlayerLevel(), GameProgress.Location.Local); }); int leaderboardTestAmount = GameProgress.GetInt("cheat_leaderboard_test", -1, GameProgress.Location.Local, null); if (leaderboardTestAmount < 0) { this.DrawButton("Generate test leaderboard", delegate { GameProgress.SetInt("cheat_leaderboard_test", 0, GameProgress.Location.Local); }); } else { this.DrawButton("Test leaderboard amount:\n" + leaderboardTestAmount.ToString(), delegate { switch (leaderboardTestAmount) { case 0: case 1: case 2: case 3: case 4: break; case 5: leaderboardTestAmount = 8; goto IL_1D7; default: switch (leaderboardTestAmount) { case 500: case 501: case 502: break; default: if (leaderboardTestAmount == 25) { leaderboardTestAmount = 50; goto IL_1D7; } if (leaderboardTestAmount == 50) { leaderboardTestAmount = 75; goto IL_1D7; } if (leaderboardTestAmount == 75) { leaderboardTestAmount = 100; goto IL_1D7; } if (leaderboardTestAmount == 100) { leaderboardTestAmount = 175; goto IL_1D7; } if (leaderboardTestAmount == 175) { leaderboardTestAmount = 250; goto IL_1D7; } if (leaderboardTestAmount == 250) { leaderboardTestAmount = 425; goto IL_1D7; } if (leaderboardTestAmount != 425) { leaderboardTestAmount = 0; goto IL_1D7; } leaderboardTestAmount = 500; goto IL_1D7; } break; case 8: leaderboardTestAmount = 10; goto IL_1D7; case 10: leaderboardTestAmount = 25; goto IL_1D7; } leaderboardTestAmount++; IL_1D7: GameProgress.SetInt("cheat_leaderboard_test", leaderboardTestAmount, GameProgress.Location.Local); }); int leaderboardRankCheat = GameProgress.GetInt("cheat_leaderboard_test_local_rank", -1, GameProgress.Location.Local, null); this.DrawButton("Cheat player rank: " + (leaderboardRankCheat + 1), delegate { switch (leaderboardRankCheat + 1) { case 0: leaderboardRankCheat = 0; break; case 1: leaderboardRankCheat = 1; break; case 2: leaderboardRankCheat = 2; break; case 3: leaderboardRankCheat = 3; break; case 4: leaderboardRankCheat = 4; break; case 5: leaderboardRankCheat = 9; break; default: if (leaderboardRankCheat != 24) { if (leaderboardRankCheat != 49) { if (leaderboardRankCheat != 149) { if (leaderboardRankCheat != 499) { if (leaderboardRankCheat != 999) { if (leaderboardRankCheat != 9999) { if (leaderboardRankCheat == 99999) { leaderboardRankCheat = -1; } } else { leaderboardRankCheat = 99999; } } else { leaderboardRankCheat = 9999; } } else { leaderboardRankCheat = 999; } } else { leaderboardRankCheat = 499; } } else { leaderboardRankCheat = 149; } } else { leaderboardRankCheat = 49; } break; case 10: leaderboardRankCheat = 24; break; } GameProgress.SetInt("cheat_leaderboard_test_local_rank", leaderboardRankCheat, GameProgress.Location.Local); }); this.DrawButton("Clear test leaderboard", delegate { GameProgress.DeleteKey("cheat_leaderboard_test", GameProgress.Location.Local); GameProgress.DeleteKey("cheat_leaderboard_test_local_rank", GameProgress.Location.Local); }); } this.DrawButton("Reset alien machine", delegate { if (GameProgress.HasKey("AlienCraftingMachineShown", GameProgress.Location.Local, null)) { GameProgress.DeleteKey("AlienCraftingMachineShown", GameProgress.Location.Local); } }); this.DrawButton("Reset Cake Race unlock", delegate { if (GameProgress.HasKey("CakeRaceUnlockShown", GameProgress.Location.Local, null)) { GameProgress.SetBool("CakeRaceUnlockShown", false, GameProgress.Location.Local); } if (GameProgress.HasKey("UnlockShown_CakeRaceButton", GameProgress.Location.Local, null)) { GameProgress.SetBool("UnlockShown_CakeRaceButton", false, GameProgress.Location.Local); } }); this.DrawButton("Skip cake race tutorial", delegate { int @int = GameProgress.GetInt("cake_race_total_wins", 0, GameProgress.Location.Local, null); if (@int < 7) { GameProgress.SetInt("cake_race_total_wins", 7, GameProgress.Location.Local); } }); this.EndGrid(); GUILayout.EndScrollView(); GUI.Label(new Rect((float)Screen.width * 0.9f, (float)Screen.height * 0.93f, (float)Screen.width * 0.1f, (float)Screen.height * 0.1f), string.Concat(new string[] { "Debug \n(v", Singleton <BuildCustomizationLoader> .Instance.ApplicationVersion, " - ", Singleton <BuildCustomizationLoader> .Instance.SVNRevisionNumber, ")" })); if (GUI.Button(new Rect((float)Screen.width * 0.2f, (float)Screen.height * 0.92f, (float)Screen.width * 0.6f, (float)Screen.height * 0.08f), "Back to Main Menu")) { GameProgress.Save(); PlayerPrefs.Save(); Singleton <GameManager> .Instance.LoadMainMenu(false); } GUI.skin = null; }
private FeedingPrize.PrizeType GiveReward(GameObject dessert) { FeedingPrize.PrizeType result = FeedingPrize.PrizeType.None; int num = GameProgress.EatenDessertsCount(); if (UnityEngine.Random.value < this.m_PrizeProbability || num <= 1 || dessert.name == "GoldenCake") { FeedingPrize feedingPrize; if (num <= 1) { feedingPrize = null; foreach (FeedingPrize x in this.m_FeedingPrizes) { if (x.type == FeedingPrize.PrizeType.SuperGlue) { feedingPrize = x; break; } } } else { feedingPrize = this.SelectFeedingPrize(); } FeedingPrize feedingPrize2 = feedingPrize; if (dessert.name == "GoldenCake" && feedingPrize2.type == FeedingPrize.PrizeType.Junk) { feedingPrize2 = this.m_FeedingPrizes[1]; } if (feedingPrize2 != null) { if (feedingPrize2.type != FeedingPrize.PrizeType.Junk && feedingPrize2.type != FeedingPrize.PrizeType.None) { GameObject gameObject = this.m_Reward.transform.Find("Offset/AnimationNode").gameObject; if (gameObject.transform.childCount > 0) { UnityEngine.Object.Destroy(gameObject.transform.GetChild(0).gameObject); } GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(feedingPrize2.icon, gameObject.transform.position, gameObject.transform.rotation); gameObject2.transform.parent = gameObject.transform; gameObject2.transform.localScale = Vector3.one * feedingPrize2.iconScale; CurrencyParticleBurst burst = null; string text = "King Pig feeding prize"; switch (feedingPrize2.type) { case FeedingPrize.PrizeType.SuperGlue: GameProgress.AddSuperGlue(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperGlueSingle, 1, text); } break; case FeedingPrize.PrizeType.SuperMagnet: GameProgress.AddSuperMagnet(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperMagnetSingle, 1, text); } break; case FeedingPrize.PrizeType.TurboCharge: GameProgress.AddTurboCharge(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.TurboChargeSingle, 1, text); } break; case FeedingPrize.PrizeType.SuperMechanic: GameProgress.AddBluePrints(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.BlueprintSingle, 1, text); } break; case FeedingPrize.PrizeType.NightVision: GameProgress.AddNightVision(1); if (Singleton <IapManager> .Instance != null) { Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.NightVisionSingle, 1, text); } break; case FeedingPrize.PrizeType.SnoutCoins: { int value = Singleton <GameConfigurationManager> .Instance.GetValue <int>("king_pig_snout_reward", "min"); int value2 = Singleton <GameConfigurationManager> .Instance.GetValue <int>("king_pig_snout_reward", "max"); int num2 = UnityEngine.Random.Range(value, value2 + 1); if (num2 > 0) { if (Singleton <DoubleRewardManager> .Instance.HasDoubleReward) { num2 *= 2; } GameProgress.AddSnoutCoins(num2); GameObject gameObject3 = GameObject.FindGameObjectWithTag("KingPigMouth"); if (gameObject3 != null) { Camera main = Camera.main; Camera camera = Singleton <GuiManager> .Instance.FindCamera(); if (main == null || camera == null) { break; } Vector3 a = gameObject3.transform.position * (1f / main.orthographicSize); gameObject2.transform.parent = null; gameObject2.transform.position = a * camera.orthographicSize; } burst = gameObject2.GetComponent <CurrencyParticleBurst>(); if (burst != null) { burst.SetBurst(num2, 10f, true); } } break; } case FeedingPrize.PrizeType.Scrap: { int value3 = Singleton <GameConfigurationManager> .Instance.GetValue <int>("king_pig_scrap_reward", "min"); int value4 = Singleton <GameConfigurationManager> .Instance.GetValue <int>("king_pig_scrap_reward", "max"); int num3 = UnityEngine.Random.Range(value3, value4 + 1); if (num3 > 0) { GameProgress.AddScrap(num3); GameObject gameObject4 = GameObject.FindGameObjectWithTag("KingPigMouth"); if (gameObject4 != null) { Camera main2 = Camera.main; Camera camera2 = Singleton <GuiManager> .Instance.FindCamera(); if (main2 == null || camera2 == null) { break; } Vector3 a2 = gameObject4.transform.position * (1f / main2.orthographicSize); gameObject2.transform.parent = null; gameObject2.transform.position = a2 * camera2.orthographicSize; } burst = gameObject2.GetComponent <CurrencyParticleBurst>(); if (burst != null) { burst.SetBurst(num3, 10f, true); } } break; } } if (feedingPrize2.type == FeedingPrize.PrizeType.SnoutCoins || feedingPrize2.type == FeedingPrize.PrizeType.Scrap) { this.DelayAction(delegate { if (burst != null) { burst.Burst(); } }, 1.3f); } else { this.DelayAction(delegate { this.m_Reward.SetActive(true); }, this.m_GrowDuration); } if (PlayerProgressBar.Instance != null && Singleton <PlayerProgress> .IsInstantiated()) { GameObject gameObject5 = GameObject.FindGameObjectWithTag("KingPigMouth"); Vector3 vector = gameObject5.transform.position * (1f / this.m_mainCam.orthographicSize); vector *= this.m_hudCam.orthographicSize; PlayerProgressBar.Instance.DelayUpdate(); int amount = Singleton <PlayerProgress> .Instance.AddExperience(PlayerProgress.ExperienceType.KingBurp); PlayerProgressBar.Instance.AddParticles(vector, amount, 1.3f, 0f, null); } if (Singleton <SocialGameManager> .IsInstantiated()) { Singleton <SocialGameManager> .Instance.ReportAchievementProgress("grp.KINGS_FAVORITE", 100.0); } } result = feedingPrize2.type; } } return(result); }