/// <summary> /// Return the filtered Directories List /// </summary> /// <param name="pProject"></param> /// <param name="pFilter"></param> /// <returns></returns> public List <VO_Directory> BindListFolder(VO_Project project, string filter) { DirectoriesList = InitListFolder(project); List <VO_Directory> filteredDir = new List <VO_Directory>(); filteredDir.Add(DirectoriesList.Find(dir => dir.Name == filter)); return(filteredDir); }
/// <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> /// Return the filtered Directories List /// </summary> /// <param name="pProject"></param> /// <param name="pFilter"></param> /// <returns></returns> public List <VO_Directory> BindListFolder(VO_Project project, String filter) { List <VO_Directory> list = null; RunServiceTask(delegate { list = _rmBusiness.BindListFolder(project, filter); }, Errors.ERROR_RESOURCESMANAGER_STR_LOAD, project.Title, filter); return(list); }
/// <summary> /// Renvoie les informations du menu /// </summary> /// <returns>VO_Menu</returns> public VO_Project GetProjectData() { VO_Project project = null; RunServiceTask(delegate { project = _Business.GetProjectData(); }); return(project); }
/// <summary> /// Création d'un projet /// </summary> /// <param name="pProject">VO_Project</param> public bool CreateProject(VO_Project project) { bool output = false; RunServiceTask(delegate { _Business.CreateProject(project); output = true; }, Errors.ERROR_PROJECT_STR_CREATE); return(output); }
/// <summary> /// Constructeur /// </summary> /// <param name="game"></param> public Screen(Game game, SpriteBatch spriteBatch) : base(game) { _SpriteBatch = spriteBatch; //1 - Couche métier _ScreenBusiness = new ScreenService(); //2 - Récupérer les informations projet _MenuData = _ScreenBusiness.GetMenuData(); _ProjectData = _ScreenBusiness.GetProjectData(); _TerminologyData = _ScreenBusiness.GetTerminologyData(); }
/// <summary> /// Constructeur principal /// </summary> public GameCoreDBSave() { ObjectAnimations = new List<VO_Animation>(); Characters = new List<VO_Character>(); PlayableCharacters = new List<VO_PlayableCharacter>(); Items = new List<VO_Item>(); Actions = new List<VO_Action>(); Events = new List<VO_Event>(); Classes = new List<VO_Class>(); Triggers = new List<VO_Trigger>(); GlobalEvents = new List<VO_GlobalEvent>(); InteractionScripts = new List<VO_Script>(); Menu = new VO_Menu(); Project = new VO_Project(); Variables = new List<VO_Variable>(); Terminology = new VO_Terminology(); }
/// <summary> /// Survient lorsque le formulaire devient visible /// </summary> public void InitializeDBSystem() { //Code de chargement Project = GameCore.Instance.Game.Project.Clone(); //Désactiver events rscMainMenuMusic.ValueChanged -= new EventHandler(rscMainMenuMusic_ValueChanged); rscGameOverMusic.ValueChanged -= new EventHandler(rscGameOverMusic_ValueChanged); rscChoiceButtonSound.ValueChanged -= new EventHandler(rscChoiceButtonSound_ValueChanged); rscMovementButtonSound.ValueChanged -= new EventHandler(rscMovementButtonSound_ValueChanged); rscLifeBar.ValueChanged -= new EventHandler(rscLifeBar_ValueChanged); rscLifeBarDeco.ValueChanged -= new EventHandler(rscLifeBarDeco_ValueChanged); txtTitle.TextChanged -= new EventHandler(txtTitle_TextChanged); rscSystemGUI.ValueChanged -= new EventHandler(rscSystemGUI_ValueChanged); txtAuthor.TextChanged -= new EventHandler(txtAuthor_TextChanged); crdLifeBar.ValueChanged -= new EventHandler(crdLifeBar_ValueChanged); radMov4.CheckedChanged -= new EventHandler(radMov4_CheckedChanged); //Bind des infos dans les contrôles LoadLists(); ScriptManager.LoadScript(Project.GameOver); rscMainMenuMusic.ResourceString = Project.MainMenuMusic.Filename; rscGameOverMusic.ResourceString = Project.GameOverMusic.Filename; rscChoiceButtonSound.ResourceString = Project.ChoiceButtonSound; rscMovementButtonSound.ResourceString = Project.MovementButtonSound; rscLifeBar.ResourceString = Project.LifeBarResource; rscLifeBarDeco.ResourceString = Project.LifeBarBackground; rscSystemGUI.ResourceString = Project.GuiResource; txtResolution.Text = Project.Resolution.Title; txtTitle.Text = Project.Title; if (File.Exists(PathTools.GetProjectPath(Enums.ProjectPath.Menus) + Project.LifeBarResource)) { Image pic = ImageManager.GetImageResource(PathTools.GetProjectPath(Enums.ProjectPath.Menus) + Project.LifeBarResource); crdLifeBar.Coords = new Rectangle(Project.LifeBarCoords, pic.Size); } else { crdLifeBar.Coords = new Rectangle(Project.LifeBarCoords, new Size(0, 0)); } crdLifeBar.SourceResolution = new Size(Project.Resolution.Width, Project.Resolution.Height); if (Project.SplashScreenAnimation != new Guid()) { AnimLoading.LoadAnimation(Project.SplashScreenAnimation); AnimLoading.Start(); } else { AnimLoading.LoadAnimation(new Guid()); } radMov4.Checked = false; radMov8.Checked = false; if (Project.MovementDirections == 4) { radMov4.Checked = true; } else if (Project.MovementDirections == 8) { radMov8.Checked = true; } //Désactiver events rscMainMenuMusic.ValueChanged += new EventHandler(rscMainMenuMusic_ValueChanged); rscGameOverMusic.ValueChanged += new EventHandler(rscGameOverMusic_ValueChanged); rscChoiceButtonSound.ValueChanged += new EventHandler(rscChoiceButtonSound_ValueChanged); rscMovementButtonSound.ValueChanged += new EventHandler(rscMovementButtonSound_ValueChanged); rscLifeBar.ValueChanged += new EventHandler(rscLifeBar_ValueChanged); rscLifeBarDeco.ValueChanged += new EventHandler(rscLifeBarDeco_ValueChanged); rscSystemGUI.ValueChanged += new EventHandler(rscSystemGUI_ValueChanged); txtTitle.TextChanged += new EventHandler(txtTitle_TextChanged); txtAuthor.TextChanged += new EventHandler(txtAuthor_TextChanged); crdLifeBar.ValueChanged += new EventHandler(crdLifeBar_ValueChanged); radMov4.CheckedChanged += new EventHandler(radMov4_CheckedChanged); }
public static bool CheckCurrentProjectIntegrity() { #region Check Event Stage Integrity ProjectValid = true; ErrorList = new List <string>(); #region Verification des nécessités de démarrage VO_Project project = GameCore.Instance.Game.Project; VO_PlayableCharacter character = GameCore.Instance.GetPlayableCharacterById(project.StartingCharacter); if (character == null) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STARTING_CHARACTER_NEEDED); ErrorList.Add(FormatedResult); } else { VO_Stage stage = GameCore.Instance.GetStageById(character.CoordsCharacter.Map); if (stage == null) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STARTING_STAGE_NEEDED); ErrorList.Add(FormatedResult); } } if (string.IsNullOrEmpty(project.GuiResource)) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.GUI_SYSTEM_NEEDED); ErrorList.Add(FormatedResult); } #endregion #region Verification des GlobalEvents ErrorList.Add(Culture.Language.ProjectIntegrity.INTEGRITY_DATABASEZONE + "\r\n\r\n"); foreach (VO_GlobalEvent CurrentEvent in GameCore.Instance.Game.GlobalEvents) { #region Verification des pages if (CurrentEvent.Script != null) { if (EventScriptIntegrity(CurrentEvent.Script) == false) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.SCRIPT_GLOBALEVENT, CurrentEvent.Title); ErrorList.Add(FormatedResult); } } #endregion } #endregion #region Verification de GameOver VO_Script GameOverScript = project.GameOver; if (EventScriptIntegrity(GameOverScript) == false) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.SCRIPT_GAMEOVER); ErrorList.Add(FormatedResult); } #endregion #region Verification des Items foreach (VO_Item CurrentItem in GameCore.Instance.Game.Items) { #region Verification des Action sur Item if (CurrentItem.Scripts != null) { foreach (VO_ActionOnItemScript CurrentItemScript in CurrentItem.Scripts) { if (EventScriptIntegrity(CurrentItemScript.Script) == false) { VO_Action CurrentAction = GameCore.Instance.GetActionById(CurrentItemScript.Id); ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.SCRIPT_ITEM, CurrentItem.Title, CurrentAction.Title); ErrorList.Add(FormatedResult); } } } #endregion } #endregion #region Verification des ItemsInteraction foreach (VO_Script CurrentItemInteraction in GameCore.Instance.Game.InteractionScripts) { #region Verification de l'ItemInteraction if (CurrentItemInteraction != null) { if (EventScriptIntegrity(CurrentItemInteraction) == false) { ProjectValid = false; int FoundItem = 0; List <VO_Item> AssociatedItems = new List <VO_Item>(); foreach (VO_Item CurrentItem in GameCore.Instance.Game.Items) { if (CurrentItem.ItemInteraction.Find(p => p.Script == CurrentItemInteraction.Id) != null) { AssociatedItems.Add(CurrentItem); if (FoundItem == 2) { break; } else { FoundItem = FoundItem + 1; } } } string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.SCRIPT_ITEMINTERACTION, AssociatedItems[0].Title, AssociatedItems[1].Title); ErrorList.Add(FormatedResult); } } #endregion } #endregion #region Verification des Personnages de la Database List <VO_PlayableCharacter> PlayableCharacterList = GameCore.Instance.Game.PlayableCharacters; foreach (VO_PlayableCharacter CurrentPlayableCharacter in PlayableCharacterList) { if (ValidationTools.CheckMapExistence(CurrentPlayableCharacter.CoordsCharacter) == false) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.CHECK_PLAYABLECHARACTER_MAP, CurrentPlayableCharacter.Title); ErrorList.Add(FormatedResult); } } #endregion ErrorList.Add("\r\n\r\n" + Culture.Language.ProjectIntegrity.INTEGRITY_STAGE + "\r\n\r\n"); List <VO_Base> StageList = GameCore.Instance.GetStages(); foreach (VO_Stage CurrentStage in StageList) { #region Verification du Script de démarrage (Premiere fois) if (EventScriptIntegrity(CurrentStage.StartingFirstScript) == false) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_START_FIRST, CurrentStage.Title); ErrorList.Add(FormatedResult); } #endregion #region Verification du Script de démarrage if (EventScriptIntegrity(CurrentStage.StartingScript) == false) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_START, CurrentStage.Title); ErrorList.Add(FormatedResult); } #endregion #region Verification du Script de fin (Premiere fois) if (EventScriptIntegrity(CurrentStage.EndingFirstScript) == false) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_END_FIRST, CurrentStage.Title); ErrorList.Add(FormatedResult); } #endregion #region Verification du Script de fin if (EventScriptIntegrity(CurrentStage.EndingScript) == false) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_END, CurrentStage.Title); ErrorList.Add(FormatedResult); } #endregion #region Verification des Hotspot foreach (VO_StageHotSpot CurrentHotSpot in CurrentStage.ListHotSpots) { #region Verification des pages if (CurrentHotSpot.Event != null) { foreach (VO_Page CurrentPage in CurrentHotSpot.Event.PageList) { #region Verification du Script Courant if (EventScriptIntegrity(CurrentPage.Script) == false) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_HOTSPOT, CurrentStage.Title, CurrentHotSpot.Title, CurrentPage.PageNumber + 1); ErrorList.Add(FormatedResult); } #endregion } } #endregion } #endregion #region Verification des Personnages foreach (VO_StageCharacter CurrentCharacter in CurrentStage.ListCharacters) { #region Verification des pages if (CurrentCharacter.Event != null) { foreach (VO_Page CurrentPage in CurrentCharacter.Event.PageList) { #region Verification du Script Courant if (EventScriptIntegrity(CurrentPage.Script) == false) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.STAGE_SCRIPT_CHARACTER, CurrentStage.Title, CurrentCharacter.Title, CurrentPage.PageNumber + 1); ErrorList.Add(FormatedResult); } #endregion } } #endregion } #endregion #region Verification des Animation foreach (VO_Layer CurrentLayer in CurrentStage.ListLayers) { #region Verification des pages List <VO_StageAnimation> StageAnimationList = CurrentLayer.ListAnimations; if (StageAnimationList != null) { foreach (VO_StageAnimation CurrentStageAnimation in StageAnimationList) { foreach (VO_Page CurrentPage in CurrentStageAnimation.Event.PageList) { #region Verification du Script Courant if (EventScriptIntegrity(CurrentPage.Script) == false) { ProjectValid = false; string FormatedResult = System.String.Format(Culture.Language.ProjectIntegrity.SCRIPT_ANIMATION, CurrentStage.Title, CurrentLayer.Title, CurrentStageAnimation.Title, CurrentPage.PageNumber); ErrorList.Add(FormatedResult); } #endregion } } } #endregion } #endregion } #endregion return(ProjectValid); }
/// <summary> /// Create VO_Directory of each folder locate in the resources manager /// </summary> /// <param name="pProject"></param> /// <returns></returns> private List <VO_Directory> InitListFolder(VO_Project project) { List <VO_Directory> rmFolders = new List <VO_Directory>(); VO_Directory animationsCharactere = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_CHARACTERANIMATIONS, Path = "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_CHARACTERANIMATIONS, Extensions = "Images PNG (*.png)|*.png|Images JPEG (*.jpg)|*.jpg" }; VO_Directory animationsFaces = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_CHARACTERFACES, Path = "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_CHARACTERFACES, Extensions = "Images PNG (*.png)|*.png|Images JPEG (*.jpg)|*.jpg" }; VO_Directory animationsIcons = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_ICONS, Path = "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_ICONS, Extensions = "Images PNG (*.png)|*.png|Images JPEG (*.jpg)|*.jpg" }; VO_Directory animationsMenus = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_MENUS, Path = "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_MENUS, Extensions = "Images PNG (*.png)|*.png|Images JPEG (*.jpg)|*.jpg" }; VO_Directory animationsObjects = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_OBJECTANIMATIONS, Path = "\\" + GlobalConstants.PROJECT_DIR_ANIMATIONS + "\\" + GlobalConstants.PROJECT_DIR_OBJECTANIMATIONS, Extensions = "Images PNG (*.png)|*.png|Images JPEG (*.jpg)|*.jpg" }; VO_Directory decors = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_DECORS, Path = "\\" + GlobalConstants.PROJECT_DIR_DECORS, Extensions = "Images PNG (*.png)|*.png|Images JPEG (*.jpg)|*.jpg" }; VO_Directory fonts = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_FONTS, Path = "\\" + GlobalConstants.PROJECT_DIR_FONTS, Extensions = "Images PNG (*.png)|*.png|Images JPEG (*.jpg)|*.jpg" }; VO_Directory lifeBar = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_LIFEBAR, Path = "\\" + GlobalConstants.PROJECT_DIR_LIFEBAR, Extensions = "Images PNG (*.png)|*.png|Images JPEG (*.jpg)|*.jpg" }; VO_Directory musics = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_MUSICS, Path = "\\" + GlobalConstants.PROJECT_DIR_MUSICS, Extensions = "Musics (*.mp3)|" + GlobalConstants.EXT_MUSIC_PATTERN }; VO_Directory effects = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_EFFECTS, Path = "\\" + GlobalConstants.PROJECT_DIR_SOUNDS + "\\" + GlobalConstants.PROJECT_DIR_EFFECTS, Extensions = "Sounds (*.mp3)|" + GlobalConstants.EXT_SOUNDS_PATTERN }; VO_Directory voices = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_VOICES, Path = "\\" + GlobalConstants.PROJECT_DIR_SOUNDS + "\\" + GlobalConstants.PROJECT_DIR_VOICES, Extensions = "Sounds (*.mp3)|" + GlobalConstants.EXT_SOUNDS_PATTERN }; VO_Directory gui = new VO_Directory() { Name = GlobalConstants.PROJECT_DIR_GUIS, Path = "\\" + GlobalConstants.PROJECT_DIR_GUIS, Extensions = "Images PNG (*.png)|*.png" }; rmFolders.Add(animationsCharactere); rmFolders.Add(animationsFaces); rmFolders.Add(animationsIcons); rmFolders.Add(animationsMenus); rmFolders.Add(animationsObjects); rmFolders.Add(decors); rmFolders.Add(fonts); rmFolders.Add(lifeBar); rmFolders.Add(musics); rmFolders.Add(effects); rmFolders.Add(voices); rmFolders.Add(gui); return(rmFolders); }
/// <summary> /// Default method for binding all directories /// </summary> /// <param name="pProject"></param> /// <returns></returns> public List <VO_Directory> BindListFolder(VO_Project project) { DirectoriesList = InitListFolder(project); return(DirectoriesList); }