diff --git a/Assets/Scripts/Studio/UI/Panel/Panel_NewProjectInfo.cs b/Assets/Scripts/Studio/UI/Panel/Panel_NewProjectInfo.cs index 878547a7..40691c8a 100644 --- a/Assets/Scripts/Studio/UI/Panel/Panel_NewProjectInfo.cs +++ b/Assets/Scripts/Studio/UI/Panel/Panel_NewProjectInfo.cs @@ -47,7 +47,7 @@ namespace Studio.UI var projectName = GetProjectName(); var projectPath = GetProjectRoute(); - if (!IsProjectNameVaild(projectName) || !IsProjectPathVaild(projectPath)) + if (!IsProjectNameVaild(projectName) || !IsProjectPathVaild(projectPath) || !IsProjectExistVaild()) { return; } @@ -95,6 +95,17 @@ namespace Studio.UI } return true; } + private bool IsProjectExistVaild() + { + var projectPath = InputField_ProjectRoute.text; + var projectNameAndExtension = $"{InputField_ProjectName.text}.ocs"; + var filePath = Path.Combine(projectPath, projectNameAndExtension); + if (File.Exists(filePath)) + { + 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 25a8b377..df24aa88 100644 --- a/Assets/Scripts/Studio/UI/Panel/Panel_TopMenuNewProjectInfo.cs +++ b/Assets/Scripts/Studio/UI/Panel/Panel_TopMenuNewProjectInfo.cs @@ -41,7 +41,7 @@ namespace Studio.UI var projectName = GetProjectName(); var projectPath = GetProjectRoute(); - if (!IsProjectNameVaild(projectName) || !IsProjectPathVaild(projectPath)) + if (!IsProjectNameVaild(projectName) || !IsProjectPathVaild(projectPath) || IsProjectExistVaild()) { return; } @@ -87,5 +87,17 @@ namespace Studio.UI } return true; } + private bool IsProjectExistVaild() + { + var projectPath = InputField_ProjectRoute.text; + var projectNameAndExtension = $"{InputField_ProjectName.text}.ocs"; + + var filePath = Path.Combine(projectPath, projectNameAndExtension); + if (File.Exists(filePath)) + { + return false; + } + return true; + } } }