Пример #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));
    }
Пример #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();
    }
Пример #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));
    }
Пример #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);
    }
Пример #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);
        }
Пример #6
0
    void DrawBuildAndroidPlayerGUI()
    {
        GUILayout.Space(3);
        GUILayout.Label("-------------[Build Android Player]-------------");
        GUILayout.Space(3);

        GUILayout.BeginHorizontal();
        if (PackageUtils.BuildAssetBundlesForPerChannel(buildTarget))
        {
            if (GUILayout.Button("Copy SDK Resources", GUILayout.Width(200)))
            {
                EditorApplication.delayCall += CopyAndroidSDKResources;
            }
            if (GUILayout.Button("Current Channel Only", GUILayout.Width(200)))
            {
                EditorApplication.delayCall += BuildAndroidPlayerForCurrentChannel;
            }
            if (GUILayout.Button("For All Channels", GUILayout.Width(200)))
            {
                EditorApplication.delayCall += BuildAndroidPlayerForAllChannels;
            }
            if (GUILayout.Button("Open Output Folder", GUILayout.Width(200)))
            {
                var folder = PackageUtils.GetChannelOutputPath(buildTarget, channelType.ToString());
                EditorUtils.ExplorerFolder(folder);
            }
        }
        else
        {
            if (GUILayout.Button("Copy SDK Resource", GUILayout.Width(200)))
            {
                EditorApplication.delayCall += CopyAndroidSDKResources;
            }
            if (GUILayout.Button("Execute Build", GUILayout.Width(200)))
            {
                EditorApplication.delayCall += BuildAndroidPlayerForCurrentChannel;
            }
            if (GUILayout.Button("Open Output Folder", GUILayout.Width(200)))
            {
                var folder = PackageUtils.GetChannelOutputPath(buildTarget, channelType.ToString());
                EditorUtils.ExplorerFolder(folder);
            }
        }
        GUILayout.EndHorizontal();
    }
Пример #7
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));
    }
Пример #8
0
 void DrawBuildIOSPlayerGUI()
 {
     GUILayout.Space(3);
     GUILayout.Label("-------------[Build IOS Player]-------------");
     GUILayout.Space(3);
     GUILayout.BeginHorizontal();
     if (PackageUtils.BuildAssetBundlesForPerChannel(buildTarget))
     {
         if (GUILayout.Button("Current Channel Only", GUILayout.Width(200)))
         {
             EditorApplication.delayCall += BuildIOSPlayerForCurrentChannel;
         }
         if (GUILayout.Button("For All Channels", GUILayout.Width(200)))
         {
             EditorApplication.delayCall += BuildIOSPlayerForAllChannels;
         }
         if (GUILayout.Button("Open Current Output", GUILayout.Width(200)))
         {
             var folder = Path.Combine(System.Environment.CurrentDirectory, BuildPlayer.XCodeOutputPath);
             EditorUtils.ExplorerFolder(folder);
         }
     }
     else
     {
         if (GUILayout.Button("Execute Build", GUILayout.Width(200)))
         {
             EditorApplication.delayCall += BuildIOSPlayerForCurrentChannel;
         }
         if (GUILayout.Button("Open Output Folder", GUILayout.Width(200)))
         {
             var folder = Path.Combine(System.Environment.CurrentDirectory, BuildPlayer.XCodeOutputPath);
             EditorUtils.ExplorerFolder(folder);
         }
     }
     GUILayout.EndHorizontal();
 }
