示例#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();
            }
        }
    }
示例#2
0
 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);
     }
 }
示例#3
0
    private void RepositionIcons(PartData data, float xPos)
    {
        for (int i = 0; i < this.PartTierCount - 1; i++)
        {
            for (int j = 0; j < data.RowWidth(); j++)
            {
                int index = j;
                BasePart.PartTier tier          = (BasePart.PartTier)i;
                Vector3           localPosition = new Vector3(xPos + (float)index * this.horizontalPadding, (float)(this.PartTierCount / 2) - (float)i * this.verticalPadding + this.verticalPadding);
                localPosition.y += ((i != 0) ? 0f : this.firstRowPadding);
                if (!this.columns.Contains(localPosition.x))
                {
                    this.columns.Add(localPosition.x);
                }
                if (tier == BasePart.PartTier.Epic && index >= data.PartCount(tier))
                {
                    index -= data.PartCount(tier);
                    tier   = BasePart.PartTier.Legendary;
                }
                if (data.partInstances.ContainsKey(tier) && index < data.partInstances[tier].Count)
                {
                    data.partInstances[tier][index].transform.localPosition = localPosition;
                    if (CustomizationManager.IsPartNew(data.parts[tier][index]))
                    {
                        PartData   data_ = data;
                        GameObject gameObject;
                        if (this.AddNewContentTag(data.partInstances[tier][index], out gameObject))
                        {
                            GameObjectEvents gameObjectEvents  = gameObject.AddComponent <GameObjectEvents>();
                            GameObjectEvents gameObjectEvents2 = gameObjectEvents;
                            gameObjectEvents2.OnVisible = (Action <bool>) Delegate.Combine(gameObjectEvents2.OnVisible, new Action <bool>(delegate(bool visible)
                            {
                                if (visible)
                                {
                                    CustomizationManager.SetPartNew(data_.parts[tier][index], false);
                                }
                            }));
                            this.newButtons.Add(gameObject);
                        }
                    }
                }
            }
        }
        int lastUsedPartIndex = CustomizationManager.GetLastUsedPartIndex(data.PartType);

        data.UpdateSelectionIcon(this.gameData.GetCustomPart(data.PartType, lastUsedPartIndex).name);
    }