예제 #1
0
    public static void ReportExperienceGiven(PlayerProgress.ExperienceType expType, string identifier = "")
    {
        string key  = string.Format("exp_{0}{1}", expType.ToString(), identifier);
        int    @int = GameProgress.m_data.GetInt(key, 0);

        GameProgress.m_data.SetInt(key, @int + 1);
    }
예제 #2
0
    public static void SetPartUsed(BasePart part, bool used)
    {
        string key = string.Format("{0}_isUsed", part.name);

        if (!used && !GameProgress.HasKey(key, GameProgress.Location.Local, null))
        {
            GameProgress.SetBool(key, used, GameProgress.Location.Local);
        }
        else if (used && !GameProgress.GetBool(key, false, GameProgress.Location.Local, null))
        {
            GameProgress.SetBool(key, used, GameProgress.Location.Local);
            PlayerProgress.ExperienceType experienceType = PlayerProgress.ExperienceType.NewCommonPartViewed;
            if (part.m_partTier == BasePart.PartTier.Rare)
            {
                experienceType = PlayerProgress.ExperienceType.NewRarePartViewed;
            }
            else if (part.m_partTier == BasePart.PartTier.Epic)
            {
                experienceType = PlayerProgress.ExperienceType.NewEpicPartViewed;
            }
            else if (part.m_partTier == BasePart.PartTier.Legendary)
            {
                experienceType = PlayerProgress.ExperienceType.NewLegendaryPartViewed;
            }
            Singleton <PlayerProgress> .Instance.AddExperience(experienceType);
        }
    }
예제 #3
0
    private int RewardExperience()
    {
        ResourceBar.Instance.ShowItem(ResourceBar.Item.PlayerProgress, true, true);
        int num = 0;

        for (int i = 0; i < this.dailyChallenges.Length; i++)
        {
            if (this.dailyChallenges[i].collected)
            {
                num++;
            }
        }
        PlayerProgress.ExperienceType experienceType = PlayerProgress.ExperienceType.DailyLootCrateCollected1st;
        if (num == 2)
        {
            experienceType = PlayerProgress.ExperienceType.DailyLootCrateCollected2nd;
        }
        else if (num == 3)
        {
            experienceType = PlayerProgress.ExperienceType.DailyLootCrateCollected3rd;
        }
        return(Singleton <PlayerProgress> .Instance.AddExperience(experienceType));
    }
예제 #4
0
    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)
        {
        }
    }
예제 #5
0
 public static int ExperienceGiven(PlayerProgress.ExperienceType expType, string identifier = "")
 {
     return(GameProgress.m_data.GetInt(string.Format("exp_{0}{1}", expType.ToString(), identifier), 0));
 }