mirror of https://github.com/tuyoogame/YooAsset
parent
d354db382c
commit
636fbed7f2
|
@ -132,6 +132,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
typeof(PackSeparately),
|
typeof(PackSeparately),
|
||||||
typeof(PackDirectory),
|
typeof(PackDirectory),
|
||||||
|
typeof(PackTopDirectory),
|
||||||
typeof(PackCollector),
|
typeof(PackCollector),
|
||||||
typeof(PackGrouper),
|
typeof(PackGrouper),
|
||||||
typeof(PackRawFile),
|
typeof(PackRawFile),
|
||||||
|
|
|
@ -479,28 +479,41 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
if (collector.IsValid() && collector.NotWriteToAssetList == false)
|
if (collector.IsValid() && collector.NotWriteToAssetList == false)
|
||||||
{
|
{
|
||||||
var collectAssetInfos = collector.GetAllCollectAssets(grouper);
|
List<CollectAssetInfo> collectAssetInfos = null;
|
||||||
foreach (var collectAssetInfo in collectAssetInfos)
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
VisualElement elementRow = new VisualElement();
|
collectAssetInfos = collector.GetAllCollectAssets(grouper);
|
||||||
elementRow.style.flexDirection = FlexDirection.Row;
|
}
|
||||||
foldout.Add(elementRow);
|
catch(System.Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogError(e.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
string showInfo = collectAssetInfo.AssetPath;
|
if(collectAssetInfos != null)
|
||||||
if (_enableAddressableToogle.value)
|
{
|
||||||
|
foreach (var collectAssetInfo in collectAssetInfos)
|
||||||
{
|
{
|
||||||
IAddressRule instance = AssetBundleGrouperSettingData.GetAddressRuleInstance(collector.AddressRuleName);
|
VisualElement elementRow = new VisualElement();
|
||||||
AddressRuleData ruleData = new AddressRuleData(collectAssetInfo.AssetPath, collector.CollectPath, grouper.GrouperName);
|
elementRow.style.flexDirection = FlexDirection.Row;
|
||||||
string addressValue = instance.GetAssetAddress(ruleData);
|
foldout.Add(elementRow);
|
||||||
showInfo = $"[{addressValue}] {showInfo}";
|
|
||||||
}
|
|
||||||
|
|
||||||
var label = new Label();
|
string showInfo = collectAssetInfo.AssetPath;
|
||||||
label.text = showInfo;
|
if (_enableAddressableToogle.value)
|
||||||
label.style.width = 300;
|
{
|
||||||
label.style.marginLeft = 0;
|
IAddressRule instance = AssetBundleGrouperSettingData.GetAddressRuleInstance(collector.AddressRuleName);
|
||||||
label.style.flexGrow = 1;
|
AddressRuleData ruleData = new AddressRuleData(collectAssetInfo.AssetPath, collector.CollectPath, grouper.GrouperName);
|
||||||
elementRow.Add(label);
|
string addressValue = instance.GetAssetAddress(ruleData);
|
||||||
|
showInfo = $"[{addressValue}] {showInfo}";
|
||||||
|
}
|
||||||
|
|
||||||
|
var label = new Label();
|
||||||
|
label.text = showInfo;
|
||||||
|
label.style.width = 300;
|
||||||
|
label.style.marginLeft = 0;
|
||||||
|
label.style.flexGrow = 1;
|
||||||
|
elementRow.Add(label);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,30 +7,64 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 以文件路径作为资源包名
|
/// 以文件路径作为资源包名
|
||||||
/// 注意:每个文件独自打资源包
|
/// 注意:每个文件独自打资源包
|
||||||
|
/// 例如:收集器路径为 "Assets/UIPanel"
|
||||||
|
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets/uipanel/shop/image/backgroud.bundle"
|
||||||
|
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets/uipanel/shop/view/main.bundle"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PackSeparately : IPackRule
|
public class PackSeparately : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
{
|
{
|
||||||
return StringUtility.RemoveExtension(data.AssetPath); //"Assets/Config/test.txt" --> "Assets/Config/test"
|
return StringUtility.RemoveExtension(data.AssetPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 以父类文件夹路径作为资源包名
|
/// 以父类文件夹路径作为资源包名
|
||||||
/// 注意:文件夹下所有文件打进一个资源包
|
/// 注意:文件夹下所有文件打进一个资源包
|
||||||
|
/// 例如:收集器路径为 "Assets/UIPanel"
|
||||||
|
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets/uipanel/shop/image.bundle"
|
||||||
|
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets/uipanel/shop/view.bundle"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PackDirectory : IPackRule
|
public class PackDirectory : IPackRule
|
||||||
{
|
{
|
||||||
string IPackRule.GetBundleName(PackRuleData data)
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
{
|
{
|
||||||
return Path.GetDirectoryName(data.AssetPath); //"Assets/Config/test.txt" --> "Assets/Config"
|
return Path.GetDirectoryName(data.AssetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 以收集器路径下顶级文件夹为资源包名
|
||||||
|
/// 注意:文件夹下所有文件打进一个资源包
|
||||||
|
/// 例如:收集器路径为 "Assets/UIPanel"
|
||||||
|
/// 例如:"Assets/UIPanel/Shop/Image/backgroud.png" --> "assets/uipanel/shop.bundle"
|
||||||
|
/// 例如:"Assets/UIPanel/Shop/View/main.prefab" --> "assets/uipanel/shop.bundle"
|
||||||
|
/// </summary>
|
||||||
|
public class PackTopDirectory : IPackRule
|
||||||
|
{
|
||||||
|
string IPackRule.GetBundleName(PackRuleData data)
|
||||||
|
{
|
||||||
|
string assetPath = data.AssetPath.Replace(data.CollectPath, string.Empty);
|
||||||
|
assetPath = assetPath.TrimStart('/');
|
||||||
|
string[] splits = assetPath.Split('/');
|
||||||
|
if (splits.Length > 0)
|
||||||
|
{
|
||||||
|
if (Path.HasExtension(splits[0]))
|
||||||
|
throw new Exception($"Not found root directory : {assetPath}");
|
||||||
|
string bundleName = $"{data.CollectPath}/{splits[0]}";
|
||||||
|
return bundleName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"Not found root directory : {assetPath}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 以收集器路径作为资源包名
|
/// 以收集器路径作为资源包名
|
||||||
/// 注意:收集器下所有文件打进一个资源包
|
/// 注意:收集的所有文件打进一个资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PackCollector : IPackRule
|
public class PackCollector : IPackRule
|
||||||
{
|
{
|
||||||
|
@ -42,7 +76,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 以分组名称作为资源包名
|
/// 以分组名称作为资源包名
|
||||||
/// 注意:分组内所有文件打进一个资源包
|
/// 注意:收集的所有文件打进一个资源包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PackGrouper : IPackRule
|
public class PackGrouper : IPackRule
|
||||||
{
|
{
|
||||||
|
|
|
@ -582,19 +582,5 @@ namespace YooAsset.Editor
|
||||||
return content.Substring(startIndex + key.Length);
|
return content.Substring(startIndex + key.Length);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 玩家偏好
|
|
||||||
// 枚举
|
|
||||||
public static void PlayerSetEnum<T>(string key, T value)
|
|
||||||
{
|
|
||||||
string enumName = value.ToString();
|
|
||||||
EditorPrefs.SetString(key, enumName);
|
|
||||||
}
|
|
||||||
public static T PlayerGetEnum<T>(string key, T defaultValue)
|
|
||||||
{
|
|
||||||
string enumName = EditorPrefs.GetString(key, defaultValue.ToString());
|
|
||||||
return StringUtility.NameToEnum<T>(enumName);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue