示例#1
0
    /// <summary>
    ///  创建文件夹
    /// </summary>
    /// <param name="packageName"></param>
    /// <param name="filterName"></param>
    /// <param name="packagePaths"></param>
    private static void CreateAbData(string packageName, string filterName, params string[] packagePaths)
    {
        string[] pps = new string[packagePaths.Length];
        for (int i = 0; i < packagePaths.Length; i++)
        {
            pps[i] = Path.Combine(RGResource.ROOT_PATH, packagePaths[i]);
            if (!Directory.Exists(pps[i]))
            {
                RGLog.DebugError("CreateAbData -> Path does not exist! " + pps[i]);
            }
        }

        string[] guids = AssetDatabase.FindAssets(filterName, pps);

        AssetBundleBuild abb = new AssetBundleBuild();

        abb.assetBundleName = packageName;
        abb.assetNames      = new string[guids.Length];

        for (int i = 0; i < guids.Length; i++)
        {
            string filePath = AssetDatabase.GUIDToAssetPath(guids[i]);

            if (_abbGUIList.Contains(guids[i]))
            {
                RGLog.DebugError("Has Add AB Item:" + filePath);
                continue;
            }

            abb.assetNames[i] = filePath;
        }

        _abbList.Add(abb);
    }
    public static string GetPackageName(string path)
    {
        string[] model = path.ToLower().Split(RGResource.PATH_SEPARATOR);

        // 包路径
        string packageUrl = "";

        if (model.Length > 0)
        {
            if (model[0].Equals("effect"))
            {
                //effect
                packageUrl = "effect";
            }
            else if (model[0].Equals("prefabs"))
            {
                // prefabs
                packageUrl = "prefabs";
            }

            RGLog.DebugResLoad("<color=yellow>Package Name = " + packageUrl + "</color>");
            return(packageUrl.ToLower());
        }

        RGLog.DebugError("GetPackagePath Error ! Path is Empty");

        return(string.Empty);
    }
示例#3
0
    // 获得AssetBundle资源包名
    public static string GetPackageName(string path)
    {
        string[] model = path.ToLower().Split(RGResource.PATH_SEPARATOR);

        // 包路径
        string packageUrl = "";

        for (int i = 0; i < model.Length; i++)
        {
            RGLog.Debug(model[i]);
        }
        if (model.Length > 0)
        {
            if (model[0].Equals("ui"))
            {
                // ui
                packageUrl = "ui/" + model[1];
            }

            return(packageUrl.ToLower());
        }
        RGLog.DebugError(" GetPackagePath Error! Path is Empty");
        return(string.Empty);
    }