Exemplo n.º 1
0
        /// <summary>
        /// 执行保存到二进制中
        /// </summary>
        /// <returns></returns>
        public override AssetAssemblyResult Execute()
        {
            AssetAddressAssemblyResult result = new AssetAddressAssemblyResult();

            foreach (var group in m_AssetGroups)
            {
                group.Execute(result);
            }

            //读取配置
            AssetBundleTagConfig tagConfig = Util.FileUtil.ReadFromBinary <AssetBundleTagConfig>(BundlePackUtil.GetTagConfigPath());

            if (tagConfig.GroupDatas == null)
            {
                tagConfig.GroupDatas = new List <AssetBundleGroupData>();
            }
            else
            {
                tagConfig.GroupDatas.Clear();
            }

            foreach (var groupResult in result.m_GroupResults)
            {
                AssetAddressGroupResult gResult = groupResult as AssetAddressGroupResult;

                AssetBundleGroupData groupData = new AssetBundleGroupData();
                groupData.GroupName    = gResult.m_GroupName;
                groupData.IsGenAddress = gResult.m_IsGenAddress;
                groupData.IsMain       = gResult.m_IsMain;
                groupData.IsPreload    = gResult.m_IsPreload;

                tagConfig.GroupDatas.Add(groupData);

                foreach (var operationResult in gResult.m_OperationResults)
                {
                    AssetAddressOperationResult oResult = operationResult as AssetAddressOperationResult;
                    foreach (var kvp in oResult.m_AddressDataDic)
                    {
                        AssetAddressData aaData   = new AssetAddressData();
                        AssetAddressData kvpValue = kvp.Value as AssetAddressData;

                        aaData.AssetAddress = kvpValue.AssetAddress;
                        aaData.AssetPath    = kvpValue.AssetPath;
                        aaData.BundlePath   = kvpValue.BundlePath;
                        aaData.Labels       = new List <string>(kvpValue.Labels).ToArray();

                        groupData.AssetDatas.Add(aaData);
                    }
                }
            }

            //保存配置
            Util.FileUtil.SaveToBinary <AssetBundleTagConfig>(BundlePackUtil.GetTagConfigPath(), tagConfig);

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 执行
        /// </summary>
        /// <param name="assemblyResult"></param>
        /// <returns></returns>
        public override AssetGroupResult Execute(AssetAssemblyResult assemblyResult)
        {
            AssetAddressGroupResult result = base.Execute(assemblyResult) as AssetAddressGroupResult;

            if (result != null)
            {
                result.m_IsGenAddress = m_IsGenAddress;
                result.m_IsMain       = m_IsMain;
                result.m_IsPreload    = m_IsPreload;
            }
            return(result);
        }