EditorTool3D/Assets/ZXL/Scripts/Test/FS/FileSystemItem.cs

27 lines
695 B
C#

using UnityEngine;
using UnityEngine.UI;
namespace ZXLA
{
class FileSystemItem: MonoBehaviour
{
FileSystemObject _fileSystemObject;
[SerializeField]
private Text _text;
public FileSystemObject fileSystemObject=> _fileSystemObject;
public void SetObject(FileSystemObject fileSystemObject)
{
this._fileSystemObject = fileSystemObject;
string indent = "";
for (int i = 0; i < fileSystemObject.depth; i++)
{
indent += " ";
}
var strings = fileSystemObject.path.Split("/");
_text.text = indent + strings[^1];
}
}
}