Exemple #1
0
    //循环加载依赖项
    public IEnumerator LoadDependencesAssetBundle(string path)
    {
        while (!isLoadManifestFinished)
        {
            yield return(null);
        }
        using (WWW www = new WWW(path))
        {
            yield return(www);

            if (!string.IsNullOrEmpty(www.error))
            {
                Debug.Log(www.error);
            }
            else
            {
                if (www.progress >= 1.0)
                {
                    AssetBundle ab = www.assetBundle;
                    if (!abDic.ContainsKey(ab.name))
                    {
                        abDic.Add(ab.name, ab);
                        Debug.Log("依赖ab.name = " + ab.name);
                    }

                    string[] dependences = assetManifest.GetAllDependencies(ab.name);
                    for (int i = 0, iMax = dependences.Length; i < iMax; ++i)
                    {
                        string abPath = IPathTools.GetAssetBundlePath() + "/" + dependences[i];
                        yield return(LoadDependencesAssetBundle(abPath));
                    }
                }
            }
        }
    }
Exemple #2
0
    public void ReadConfiger(string filePath)
    {
        string textFileName = "Record.txt";
        string path         = IPathTools.GetAssetBundlePath() + "/" + filePath + textFileName;

        ReadConfig(path);
    }
    /// <summary>
    /// 场景名字 SceneOne
    /// </summary>
    /// <param name="fileName"></param>
    public void ReadConfiger(string scenename)
    {
        string path = IPathTools.GetAssetBundlePath() + "/" + scenename + "Record.txt";

        allAsset  = new Dictionary <string, string>();
        abManager = new IABManager(scenename);
        ReadConfig(path);
    }
Exemple #4
0
    /// <summary>
    /// 通过场景名读取配置文件
    /// </summary>
    /// <param name="fileName">场景名字</param>
    public void ReadConfigByName(string sceneName)
    {
        string textFileName = "Record.txt";
        string path         = IPathTools.GetAssetBundlePath() + "/" + sceneName + textFileName;

        mABManager = new IABManager(sceneName);
        ReadConfigByPath(path);
    }
 private IABManifestLoader()
 {
     ABManifest     = null;
     ManifestLoader = null;
     mIsLoadFinish  = false;
     //ManifestPath = IPathTools.GetWWWAssetBundlePath() + "/" + IPathTools.GetPlatformFolderName(Application.platform);
     ManifestPath = IPathTools.GetAssetBundlePath() + "/" + IPathTools.GetPlatformFolderName(Application.platform);
 }
Exemple #6
0
    string GetBundlePath(string bundleName)
    {
        string path = Path.Combine(IPathTools.GetAssetBundlePath(), bundleName);

        path = IPathTools.StandardPath(path);
        Debug.Log(path);
        return(path);
    }
    public static void BuildAssetBundle()
    {
        //streamingassetpath
        string outPath = IPathTools.GetAssetBundlePath(); //Application.streamingAssetsPath + "/AssetBundle";

        BuildPipeline.BuildAssetBundles(outPath, 0, EditorUserBuildSettings.activeBuildTarget);
        AssetDatabase.Refresh();
    }
Exemple #8
0
    // Use this for initialization
    void Start()
    {
        manifestPath = IPathTools.GetABMainfestName();
        StartCoroutine(LoadManifest());

        string path = IPathTools.GetAssetBundlePath() + "/load.ab";

        StartCoroutine(LoadAssetBundle(path));
    }
    // 构造
    public IABManifestLoader()
    {
        assetManifest  = null;
        manifestLoader = null;
        isLoadFinish   = false;

        string manifestName = IPathTools.GetPlatformFolderName(Application.platform);

        manifestPath = IPathTools.GetAssetBundlePath() + "/" + manifestName;
    }
Exemple #10
0
    public void Initial(string bundlePath, LoaderProgress progress)
    {
        mIsLoadFinish   = false;
        mbundlePath     = bundlePath;
        mLoaderProgress = progress;
        mABLoader       = new IABLoader(progress, BundleLoadFinish);
        mABLoader.SetBundleName(bundlePath);
        string fullPathWWW  = IPathTools.GetWWWAssetBundlePath() + "/" + bundlePath;
        string fullPathFile = IPathTools.GetAssetBundlePath() + "/" + bundlePath;

        mABLoader.LoadResources(fullPathWWW, fullPathFile);
    }
Exemple #11
0
    public static void BuildeAssetBundle()
    {
        string outPath = IPathTools.GetAssetBundlePath();

        if (!Directory.Exists(outPath))
        {
            Directory.CreateDirectory(outPath);
        }

        BuildPipeline.BuildAssetBundles(outPath, 0, EditorUserBuildSettings.activeBuildTarget);

        AssetDatabase.Refresh();
    }
