private void OnLoad(object sender, EventArgs e) { cmbTypeAnimation.Items.Clear(); cmbAnimation.DataSource = EnumHelper.ToList(typeof(Enums.CharacterAnimationType)); cmbAnimation.DisplayMember = "Value"; cmbAnimation.ValueMember = "Key"; if (IsAdd == true) { CharacterId = Guid.Empty; characterButton1.ResetText(); characterButton1.CharacterGuid = CharacterId; AnimationType = Enums.CharacterAnimationType.Standing; chkLoop.Checked = true; Loop = true; cmbAnimation.SelectedIndex = 0; } else { characterButton1.CharacterGuid = CharacterId; chkLoop.Checked = Loop; cmbAnimation.SelectedValue = AnimationType; ChangePlayerAnimation(sender, e); } }
private void OnLoad(object sender, EventArgs e) { cmbAnimation.DataSource = EnumHelper.ToList(typeof(Enums.CharacterAnimationType)); cmbAnimation.DisplayMember = "Value"; cmbAnimation.ValueMember = "Key"; if (IsAdd == true) { CharacterId = Guid.Empty; characterButton1.ResetText(); characterButton1.CharacterGuid = CharacterId; AnimationType = Enums.CharacterAnimationType.Standing; cmbAnimation.SelectedIndex = 0; AllAnimation = false; chxAllAnimations.Checked = false; rdxCurrentCharacter.Checked = true; } else { characterButton1.CharacterGuid = CharacterId; cmbAnimation.SelectedValue = AnimationType; chxAllAnimations.Checked = AllAnimation; if (CharacterId == new Guid(GlobalConstants.CURRENT_PLAYER_ID)) { rdxCurrentCharacter.Checked = true; } } }
private void btnValidation(object sender, EventArgs e) { CharacterId = characterButton1.CharacterGuid; AnimationType = (Enums.CharacterAnimationType)((cmbAnimation.SelectedItem.GetType()).GetProperty("Key")).GetValue(cmbAnimation.SelectedItem, null); if (cmbTypeAnimation.SelectedItem != null) { VO_Base CurrentAnimation = (VO_Base)cmbTypeAnimation.SelectedItem; CharacterAnimationType = CurrentAnimation.Id; } this.DialogResult = DialogResult.OK; this.Close(); }
private void OnLoad(object sender, EventArgs e) { cmbCharacterList.Items.Clear(); VO_StageCharacter CurrentCharacter = null; foreach (VO_StageCharacter character in EditorHelper.Instance.GetCurrentStageInstance().ListCharacters) { cmbCharacterList.Items.Add(character); if (CharacterId == character.Id) { CurrentCharacter = character; } } cmbCharacterList.DisplayMember = "Title"; cmbCharacterList.ValueMember = "Id"; cmbCharacterList.Enabled = true; cmbAnimation.DataSource = EnumHelper.ToList(typeof(Enums.CharacterAnimationType)); cmbAnimation.DisplayMember = "Value"; cmbAnimation.ValueMember = "Key"; if (IsAdd == true) { CharacterId = Guid.Empty; AnimationType = Enums.CharacterAnimationType.Standing; cmbAnimation.SelectedIndex = 0; trkFrequency.Value = GlobalConstants.PLAYER_NORMAL_SPEED;; Frequency = GlobalConstants.PLAYER_NORMAL_SPEED;; prctFrequency.Text = Convert.ToString(GlobalConstants.PLAYER_NORMAL_SPEED) + "%"; if (cmbCharacterList.Items.Count <= 0) { cmbCharacterList.Enabled = false; return; } cmbCharacterList.SelectedIndex = 0; } else { if (CurrentCharacter != null) { cmbCharacterList.SelectedItem = CurrentCharacter; } cmbAnimation.SelectedValue = AnimationType; trkFrequency.Value = Frequency; prctFrequency.Text = Convert.ToString(Frequency) + "%"; } }
private void btnValidation(object sender, EventArgs e) { if (rdxCurrentCharacter.Checked == true) { CharacterId = new Guid(GlobalConstants.CURRENT_PLAYER_ID); } else { CharacterId = characterButton1.CharacterGuid; } AnimationType = (Enums.CharacterAnimationType)((cmbAnimation.SelectedItem.GetType()).GetProperty("Key")).GetValue(cmbAnimation.SelectedItem, null); AllAnimation = chxAllAnimations.Checked; this.DialogResult = DialogResult.OK; this.Close(); }
private void btnValidation(object sender, EventArgs e) { if (cmbCharacterList.Items.Count <= 0) { MessageBox.Show(Culture.Language.Notifications.NO_CHARACTER_SELECTION); } else { VO_StageCharacter CurrentStageCharacter = (VO_StageCharacter)cmbCharacterList.SelectedItem; CharacterId = CurrentStageCharacter.Id; AnimationType = (Enums.CharacterAnimationType)((cmbAnimation.SelectedItem.GetType()).GetProperty("Key")).GetValue(cmbAnimation.SelectedItem, null); this.DialogResult = DialogResult.OK; this.Close(); } }
private void OnLoad(object sender, EventArgs e) { cmbCharacterList.Items.Clear(); VO_StageCharacter CurrentCharacter = null; foreach (VO_StageCharacter character in EditorHelper.Instance.GetCurrentStageInstance().ListCharacters) { cmbCharacterList.Items.Add(character); if (CharacterId == character.Id) { CurrentCharacter = character; } } cmbCharacterList.DisplayMember = "Title"; cmbCharacterList.ValueMember = "Id"; cmbAnimation.DataSource = EnumHelper.ToList(typeof(Enums.CharacterAnimationType)); cmbAnimation.DisplayMember = "Value"; cmbAnimation.ValueMember = "Key"; cmbCharacterList.Enabled = true; if (IsAdd == true) { CharacterId = Guid.Empty; AnimationType = Enums.CharacterAnimationType.Standing; cmbAnimation.SelectedIndex = 0; AllAnimation = false; chxAllAnimations.Checked = false; if (cmbCharacterList.Items.Count <= 0) { cmbCharacterList.Enabled = false; return; } cmbCharacterList.SelectedIndex = 0; } else { if (CurrentCharacter != null) { cmbCharacterList.SelectedItem = CurrentCharacter; } cmbAnimation.SelectedValue = AnimationType; chxAllAnimations.Checked = AllAnimation; } }
/// <summary> /// Setter l'animation courante /// </summary> /// <param name="anim"></param> public void SetCurrentAnimation(Enums.CharacterAnimationType type, Guid anim) { if (_CurrentAnimationType != anim) { switch (type) { case Enums.CharacterAnimationType.Standing: AllDirectionsSprites = _AnimationsStanding.Find(p => p[0].AnimationId == anim); break; case Enums.CharacterAnimationType.Walking: AllDirectionsSprites = _AnimationsWalking.Find(p => p[0].AnimationId == anim); break; case Enums.CharacterAnimationType.Talking: AllDirectionsSprites = _AnimationsTalking.Find(p => p[0].AnimationId == anim); break; } if (AllDirectionsSprites == null) { _CurrentAnimationType = StandingAnim; } else { _CurrentAnimationType = anim; } if (AllDirectionsSprites != null) { foreach (VO_AnimatedSprite animSprite in AllDirectionsSprites) { int scaledW = (int)((float)animSprite.Width * _Scale.X); int scaledH = (int)((float)animSprite.Height * _Scale.X); animSprite.SetPosition(Location.X - scaledW / 2, Location.Y - scaledH / 2); } } } }