Beispiel #1
0
        private void DrawPackOperation()
        {
            if (bundleBuildConfig == null)
            {
                bundleBuildConfig = AssetPackerUtil.ReadBuildData();
            }

            EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
            {
                EditorGUILayout.LabelField(Contents.BuildTitleContent, EGUIStyles.MiddleCenterLabel);
                EditorGUI.BeginChangeCheck();
                {
                    EGUI.BeginLabelWidth(120);
                    {
                        bundleBuildConfig.OutputDir          = EGUILayout.DrawDiskFolderSelection(Contents.BuildOutputDirStr, bundleBuildConfig.OutputDir);
                        bundleBuildConfig.CleanupBeforeBuild = EditorGUILayout.Toggle(Contents.BuildCleanup, bundleBuildConfig.CleanupBeforeBuild);
                        bundleBuildConfig.PathFormat         = (BundlePathFormatType)EditorGUILayout.EnumPopup(Contents.BuildPathFormatContent, bundleBuildConfig.PathFormat);
                        EditorGUILayout.Space();
                        bundleBuildConfig.IsForceRebuild = EditorGUILayout.Toggle(Contents.ForceRebuild, bundleBuildConfig.IsForceRebuild);
                        bundleBuildConfig.Target         = (ValidBuildTarget)EditorGUILayout.EnumPopup(Contents.BuildTargetContent, bundleBuildConfig.Target);
                        bundleBuildConfig.Compression    = (CompressOption)EditorGUILayout.EnumPopup(Contents.BuildCompressionContent, bundleBuildConfig.Compression);
                    }
                    EGUI.EndLableWidth();
                }
                if (EditorGUI.EndChangeCheck())
                {
                    AssetPackerUtil.WriteBuildData(bundleBuildConfig);
                }

                GUILayout.FlexibleSpace();

                EGUI.BeginGUIBackgroundColor(Color.red);
                {
                    if (GUILayout.Button(Contents.OperationAutoBuildContent, GUILayout.Height(80), GUILayout.ExpandWidth(true)))
                    {
                        EditorApplication.delayCall += () =>
                        {
                            AssetPackerUtil.BuildAssetBundles(packerData, bundleBuildConfig);
                        };
                    }
                }
                EGUI.EndGUIBackgroundColor();
            }
            EditorGUILayout.EndVertical();
        }
Beispiel #2
0
        //private Dictionary<string, List<PackerBundleData>> addressRepeatDataDic = new Dictionary<string, List<PackerBundleData>>();
        private void OnEnable()
        {
            packerData = AssetPackerUtil.GetPackerData();

            //foreach(var group in assetPackerConfig.groupDatas)
            //{
            //    foreach(var data in group.assetFiles)
            //    {
            //        if(!addressRepeatDataDic.TryGetValue(data.Address,out List<PackerBundleData> dataList))
            //        {
            //            dataList = new List<PackerBundleData>();
            //            addressRepeatDataDic.Add(data.Address, dataList);
            //        }
            //        dataList.Add(data);
            //    }
            //}

            if (PlayerSettingsUtility.HasScriptingDefineSymbol(ASSET_BUNDLE_SYMBOL))
            {
                runMode = RunMode.AssetBundle;
            }
        }