Ejemplo n.º 1
0
    void Start()
    {
        m_DataInstance = this;

        sDefaultFolderPath = Application.dataPath + "/StreamingAssets/XML";

        GetFolder();
    }
    void Start()
    {
        m_DataInstance = this;

        sDefaultFolderPath = Application.dataPath + "/XML";

        if (CheckUrl(sLevelsFolderUrl))
        {
            FolderInfo = new DirectoryInfo(sLevelsFolderUrl);
        }
        else
        {
            FolderInfo       = new DirectoryInfo(sDefaultFolderPath);
            sLevelsFolderUrl = sDefaultFolderPath;
            Debug.LogError("FolderPath not assigned/is null, using default, assigning default as url");
        }

        if (FolderInfo != null)
        {
            FileInfo[] infos = FolderInfo.GetFiles("*.xml");

            foreach (FileInfo obj in infos)
            {
                //Debug.Log("FileInfo name : " + obj.Name);
                //Debug.Log("FileInfo name through path : " + Path.GetFileNameWithoutExtension(obj.Name));
                //Debug.Log("FileInfo full name : " + obj.FullName);

                FileUrls.Add(obj.FullName);
                FileNames.Add(Path.GetFileNameWithoutExtension(obj.Name));
            }
        }
        else
        {
            Debug.LogError("FolderInfo checked to be null");
        }

        gameObject.GetComponent <LoadedLevels>().vUpdateData();
    }