update editor logic

pull/62/head
hevinci 2022-12-07 17:52:02 +08:00
parent a1d5949177
commit 3a81d7babd
5 changed files with 35 additions and 6 deletions

View File

@ -297,8 +297,8 @@ namespace YooAsset.Editor
} }
private List<string> GetAssetTags(AssetBundleCollectorGroup group) private List<string> GetAssetTags(AssetBundleCollectorGroup group)
{ {
List<string> tags = StringUtility.StringToStringList(group.AssetTags, ';'); List<string> tags = EditorTools.StringToStringList(group.AssetTags, ';');
List<string> temper = StringUtility.StringToStringList(AssetTags, ';'); List<string> temper = EditorTools.StringToStringList(AssetTags, ';');
tags.AddRange(temper); tags.AddRange(temper);
return tags; return tags;
} }

View File

@ -143,7 +143,7 @@ namespace YooAsset.Editor
AssetBundleCollector collector = new AssetBundleCollector(); AssetBundleCollector collector = new AssetBundleCollector();
collector.CollectPath = collectorElement.GetAttribute(XmlCollectPath); collector.CollectPath = collectorElement.GetAttribute(XmlCollectPath);
collector.CollectorGUID = collectorElement.GetAttribute(XmlCollectorGUID); collector.CollectorGUID = collectorElement.GetAttribute(XmlCollectorGUID);
collector.CollectorType = StringUtility.NameToEnum<ECollectorType>(collectorElement.GetAttribute(XmlCollectorType)); collector.CollectorType = EditorTools.NameToEnum<ECollectorType>(collectorElement.GetAttribute(XmlCollectorType));
collector.AddressRuleName = collectorElement.GetAttribute(XmlAddressRule); collector.AddressRuleName = collectorElement.GetAttribute(XmlAddressRule);
collector.PackRuleName = collectorElement.GetAttribute(XmlPackRule); collector.PackRuleName = collectorElement.GetAttribute(XmlPackRule);
collector.FilterRuleName = collectorElement.GetAttribute(XmlFilterRule); collector.FilterRuleName = collectorElement.GetAttribute(XmlFilterRule);

View File

@ -102,7 +102,7 @@ namespace YooAsset.Editor
HashSet<string> result = new HashSet<string>(); HashSet<string> result = new HashSet<string>();
foreach (var group in Groups) foreach (var group in Groups)
{ {
List<string> groupTags = StringUtility.StringToStringList(group.AssetTags, ';'); List<string> groupTags = EditorTools.StringToStringList(group.AssetTags, ';');
foreach (var tag in groupTags) foreach (var tag in groupTags)
{ {
if (result.Contains(tag) == false) if (result.Contains(tag) == false)
@ -111,7 +111,7 @@ namespace YooAsset.Editor
foreach (var collector in group.Collectors) foreach (var collector in group.Collectors)
{ {
List<string> collectorTags = StringUtility.StringToStringList(collector.AssetTags, ';'); List<string> collectorTags = EditorTools.StringToStringList(collector.AssetTags, ';');
foreach (var tag in collectorTags) foreach (var tag in collectorTags)
{ {
if (result.Contains(tag) == false) if (result.Contains(tag) == false)

View File

@ -694,7 +694,7 @@ namespace YooAsset.Editor
popupField0.index = GetCollectorTypeIndex(collector.CollectorType.ToString()); popupField0.index = GetCollectorTypeIndex(collector.CollectorType.ToString());
popupField0.RegisterValueChangedCallback(evt => popupField0.RegisterValueChangedCallback(evt =>
{ {
collector.CollectorType = StringUtility.NameToEnum<ECollectorType>(evt.newValue); collector.CollectorType = EditorTools.NameToEnum<ECollectorType>(evt.newValue);
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector); AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
if (foldout.value) if (foldout.value)
{ {

View File

@ -285,6 +285,35 @@ namespace YooAsset.Editor
} }
#endregion #endregion
#region StringUtility
public static List<string> StringToStringList(string str, char separator)
{
List<string> result = new List<string>();
if (!String.IsNullOrEmpty(str))
{
string[] splits = str.Split(separator);
foreach (string split in splits)
{
string value = split.Trim(); //移除首尾空格
if (!String.IsNullOrEmpty(value))
{
result.Add(value);
}
}
}
return result;
}
public static T NameToEnum<T>(string name)
{
if (Enum.IsDefined(typeof(T), name) == false)
{
throw new ArgumentException($"Enum {typeof(T)} is not defined name {name}");
}
return (T)Enum.Parse(typeof(T), name);
}
#endregion
#region 文件 #region 文件
/// <summary> /// <summary>
/// 创建文件所在的目录 /// 创建文件所在的目录