29 lines
477 B
C#
29 lines
477 B
C#
using Godot;
|
|
|
|
public partial class LearnTree : Tree
|
|
{
|
|
[Export]
|
|
private FileDirSelector _dirSelector;
|
|
|
|
public override void _Ready()
|
|
{
|
|
ItemSelected += OnItemSelected;
|
|
}
|
|
|
|
private void OnItemSelected()
|
|
{
|
|
TreeItem selected = GetSelected();
|
|
if (selected != null)
|
|
{
|
|
GD.Print($"选中了: {selected.GetText(0)}");
|
|
}
|
|
}
|
|
|
|
private async void Open()
|
|
{
|
|
var path = await _dirSelector.SelectFolderAsync() ?? "None";
|
|
if (string.IsNullOrEmpty(path)) return;
|
|
|
|
}
|
|
}
|