3 using System.Collections.Generic;
23 currentPath = Application.dataPath +
"/../samples/";
39 currentPath = pathToGo;
40 Debug.Log (currentPath);
42 DirectoryInfo dir =
new DirectoryInfo (pathToGo);
43 FileInfo[] info = dir.GetFiles (
"*.*");
44 DirectoryInfo[] infod = dir.GetDirectories (
"*");
47 foreach (Transform child
in fileBro.transform) {
48 GameObject.Destroy (child.gameObject);
53 foreach (DirectoryInfo f
in infod) {
54 Button fbButton = Instantiate (foldButton) as Button;
56 fbButton.GetComponentInChildren<Text> ().text = f.Name;
58 fbButton.transform.SetParent (fileBro.transform,
false);
60 string captured = f.FullName;
62 fbButton.onClick.AddListener (() => (
UpdateBro (captured)));
68 foreach (FileInfo f
in info) {
69 Button fbButton = Instantiate (fileButton) as Button;
71 fbButton.GetComponentInChildren<Text> ().text = f.Name;
73 fbButton.transform.SetParent (fileBro.transform,
false);
75 string captured = f.FullName;
77 fbButton.onClick.AddListener (() => (
SetFileToOpen (captured)));
80 foreach (Transform child
in folderBro.transform) {
81 GameObject.Destroy (child.gameObject);
91 DirectoryInfo dir =
new DirectoryInfo (currentPath);
92 List<DirectoryInfo> directories = dir.Split ();
93 foreach (DirectoryInfo dirf
in directories) {
94 Button fbButton = Instantiate (foldButton) as Button;
96 fbButton.GetComponentInChildren<Text> ().text = dirf.Name;
98 fbButton.transform.SetParent (folderBro.transform,
false);
100 string captured = dirf.FullName;
102 fbButton.onClick.AddListener (() => (
UpdateBro (captured)));
109 fileToOpen = fileSelected;
110 if(lastPath != null && lastPath == fileSelected && Time.time - lastClicked < 0.5f){
112 GameObject.Find(
"UIManager").GetComponent<
LoadGUI>().OpenFileCallback();
114 lastClicked = Time.time;
115 lastPath = fileSelected;
123 Debug.Log (currentPath);
void UpdateBro(string pathToGo)
Change current path and updates the content of the browser.
void SetFileToOpen(string fileSelected)
void GoToParent()
Move to the parent directory and display it
void UpdateParentsFolderPanel()
Update the panel which contain parents folder