public void DeletePlan(ProjectBox box)
 {
     print(box.name + "deleted !");
     print(path + "\\" + box.text.text + "." + fileExtension);
     System.IO.File.Delete(path + "\\" + box.text.text + "." + fileExtension);
     Refresh();
 }
    public void FindFiles()
    {
        var info     = new DirectoryInfo(path);
        var fileInfo = info.GetFiles();
        int i        = 0;

        foreach (string file in System.IO.Directory.GetFiles(path))
        {
            if (file.Substring(file.Length - fileExtension.Length) == fileExtension)
            {
                ProjectBox currentBox = Instantiate(projectBoxPrefab, boxPosList[i], Quaternion.identity, spawnPos).GetComponent <ProjectBox>();
                boxes.Add(currentBox.gameObject);
                currentBox.text.text   = file.Split('\\')[1].Split('.')[0];
                currentBox.image.color = Color.HSVToRGB((Mathf.Abs(currentBox.text.text.GetHashCode()) % 512) / 512f, 1f, 1f);
                currentBox.crossButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => ProjectManager.singleton.DeletePlan(currentBox)));
                currentBox.imageButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => ProjectManager.singleton.SelectPlan(currentBox)));
                i++;
            }
        }
    }
Exemple #3
0
 public void LoadPlan(ProjectBox box)
 {
     StartCoroutine(LoadYourAsyncScene(box.text.text));
 }
 public void SelectPlan(ProjectBox box)
 {
     MenuManager.singleton.LoadPlan(box);
 }