Component code
public static bool FileBrowser( ref string
location, ref Vector2 directoryScroll, ref Vector2
fileScroll )
{
bool complete;
DirectoryInfo directoryInfo;
DirectoryInfo directorySelection;
FileInfo fileSelection;
int contentWidth;
// Our return state - altered by the "Select"
button
complete = false;
// Get the directory info of the current
location
fileSelection = new FileInfo( location );
if( (fileSelection.Attributes &
FileAttributes.Directory) ==
FileAttributes.Directory )
{
directoryInfo = new DirectoryInfo( location
);
}
else
{
directoryInfo = fileSelection.Directory;
}
if( location!= "/" && GUI.Button( new Rect(
10, 20, 410, 20 ), "Up one level" ) )
{
directoryInfo = directoryInfo.Parent;
location = directoryInfo.FullName;
}
// Handle the directories list
GUILayout.BeginArea( new Rect( 10, 40, 200, 300
) );
- 1
- 2
- 3
前往页