Esempio n. 1
0
    public static CharacterJobList  Create()
    {
        CharacterJobList asset = ScriptableObject.CreateInstance <CharacterJobList>();

        AssetDatabase.CreateAsset(asset, "Assets/Scripts/Characters/JobScript/CharacterJobList.asset");
        AssetDatabase.SaveAssets();
        return(asset);
    }
Esempio n. 2
0
 void  OnEnable()
 {
     if (EditorPrefs.HasKey("ObjectPath"))
     {
         string objectPath = EditorPrefs.GetString("ObjectPath");
         CharacterJobList = AssetDatabase.LoadAssetAtPath(objectPath, typeof(CharacterJobList)) as CharacterJobList;
     }
 }
Esempio n. 3
0
 void CreateNewJobList()
 {
     // There is no overwrite protection here!
     // There is No "Are you sure you want to overwrite your existing object?" if it exists.
     // This should probably get a string from the user to create a new name and pass it ...
     viewIndex        = 1;
     CharacterJobList = CreateCharacterJobList.Create();
     if (CharacterJobList)
     {
         CharacterJobList.JobList = new List <CharacterJob>();
         string relPath = AssetDatabase.GetAssetPath(CharacterJobList);
         EditorPrefs.SetString("ObjectPath", relPath);
     }
 }
Esempio n. 4
0
    void OpenJobList()
    {
        string absPath = EditorUtility.OpenFilePanel("Select Character Job List", "", "");

        if (absPath.StartsWith(Application.dataPath))
        {
            string relPath = absPath.Substring(Application.dataPath.Length - "Assets".Length);
            CharacterJobList = AssetDatabase.LoadAssetAtPath(relPath, typeof(CharacterJobList)) as CharacterJobList;
            if (CharacterJobList.JobList == null)
            {
                CharacterJobList.JobList = new List <CharacterJob>();
            }
            if (CharacterJobList)
            {
                EditorPrefs.SetString("ObjectPath", relPath);
            }
        }
    }