Example #1
0
 public static void BuildGameAB(List <string> list)
 {
     foreach (string str in list)
     {
         BuildResInfo build = AssetDatabase.LoadAssetAtPath <BuildResInfo>("Assets/YKFramwork/Editor/BuildAbInfo/" + str + ".asset");
         if (build == null)
         {
             Debug.LogError("生成资源失败:" + str);
         }
         build.Build(2);
     }
 }
Example #2
0
    public static BuildResInfo CreateAsste()
    {
        var select = Selection.activeObject;
        var path   = AssetDatabase.GetAssetPath(select);

        path = AssetDatabase.GenerateUniqueAssetPath(path + "/BuildeResInfo.asset");
        BuildResInfo data = ScriptableObject.CreateInstance <BuildResInfo>();

        AssetDatabase.CreateAsset(data, path);
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
        return(data);
    }
Example #3
0
    /// <summary>
    /// 生成某个配置文件的AB
    /// </summary>
    /// <param name="info"></param>
    public static void BuildResByInfo(BuildResInfo info, int flag)
    {
        string  fileName = Application.streamingAssetsPath + "/0ver.txt";
        VerInfo oldVer   = null;

        if (File.Exists(fileName))
        {
            oldVer = JsonUtility.FromJson <VerInfo>(File.ReadAllText(fileName));
        }
        BuildInfoAB    build   = new BuildInfoAB(info);
        List <VerInfo> newInfo = build.BuildAb(flag);

        if (oldVer != null)
        {
            foreach (VerInfo verinfo in newInfo)
            {
                foreach (ABInfo ver in verinfo.files)
                {
                    bool has = false;
                    foreach (ABInfo _ver in oldVer.files)
                    {
                        if (ver.fileName == _ver.fileName)
                        {
                            _ver.length = ver.length;
                            _ver.assets = ver.assets;
                            _ver.sha1   = ver.sha1;
                            has         = true;
                        }
                    }
                    if (!has)
                    {
                        oldVer.files.Add(ver);
                    }
                }
            }
        }
        else
        {
            VerInfo buildinfo = new VerInfo();
            foreach (VerInfo ver in newInfo)
            {
                buildinfo.ver = ver.ver;
                buildinfo.files.AddRange(ver.files);
            }
            oldVer = buildinfo;
        }
        string txtStr = JsonUtility.ToJson(oldVer, true);

        File.WriteAllText(fileName, txtStr);
    }
Example #4
0
 public static void GetLuas(List <string> list, ref List <string> luas, ref List <string> abs)
 {
     foreach (string str in list)
     {
         BuildResInfo build = AssetDatabase.LoadAssetAtPath <BuildResInfo>("Assets/YKFramwork/Editor/BuildAbInfo/"
                                                                           + str + ".asset");
         if (!luas.Contains(build.LuaABName))
         {
             luas.Add(build.LuaABName);
         }
         if (!abs.Contains(build.ResName))
         {
             abs.Add(build.ResName);
         }
     }
 }
Example #5
0
 public BuildInfoAB(BuildResInfo ins)
 {
     m_BuildResInfo = ins;
 }