Beispiel #1
0
        public void LoadEditor()
        {
            if (Application.isPlaying)
            {
                return;
            }

            if (!Manager.IsAwake <Mods>())
            {
                Manager.WakeUp <Mods>("__MODS");
            }
            Mods.Get.Editor.InitializeEditor();
            DefaultSkillStartupSettings.Clear();

            //load all skills from mods
            List <string> skillNames = Mods.Get.ModDataNames("Skill");

            foreach (string skillName in skillNames)
            {
                Transform      parentObject   = gameObject.FindOrCreateChild("Skills");
                SkillSaveState skillSaveState = null;
                if (Mods.Get.Editor.LoadMod <SkillSaveState>(ref skillSaveState, "Skill", skillName))
                {
                    GameObject newSkillObject = new GameObject(skillName);
                    Skill      newSkill       = null;
                    if (!string.IsNullOrEmpty(skillSaveState.ClassName))
                    {
                        //if we use a custom script then add it now
                        Component skillComponent = newSkillObject.AddComponent(Type.GetType("Frontiers.World.Gameplay." + skillSaveState.ClassName));
                        //UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(newSkillObject, "Assets/Scripts/Managers/Skills.cs (533,40)", skillSaveState.ClassName);
                        newSkill = skillComponent as Skill;
                    }
                    else
                    {
                        //otherwise just use the normal skill
                        newSkill = newSkillObject.AddComponent <Skill>();
                    }
                    if (newSkill != null)
                    {
                        //load the state'
                        newSkill.CheckExtensionProps();
                        newSkill.SaveState = skillSaveState;
                        //add it to the list
                        SkillList.Add(newSkill);
                        //create the subgroup lookup and parent it underneath
                        if (!string.IsNullOrEmpty(newSkill.Info.SkillGroup))
                        {
                            parentObject = parentObject.gameObject.FindOrCreateChild(newSkill.Info.SkillGroup);
                            if (!string.IsNullOrEmpty(newSkill.Info.SkillSubgroup))
                            {
                                parentObject = parentObject.gameObject.FindOrCreateChild(newSkill.Info.SkillSubgroup);
                            }
                        }
                        newSkill.transform.parent = parentObject.transform;
                    }

                    DefaultSkillStartupSettings.Add(new SkillStartupSetting(skillName, newSkill.State.KnowledgeState, newSkill.HasBeenMastered));
                }
            }
        }
Beispiel #2
0
        protected void SaveSkill(string skillName)
        {
            Skill skill = null;

            if (mSkillsLookup.TryGetValue(skillName, out skill))
            {
                SkillSaveState skillSaveState = skill.SaveState;
                Mods.Get.Runtime.SaveMod <SkillSaveState> (skillSaveState, "Skill", skillSaveState.Name);
            }
        }
Beispiel #3
0
 protected void SaveSkills()
 {
     foreach (Skill skill in SkillList)
     {
         if (skill != null)
         {
             SkillSaveState skillSaveState = skill.SaveState;
             Mods.Get.Runtime.SaveMod <SkillSaveState> (skillSaveState, "Skill", skillSaveState.Name);
         }
     }
 }
Beispiel #4
0
        public void SaveEditor()
        {
            if (Application.isPlaying)
            {
                return;
            }

            if (!Manager.IsAwake <Mods>())
            {
                Manager.WakeUp <Mods>("__MODS");
            }
            Mods.Get.Editor.InitializeEditor();

            foreach (Skill skill in SkillList)
            {
                if (skill != null)
                {
                    skill.CheckExtensionProps();
                    SkillSaveState skillSaveState = skill.SaveState;
                    Mods.Get.Editor.SaveMod <SkillSaveState>(skillSaveState, "Skill", skillSaveState.Name);
                }
            }
        }
Beispiel #5
0
        protected void LoadSkills()
        {
            //destroy / clear all existing skills
            foreach (Skill skill in SkillList)
            {
                if (skill != null)
                {
                    GameObject.DestroyImmediate(skill.gameObject);
                }
            }
            SkillList.Clear();
            mSkillsLookup.Clear();
            mSkillsLookupByWorldItem.Clear();
            mSkillsLookupByWIScript.Clear();

            //load all skills from mods
            List <string> skillNames = Mods.Get.ModDataNames("Skill");

            foreach (string skillName in skillNames)
            {
                Transform      parentObject   = gameObject.FindOrCreateChild("Skills");
                SkillSaveState skillSaveState = null;
                if (Mods.Get.Runtime.LoadMod <SkillSaveState> (ref skillSaveState, "Skill", skillName))
                {
                    GameObject newSkillObject = new GameObject(skillName);
                    Skill      newSkill       = null;
                    if (!string.IsNullOrEmpty(skillSaveState.ClassName))
                    {
                        //if we use a custom script then add it now
                        Component skillComponent = newSkillObject.AddComponent(Type.GetType("Frontiers.World.Gameplay." + skillSaveState.ClassName));
                        //UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent (newSkillObject, "Assets/Scripts/Managers/Skills.cs (420,34)", skillSaveState.ClassName);
                        newSkill = skillComponent as Skill;
                    }
                    else
                    {
                        //otherwise just use the normal skill
                        newSkill = newSkillObject.AddComponent <Skill> ();
                    }
                    if (newSkill != null)
                    {
                        //load the state
                        newSkill.CheckExtensionProps();
                        newSkill.SaveState = skillSaveState;
                        //spyglass related skills require a particular fix
                        //due to a mismatch between script and item name
                        //just fix it here, nobody cares
                        for (int i = 0; i < newSkill.Requirements.RequiredEquippedWIScriptNames.Count; i++)
                        {
                            if (newSkill.Requirements.RequiredEquippedWIScriptNames [i] == "Spyglass")
                            {
                                newSkill.Requirements.RequiredEquippedWIScriptNames [i] = "SpyGlass";
                            }
                        }
                        for (int i = 0; i < newSkill.Usage.TargetWIScriptNames.Count; i++)
                        {
                            if (newSkill.Usage.TargetWIScriptNames [i] == "Spyglass")
                            {
                                newSkill.Usage.TargetWIScriptNames [i] = "SpyGlass";
                            }
                        }
                        //add it to the list
                        SkillList.Add(newSkill);
                        //create the subgroup lookup and parent it underneath
                        if (!string.IsNullOrEmpty(newSkill.Info.SkillGroup))
                        {
                            parentObject = parentObject.gameObject.FindOrCreateChild(newSkill.Info.SkillGroup);
                            if (!string.IsNullOrEmpty(newSkill.Info.SkillSubgroup))
                            {
                                parentObject = parentObject.gameObject.FindOrCreateChild(newSkill.Info.SkillSubgroup);
                            }
                        }
                        newSkill.transform.parent = parentObject.transform;
                    }
                }
            }
        }