public static void ClearAssetName(string path, ResourceInfo info)
 {
     //清除AssetBundle的名字
     for (int i = 0; i < info.ResList.Count; i++)
     {
         AssetHeplerEditor.SetAssetBundleName(FileTools.CombinePath(RootPath + path, info.ResList[i].Path), "");
         //SetAssetNameToNull (mResourceInfo.ResList[i]);
     }
 }
Esempio n. 2
0
 public static void GetResItemInfo(ResourceInfo resInfo, string itemPath, bool isResident, List <string> assetNames)
 {
     string[] Dirs = Directory.GetDirectories("Assets/" + ModulePath + "/" + itemPath);
     for (int i = 0; i < Dirs.Length; i++)
     {
         string           path = Dirs[i].Replace("\\", "/");
         string           name = FileTools.GetFullName(path);
         ResourceItemInfo item = new ResourceItemInfo();
         item.Path       = itemPath + "/" + name;
         item.Name       = name;
         item.IsResident = isResident;
         item.ResNames   = new List <string>();
         resInfo.ResList.Add(item);
         assetNames.Add(item.Name);
         item.IsAsset = AssetHeplerEditor.SetAssetBundleName(path, item.Name, item.ResNames);
     }
 }
//	static void SetAssetNameToNull(ResourceItemInfo itemInfo) {
//		for (int i = 0; i < itemInfo.Dependencies.Count; i++) {
//			AssetHeplerEditor.SetAssetBundleName (FileTools.CombinePath(RootPath + AssetPath, itemInfo.Dependencies[i].Path), "");
//			SetAssetNameToNull (itemInfo.Dependencies[i]);
//		}
//	}

//	static void AddBundleName(ResourceItemInfo itemInfo) {
//		for (int i = 0; i < itemInfo.Dependencies.Count; i++) {
//			if (itemInfo.Dependencies [i].IsAsset) {
//				BundleNames.Add (itemInfo.Dependencies [i].Name);
//			}
//			AddBundleName (itemInfo.Dependencies [i]);
//		}
//	}

    public static void GetResItemInfo(ResourceInfo resInfo, string itemPath, bool isResident, List <string> assetNames)
    {
        //List<ResourceItemInfo> infos = new List<ResourceItemInfo> ();
        string[] Dirs = Directory.GetDirectories(RootPath + AssetPath + "/" + itemPath);
        for (int i = 0; i < Dirs.Length; i++)
        {
            string           path = Dirs[i].Replace("\\", "/");
            string           name = FileTools.GetFullName(path);
            ResourceItemInfo item = new ResourceItemInfo();
            item.Path       = itemPath + "/" + name;
            item.Name       = name;
            item.IsResident = isResident;
            GetResItemInfo(resInfo, item.Path, isResident, assetNames);
            //item.Dependencies = GetResItemInfo (item.Path, isResident);
            item.ResNames = new List <string> ();
            //infos.Add (item);
            resInfo.ResList.Add(item);
            assetNames.Add(item.Name);
            item.IsAsset = AssetHeplerEditor.SetAssetBundleName(path, item.Name, item.ResNames);
        }
        //return infos;
    }
Esempio n. 4
0
    static void CreateAsset(string rootName, string name, int appV, int codeV, int resV)
    {
        PublishEditor.MoveResToModuleAsset(name);
        BundleNames.Clear();
        ResourceInfo resInfo = new ResourceInfo();

        resInfo.AppVersion  = appV;
        resInfo.CodeVersion = codeV;
        resInfo.ResVersion  = resV;
        resInfo.ResList     = new List <ResourceItemInfo> ();
        ResourceItemInfo item = new ResourceItemInfo();

        item.Path       = name;
        item.Name       = name;
        item.IsResident = false;
        GetResItemInfo(resInfo, item.Path, false, BundleNames);
        item.ResNames = new List <string> ();
        resInfo.ResList.Add(item);
        item.IsAsset = AssetHeplerEditor.SetAssetBundleName("Assets/" + rootName + "/" + name, item.Name, item.ResNames);

        string outP = GetOutPath(CreateAssetBundle.AssetPath);

        //FileTools.ClearDirectory (outP);
        FileTools.CreateDirectory(outP);

        BuildPipeline.BuildAssetBundles(outP, BuildAssetBundleOptions.UncompressedAssetBundle | BuildAssetBundleOptions.ForceRebuildAssetBundle, EditorUserBuildSettings.activeBuildTarget);

        CreateAssetBundle.SetDependencies(resInfo, outP);

        CreateAssetBundle.SaveResInfoFile(FileTools.CombinePath(outP, name + CreateAssetBundle.ResInfoName), resInfo);

        CreateAssetBundle.ClearAssetName(rootName, resInfo);

        //CopyToSteaming(rootName, name);
        PublishEditor.MoveModuleAssetToRes(name);
        AssetDatabase.Refresh();
        //EditorUtility.DisplayDialog("提示", "打包AssetBundle完成!", "确定");
    }
 public static void SetAssetName(ResourceInfo resInfo, string rootName, List <string> assetNames)
 {
     string[] Dirs = Directory.GetDirectories(RootPath + rootName);
     for (int i = 0; i < Dirs.Length; i++)
     {
         string path = Dirs[i].Replace("\\", "/");
         string name = FileTools.GetFullName(path);
         //Debug.LogWarning (path);
         //Debug.LogWarning (name);
         ResourceItemInfo item = new ResourceItemInfo();
         item.Path = name;
         item.Name = name;
         if (name == "resident")
         {
             item.IsResident = true;
         }
         GetResItemInfo(resInfo, item.Path, item.IsResident, assetNames);
         //item.Dependencies = GetResItemInfo (item.Path, item.IsResident);
         item.ResNames = new List <string> ();
         resInfo.ResList.Add(item);
         assetNames.Add(item.Name);
         item.IsAsset = AssetHeplerEditor.SetAssetBundleName(path, item.Name, item.ResNames);
     }
 }