private IEnumerator WaitForAnswer(CustomDIalogBox dialogBox) { while (dialogBox.Answer.Equals(CustomDIalogBox.AnswerState.Thinking)) { yield return(null); } if (dialogBox.Answer.Equals(CustomDIalogBox.AnswerState.Yes)) { if (isFile) { File.Delete(path); } else if (filebrowser.browseCustomSongs) { string[] files = Directory.GetFiles(path); foreach (var file in files) { File.Delete(file); } Directory.Delete(path); } GameObject.Destroy(gameObject); } }
public static CustomDIalogBox Show(string title, string message) { GameObject canvas = GameObject.Find("Canvas"); if (dialogBox == null) { dialogBox = ((GameObject)Instantiate(Resources.Load("DialogBoxView"), canvas.transform, false)).GetComponent <CustomDIalogBox>(); } else { Instantiate(dialogBox); } dialogBox.txtTitle.text = title; dialogBox.txtMessage.text = message; dialogBox.answer = null; return(dialogBox); }
public void Delete() { if (!(isFile || filebrowser.browseCustomSongs)) { return; } pathHelper.SetPath(path); CustomDIalogBox dialogBox = null; if (isFile) { dialogBox = CustomDIalogBox.Show(pathHelper.FileName, "Are you sure you want to delete the file: " + "\"" + pathHelper.FileName + "\"?"); } else if (filebrowser.browseCustomSongs) { dialogBox = CustomDIalogBox.Show(pathHelper.FileName, "Are you sure you want to delete the map: " + "\"" + pathHelper.FileName + "\"?"); } StartCoroutine(WaitForAnswer(dialogBox)); }