This commit is contained in:
CortexCore
2024-04-16 04:06:46 +08:00
parent 37e7fcea51
commit c798b224be
67 changed files with 1305 additions and 425 deletions

View File

@@ -70,7 +70,7 @@ namespace BITKit.GameEditor
}
}
}
catch (Exception e)
catch (Exception)
{
continue;
}

View File

@@ -18,7 +18,7 @@ namespace BITKit.GameEditor
protected readonly List<T> List=new();
private ListView _listView;
private VisualElement _container;
protected VisualElement _container { get; private set; }
private Button _createButton;
private void OnEnable()
@@ -99,7 +99,7 @@ namespace BITKit.GameEditor
$"{GetType().Name} 已初始化,从{AssetsPath}获取到{List.Count}个{typeof(T).Name}");
}
private void ItemsChosen(IEnumerable<object> obj)
protected virtual void ItemsChosen(IEnumerable<object> obj)
{
var selected = obj.FirstOrDefault() as Object;
var serializedObject = new SerializedObject(selected);
@@ -167,6 +167,7 @@ namespace BITKit.GameEditor
).ToArray();
List.AddRange(allItem.Cast<T>());
}
protected virtual void CreateScriptableObject(string name)
{
if (string.IsNullOrEmpty(name))
@@ -178,6 +179,8 @@ namespace BITKit.GameEditor
if (EditorUtility.DisplayDialog("创建", $"是否创建{name}与{path}?", "是", "否") is false) return;
new DirectoryInfo(Path.GetDirectoryName(path)!).Create();
var item = CreateInstance<T>();
item.name = name;
AssetDatabase.CreateAsset(item, path);