/// <summary> /// Vérifie si un projet à créer existe à l'emplacement indiqué. /// </summary> /// <param name="pFile">Chemin vers le projet</param> /// <param name="pTitle">Titre du projet</param> /// <returns>True si le projet existe, false sinon</returns> public bool CheckIfProjectExist(string file, string title) { string normTitle = ValidationTools.NormalizeFolderName(title); if (File.Exists(file + "\\" + normTitle + "\\" + normTitle + ".pcs")) { return(true); } return(false); }
/// <summary> /// Création d'un projet /// </summary> /// <param name="pProject">VO_Project</param> public void CreateProject(VO_Project project) { //Nouvelles données projet. GameCore.Instance.ResetGameCore(); GameCore.Instance.Game.Project = project; GameCore.Instance.Game.Project.ProjectFileName = project.Title; GameCore.Instance.Game.Project.Version = GlobalConstants.PROJECT_VERSION; GameCore.Instance.Game.Project.BetaVersion = GlobalConstants.BETA_VERSION; GameCore.Instance.Game.Project.RootPath = project.RootPath += "\\" + ValidationTools.NormalizeFolderName(project.Title) + "\\"; GameCore.Instance.Game.Project.MovementDirections = 4; //Création des dossiers du projet Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_MANUALS); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_CHARACTERANIMATIONS); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_CHARACTERFACES); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_ICONS); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_MENUS); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_OBJECTANIMATIONS); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_DECORS); //Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_FONTS); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_LIFEBAR); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_MUSICS); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_SOUNDS); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_SOUNDS + "\\" + GlobalConstants.PROJECT_DIR_VOICES); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_SOUNDS + "\\" + GlobalConstants.PROJECT_DIR_EFFECTS); Directory.CreateDirectory(project.RootPath + GlobalConstants.PROJECT_DIR_RESOURCES + "\\" + GlobalConstants.PROJECT_DIR_GUIS); project.GameOverMusic = new VO_Music(); project.MainMenuMusic = new VO_Music(); project.GameOver = ObjectsFactory.CreateScript(Enums.ScriptType.GameOverEvent); //Création de Map de base. EditorHelper.Instance.LastOrdinalLayer = 0; project.GameOver = ObjectsFactory.CreateScript(Enums.ScriptType.GameOverEvent); //Création de l'action "Aller" VO_Action go = ObjectsFactory.CreateAction(new Guid(GlobalConstants.ACTION_GO_ID)); go.Title = GlobalConstants.ACTION_GO; go.GoAction = true; //Création de l'action "Utiliser" VO_Action use = ObjectsFactory.CreateAction(new Guid(GlobalConstants.ACTION_USE_ID)); use.Title = GlobalConstants.ACTION_USE; use.UseAction = true; //Création des menus ObjectsFactory.CreateMenu(); //Terminology ObjectsFactory.CreateTerminology(); }
/// <summary> /// Sauvegarde l'intégralité du projet (xml général et maps) /// </summary> public void SaveProject() { //Cleanup Projet ValidationTools.CleanupProject(); Type[] ScriptTypes = AppTools.GetScriptTypes(); XmlSerializer XML_Project = new XmlSerializer(typeof(VO_Game), ScriptTypes); TextWriter text = new StringWriter(); XmlWriter xmlWriter = new XmlTextWriter(text); //Début de l'écriture xmlWriter.WriteStartElement(XML.NODE_ROOT); XML_Project.Serialize(xmlWriter, GameCore.Instance.Game); xmlWriter.WriteEndElement(); StreamWriter stream = File.CreateText(GameCore.Instance.Game.Project.RootPath + "\\" + ValidationTools.NormalizeFolderName(GameCore.Instance.Game.Project.ProjectFileName) + GlobalConstants.EXT_PROJECT); stream.Write(text.ToString()); stream.Close(); xmlWriter.Close(); text.Close(); }