public static string GetProjectConfigPath(ProjectConfigTypes configType) { var projectRootDir = Path.Combine(Application.dataPath, "../.."); var unityProjectsDir = Path.Combine(projectRootDir, ".."); switch (configType) { case ProjectConfigTypes.LocalProject: { return(Path.Combine(projectRootDir, ProjenyEditorUtil.ProjectConfigFileName)); } case ProjectConfigTypes.LocalProjectUser: { return(Path.Combine(projectRootDir, ProjenyEditorUtil.ProjectConfigUserFileName)); } case ProjectConfigTypes.AllProjects: { return(Path.Combine(unityProjectsDir, ProjenyEditorUtil.ProjectConfigFileName)); } case ProjectConfigTypes.AllProjectsUser: { return(Path.Combine(unityProjectsDir, ProjenyEditorUtil.ProjectConfigUserFileName)); } } return(null); }
public static string GetProjectConfigPath(ProjectConfigTypes configType) { var projectRootDir = Path.Combine(Application.dataPath, "../.."); var unityProjectsDir = Path.Combine(projectRootDir, ".."); switch (configType) { case ProjectConfigTypes.LocalProject: { return Path.Combine(projectRootDir, ProjenyEditorUtil.ProjectConfigFileName); } case ProjectConfigTypes.LocalProjectUser: { return Path.Combine(projectRootDir, ProjenyEditorUtil.ProjectConfigUserFileName); } case ProjectConfigTypes.AllProjects: { return Path.Combine(unityProjectsDir, ProjenyEditorUtil.ProjectConfigFileName); } case ProjectConfigTypes.AllProjectsUser: { return Path.Combine(unityProjectsDir, ProjenyEditorUtil.ProjectConfigUserFileName); } } return null; }
IEnumerator TryChangeProjectType(ProjectConfigTypes configType) { if (_projectHandler.HasProjectConfigChanged()) { var fileName = Path.GetFileName(ProjenyEditorUtil.GetProjectConfigPath(_view.ProjectConfigType)); var choice = _view.PromptForUserChoice( "Do you want to save changes to {0}?".Fmt(fileName), new[] { "Save", "Don't Save", "Cancel" }, null, null, 0, 2); yield return(choice); switch (choice.Current) { case 0: { _projectHandler.OverwriteConfig(); break; } case 1: { // Do nothing break; } case 2: { yield break; } default: { Assert.Throw(); break; } } } _view.ProjectConfigType = configType; _projectHandler.RefreshProject(); }
public void OnClickedProjectType(ProjectConfigTypes desiredConfigType) { _asyncProcessor.Process( TryChangeProjectType(desiredConfigType)); }
IEnumerator TryChangeProjectType(ProjectConfigTypes configType) { if (_projectHandler.HasProjectConfigChanged()) { var fileName = Path.GetFileName(ProjenyEditorUtil.GetProjectConfigPath(_view.ProjectConfigType)); var choice = _view.PromptForUserChoice( "Do you want to save changes to {0}?".Fmt(fileName), new[] { "Save", "Don't Save", "Cancel" }, null, null, 0, 2); yield return choice; switch (choice.Current) { case 0: { _projectHandler.OverwriteConfig(); break; } case 1: { // Do nothing break; } case 2: { yield break; } default: { Assert.Throw(); break; } } } _view.ProjectConfigType = configType; _projectHandler.RefreshProject(); }
public void OnClickedProjectType(ProjectConfigTypes desiredConfigType) { _asyncProcessor.Process( TryChangeProjectType(desiredConfigType)); }