Ejemplo n.º 1
0
    void ReadCharacterInfo()
    {
        characters = new List <Character>();
        CharacterImport temp = new CharacterImport();

        temp       = JsonUtility.FromJson <CharacterImport>(File.ReadAllText(Application.dataPath + "/characters.json"));
        characters = temp.characters;
    }
        public static FileInfo[] GetFileList(string absPath, string fileExtension)
        {
            if (!string.IsNullOrEmpty(absPath))
            {
                DirectoryInfo dir  = new DirectoryInfo(absPath);
                FileInfo[]    info = dir.GetFiles(fileExtension);


                // Einmalige ausgabe auf Console
                foreach (FileInfo f in info)
                {
                    //				Debug.Log("Found " + f.Name);
                    //				Debug.Log("f.DirectoryName=" + f.DirectoryName);
                    //				Debug.Log("f.FullName=" + f.FullName);
                    //				Debug.Log("modified=" + f.FullName.Substring(Application.dataPath.Length - "Assets".Length));
                    // relative pfad angabe
                    string currentSpritePath = f.FullName.Substring(Application.dataPath.Length - "Assets".Length);
                    Debug.Log("currentSpritePath=" + currentSpritePath);

                    //string charName = GetCharNameFromFileName(f.Name);
                    string charName = CharacterImport.GetInfoFromFileName(f.Name, FilenameFilter.CharacterName);
                    if (charName != null)
                    {
                        Debug.Log(charName);
                    }
                    else
                    {
                        Debug.LogError(f.Name + " konnte Character Name nicht extrahieren");
                    }
                }
                return(info);
            }
            else
            {
                Debug.LogError("absPath == \"\" or NULL ");
                return(null);
            }
        }