コード例 #1
0
 private static void RemoveAllSymbols()
 {
     AssetHeplerEditor.RemoveSymbolsForGroup(BuildTargetGroup.Android, "SUPER_MY");
     AssetHeplerEditor.RemoveSymbolsForGroup(BuildTargetGroup.Android, "SUPER_PARK");
     AssetHeplerEditor.RemoveSymbolsForGroup(BuildTargetGroup.Android, "PACKAGE_ENGLISH");
     AssetHeplerEditor.RemoveSymbolsForGroup(BuildTargetGroup.Android, "PACKAGE_MATH");
 }
コード例 #2
0
 public static void ToPack()
 {
     RemoveAllSymbols();
     AssetHeplerEditor.AddSymbolsForGroup(BuildTargetGroup.Android, "SUPER_PARK");
     AssetDatabase.CopyAsset(VariResPath + "ui_update/UpdateForm_park.prefab", PublishEditor.ResPath + UpdatePath);
     AssetDatabase.Refresh();
 }
コード例 #3
0
 public static void ToMath()
 {
     RemoveAllSymbols();
     AssetHeplerEditor.AddSymbolsForGroup(BuildTargetGroup.Android, "PACKAGE_MATH");
     AssetDatabase.CopyAsset(VariResPath + "ui_update/UpdateForm_math.prefab", PublishEditor.ResPath + UpdatePath);
     AssetDatabase.Refresh();
 }
コード例 #4
0
    static void CreateUpdateFile(string path, ResourceInfo resInfo)
    {
        string updatePath = FileTools.CombinePath(path, UpdateFileName);

        resInfo.ResLength = 0;
        using (StreamWriter streamWriter = new StreamWriter(updatePath, false)) {
            string[] files = Directory.GetFiles(path);
            for (int i = 0; i < files.Length; i++)
            {
                string fileName = Path.GetFileName(files[i]);
                if (fileName.IndexOf(AssetHeplerEditor.GetPlatformName()) >= 0 || fileName.IndexOf(".meta") >= 0 || fileName.IndexOf(".manifest") >= 0 || !BundleNames.Contains(fileName))
                {
                    //文件夹名称的AssetBundle排除
                    continue;
                }
                if (fileName == ResInfoName || fileName == UpdateFileName)
                {
                    continue;
                }
                string md5      = FileTools.GetMD5(Path.Combine(AssetOutPath, fileName));
                string filePath = Path.Combine(path, fileName);
                long   size     = FileTools.GetFileSize(filePath);
                resInfo.ResLength += size;
                string value = fileName + ";" + size + ";" + md5;
                streamWriter.WriteLine(value);
                streamWriter.Flush();
            }
        }
    }
コード例 #5
0
 public static void PublishAndroidMy()
 {
     AssetHeplerEditor.RemoveSymbolsForGroup(BuildTargetGroup.Android, "SUPER_PARK");
     AssetHeplerEditor.AddSymbolsForGroup(BuildTargetGroup.Android, "SUPER_MY");
     PublishAndroid(PublishType.My);
     AssetHeplerEditor.RemoveSymbolsForGroup(BuildTargetGroup.Android, "SUPER_MY");
 }
コード例 #6
0
 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]);
     }
 }
コード例 #7
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);
     }
 }
コード例 #8
0
 static void ZipFileToServer(string serverPath)
 {
     string[] files = Directory.GetFiles(AssetOutPath);
     for (int i = 0; i < files.Length; i++)
     {
         string fileName = Path.GetFileName(files [i]);
         if (fileName.IndexOf(AssetHeplerEditor.GetPlatformName()) >= 0 || fileName.IndexOf(".meta") >= 0 || fileName.IndexOf(".manifest") >= 0 || !BundleNames.Contains(fileName))
         {
             //文件夹名称的AssetBundle排除
             continue;
         }
         if (fileName == ResInfoName)
         {
             continue;
         }
         string dp = FileTools.CombinePath(serverPath, fileName);
         ZipUtils.CompressFile(files[i], dp);
     }
 }
コード例 #9
0
//	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;
    }
コード例 #10
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完成!", "确定");
    }
コード例 #11
0
 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);
     }
 }
コード例 #12
0
 static string GetOutPath(string path)
 {
     return(FileTools.CombinePath(path, AssetHeplerEditor.GetPlatformName()));
 }
コード例 #13
0
    public static void SetDependencies(ResourceInfo itemInfo, string outPath)
    {
        //string info = File.ReadAllText (Path.Combine (AssetOutPath, ResInfoName));
        //ResourceInfo itemInfo = JsonUtility.FromJson<ResourceInfo> (info);

        AssetBundle         ab = AssetBundle.LoadFromFile(FileTools.CombinePath(outPath, AssetHeplerEditor.GetPlatformName()));
        AssetBundleManifest m  = ab.LoadAsset <AssetBundleManifest> ("AssetBundleManifest");

        //Debug.Log (m.GetAllDependencies("10001")[0]);
        for (int i = 0; i < itemInfo.ResList.Count; i++)
        {
            if (itemInfo.ResList [i].IsAsset)
            {
                itemInfo.ResList [i].Dependencies = m.GetAllDependencies(itemInfo.ResList [i].Name);
            }
        }
        ab.Unload(true);
//		string infoPath = Path.Combine (AssetOutPath, ResInfoName);
//		using (StreamWriter streamWriter = new StreamWriter(infoPath, false)) {
//			streamWriter.WriteLine(JsonUtility.ToJson(itemInfo));
//			streamWriter.Flush();
//		}
//		Debug.LogWarning (JsonUtility.ToJson(itemInfo));
    }
コード例 #14
0
 static void CloseDebugMode()
 {
     //PlayerSettings.SetScriptingDefineSymbolsForGroup (BuildTargetGroup.Android, "");
     AssetHeplerEditor.RemoveSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, "LOCAL_RELEASE");
 }