Exemplo n.º 1
0
    private void Awake()
    {
        gatherProjectFolders();
#if (UNITY_WEBGL) && !UNITY_EDITOR
        for (int i = 0; i < projectFolders.Count; i++)
        {
            string cProject = projectFolders[i];
            if (!WebGL_FileSystem.ResourceReadyCheck(cProject))
            {
                lastPreparedProjectFolderidx = i;
                PrepareProjectFolder(cProject);
                break;
            }
        }
#endif
    }
Exemplo n.º 2
0
    private bool ResolveProjectFolder(string inProjectFolder, out string outProjectFolder)
    {
        outProjectFolder = null;

#if (UNITY_WEBGL) && !UNITY_EDITOR
        if (WebGL_FileSystem.ResourceReadyCheck(inProjectFolder))
        {
            outProjectFolder = inProjectFolder;
            return(true);
        }
        else
        {
            return(false);
        }
#endif

        if (string.IsNullOrEmpty(inProjectFolder))
        {
            return(false);
        }

        if (new DirectoryInfo(inProjectFolder).Exists)
        {
            outProjectFolder = inProjectFolder;
            return(true);
        }

#if UNITY_ANDROID
        if (ZIP_AndroidAssets.isUrl(inProjectFolder))
        {
            if (ZIP_AndroidAssets.synchronizeProjectFolder(inProjectFolder, out outProjectFolder))
            {
                return(true);
            }
        }
#endif

        return(false);
    }
Exemplo n.º 3
0
    private bool ResolveProjectFolder()
    {
        if (string.IsNullOrEmpty(projectFolder))
        {
            return(false);
        }

#if (UNITY_WEBGL) && !UNITY_EDITOR
        if (WebGL_FileSystem.ResourceReadyCheck(projectFolder))
        {
            liveProjectFolder = projectFolder;
            return(true);
        }
        else
        {
            return(false);
        }
#endif

        if (new DirectoryInfo(projectFolder).Exists)
        {
            //this should be activated on webgl as well
            liveProjectFolder = projectFolder;
            return(true);
        }

        //  Try to find a valid directory.  If projectFolder does not exist, append
        //  persistent data path to it and test again.
        if (!new DirectoryInfo(projectFolder).Exists)
        {
            string altProjectFolder = Application.persistentDataPath + "/" + projectFolder;
            if (new DirectoryInfo(altProjectFolder).Exists)
            {
                liveProjectFolder = altProjectFolder;
                return(true);
            }
        }

        //  Try to find a valid directory.  If projectFolder does not exist, append
        //  streaming asset path to it and test again.
        if (!new DirectoryInfo(projectFolder).Exists)
        {
            string altProjectFolder = Application.streamingAssetsPath + "/" + projectFolder;

#if UNITY_ANDROID
            //  streamingAssetsPath is a url (android), download assets locally.
            if (ZIP_AndroidAssets.isUrl(altProjectFolder))
            {
                string tmpProjectFolder;
                if (ZIP_AndroidAssets.synchronizeProjectFolder(altProjectFolder, out tmpProjectFolder))
                {
                    liveProjectFolder = tmpProjectFolder;
                    return(true);
                }
            }
            //  otherwise, a direct path on disk.
            else
#endif
            {
                if (new DirectoryInfo(altProjectFolder).Exists)
                {
                    liveProjectFolder = altProjectFolder;
                    return(true);
                }
            }
        }

        return(false);
    }