Beispiel #1
0
        // 获取指定包名的包对象信息
        public static bool TryGetBundleSlice(BundleBuilderData data, string bundleName,
                                             out BundleBuilderData.BundleInfo bundleInfo,
                                             out BundleBuilderData.BundleSplit bundleSplit,
                                             out BundleBuilderData.BundleSlice bundleSlice)
        {
            foreach (var bundle in data.bundles)
            {
                foreach (var split in bundle.splits)
                {
                    foreach (var slice in split.slices)
                    {
                        if (slice.name == bundleName)
                        {
                            bundleInfo  = bundle;
                            bundleSplit = split;
                            bundleSlice = slice;
                            return(true);
                        }
                    }
                }
            }

            bundleInfo  = null;
            bundleSplit = null;
            bundleSlice = null;
            return(false);
        }
Beispiel #2
0
        // 计算指定 slice 中最高的资源优先级作为包优先级 (最低不低于 bundleInfo定义的优先级)
        private static int GetPriority(PackageBuildInfo buildInfo, BundleBuilderData.BundleInfo bundleInfo,
                                       BundleBuilderData.BundleSlice bundleSlice)
        {
            var priority = bundleInfo.priority;

            for (int i = 0, size = bundleSlice.assetGuids.Count; i < size; i++)
            {
                var guid  = bundleSlice.assetGuids[i];
                var attrs = buildInfo.data.GetAssetAttributes(guid);
                if (attrs != null)
                {
                    if (attrs.priority > priority)
                    {
                        priority = attrs.priority;
                    }
                }
            }
            return(priority);
        }
 private static void GotoBundleSlice(BundleBuilderData data,
                                     BundleBuilderData.BundleInfo rBundleInfo,
                                     BundleBuilderData.BundleSlice rBundleSlice)
 {
     if (rBundleInfo != null)
     {
         EditorGUILayout.TextField(rBundleSlice.name);
         if (GUILayout.Button(">", GUILayout.Width(20f)))
         {
             BundleAssetsWindow.Inspect(data, new List <BundleBuilderData.BundleInfo>(new[] { rBundleInfo }));
         }
     }
     else
     {
         EditorGUI.BeginDisabledGroup(true);
         EditorGUILayout.TextField("<null>");
         GUILayout.Button(">", GUILayout.Width(20f));
         EditorGUI.EndDisabledGroup();
     }
 }
Beispiel #4
0
        // 计算指定 slice 中最高的资源优先级作为包优先级 (最低不低于 bundleInfo定义的优先级)
        private static int GetPriority(PackageBuildInfo buildInfo, BundleBuilderData.BundleInfo bundleInfo,
                                       BundleBuilderData.BundleSlice bundleSlice)
        {
            var priority = bundleInfo.priority;

            for (int assetIndex = 0, assetCount = bundleSlice.GetAssetCount(); assetIndex < assetCount; assetIndex++)
            {
                var assetPath = bundleSlice.GetAssetPath(assetIndex);
                var attrs     = buildInfo.data.GetAssetPathAttributes(assetPath);
                if (attrs != null)
                {
                    if (attrs.priority > priority)
                    {
                        priority = attrs.priority;
                    }
                }
            }

            return(priority);
        }