Beispiel #1
0
    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();
            }
        }
    }