Exemple #1
0
    public string GetNextMilestoneText(int heroIndex, int heroLevel)
    {
        int             num             = (heroLevel + PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep) / PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep * PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep;
        BonusMultConfig milestoneOrNull = GetMilestoneOrNull(heroIndex, num);

        return(milestoneOrNull.Amount + " " + milestoneOrNull.BonusType + " on level " + num);
    }
Exemple #2
0
    public BonusMultConfig GetMiniMilestoneOrNull(int heroIndex, int startLevel, int endLevel)
    {
        if (startLevel <= 0 && endLevel <= 0)
        {
            return(null);
        }
        if (endLevel % PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep != 0 && endLevel - startLevel < PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep - startLevel % PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep)
        {
            return(null);
        }
        int num  = (startLevel + (PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep - startLevel % PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep)) / PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep - 1;
        int num2 = Mathf.FloorToInt((endLevel - startLevel - 1 - startLevel % PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep) / PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep + 1);

        if (num2 == 1)
        {
            if (IsPerkMilestone(heroIndex, (num + 1) * PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep))
            {
                return(null);
            }
            if (heroIndex == 0)
            {
                num %= PersistentSingleton <Economies> .Instance.HeroMiniMilestones.Count;
                return(PersistentSingleton <Economies> .Instance.HeroMiniMilestones[num]);
            }
            num %= PersistentSingleton <Economies> .Instance.CompanionMiniMilestones.Count;
            return(PersistentSingleton <Economies> .Instance.CompanionMiniMilestones[num]);
        }
        List <BonusMultConfig> list = new List <BonusMultConfig>();

        for (int i = 0; i < num2; i++)
        {
            if (!IsPerkMilestone(heroIndex, (num + i + 1) * PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep))
            {
                if (heroIndex == 0)
                {
                    list.Add(PersistentSingleton <Economies> .Instance.HeroMiniMilestones[(num + i) % PersistentSingleton <Economies> .Instance.HeroMiniMilestones.Count]);
                }
                else
                {
                    list.Add(PersistentSingleton <Economies> .Instance.CompanionMiniMilestones[(num + i) % PersistentSingleton <Economies> .Instance.CompanionMiniMilestones.Count]);
                }
            }
        }
        if (list.Count < 1)
        {
            return(null);
        }
        float num3 = 1f;

        for (int j = 0; j < list.Count; j++)
        {
            num3 *= list[j].Amount;
        }
        BonusMultConfig bonusMultConfig = new BonusMultConfig();

        bonusMultConfig.BonusType = list[0].BonusType;
        bonusMultConfig.Amount    = num3;
        return(bonusMultConfig);
    }
Exemple #3
0
    public static BonusMultConfig ParseBonusMultConfig(string str)
    {
        string[]        row             = str.Split('X');
        BonusMultConfig bonusMultConfig = new BonusMultConfig();

        bonusMultConfig.BonusType = row.asEnum(0, row.toError <BonusTypeEnum>());
        bonusMultConfig.Amount    = row.asFloat(1, row.toError <float>());
        return(bonusMultConfig);
    }
Exemple #4
0
    private string GetPrefabPath()
    {
        HeroRunner heroRunner = (HeroRunner)Singleton <PropertyManager> .Instance.GetContext("HeroRunner", base.transform);

        PerkRunner perkRunner = (PerkRunner)Singleton <PropertyManager> .Instance.GetContext("PerkRunner", base.transform);

        BonusMultConfig bonusMultConfig = PersistentSingleton <Economies> .Instance.PerkMilestoneConfigs[heroRunner.HeroIndex].Items[perkRunner.PerkIndex];

        return("UI/PerkPanels/PerkPanel." + bonusMultConfig.BonusType);
    }
Exemple #5
0
    public PerkRunner(int perkIndex, HeroRunner hero)
    {
        SceneLoader instance = SceneLoader.Instance;

        PerkIndex = perkIndex;
        Hero      = hero;
        Unlocked  = (from count in Hero.UnlockedPerkCount
                     select count > perkIndex).TakeUntilDestroy(instance).ToReactiveProperty();
        AtLevel = new ReactiveProperty <int>(PersistentSingleton <Economies> .Instance.PerkMilestones[PerkIndex]);
        BonusMultConfig bonusMultConfig = PersistentSingleton <Economies> .Instance.PerkMilestoneConfigs[Hero.HeroIndex].Items[PerkIndex];

        LocalizedTitle = new ReactiveProperty <string>(PersistentSingleton <LocalizationService> .Instance.Text("Perk." + bonusMultConfig.BonusType + ".Title"));
        LocalizedDesc  = new ReactiveProperty <string>(BonusTypeHelper.GetAttributeText(bonusMultConfig.BonusType, bonusMultConfig.Amount));
    }
Exemple #6
0
    private void ShowPerkUnlock(int hero, int perk)
    {
        if (PlayerData.Instance.HeroStates[hero].Level.Value >= PlayerData.Instance.HeroStates[hero].LifetimeLevel.Value)
        {
            base.gameObject.SetActive(value: true);
            BonusMultConfig bonusMultConfig = PersistentSingleton <Economies> .Instance.PerkMilestoneConfigs[hero].Items[perk];
            m_perkParent.transform.DestroyChildrenImmediate();
            GameObject gameObject = GameObjectExtensions.InstantiateFromResources(GetPrefabPath(bonusMultConfig));
            gameObject.transform.SetParent(m_perkParent.transform, worldPositionStays: false);
            m_perkName.text = PersistentSingleton <LocalizationService> .Instance.Text("Perk." + bonusMultConfig.BonusType + ".Title");

            m_perkAttribute.text = BonusTypeHelper.GetAttributeText(bonusMultConfig.BonusType, bonusMultConfig.Amount);
        }
    }
Exemple #7
0
    private BigDouble GetMiniDamageMult(List <BonusMultConfig> configs, int level, bool isHero)
    {
        BigDouble bigDouble = new BigDouble(1.0);
        int       i         = PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep;
        int       num       = 0;

        for (; i <= level; i += PersistentSingleton <GameSettings> .Instance.MiniMilestoneStep)
        {
            if (isHero || !PersistentSingleton <Economies> .Instance.PerkMilestones.Contains(i))
            {
                int             index           = num % configs.Count;
                BonusMultConfig bonusMultConfig = configs[index];
                bigDouble *= bonusMultConfig.Amount;
            }
            num++;
        }
        return(bigDouble);
    }
Exemple #8
0
 private string GetPrefabPath(BonusMultConfig cfg)
 {
     return("UI/PerkPanels/PerkPanel." + cfg.BonusType);
 }