Exemple #12
0
    IEnumerator LoadAssetBundle(string path)
    {
        while (!isLoadManifestFinished)
        {
            yield return(null);
        }

        WWW www = new WWW(path);

        yield return(www);

        if (!string.IsNullOrEmpty(www.error))
        {
            Debug.Log(www.error);
        }
        else
        {
            AssetBundle ab = www.assetBundle;
            //Debug.Log("ab.name = " + ab.name);
            if (!abDic.ContainsKey(ab.name))
            {
                abDic.Add(ab.name, ab);
            }

            string[] dependence = assetManifest.GetAllDependencies(ab.name);
            for (int i = 0, iMax = dependence.Length; i < iMax; ++i)
            {
                Debug.Log(dependence[i]);
                if (!abDic.ContainsKey(dependence[i]))
                {
                    string _path = IPathTools.GetAssetBundlePath() + "/" + dependence[i];
                    yield return(LoadAssetBundle(_path));
                }
            }

            //实例化 Cube
            if (ab.name == "load.ab")
            {
                AssetBundle bundle = abDic[ab.name];
                Object      obj    = bundle.LoadAsset("Cube");
                Instantiate(obj, Vector3.zero, Quaternion.identity);
            }


            www.Dispose();
        }
    }
Exemple #13
0
    public void ReadConfiger(string scenceName)
    {
        //  string path="";
        // string path = Application.persistentDataPath + "/AssetBundle/" + scenceName + "Record.txt";


        string path = IPathTools.GetAssetBundlePath() + "/" + scenceName + "Record.txt";



        //Debug.Log("path:"+path );
        allAssets = new Dictionary <string, string>();

        aBsManager = new IABsManager(scenceName);


        ReadConfig(path);
    }
    public static void MarkAssetBundle()
    {
        AssetDatabase.RemoveUnusedAssetBundleNames();
        string        path = Application.dataPath + "/Prefabs/Scenes/";
        DirectoryInfo dir  = new DirectoryInfo(path);         //得到文件夹信息

        FileSystemInfo[] fileInfo = dir.GetFileSystemInfos(); //文件夹下的所有文件包括文件夹
        for (int i = 0; i < fileInfo.Length; i++)
        {
            FileSystemInfo info = fileInfo[i];
            if (info is DirectoryInfo)//说明当前info是文件夹
            {
                string tempPath = Path.Combine(path, info.Name);
                SceneOverView(tempPath);
            }
        }
        string outPath = IPathTools.GetAssetBundlePath();

        CopyRecord(path, outPath);
        AssetDatabase.Refresh();
    }
Exemple #15
0
    public static void MarkAssetBundle()
    {
        AssetDatabase.RemoveUnusedAssetBundleNames();

        string path = Application.dataPath + "/Art/Scenes/";

        DirectoryInfo dirInfo = new DirectoryInfo(path);

        // 遍历路径下的所有文件
        FileSystemInfo[] fileInfos = dirInfo.GetFileSystemInfos();
        for (int i = 0; i < fileInfos.Length; i++)
        {
            FileSystemInfo tempInfo = fileInfos[i];
            if (tempInfo is DirectoryInfo)
            {
                string tempPath = Path.Combine(path, tempInfo.Name);
                SceneOverView(tempPath);
            }
        }

        CopyRecord(path, IPathTools.GetAssetBundlePath());
        AssetDatabase.Refresh();
    }
    public static void MarkAssetBundle()
    {
        AssetDatabase.RemoveUnusedAssetBundleNames();

        string        path = Application.dataPath + "/Art/Scenes";
        DirectoryInfo dir  = new DirectoryInfo(path);

        FileSystemInfo[] fileInfo = dir.GetFileSystemInfos();

        for (int i = 0; i < fileInfo.Length; i++)
        {
            FileSystemInfo tmpFile = fileInfo[i];
            if (tmpFile is DirectoryInfo)
            {
                string tmpPath = Path.Combine(path, tmpFile.Name);
                tmpPath = FixedPath(tmpPath);
                SceneOverView(tmpPath);
            }
        }
        string outPath = IPathTools.GetAssetBundlePath();

        CopyRecord(path, outPath);
        AssetDatabase.Refresh();
    }
Exemple #17
0
    /// <summary>
    /// 读取配置
    /// </summary>
    /// <param name="sceneName">场景名字</param>
    public void ReadConfiger()
    {
        string path = IPathTools.GetAssetBundlePath() + "/" + sceneName + "/" + "Record.txt";

        ReadConfig(path);
    }
    public void Initial(string bundleName, LoaderProgrecess progress)
    {
        IsLoadFinish = false;

        theBundleName = bundleName;

        loaderProgrecess = progress;
        assetLoader      = new IABLoader(IPathTools.GetWWWAssetBundlePath() + "/" + theBundleName, IPathTools.GetAssetBundlePath() + "/" + theBundleName, theBundleName, progress, BundleLoadFinish);
    }