diff --git a/Assets/Scripts/Studio/UI/Panel/Panel_NewProjectInfo.cs b/Assets/Scripts/Studio/UI/Panel/Panel_NewProjectInfo.cs index 736aa78b..878547a7 100644 --- a/Assets/Scripts/Studio/UI/Panel/Panel_NewProjectInfo.cs +++ b/Assets/Scripts/Studio/UI/Panel/Panel_NewProjectInfo.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using TMPro; using TriLibCore.SFB; @@ -43,6 +44,14 @@ namespace Studio.UI private void OnClickCreate() { + var projectName = GetProjectName(); + var projectPath = GetProjectRoute(); + + if (!IsProjectNameVaild(projectName) || !IsProjectPathVaild(projectPath)) + { + return; + } + onClickCreate?.Invoke(); } @@ -70,6 +79,22 @@ namespace Studio.UI var template = InputField_ProjectTemplate.text; return template; } + private bool IsProjectNameVaild(string projectName) + { + if (projectName == string.Empty) + { + return false; + } + return true; + } + private bool IsProjectPathVaild(string projectPath) + { + if (projectPath == string.Empty || !Directory.Exists(projectPath)) + { + return false; + } + return true; + } } } diff --git a/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs b/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs index f3c929ef..615f21b1 100644 --- a/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs +++ b/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs @@ -124,14 +124,8 @@ namespace Studio.UI } private bool IsPathVaild(string path) { - if(path == string.Empty) + if(path == string.Empty || !File.Exists(path)) { - Debug.Log("The project path entry field is empty"); - return false; - } - else if (!File.Exists(path)) - { - Debug.Log("The path you entered is not a valid path"); return false; } return true; diff --git a/Assets/Scripts/Studio/UI/Panel/Panel_TopMenuNewProjectInfo.cs b/Assets/Scripts/Studio/UI/Panel/Panel_TopMenuNewProjectInfo.cs index 0e7144d1..25a8b377 100644 --- a/Assets/Scripts/Studio/UI/Panel/Panel_TopMenuNewProjectInfo.cs +++ b/Assets/Scripts/Studio/UI/Panel/Panel_TopMenuNewProjectInfo.cs @@ -75,21 +75,14 @@ namespace Studio.UI { if(projectName == string.Empty) { - Debug.Log("The project name entry field is empty"); return false; } return true; } private bool IsProjectPathVaild(string projectPath) { - if (projectPath == string.Empty) + if (projectPath == string.Empty || !Directory.Exists(projectPath)) { - Debug.Log("The project path entry field is empty"); - return false; - } - else if (!Directory.Exists(projectPath)) - { - Debug.Log("The path you entered is not a valid path"); return false; } return true; diff --git a/Assets/Scripts/Studio/UI/Panel/Panel_TopMenuOpenProjectInfo.cs b/Assets/Scripts/Studio/UI/Panel/Panel_TopMenuOpenProjectInfo.cs index 4b32cc3f..896010a9 100644 --- a/Assets/Scripts/Studio/UI/Panel/Panel_TopMenuOpenProjectInfo.cs +++ b/Assets/Scripts/Studio/UI/Panel/Panel_TopMenuOpenProjectInfo.cs @@ -62,14 +62,8 @@ namespace Studio.UI } private bool IsPathVaild(string path) { - if (path == string.Empty) + if (path == string.Empty || !File.Exists(path)) { - Debug.Log("The project path entry field is empty"); - return false; - } - else if (!File.Exists(path)) - { - Debug.Log("The path you entered is not a valid path"); return false; } return true;