/// <summary> /// Méthode qui charge l'animation courante /// </summary> public void LoadCharacter(Guid guid) { Cursor.Current = Cursors.WaitCursor; //Suppression des eventhandler this.txtName.LostFocus -= new System.EventHandler(this.txtName_TextChanged); this.ddpSpeed.ValueChanged -= new System.EventHandler(this.ddpSpeed_ValueChanged); //Code de chargement CurrentCharacter = GameCore.Instance.GetCharacterById(guid); txtName.Text = CurrentCharacter.Title; ddpSpeed.Value = CurrentCharacter.Speed; AnimCharacter.ParentCharacter = CurrentCharacter.Id; ColorDialog.Color = FormsTools.GetGDIColorFromVOColor(CurrentCharacter.DialogColor); if (CurrentCharacter.Face != new Guid()) { AnimFace.LoadAnimation(CurrentCharacter.Face); AnimFace.Start(); } else { AnimFace.LoadAnimation(new Guid()); } if (CurrentCharacter.TalkingFace != new Guid()) { TalkingFace.LoadAnimation(CurrentCharacter.TalkingFace); TalkingFace.Start(); } else { TalkingFace.LoadAnimation(new Guid()); } LoadLists(); if (CurrentCharacter.StandingAnim != new Guid()) { AnimCharacter.UseCustomRow = true; AnimCharacter.Row = 2; AnimCharacter.LoadAnimation(CurrentCharacter.StandingAnim); AnimCharacter.Start(); } else { AnimCharacter.LoadAnimation(new Guid()); } this.txtName.LostFocus += new System.EventHandler(this.txtName_TextChanged); this.ddpSpeed.ValueChanged += new System.EventHandler(this.ddpSpeed_ValueChanged); grpAnimations.Visible = true; grpInformations.Visible = true; grpDialogs.Visible = true; Cursor.Current = DefaultCursor; }
/// <summary> /// Méthode qui charge l'animation courante /// </summary> public void LoadCharacter(Guid guid) { Cursor.Current = Cursors.WaitCursor; //Suppression des eventhandler this.chkLife.CheckedChanged -= new System.EventHandler(this.chkLife_CheckedChanged); this.ddpPVStarting.ValueChanged -= new System.EventHandler(this.ddpPV_ValueChanged); this.ddpPVMax.ValueChanged -= new System.EventHandler(this.ddpPV_ValueChanged); this.txtName.LostFocus -= new System.EventHandler(this.txtName_TextChanged); this.crdStartingPosition.ValueChanged -= new EventHandler(crdStartingPosition_ValueChanged); //Code de chargement CurrentCharacter = GameCore.Instance.GetPlayableCharacterById(guid); _characterTemplate = GameCore.Instance.GetCharacterById(CurrentCharacter.CharacterId); txtName.Text = CurrentCharacter.Title; ddpPVMax.Value = CurrentCharacter.PvMax; ddpPVStarting.Value = CurrentCharacter.PvAtStart; chkLife.Checked = CurrentCharacter.ActivateLife; chkLife_CheckedChanged(this, new EventArgs()); crdStartingPosition.FullCoords = CurrentCharacter.CoordsCharacter; AnimCharacter.ParentCharacter = _characterTemplate.Id; LoadLists(); if (_characterTemplate.StandingAnim != new Guid()) { AnimCharacter.UseCustomRow = true; AnimCharacter.Row = (int)CurrentCharacter.StartPosition; AnimCharacter.LoadAnimation(_characterTemplate.StandingAnim); AnimCharacter.Start(); } else { AnimCharacter.LoadAnimation(new Guid()); } //Chargement des actions ListSelectedActions.Items.Clear(); ListSelectedActions.DisplayMember = "Title"; ListSelectedActions.ValueMember = "Id"; ListAvailableActions.Items.Clear(); ListAvailableActions.DisplayMember = "Title"; ListAvailableActions.ValueMember = "Id"; foreach (VO_Base action in GameCore.Instance.Game.Actions) { if (CurrentCharacter.Actions.Contains(action.Id)) { ListSelectedActions.Items.Add(action); } else { ListAvailableActions.Items.Add(action); } } //Chargement des items ListSelectedItems.Items.Clear(); ListSelectedItems.DisplayMember = "Title"; ListSelectedItems.ValueMember = "Id"; ListAvailableItems.Items.Clear(); ListAvailableItems.DisplayMember = "Title"; ListAvailableItems.ValueMember = "Id"; foreach (VO_Base item in GameCore.Instance.Game.Items) { if (CurrentCharacter.Items.Contains(item.Id)) { ListSelectedItems.Items.Add(item); } else { ListAvailableItems.Items.Add(item); } } this.chkLife.CheckedChanged += new System.EventHandler(this.chkLife_CheckedChanged); this.ddpPVStarting.ValueChanged += new System.EventHandler(this.ddpPV_ValueChanged); this.ddpPVMax.ValueChanged += new System.EventHandler(this.ddpPV_ValueChanged); this.txtName.LostFocus += new System.EventHandler(this.txtName_TextChanged); this.crdStartingPosition.ValueChanged += new EventHandler(crdStartingPosition_ValueChanged); grpAnimations.Visible = true; grpInteractions.Visible = true; grpInformations.Visible = true; grpLife.Visible = true; Cursor.Current = DefaultCursor; }