Exemple #1
0
 public static void Postfix(ref Skills __instance)
 {
     // TODO: Move into SkillsManager Register
     foreach (var pair in SkillManager.Instance.Skills)
     {
         Skills.SkillDef skill = pair.Value;
         __instance.m_skills.Add(skill);
         System.Console.WriteLine("Added extra skill: " + skill.m_skill);
     }
 }
Exemple #2
0
            public static void Postfix(Skills.SkillType type, ref Skills.SkillDef __result, List <Skills.SkillDef> ___m_skills)
            {
                if (__result == null)
                {
                    var def = GetSkillDef(type, ___m_skills);

                    if (def != null)
                    {
                        ___m_skills.Add(def);
                        __result = def;
                    }
                }
            }
Exemple #3
0
        public Skills.SkillType RegisterSkill(string name, string description, float increaseStep = 1f, Sprite icon = null)
        {
            LocalizationManager.Instance.RegisterTranslation("skill_" + nextSkillId, name);
            LocalizationManager.Instance.RegisterTranslation("skill_" + nextSkillId + "_description", description);

            Skills.SkillDef skillDef = new Skills.SkillDef()
            {
                m_skill       = (Skills.SkillType)nextSkillId,
                m_description = "$skill_" + nextSkillId + "_description",
                m_increseStep = increaseStep, // nice they spelled increase wrong
                m_icon        = icon
            };

            Skills.Add((Skills.SkillType)nextSkillId, skillDef);
            nextSkillId++;

            return(skillDef.m_skill);
        }
Exemple #4
0
        /// <summary>
        /// Register a new skill with given SkillConfig object, and registers translations for it in the current localization
        /// </summary>
        /// <param name="skillConfig">SkillConfig object representing new skill to register</param>
        /// <returns>The SkillType of the newly registered skill</returns>
        public Skills.SkillType RegisterSkill(SkillConfig skillConfig, bool registerLocalizations = true)
        {
            if (string.IsNullOrEmpty(skillConfig.Identifier))
            {
                Debug.LogError("Failed to register skill with invalid identifier: " + skillConfig.Identifier);
                return(global::Skills.SkillType.None);
            }

            if (Skills.ContainsKey(skillConfig.UID))
            {
                Debug.LogError("Failed to register skill with conflicting UID (m_skill): " + skillConfig.UID);
                return(global::Skills.SkillType.None);
            }

            if ((int)skillConfig.UID < 1000)
            {
                Debug.LogError("Failed to register skill with invalid UID (m_skill), please use a UID >= 1000: " + (int)skillConfig.UID);
                return(global::Skills.SkillType.None);
            }

            if (registerLocalizations)
            {
                LocalizationManager.Instance.RegisterTranslation("skill_" + skillConfig.UID, skillConfig.Name);
                LocalizationManager.Instance.RegisterTranslation("skill_" + skillConfig.UID + "_description", skillConfig.Description);
            }

            Skills.SkillDef skillDef = new Skills.SkillDef()
            {
                m_skill       = skillConfig.UID,
                m_description = "$skill_" + skillConfig.UID + "_description",
                m_increseStep = skillConfig.IncreaseStep,
                m_icon        = skillConfig.Icon
            };

            Skills.Add(skillConfig.UID, skillDef);
            return(skillDef.m_skill);
        }
Exemple #5
0
 public Skill(Skills.SkillDef info)
 {
     this.m_info = info;
 }