/// <summary> /// Insère une animation /// </summary> /// <returns>VO_Animation</returns> public static VO_Animation CreateMenuAnimation() { //Création de l'objet int i = 1; string title = string.Empty; while (true) { if (GameCore.Instance.Game.MenusAnimations.Find(p => p.Title == string.Format(GlobalConstants.ANIMATIONS_NEW_ITEM, i)) != null) { i++; continue; } else { title = string.Format(GlobalConstants.ANIMATIONS_NEW_ITEM, i); break; } } VO_Animation animation = new VO_Animation(Guid.NewGuid(), Enums.AnimationType.Menu); animation.Title = title; //Insertion de l'objet GameCore.Instance.Game.MenusAnimations.Add(animation); return(animation); }
/// <summary> /// Create de l'animation /// </summary> /// <param name="item">Item</param> /// <param name="IdCharacter">Id du character</param> /// <param name="type">Type d'anim</param> /// <param name="x">Position X</param> /// <param name="y">Position Y</param> private void CreateAnimation(Guid itemId, Guid IdCharacter, Enums.AnimationType type, int x, int y, ViewerEnums.ImageResourceType resourceType) { ReadyToExecScript = true; VO_Animation anim = null; switch (type) { case Enums.AnimationType.CharacterAnimation: anim = GameCore.Instance.GetCharAnimationById(IdCharacter, itemId); break; case Enums.AnimationType.CharacterFace: anim = GameCore.Instance.GetCharFaceById(itemId); break; case Enums.AnimationType.IconAnimation: anim = GameCore.Instance.GetIconById(itemId); break; case Enums.AnimationType.Menu: anim = GameCore.Instance.GetMenuById(itemId); break; case Enums.AnimationType.ObjectAnimation: anim = GameCore.Instance.GetAnimationById(itemId); break; } CreateAnimation(itemId, IdCharacter, type, x, y, resourceType, anim.Row); }
public static void CreateCharacter(VO_Stage stage, Point position, Guid charId) { if (stage.ListCharacters.Count < GlobalConstants.PERF_MAX_CHARACTERS_PER_LAYERS) { VO_Character character = GameCore.Instance.GetCharacterById(charId); VO_StageCharacter newChar = new VO_StageCharacter(); //Animation standing VO_Animation standingAnim = character.GetAnimationById(character.StandingAnim); newChar.AnimationId = standingAnim.Id; newChar.Id = Guid.NewGuid(); newChar.Title = character.Title; newChar.Location = position; newChar.Size = new Size(standingAnim.SpriteWidth, standingAnim.SpriteHeight); newChar.CharacterId = charId; newChar.ObjectType = Enums.StageObjectType.Characters; newChar.Stage = stage.Id; newChar.PlayerPositionPoint = new VO_Coords(); newChar.Event = CreateEvent(Enums.EventType.Character, character.Id); stage.ListCharacters.Add(newChar); } else { MessageBox.Show(string.Format(Errors.STAGE_MAX_CHARACTERS, GlobalConstants.PERF_MAX_CHARACTERS_PER_LAYERS), Errors.ERROR_BOX_TITLE); } }
/// <summary> /// Insère une animation /// </summary> /// <returns>VO_Animation</returns> public static VO_Animation CreateCharAnimation(Guid guidChar) { //Création de l'objet int i = 1; string title = string.Empty; while (true) { if (GameCore.Instance.GetCharacterById(guidChar).Animations.Find(p => p.Title == string.Format(GlobalConstants.ANIMATIONS_NEW_ITEM, i)) != null) { i++; continue; } else { title = string.Format(GlobalConstants.ANIMATIONS_NEW_ITEM, i); break; } } VO_Animation animation = new VO_Animation(Guid.NewGuid(), Enums.AnimationType.CharacterAnimation) { ParentCharacter = guidChar, Frequency = 50, SpriteHeight = 1, SpriteWidth = 1, Title = title }; //Insertion de l'objet GameCore.Instance.GetCharacterById(guidChar).Animations.Add(animation); return(animation); }
/// <summary> /// Récupère une nouvelle instance d'un objet /// </summary> /// <param name="pId"></param> /// <returns></returns> public VO_Animation GetCharFaceById(Guid id) { VO_Animation charFace = Game.CharFacesAnimations.Find(p => p.Id == id); if (charFace != null) { return(charFace); } return((VO_Animation)ValidationTools.CreateEmptyRessource(new VO_Animation())); }
/// <summary> /// Récupère une nouvelle instance d'un objet /// </summary> /// <param name="pId"></param> /// <returns></returns> public VO_Animation GetIconById(Guid id) { VO_Animation iconAnimation = Game.IconsAnimations.Find(p => p.Id == id); if (iconAnimation != null) { return(iconAnimation); } return((VO_Animation)ValidationTools.CreateEmptyRessource(new VO_Animation())); }
/// <summary> /// Récupère une nouvelle instance d'un objet /// </summary> /// <param name="pId"></param> /// <returns></returns> public VO_Animation GetMenuById(Guid id) { VO_Animation menuAnimation = Game.MenusAnimations.Find(p => p.Id == id); if (menuAnimation != null) { return(menuAnimation); } return((VO_Animation)ValidationTools.CreateEmptyRessource(new VO_Animation())); }
/// <summary> /// Charge le VO_Animation en fonction du type /// </summary> /// <param name="pParentCharacterId">Id d'un character</param> /// <param name="pId">Id de l'animation</param> /// <returns>Animation</returns> public VO_Animation LoadVOObject(Guid parentCharacterId, Guid id) { VO_Animation animation = null; RunServiceTask(delegate { animation = _Business.LoadVOObject(parentCharacterId, id); }, Errors.ERROR_ANIMATION_STR_LOAD, parentCharacterId.ToString(), id.ToString()); return(animation); }
/// <summary> /// Charge le VO_Animation en fonction du type /// </summary> /// <param name="pType">Type d'animation</param> /// <param name="pId">Id de l'animation</param> /// <returns>Animation</returns> public VO_Animation LoadVOObject(Enums.AnimationType type, Guid id) { VO_Animation animation = null; RunServiceTask(delegate { animation = _Business.LoadVOObject(type, id); }, Errors.ERROR_ANIMATION_STR_LOAD, type.ToString(), id.ToString()); return(animation); }
/// <summary> /// Crée une animation /// </summary> /// <param name="pParentCharacter">Id du character</param> /// <returns>VO_Animation</returns> public VO_Animation CreateAnimation(Guid parentCharacter) { VO_Animation animation = null; RunServiceTask(delegate { animation = _Business.CreateAnimation(parentCharacter); }, Errors.ERROR_ANIMATION_STR_CREATE, parentCharacter.ToString()); return(animation); }
/// <summary> /// Crée une animation /// </summary> /// <param name="pType">Type d'animation</param> /// <returns>VO_Animation</returns> public VO_Animation CreateAnimation(Enums.AnimationType type) { VO_Animation animation = null; RunServiceTask(delegate { animation = _Business.CreateAnimation(type); }, Errors.ERROR_ANIMATION_STR_CREATE, type.ToString()); return(animation); }
/// <summary> /// set la position /// </summary> /// <param name="x">x</param> /// <param name="y">y</param> public static void SetPosition(int x, int y) { if (_CurrentActionSprite != null) { foreach (VO_AnimatedSprite anim in _CurrentActionSprite) { VO_Animation animation = GameCore.Instance.GetIconById(anim.AnimationId); anim.SetPosition(x - animation.OriginPoint.X, y - animation.OriginPoint.Y); } } }
/// <summary> /// Récupère une nouvelle instance d'un objet /// </summary> /// <param name="pId"></param> /// <returns></returns> public VO_Animation GetCharAnimationById(Guid idChar, Guid idAnim) { VO_Character character = GameCore.Instance.GetCharacterById(idChar); if (character.Id != Guid.Empty) { VO_Animation charAnimation = character.Animations.Find(p => p.Id == idAnim); if (charAnimation != null) { return(charAnimation); } } return((VO_Animation)ValidationTools.CreateEmptyRessource(new VO_Animation())); }
/// <summary> /// Constructeur pour pnj /// </summary> public VO_CharacterSprite(VO_StageCharacter source) { _AnimationsStanding = new List <VO_AnimatedSprite[]>(); _AnimationsWalking = new List <VO_AnimatedSprite[]>(); _AnimationsTalking = new List <VO_AnimatedSprite[]>(); VO_Character character = GameCore.Instance.GetCharacterById(source.CharacterId); this.Face = character.Face; this.CharacterId = character.Id; this.Id = source.Id; this.DialogColor = character.DialogColor; if (character.Face != Guid.Empty) { FaceAnim = new VO_AnimatedSprite(character.Face, Guid.Empty, Enums.AnimationType.CharacterFace, 0, 0, Constants.ViewerEnums.ImageResourceType.Screen); } this.Speed = character.Speed; this.StandingAnim = character.StandingAnim; this.TalkingAnim = character.TalkingAnim; this.Title = source.Title; this.WalkingAnim = character.WalkingAnim; _NbrDirections = GameCore.Instance.Game.Project.MovementDirections; foreach (VO_Animation anim in character.Animations) { VO_AnimatedSprite[] animationsStanding = new VO_AnimatedSprite[GameCore.Instance.Game.Project.MovementDirections]; VO_AnimatedSprite[] animationsWalking = new VO_AnimatedSprite[GameCore.Instance.Game.Project.MovementDirections]; VO_AnimatedSprite[] animationsTalking = new VO_AnimatedSprite[GameCore.Instance.Game.Project.MovementDirections]; for (int i = 0; i < GameCore.Instance.Game.Project.MovementDirections; i++) { animationsStanding[i] = new VO_AnimatedSprite(anim.Id, source.CharacterId, Enums.AnimationType.CharacterAnimation, 0, 0, Constants.ViewerEnums.ImageResourceType.Screen, i); animationsWalking[i] = new VO_AnimatedSprite(anim.Id, source.CharacterId, Enums.AnimationType.CharacterAnimation, 0, 0, Constants.ViewerEnums.ImageResourceType.Screen, i); animationsTalking[i] = new VO_AnimatedSprite(anim.Id, source.CharacterId, Enums.AnimationType.CharacterAnimation, 0, 0, Constants.ViewerEnums.ImageResourceType.Screen, i); } _AnimationsStanding.Add(animationsStanding); _AnimationsWalking.Add(animationsWalking); _AnimationsTalking.Add(animationsTalking); } _Scale = new Vector2(1, 1); CurrentExecutingPage = -1; VO_Animation anima = GameCore.Instance.GetCharAnimationById(this.CharacterId, this.StandingAnim); SetPosition(source.Location.X + anima.OriginPoint.X, source.Location.Y + anima.OriginPoint.Y); SetCurrentAnimation(Enums.CharacterAnimationType.Standing, this.StandingAnim); }
/// <summary> /// Chargement d'animation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AnimBackButton_AnimationLoading(object sender, EventArgs e) { Menu.InventoryBackButtonAnimation = AnimBackButton.Animation; Menu.Update(); VO_Animation animBackButton = GameCore.Instance.Game.MenusAnimations.Find(p => p.Id == Menu.InventoryBackButtonAnimation); if (animBackButton != null) { crdBackButtonPosition.Coords = new Rectangle(Menu.InventoryBackButtonCoords, new Size(animBackButton.SpriteWidth, animBackButton.SpriteHeight)); } else { crdBackButtonPosition.Coords = new Rectangle(Menu.InventoryBackButtonCoords, new Size(0, 0)); } }
/// <summary> /// Chargement d'animation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AnimInventoryMenu_AnimationLoading(object sender, EventArgs e) { Menu.InventoryAnimation = AnimInventoryMenu.Animation; Menu.Update(); VO_Animation animInventory = GameCore.Instance.Game.MenusAnimations.Find(p => p.Id == Menu.InventoryAnimation); if (animInventory != null) { crdInventoryBackground.Coords = new Rectangle(Menu.InventoryBackgroundCoords, new Size(animInventory.SpriteWidth, animInventory.SpriteHeight)); } else { crdInventoryBackground.Coords = new Rectangle(Menu.InventoryBackgroundCoords, new Size(0, 0)); } }
/// <summary> /// Récupérer la position en 0 de l'anim /// </summary> public Point GetAnimPosition() { if (AllDirectionsSprites != null) { foreach (VO_AnimatedSprite animSprite in AllDirectionsSprites) { VO_Animation anim = GameCore.Instance.GetCharAnimationById(this.CharacterId, animSprite.AnimationId); int scaledW = (int)((float)anim.OriginPoint.X * _Scale.X); int scaledH = (int)((float)anim.OriginPoint.Y * _Scale.X); return(new Point(this.Location.X - scaledW, this.Location.Y - scaledH)); } } return(Location); }
/// <summary> /// Insère un character /// </summary> /// <returns>VO_Character</returns> public static VO_Character CreateCharacter() { //Création de l'objet int i = 1; string title = string.Empty; while (true) { if (GameCore.Instance.Game.Characters.Find(p => p.Title == string.Format(GlobalConstants.CHARACTERS_NEW_ITEM, i)) != null) { i++; continue; } else { title = string.Format(GlobalConstants.CHARACTERS_NEW_ITEM, i); break; } } VO_Character character = new VO_Character(Guid.NewGuid()) { Title = title, Speed = GlobalConstants.CHARACTERS_NORMAL_SPEED, DialogColor = FormsTools.GetVOColorFromGDIColor(Color.Black), Animations = new List <VO_Animation>() }; //Insertion de l'objet GameCore.Instance.Game.Characters.Add(character); //Animations VO_Animation standing = CreateCharAnimation(character.Id); standing.Title = GlobalConstants.CHARACTERS_STANDING; VO_Animation walking = CreateCharAnimation(character.Id); walking.Title = GlobalConstants.CHARACTERS_WALKING; VO_Animation talking = CreateCharAnimation(character.Id); talking.Title = GlobalConstants.CHARACTERS_TALKING; character.TalkingAnim = talking.Id; character.StandingAnim = standing.Id; character.WalkingAnim = walking.Id; return(character); }
/// <summary> /// Vérifie qu'un point touche le perso /// </summary> /// <param name="point"></param> /// <returns></returns> public bool PointIsInCharacter(Point point) { VO_Animation anim = GameCore.Instance.GetCharAnimationById(this.CharacterId, this.CurrentAnimationType); Point animPos = GetAnimPosition(); Rectangle sizeChar = new Rectangle(animPos.X, animPos.Y, (int)((float)anim.SpriteWidth * _Scale.X), ((int)((float)anim.SpriteHeight * _Scale.Y))); if (sizeChar.Contains(point)) { VO_Sprite sprite = this.AllDirectionsSprites[(int)this.CurrentDirection].Sprite; if (sprite != null) { /*Point relativePoint = new Point(point.X - animPos.X, point.Y - animPos.Y); * Rectangle source = new Rectangle(sprite.Source.X + relativePoint.X, sprite.Source.Y + relativePoint.Y, 1, 1); * Color[] colors1D = new Color[1]; * sprite.Image.GetData(0, source, colors1D, 0, 1); * * Color color = colors1D[0]; * if (color.A != 0 || color.R != 0 || color.G != 0 || color.B != 0) * { * return true; * } * * Sprite*/ return(true); /*for (int x = 0; x < sprite.Width; x++) * { * if (relativePoint.X == x) * { * for (int y = 0; y < sprite.Height; y++) * { * if (relativePoint.Y == y) * { * Color color = colors1D[x + y * sprite.Width]; * if (color.A != 255) * { * return true; * } * } * } * } * }*/ } } return(false); }
/// <summary> /// Code ajouté lors de la création d'un item /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListAnimations_ItemToCreate(object sender, EventArgs e) { VO_Animation newAnim = null; if (AnimationType == Enums.AnimationType.CharacterAnimation) { newAnim = _Service.CreateAnimation(ParentCharacter); } else { newAnim = _Service.CreateAnimation(AnimationType); } newAnim.Frequency = EditorSettings.Instance.AnimationFrequency; newAnim.SpriteWidth = 1; newAnim.SpriteHeight = 1; ListAnimations.AddItem(newAnim.Id, newAnim.Title); LoadAnimation(newAnim.Id); }
/// <summary> /// Crée une nouvelle image /// </summary> /// <param name="url">Url de l'image</param> public static void CreateNewImageStageCharacter(Guid value) { //Dictionnaire d'image if (_ImagesStageChars == null) { _ImagesStageChars = new Dictionary <Guid, Image>(); } //Pas d'image envoyée if (value == new Guid()) { return; } //Ajout de l'image if (!_ImagesStageChars.ContainsKey(value)) { try { VO_Character charObject = GameCore.Instance.GetCharacterById(value); VO_Animation animObject = GameCore.Instance.GetCharAnimationById(value, charObject.StandingAnim); _ImagesStageChars.Add(value, FromFileThenClose(PathTools.GetProjectPath(Enums.AnimationType.CharacterAnimation) + animObject.ResourcePath)); LogTools.WriteDebug(string.Format(Logs.MANAGER_IMAGE_CREATED, value.ToString(), Logs.MANAGER_CHARS)); } catch (InsufficientMemoryException ie) { LogTools.WriteInfo(Logs.MANAGER_MEMORY_ERROR); LogTools.WriteDebug(ie.Message); ResetResources(); CreateNewImageStageCharacter(value); } catch (Exception e) { LogTools.WriteInfo(string.Format(Logs.MANAGER_IMAGE_NOT_FOUND, value)); LogTools.WriteDebug(e.Message); _ImagesStageChars.Add(value, NotFoundPicture); } } }
public static void CreateAnimation(VO_Layer layer, Point position, Guid animId) { if (layer.ListAnimations.Count < GlobalConstants.PERF_MAX_ANIMATION_PER_LAYERS) { VO_Animation animation = GameCore.Instance.GetAnimationById(animId); VO_StageAnimation newAnim = new VO_StageAnimation(); newAnim.Id = Guid.NewGuid(); newAnim.Title = animation.Title; newAnim.Location = position; newAnim.Size = new Size(animation.SpriteWidth, animation.SpriteHeight); newAnim.AnimationId = animId; newAnim.ObjectType = Enums.StageObjectType.Animations; newAnim.Stage = layer.Stage; newAnim.Layer = layer.Id; newAnim.Event = CreateEvent(Enums.EventType.Animation, animation.Id); layer.ListAnimations.Add(newAnim); } else { MessageBox.Show(string.Format(Errors.STAGE_MAX_ANIMATIONS, GlobalConstants.PERF_MAX_ANIMATION_PER_LAYERS), Errors.ERROR_BOX_TITLE); } }
/// <summary> /// Méthode qui charge l'animation courante /// </summary> public void LoadAnimation(Guid guid) { Cursor.Current = Cursors.WaitCursor; //Stop Timer _FrequencyTimer.Stop(); //Anim courante Animation = guid; if (this.AnimationLoading != null) { this.AnimationLoading(this, new EventArgs()); } if (AnimationFilter == Enums.AnimationType.CharacterAnimation) { _CurrentAnim = _Service.LoadVOObject(ParentCharacter, Animation); } else { _CurrentAnim = _Service.LoadVOObject(AnimationFilter, Animation); } //Rechargement de la ressource if (_CurrentAnim != null && _CurrentAnim.ResourcePath != null) { //Mise en place du sprite root. _CurrentSprite.X = 0; _CurrentSprite.Width = _CurrentAnim.SpriteWidth; _CurrentSprite.Height = _CurrentAnim.SpriteHeight; if (UseCustomRow) { _CurrentSprite.Y = Row * _CurrentSprite.Height; } else { _CurrentSprite.Y = _CurrentAnim.Row * _CurrentSprite.Height; } if (!string.IsNullOrEmpty(_CurrentAnim.ResourcePath)) { _Service.LoadSurfaceFromURI(PathTools.GetProjectPath(AnimationFilter) + _CurrentAnim.ResourcePath); } else { _Service.LoadSurfaceFromURI(string.Empty); _CurrentSprite.Y = 0; } //Timer if (UseCustomFrequency) { _FrequencyTimer.Interval = 10000 / Frequency; } else { _FrequencyTimer.Interval = 10000 / _CurrentAnim.Frequency; } } //TODO: A vérif si toujours nécessaire else { _Service.LoadEmptySurface(); _CurrentSprite.X = 0; _CurrentSprite.Width = 1; _CurrentSprite.Height = 1; } //FINTODO //Récupération de la taille de la ressource originale _OriginalResourceSize = _Service.GetSizeOfResource(); RefreshPreview(); Cursor.Current = DefaultCursor; }
/// <summary> /// Create de l'animation /// </summary> /// <param name="item">Item</param> /// <param name="IdCharacter">Id du character</param> /// <param name="type">Type d'anim</param> /// <param name="x">Position X</param> /// <param name="y">Position Y</param> private void CreateAnimation(Guid itemId, Guid IdCharacter, Enums.AnimationType type, int x, int y, ViewerEnums.ImageResourceType resourceType, int rowOverload) { //Récupérer l'animation VO_Animation anim = null; switch (type) { case Enums.AnimationType.CharacterAnimation: anim = GameCore.Instance.GetCharAnimationById(IdCharacter, itemId); break; case Enums.AnimationType.CharacterFace: anim = GameCore.Instance.GetCharFaceById(itemId); break; case Enums.AnimationType.IconAnimation: anim = GameCore.Instance.GetIconById(itemId); break; case Enums.AnimationType.Menu: anim = GameCore.Instance.GetMenuById(itemId); break; case Enums.AnimationType.ObjectAnimation: anim = GameCore.Instance.GetAnimationById(itemId); break; } if (!string.IsNullOrEmpty(anim.ResourcePath)) { Texture2D resource = null; ////TODO: Vérifier l'existence de la ressource, sinon mettre une image par défaut DANS L'IMAGE MANAGER !!!!! //String LocalPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Resources\\"; //if (File.Exists(PathTools.GetProjectPath(type) + anim.ResourcePath) == false) //{ // anim.ResourcePath = LocalPath + "Default.jpg"; //} switch (resourceType) { case ViewerEnums.ImageResourceType.Screen: resource = ImageManager.CurrentStage.GetScreenImage(PathTools.GetProjectPath(type) + anim.ResourcePath); break; case ViewerEnums.ImageResourceType.Permanent: resource = ImageManager.GetPermanentImage(PathTools.GetProjectPath(type) + anim.ResourcePath); break; } if (resource != null) { Frequency = (int)((double)(10000 / anim.Frequency) * 0.06); Width = (uint)anim.SpriteWidth; Height = (uint)anim.SpriteHeight; int nbrSprites = (int)resource.Width / anim.SpriteWidth; _Sprites = new VO_Sprite[nbrSprites]; _posX = x; _posY = y; AnimationId = anim.Id; _CharacterId = IdCharacter; _AnimationType = type; _ResourceType = resourceType; //Création des sprites for (int i = 0; i < nbrSprites; i++) { Guid id = Guid.NewGuid(); int posX = i * (int)Width; int posY = rowOverload * (int)Height; switch (resourceType) { case ViewerEnums.ImageResourceType.Screen: SpriteManager.CreateScreenSprite(id, PathTools.GetProjectPath(type) + anim.ResourcePath, new Vector2(x, y), new Rectangle(posX, rowOverload * (int)Height, (int)Width, (int)Height), null); _Sprites[i] = SpriteManager.GetScreenSprite(id); break; case ViewerEnums.ImageResourceType.Permanent: SpriteManager.CreatePermanentSprite(id, PathTools.GetProjectPath(type) + anim.ResourcePath, new Vector2(x, y), new Rectangle(posX, rowOverload * (int)Height, (int)Width, (int)Height), null); _Sprites[i] = SpriteManager.GetPermanentSprite(id); break; } _Sprites[i].Id = id; } _CurrentSprite = 0; CurrentExecutingPage = -1; } } else { _Sprites = new VO_Sprite[1]; _Sprites[0] = null; } }
/// <summary> /// Survient lorsque le formulaire devient visible /// </summary> public void InitializeDBMenus() { //Code de chargement Menu = GameCore.Instance.Game.Menu; //Désactiver events this.ddpGridWidth.ValueChanged -= new System.EventHandler(this.ddpGridWidth_ValueChanged); this.ddpGridHeight.ValueChanged -= new System.EventHandler(this.ddpGridHeight_ValueChanged); this.ddpItemWidth.ValueChanged -= new System.EventHandler(this.ddpItemWidth_ValueChanged); this.ddpItemHeight.ValueChanged -= new System.EventHandler(this.ddpGridHeight_ValueChanged); chkActivateMain.CheckedChanged -= new EventHandler(chkActivateMain_CheckedChanged); chkEchapMenu.CheckedChanged -= new EventHandler(chkEchapMenu_CheckedChanged); chkLoadingMenu.CheckedChanged -= new EventHandler(chkLoadingMenu_CheckedChanged); chkSaveMenu.CheckedChanged -= new EventHandler(chkSaveMenu_CheckedChanged); AnimMainMenu.AnimationLoading -= new EventHandler(AnimPrincipalMenu_AnimationLoading); AnimInventoryMenu.AnimationLoading -= new EventHandler(AnimInventoryMenu_AnimationLoading); AnimBackButton.AnimationLoading -= new EventHandler(AnimBackButton_AnimationLoading); //Bind des infos dans les contrôles chkActivateMain.Checked = Menu.ActivateMainMenu; chkEchapMenu.Checked = Menu.ActivateEchapMenu; chkLoadingMenu.Checked = Menu.ActivateLoadingMenu; chkSaveMenu.Checked = Menu.ActivateSaveMenu; if (Menu.InventoryAnimation != new Guid()) { AnimInventoryMenu.LoadAnimation(Menu.InventoryAnimation); AnimInventoryMenu.Start(); } else { AnimInventoryMenu.LoadAnimation(new Guid()); } if (Menu.InventoryBackButtonAnimation != new Guid()) { AnimBackButton.LoadAnimation(Menu.InventoryBackButtonAnimation); AnimBackButton.Start(); } else { AnimBackButton.LoadAnimation(new Guid()); } if (Menu.MainMenuAnimation != new Guid()) { AnimMainMenu.LoadAnimation(Menu.MainMenuAnimation); AnimMainMenu.Start(); } else { AnimMainMenu.LoadAnimation(new Guid()); } crdInventoryPosition.SourceResolution = new Size(GameCore.Instance.Game.Project.Resolution.Width, GameCore.Instance.Game.Project.Resolution.Height); crdBackButtonPosition.SourceResolution = new Size(GameCore.Instance.Game.Project.Resolution.Width, GameCore.Instance.Game.Project.Resolution.Height); crdInventoryBackground.SourceResolution = new Size(GameCore.Instance.Game.Project.Resolution.Width, GameCore.Instance.Game.Project.Resolution.Height); crdInventoryPosition.Coords = new Rectangle(Menu.InventoryCoords, new Size(Menu.GridWidth * Menu.ItemWidth, Menu.GridHeight * Menu.ItemHeight)); VO_Animation animInventory = GameCore.Instance.Game.MenusAnimations.Find(p => p.Id == Menu.InventoryAnimation); if (animInventory != null) { crdInventoryBackground.Coords = new Rectangle(Menu.InventoryBackgroundCoords, new Size(animInventory.SpriteWidth, animInventory.SpriteHeight)); } else { crdInventoryBackground.Coords = new Rectangle(Menu.InventoryBackgroundCoords, new Size(0, 0)); } VO_Animation animBackButton = GameCore.Instance.Game.MenusAnimations.Find(p => p.Id == Menu.InventoryBackButtonAnimation); if (animBackButton != null) { crdBackButtonPosition.Coords = new Rectangle(Menu.InventoryBackButtonCoords, new Size(animBackButton.SpriteWidth, animBackButton.SpriteHeight)); } else { crdBackButtonPosition.Coords = new Rectangle(Menu.InventoryBackButtonCoords, new Size(0, 0)); } ddpGridWidth.Value = Menu.GridWidth; ddpGridHeight.Value = Menu.GridHeight; ddpItemWidth.Value = Menu.ItemWidth; ddpItemHeight.Value = Menu.ItemHeight; //Activer les events this.ddpGridWidth.ValueChanged += new System.EventHandler(this.ddpGridWidth_ValueChanged); this.ddpGridHeight.ValueChanged += new System.EventHandler(this.ddpGridHeight_ValueChanged); this.ddpItemWidth.ValueChanged += new System.EventHandler(this.ddpItemWidth_ValueChanged); this.ddpItemHeight.ValueChanged += new System.EventHandler(this.ddpItemHeight_ValueChanged); AnimBackButton.AnimationLoading += new EventHandler(AnimBackButton_AnimationLoading); AnimInventoryMenu.AnimationLoading += new EventHandler(AnimInventoryMenu_AnimationLoading); AnimMainMenu.AnimationLoading += new EventHandler(AnimPrincipalMenu_AnimationLoading); chkActivateMain.CheckedChanged += new EventHandler(chkActivateMain_CheckedChanged); chkEchapMenu.CheckedChanged += new EventHandler(chkEchapMenu_CheckedChanged); chkLoadingMenu.CheckedChanged += new EventHandler(chkLoadingMenu_CheckedChanged); chkSaveMenu.CheckedChanged += new EventHandler(chkSaveMenu_CheckedChanged); }