Пример #9
0
    void DrawConfigGUI()
    {
        GUILayout.Space(3);
        GUILayout.Label("-------------[Config]-------------");

        GUILayout.Space(3);
        GUILayout.BeginHorizontal();
        GUILayout.Label("res_version", GUILayout.Width(100));
        string curResVersion = GUILayout.TextField(resVersion, GUILayout.Width(100));

        if (curResVersion != resVersion)
        {
            resVersion = curResVersion;
            SaveAllCurrentVersionFile(true);
        }
        GUILayout.Label("Auto increase sub version, otherwise modify the text directly!", GUILayout.Width(500));
        GUILayout.EndHorizontal();

        GUILayout.Space(3);
        GUILayout.BeginHorizontal();
        GUILayout.Label("notice_version", GUILayout.Width(100));
        GUILayout.Label("1.0.0", GUILayout.Width(100));
        GUILayout.Label("No supported yet!", GUILayout.Width(500));
        GUILayout.EndHorizontal();

        GUILayout.Space(3);
        GUILayout.BeginHorizontal();
        GUILayout.Label("app_version", GUILayout.Width(100));
        string curBundleVersion = GUILayout.TextField(bundleVersion, GUILayout.Width(100));

        if (curBundleVersion != bundleVersion)
        {
            bundleVersion = curBundleVersion;
            PlayerSettings.bundleVersion = curBundleVersion;
        }
        GUILayout.Label("Auto increase sub version, otherwise modify the text directly or go to PlayerSetting!", GUILayout.Width(500));
        GUILayout.EndHorizontal();

        GUILayout.Space(3);
        GUILayout.BeginHorizontal();
        if (PackageUtils.BuildAssetBundlesForPerChannel(buildTarget))
        {
            if (GUILayout.Button("Load ResVersion From Channel", GUILayout.Width(200)))
            {
                LoadCurrentResVersionFromFile();
            }
            if (GUILayout.Button("Validate All Channels ResVersion", GUILayout.Width(200)))
            {
                ValidateAllResVersionFile();
            }
            if (GUILayout.Button("Save Version To All Channels", GUILayout.Width(200)))
            {
                SaveAllVersionFile();
            }
        }
        else
        {
            if (GUILayout.Button("Load ResVersion From Channel", GUILayout.Width(200)))
            {
                LoadCurrentResVersionFromFile();
            }
            if (GUILayout.Button("Save All Version To Channel", GUILayout.Width(200)))
            {
                SaveAllCurrentVersionFile();
            }
        }
        GUILayout.EndHorizontal();
    }
Пример #10
0
    void DrawConfigGUI()
    {
        GUILayout.Space(3);
        GUILayout.Label("-------------[Config]-------------");

        GUILayout.Space(3);
        GUILayout.BeginHorizontal();
        GUILayout.Label("app_version", GUILayout.Width(80));
        string curBundleVersion = GUILayout.TextField(appVersion, GUILayout.Width(100));

        if (curBundleVersion != appVersion)
        {
            appVersion = curBundleVersion;
            PlayerSettings.bundleVersion = curBundleVersion;
            SaveLocalVersionFile(buildTarget, channelType);
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(3);
        GUILayout.BeginHorizontal();
        GUILayout.Label("res_version", GUILayout.Width(80));
        string curResVersion = GUILayout.TextField(resVersion, GUILayout.Width(100));

        if (curResVersion != resVersion)
        {
            resVersion = curResVersion;
            SaveLocalVersionFile(buildTarget, channelType);
        }
        GUILayout.EndHorizontal();


        GUILayout.Space(3);
        GUILayout.BeginHorizontal();
        if (PackageUtils.BuildAssetBundlesForPerChannel(buildTarget))
        {
            if (GUILayout.Button("Load Version From Channel", GUILayout.Width(200)))
            {
                ReadLocalVersionFile(buildTarget, channelType);
            }
            if (GUILayout.Button("Validate All Channels ResVersion", GUILayout.Width(200)))
            {
                ValidateAllLocalVersions();
            }
            if (GUILayout.Button("Save Version To All Channels", GUILayout.Width(200)))
            {
                SaveAllVersionFile();
            }
        }
        else
        {
            if (GUILayout.Button("Load Version From Channel", GUILayout.Width(200)))
            {
                ReadLocalVersionFile(buildTarget, channelType);
            }
            if (GUILayout.Button("Save Version To Channel", GUILayout.Width(200)))
            {
                SaveLocalVersionFile(buildTarget, channelType);
            }
        }
        GUILayout.EndHorizontal();
    }