private void UpdateAlienPartSilhouette() { if (!AlienCustomizationManager.Initialized) { return; } if (!AlienCustomizationManager.HasCraftableItems) { this.nextAlienPartIcon.ClearSprite(); this.checkMark.SetActive(true); return; } this.checkMark.SetActive(false); BasePart basePart; if (AlienCustomizationManager.GetNextUnlockable(out basePart)) { string id = basePart.m_constructionIconSprite.Id; SpriteData spriteData = Singleton <RuntimeSpriteDatabase> .Instance.Find(id); this.nextAlienPartIcon.SetSprite(basePart.m_constructionIconSprite.gameObject); } else { this.nextAlienPartIcon.ClearSprite(); } }
public void CraftSelectedPart() { if (this.IsMachineLocked) { return; } this.queuedAddScrapActions = 0; BasePart.PartTier partTierFromAmount = this.GetPartTierFromAmount(GameProgress.GetInt("Machine_scrap_amount", 0, GameProgress.Location.Local, null)); Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(this.gameData.commonAudioCollection.craftLeverCrank); if (partTierFromAmount == BasePart.PartTier.Regular) { this.SetMachineAnimation(this.insufficientScrapAnimationName, false, false, true); Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(this.gameData.commonAudioCollection.craftEmpty); MaterialAnimation component = this.MachineLabel.GetComponent <MaterialAnimation>(); if (component != null) { component.PlayAnimation(true, 5); } return; } SnoutButton.Instance.EnableButton(false); int num = 0; BasePart basePart = null; if (partTierFromAmount == BasePart.PartTier.Legendary && AlienCustomizationManager.GetNextUnlockable(out basePart)) { num = AlienCustomizationManager.GetPrice(); } else if (partTierFromAmount != BasePart.PartTier.Legendary) { num = Singleton <GameConfigurationManager> .Instance.GetValue <int>(WorkshopMenu.CRAFT_PRICE_CONFIG_KEY, partTierFromAmount.ToString()); basePart = CustomizationManager.GetRandomCraftablePartFromTier(partTierFromAmount, true); } if (basePart && num > 0 && GameProgress.UseScrap(num)) { this.SetMachineAnimation((!this.IsAlienMachine) ? this.craftAnimationName : this.slimeCraftAnimationName, false, false, false); Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(this.gameData.commonAudioCollection.craftPart); CustomizationManager.UnlockPart(basePart, "crafted"); this.RemoveScrap(num); this.SetMachineIdleSound(0); PlayerProgress.ExperienceType experienceType = PlayerProgress.ExperienceType.CommonPartCrafted; if (partTierFromAmount == BasePart.PartTier.Rare) { experienceType = PlayerProgress.ExperienceType.RarePartCrafted; } if (partTierFromAmount == BasePart.PartTier.Epic) { experienceType = PlayerProgress.ExperienceType.EpicPartCrafted; } if (partTierFromAmount == BasePart.PartTier.Legendary) { experienceType = PlayerProgress.ExperienceType.LegendaryPartCrafted; } PlayerProgressBar.Instance.DelayUpdate(); int exp = Singleton <PlayerProgress> .Instance.AddExperience(experienceType); this.ShowReward(basePart, exp); string key = "CraftCount" + basePart.m_partTier.ToString(); int @int = GameProgress.GetInt(key, 0, GameProgress.Location.Local, null); GameProgress.SetInt(key, @int + 1, GameProgress.Location.Local); if (Singleton <SocialGameManager> .IsInstantiated() && basePart.m_partTier == BasePart.PartTier.Epic) { Singleton <SocialGameManager> .Instance.ReportAchievementProgress("grp.CRAFT_PARTS", 100.0); } this.partsCraftedWhileInScreen++; EventManager.Send(new CraftingMachineEvent(WorkshopMenu.CraftingMachineAction.CraftPart, 0)); } else if (basePart) { } }