Beispiel #1
0
    public static void BuildFileIndex()
    {
        string resPath = (ResourcePath.GetBaseURL() + UUtility.GetPlatformName() + "/").Remove(0, 7);
        ///----------------------创建文件列表-----------------------
        string newFilePath = resPath + "files.txt";

        if (File.Exists(newFilePath))
        {
            File.Delete(newFilePath);
        }

        paths.Clear(); files.Clear();
        Recursive(resPath);

        FileStream   fs = new FileStream(newFilePath, FileMode.CreateNew);
        StreamWriter sw = new StreamWriter(fs);

        for (int i = 0; i < files.Count; i++)
        {
            string file = files[i];
            string ext  = Path.GetExtension(file);
            if (file.EndsWith(".meta") || file.Contains(".DS_Store") || file.Contains(".exe"))
            {
                continue;
            }

            string md5   = LuaUtil.md5file(file);
            string value = file.Replace(resPath, string.Empty);
            sw.WriteLine(value + "|" + md5 + "|" + filesLength[i]);
        }
        sw.Close(); fs.Close();
    }
Beispiel #2
0
    public static void CreateSeqImage()
    {
        string_rgb   = "rgb";
        string_alpha = "alpha";

        m_inCreate = false;
        string path = (ResourcePath.GetBaseURL() + AssetBundles.UUtility.GetPlatformName() + "/").Remove(0, 7);

        //if (AssetBundles.AssetManager.BaseDownloadingURL.IsNullOrEmpty())
        //{
        //    ResourceManager.Instance.Init(null);
        //}

        m_seqFileList = new List <string>();
        path         += m_orgPath;
        m_seqPath     = path.Replace(m_orgPath, m_newPath);
        path         += "/";
        Recursive(path);
    }
Beispiel #3
0
    private IEnumerator Initialize(System.Action Complete)
    {
        // With this code, when in-editor or using a development builds: Always use the AssetBundle Server
        // (This is very dependent on the production workflow of the project.
        //  Another approach would be to make this configurable in the standalone player.)
//#if DEVELOPMENT_BUILD || UNITY_EDITOR
//        AssetManager.SetDevelopmentAssetBundleServer();
//#else
//       AssetManager.SetSourceAssetBundleURL(ResourcePath.GetBaseURL());
//        // Use the following code if AssetBundles are embedded in the project for example via StreamingAssets folder etc:
//        AssetBundleManager.SetSourceAssetBundleURL(Application.dataPath + "/");
//        // Or customize the URL based on your deployment or configuration
//        //AssetBundleManager.SetSourceAssetBundleURL("http://www.MyWebsite/MyAssetBundles");
//#endif
        if (!Define.UseLoacalRes)
        {
            AssetManager.SetDevelopmentAssetBundleServer();
        }
        else
        {
            AssetManager.SetSourceAssetBundleURL(ResourcePath.GetBaseURL());
        }

        if (!Define.UpdateMode)
        {
            var request = AssetManager.Initialize(gameObject);
            if (request != null)
            {
                yield return(StartCoroutine(request));
            }
        }
        else
        {
            yield return(new WaitForSeconds(0.1f));
        }
        //Initialize AssetBundleManifest which loads the AssetBundleManifest object.

        if (null != Complete)
        {
            Complete();
        }
    }
Beispiel #4
0
    protected override void InitManager()
    {
//#if UNITY_ANDROID
//        m_baseDownloadingURL = string.Format("{0}/{1}/", Application.streamingAssetsPath, ResourceUtil.GetPlatformName());
//        m_baseDownloadingURL = AssetBundles.AssetManager.BaseDownloadingURL;

//#else
//        m_baseDownloadingURL = string.Format("File:///{0}/{1}/", Application.streamingAssetsPath, ResourceUtil.GetPlatformName());
//#endif

        m_baseDownloadingURL = AssetBundles.AssetManager.BaseDownloadingURL;

        //m_baseLocalStorage = string.Format("{0}/{1}/", Application.streamingAssetsPath, ResourceUtil.GetPlatformName());
        m_baseLocalStorage = ResourcePath.GetBaseURL() + ResourceUtil.GetPlatformName() + "/";

        //m_baseDownloadingURL = ResourcePath.GetBaseURL();
        //UnloadAssetBundle(ResourceUtil.GetPlatformName());

        //string manifestPath = string.Format("{0}/{1}/{1}", Application.streamingAssetsPath, ResourceUtil.GetPlatformName());

        //AssetBundle bundle = AssetBundle.LoadFromFile(manifestPath);
        //m_assetBundleManifest = (AssetBundleManifest)bundle.LoadAsset("AssetBundleManifest", typeof(AssetBundleManifest));
        //bundle.Unload(false);
    }