Пример #1
0
 private void CharacterSheetInfoPanel_ShowSkill(On.CharacterSheetInfoPanel.orig_ShowSkill orig, CharacterSheetInfoPanel self, Sunshine.Metric.Skill skill)
 {
     orig(self, skill);
     if (SingletonComponent <CharsheetView> .Singleton.sheetMode == CharSheetMode.CREATION_SKILLS)
     {
         var buttonTooltipSource  = (TooltipSource)self.GetType().GetField("buttonTooltipSource", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(self);
         var buttonTooltipContent = (ButtonTooltip)self.GetType().GetField("buttonTooltipContent", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(self);
         if (LevelingUtils.IsSkillUpgradeable(skill))
         {
             self.skillLevelUpButton.SetInteractable(true);
             buttonTooltipSource.enabled = false;
         }
         else
         {
             self.skillLevelUpButton.SetInteractable(false);
             buttonTooltipSource.enabled = true;
             buttonTooltipContent.SetTooltip(CharacterSheetConstants.TOOLTIP_TITLE_LEVELUP_REQ, LevelingUtils.GetWhySkillCantBeUpgraded(skill), "");
         }
         self.levelUpButton.gameObject.SetActive(true);
         if (!self.levelUpButton.enabled)
         {
             Console.WriteLine("Enabling levelup button");
             self.levelUpButton.enabled = true;
         }
     }
 }
Пример #2
0
        private bool NoSkillUpgradable()
        {
            CharacterSheet character = SingletonComponent <CharsheetView> .Singleton.character;

            for (int i = 0; i < character.skills.Length; i++)
            {
                if (LevelingUtils.IsSkillUpgradeable(character.skills[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #3
0
        private bool LevelingUtils_UpgradeSkill(On.LevelingUtils.orig_UpgradeSkill orig, CharacterSheet character, SkillType skill)
        {
            if (SingletonComponent <CharsheetView> .Singleton.sheetMode == CharSheetMode.CREATION_SKILLS)
            {
                var modifier = character.GetSkill(skill).GetModifierOfType(ModifierType.CHARACTER_CREATION);
                if (LevelingUtils.IsSkillUpgradeable(character.GetSkill(skill)))
                {
                    modifier.Amount++;
                    LiteSingleton <PlayerCharacter> .Singleton.SkillPoints--;
                    character.Recalc();
                    SingletonComponent <CharsheetView> .Singleton.NotifyActivation();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(orig(character, skill));
            }
        }