public void CustomButtonPressed(int partTypeIndex, int partIndex) { if (this.cachedPartListing.LastMovement > 1.5f) { return; } BasePart customPart = WPFMonoBehaviour.gameData.GetCustomPart((BasePart.PartType)partTypeIndex, partIndex); this.cachedPartListing.UpdateSelectionIcon((BasePart.PartType)partTypeIndex, customPart.name); this.cachedPartListing.PlaySelectionAudio((BasePart.PartType)partTypeIndex, customPart.name); if (!CustomizationManager.IsPartUsed(customPart)) { this.cachedPartListing.ShowExperienceParticles((BasePart.PartType)partTypeIndex, customPart.name); CustomizationManager.SetPartUsed(customPart, true); } if (CustomizationManager.IsPartNew(customPart)) { CustomizationManager.SetPartNew(customPart, false); } CustomizationManager.SetLastUsedPartIndex((BasePart.PartType)partTypeIndex, partIndex); EventManager.Send(new PartCustomizationEvent((BasePart.PartType)partTypeIndex, partIndex)); if (this.onButtonPressed != null) { this.onButtonPressed((BasePart.PartType)partTypeIndex); if (this.customPartWidget != null) { this.customPartWidget.ClosePastList(); } } }
public static void UnlockPart(BasePart part, string unlockType) { if (CustomizationManager.IsPartUnlocked(part)) { return; } CustomizationManager.cachedUnlockedPartCount = -1; GameProgress.SetBool(part.name, true, GameProgress.Location.Local); CustomizationManager.SetPartNew(part, true); CustomizationManager.SetPartUsed(part, false); CustomizationManager.CheckUnlockPartAchievements(); if (CustomizationManager.OnPartUnlocked != null) { CustomizationManager.OnPartUnlocked(part); } }