コード例 #1
0
    public static void ShowEditor()
    {
        AssetBuildEditor abEditor = EditorWindow.GetWindow <AssetBuildEditor>();

        abEditor.Initialize();
        abEditor.Show();
    }
コード例 #2
0
ファイル: BundlePackUtil.cs プロジェクト: fqkw6/AssetTool
        /// <summary>
        /// 生成Class,用于标识Address
        /// </summary>
        public static void CreateAddressKeyClass()
        {
            AssetBundleTagConfig tagConfig = Util.FileUtil.ReadFromBinary <AssetBundleTagConfig>(BundlePackUtil.GetTagConfigPath());

            List <string> fieldNameAndValues = new List <string>();

            foreach (var group in tagConfig.GroupDatas)
            {
                Debug.Log(!group.IsMain + "jinlai " + !group.IsGenAddress);
                if (!group.IsMain)//|| !group.IsGenAddress)//todo 先注释
                {
                    continue;
                }
                string prefix = group.GroupName.Replace(" ", "");
                foreach (var data in group.AssetDatas)
                {
                    string address = data.AssetAddress;

                    string tempName = address;
                    if (tempName.IndexOf('/') > 0)
                    {
                        tempName = Path.GetFileNameWithoutExtension(tempName);
                    }
                    tempName = tempName.Replace(" ", "_").Replace(".", "_").Replace("-", "_");

                    string fieldName = (prefix + "_" + tempName).ToUpper();
                    string content   = $"{fieldName} = @\"{address}\";";
                    if (fieldNameAndValues.IndexOf(content) < 0)
                    {
                        fieldNameAndValues.Add(content);
                    }
                }
            }
            StringBuilder classSB = new StringBuilder();

            classSB.AppendLine("namespace Leyoutech.Core.Loader.Config");
            classSB.AppendLine("{");
            classSB.AppendLine("\tpublic static class AssetAddressKey");
            classSB.AppendLine("\t{");

            fieldNameAndValues.ForEach((value) =>
            {
                classSB.AppendLine("\t\tpublic const string " + value);
            });

            classSB.AppendLine("\t}");
            classSB.AppendLine("}");

            string filePath = Application.dataPath + "/Scripts/Core/Loader/Config/AssetAddressKey.cs";

            File.WriteAllText(filePath, classSB.ToString());
            AssetBuildEditor.CreatMD5();//生成Md5值
        }
コード例 #3
0
ファイル: AssetBuildEditor.cs プロジェクト: Liangzg/GEX_1.X
    public void Initialize()
    {
        Instance = this;
        strategyDic[Strategys[0]] = new SceneStrategy();
        strategyDic[Strategys[1]] = new PreFileStrategy();
        strategyDic[Strategys[2]] = new PreDirectionStrategy();
        strategyDic[Strategys[3]] = new AllInOneStrategy();

        BuildConfigManager.Instance.ReadConfig();

        BuildConfig[] configArr = BuildConfigManager.Instance.BuildConfigs;
        if (configArr.Length > 0)
        {
            curBuildConfig = configArr[0];
            foreach (BuildConfig bc in configArr)
            {
                buildConfigs.Add(bc.BundleName);
            }
        }
    }
コード例 #4
0
 public static void CopyRunBinAsset()
 {
     AssetBuildEditor.CopyFileTo(AppPathUtils.PersistentDataRootPath);
     EditorUtility.DisplayDialog("提示", "文件已拷贝完成", "确定");
 }
コード例 #5
0
 public static void CopyInstallAsset()
 {
     AssetBuildEditor.CopyFileTo(Application.streamingAssetsPath);
     AssetDatabase.Refresh();
     EditorUtility.DisplayDialog("提示", "文件已拷贝完成", "确定");
 }