1
This commit is contained in:
@@ -16,10 +16,11 @@ namespace BITKit.GameEditor
|
||||
{
|
||||
protected virtual string AssetsPath => $"Assets/Artists/";
|
||||
protected virtual string ExportPathKey => $"{typeof(T).Name}.ExportPath";
|
||||
protected virtual string ExportNameKey=> $"{typeof(T).Name}.ExportName";
|
||||
protected readonly List<T> List=new();
|
||||
|
||||
private ListView _listView;
|
||||
protected VisualElement _container { get; private set; }
|
||||
protected ListView listView { get; private set; }
|
||||
protected VisualElement container { get; private set; }
|
||||
private Button _createButton;
|
||||
|
||||
private void OnEnable()
|
||||
@@ -44,7 +45,7 @@ namespace BITKit.GameEditor
|
||||
refreshButton.clicked += () =>
|
||||
{
|
||||
RebuildList();
|
||||
_listView.Rebuild();
|
||||
listView.Rebuild();
|
||||
};
|
||||
var container = leftSlider.Create<VisualElement>();
|
||||
|
||||
@@ -74,27 +75,27 @@ namespace BITKit.GameEditor
|
||||
listViewContainer.Create<Label>().text = $"获取到:{List.Count}个配置";
|
||||
listViewContainer.AddToClassList("pa-8");
|
||||
|
||||
_listView = leftSlider.Create<ListView>();
|
||||
_listView.makeItem = MakeItem;
|
||||
_listView.bindItem = BindItem;
|
||||
_listView.itemsChosen += ItemsChosen;
|
||||
_listView.style.minWidth = 128;
|
||||
_listView.style.flexGrow = 1;
|
||||
listView = leftSlider.Create<ListView>();
|
||||
listView.makeItem = MakeItem;
|
||||
listView.bindItem = BindItem;
|
||||
listView.itemsChosen += ItemsChosen;
|
||||
listView.style.minWidth = 128;
|
||||
listView.style.flexGrow = 1;
|
||||
|
||||
_listView.itemsSource = List;
|
||||
listView.itemsSource = List;
|
||||
|
||||
var scroll = rootVisualElement.Create<ScrollView>();
|
||||
scroll.name = "Scroll";
|
||||
scroll.style.flexGrow = 1;
|
||||
|
||||
_container = scroll.Create<GroupBox>();
|
||||
this.container = scroll.Create<GroupBox>();
|
||||
|
||||
var pingButton = toolbarContainer.Create<Button>();
|
||||
pingButton.text = "Ping";
|
||||
pingButton.clicked += () =>
|
||||
{
|
||||
if (_listView.selectedIndex < 0) return;
|
||||
var item = List[_listView.selectedIndex];
|
||||
if (listView.selectedIndex < 0) return;
|
||||
var item = List[listView.selectedIndex];
|
||||
EditorGUIUtility.PingObject(item);
|
||||
};
|
||||
|
||||
@@ -133,8 +134,8 @@ namespace BITKit.GameEditor
|
||||
{
|
||||
var selected = obj.FirstOrDefault() as Object;
|
||||
var serializedObject = new SerializedObject(selected);
|
||||
BITInspectorExtensions.FillDefaultInspector(_container,serializedObject, true);
|
||||
_container.Bind(serializedObject);
|
||||
BITInspectorExtensions.FillDefaultInspector(container,serializedObject, true);
|
||||
container.Bind(serializedObject);
|
||||
}
|
||||
protected virtual VisualElement MakeItem()
|
||||
{
|
||||
@@ -219,7 +220,7 @@ namespace BITKit.GameEditor
|
||||
|
||||
List.Add(item);
|
||||
|
||||
_listView.Rebuild();
|
||||
listView.Rebuild();
|
||||
|
||||
ItemsChosen(new[] {item});
|
||||
}
|
||||
|
Reference in New Issue
Block a user