Ejemplo n.º 1
0
    public static void BuildAssetBundlesForAllChannels(BuildTarget buildTarget)
    {
        bool buildForPerChannel = PackageUtils.BuildAssetBundlesForPerChannel(buildTarget);
        var  targetName         = PackageUtils.GetPlatformName(buildTarget);

        Debug.Assert(buildForPerChannel == true);

//        XLuaMenu.CopyLuaFilesToAssetsPackage();
        PackageUtils.CheckAndRunAllCheckers(buildForPerChannel, false);

        int    index             = 0;
        double switchChannel     = 0;
        double buildAssetbundles = 0;
        var    start             = DateTime.Now;

        foreach (var current in (ChannelType[])Enum.GetValues(typeof(ChannelType)))
        {
            var channelName = current.ToString();

            start = DateTime.Now;
            CheckAssetBundles.SwitchChannel(channelName);
            switchChannel = (DateTime.Now - start).TotalSeconds;

            start = DateTime.Now;
            InnerBuildAssetBundles(buildTarget, channelName, index == 0);
            buildAssetbundles = (DateTime.Now - start).TotalSeconds;

            index++;
            Debug.Log(string.Format("{0}.Build assetbundles for platform : {1} and channel : {2} done! use time : switchChannel = {3}s , build assetbundls = {4} s", index, targetName, channelName, switchChannel, buildAssetbundles));
        }

        Debug.Log(string.Format("Build assetbundles for platform : {0} for all {1} channels done!", targetName, index));
    }
Ejemplo n.º 2
0
    void DrawAssetBundlesConfigGUI()
    {
        GUILayout.Space(3);
        GUILayout.Label("-------------[AssetBundles Config]-------------");
        GUILayout.Space(3);

        // 是否为每个channel打一个AB包
        GUILayout.Space(3);
        GUILayout.BeginHorizontal();
        GUILayout.Label("Build For Per Channel : ", GUILayout.Width(150));
        if (buildTarget == BuildTarget.Android)
        {
            buildABSForPerChannel = EditorGUILayout.Toggle(androidBuildABForPerChannel, GUILayout.Width(50));
            if (buildABSForPerChannel != androidBuildABForPerChannel)
            {
                androidBuildABForPerChannel = buildABSForPerChannel;
                PackageUtils.SaveAndroidBuildABForPerChannelSetting(buildABSForPerChannel);
            }
        }
        else
        {
            buildABSForPerChannel = EditorGUILayout.Toggle(iosBuildABForPerChannel, GUILayout.Width(50));
            if (buildABSForPerChannel != iosBuildABForPerChannel)
            {
                iosBuildABForPerChannel = buildABSForPerChannel;
                PackageUtils.SaveIOSBuildABForPerChannelSetting(buildABSForPerChannel);
            }
        }
        if (GUILayout.Button("Run All Checkers", GUILayout.Width(200)))
        {
            bool checkChannel = PackageUtils.BuildAssetBundlesForPerChannel(buildTarget);
            PackageUtils.CheckAndRunAllCheckers(checkChannel, true);
        }
        GUILayout.EndHorizontal();
    }
Ejemplo n.º 3
0
    public static void BuildAssetBundles(BuildTarget buildTarget, string channelName)
    {
        bool buildForPerChannel = PackageUtils.BuildAssetBundlesForPerChannel(buildTarget);

        XLuaMenu.CopyLuaFilesToAssetsPackage();
        PackageUtils.CheckAndRunAllCheckers(buildForPerChannel, false);

        DateTime start = DateTime.Now;

        if (buildForPerChannel)
        {
            start = DateTime.Now;
            CheckAssetBundles.SwitchChannel(channelName);
            Debug.Log("Finished CheckAssetBundles.SwitchChannel! use " + (DateTime.Now - start).TotalSeconds + "s");
        }

        start = DateTime.Now;
        InnerBuildAssetBundles(buildTarget, channelName, true);
        Debug.Log("Finished InnerBuildAssetBundles! use " + (DateTime.Now - start).TotalSeconds + "s");

        //转换wwise xml为txt
        //ConvertXml2Json(Application.dataPath + "/StreamingAssets/SoundbanksInfo.xml", Application.dataPath + "/Wwise/Resources/SoundbanksInfo.txt");

        //拷贝所有的音效资源到下载目录 转换xml为json 计算所有资源的md5值并生成尺寸文件
        PackageUtils.BuildAudioData(buildTarget, channelName);

        var targetName = PackageUtils.GetPlatformName(buildTarget);

        Debug.Log(string.Format("Build assetbundles for platform : {0} and channel : {1} done!", targetName, channelName));
    }
Ejemplo n.º 4
0
    public static void AutoBuildPack(BuildTarget _buildTarget, ChannelType channelname)
    {
        buildTarget = _buildTarget;
        //读取上次打包的资源版本号
        bundleVersion = PlayerSettings.bundleVersion;
        resVersion    = ReadResVersionConfig();
        Debug.Log("cur resversion:" + resVersion);
        bool checkChannel = PackageUtils.BuildAssetBundlesForPerChannel(buildTarget);

        PackageUtils.CheckAndRunAllCheckers(checkChannel, true);
    }
Ejemplo n.º 5
0
        static public void ToolRunAllCheckers()
        {
            var  buildTargetName = PackageUtils.GetCurPlatformName();
            var  channelName     = PackageUtils.GetCurSelectedChannel().ToString();
            bool checkCopy       = EditorUtility.DisplayDialog("Run Checkers Warning",
                                                               string.Format("Run Checkers for : \n\nplatform : {0} \nchannel : {1} \n\nContinue ?", buildTargetName, channelName),
                                                               "Confirm", "Cancel");

            if (!checkCopy)
            {
                return;
            }

            bool checkChannel = PackageUtils.BuildAssetBundlesForPerChannel(EditorUserBuildSettings.activeBuildTarget);

            PackageUtils.CheckAndRunAllCheckers(checkChannel, true);
        }
Ejemplo n.º 6
0
    public static void BuildAssetBundles(BuildTarget buildTarget, string channelName)
    {
        bool buildForPerChannel = PackageUtils.BuildAssetBundlesForPerChannel(buildTarget);

//        XLuaMenu.CopyLuaFilesToAssetsPackage();
        PackageUtils.CheckAndRunAllCheckers(buildForPerChannel, false);

        DateTime start = DateTime.Now;

        if (buildForPerChannel)
        {
            start = DateTime.Now;
            CheckAssetBundles.SwitchChannel(channelName);
            Debug.Log("Finished CheckAssetBundles.SwitchChannel! use " + (DateTime.Now - start).TotalSeconds + "s");
        }

        start = DateTime.Now;
        InnerBuildAssetBundles(buildTarget, channelName, true);
        Debug.Log("Finished InnerBuildAssetBundles! use " + (DateTime.Now - start).TotalSeconds + "s");

        var targetName = PackageUtils.GetPlatformName(buildTarget);

        Debug.Log(string.Format("Build assetbundles for platform : {0} and channel : {1} done!", targetName, channelName));
    }