Example #1
0
        private void SetupEvents()
        {
            // TODO: make these delegates not anonymous
            killsSpinner.ValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    character.Kills = (byte)killsSpinner.Value;
                    FireDataChangedEvent();
                };

            randomNameButton.Click +=
                delegate( object sender, EventArgs e )
                {
                    string s = character.GetRandomName();
                    nameTextBox.Text = s;
                    character.Name = s;
                    FireDataChangedEvent();
                };

            unavailableCheckbox.CheckedChanged +=
                delegate( object sender, EventArgs e )
                {
                    character.OnProposition = unavailableCheckbox.Checked;
                    FireDataChangedEvent();
                };
            jobButton.Click +=
                delegate( object sender, EventArgs e )
                {
                    JobsAndAbilitiesEditor editor = new JobsAndAbilitiesEditor( character.JobsAndAbilities, character.SpriteSet.Value );
                    editor.ShowDialog( this );
                    if( editor.ChangesMade )
                    {
                        FireDataChangedEvent();
                    }
                };
            classComboBox.SelectedIndexChanged +=
                delegate( object sender, EventArgs e )
                {
                    if (!ignoreChanges)
                    {
                        character.Job = (Class)classComboBox.SelectedItem;
                        ignoreChanges = true;
                        UpdateMove();
                        UpdateJump();
                        UpdateSPValue();
                        UpdateMAValue();
                        UpdatePAValue();
                        UpdateCEV();
                        UpdateHPValue();
                        UpdateMPValue();
                        UpdateSkillLabel();
                        ignoreChanges = false;
                        FireDataChangedEvent();
                    }
                };
            nameTextBox.Validated +=
                delegate( object sender, EventArgs e )
                {
                    character.Name = nameTextBox.Text;
                    FireDataChangedEvent();
                };
            spriteSetCombo.SelectedIndexChanged +=
                delegate( object sender, EventArgs e )
                {
                    character.SpriteSet = (SpriteSet)spriteSetCombo.SelectedItem;
                    FireDataChangedEvent();
                };
            levelSpinner.ValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    character.Level = (byte)levelSpinner.Value;
                    FireDataChangedEvent();
                };
            experienceSpinner.ValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    character.Experience = (byte)experienceSpinner.Value;
                    FireDataChangedEvent();
                };
            hpSpinner.ValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if( !ignoreChanges )
                    {
                        character.HP = (uint)hpSpinner.Value;
                        UpdateHPToolTip();
                        FireDataChangedEvent();
                    }
                };
            speedSpinner.ValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if( !ignoreChanges )
                    {
                        character.Speed = (uint)speedSpinner.Value;
                        UpdateSpeedToolTip();
                        FireDataChangedEvent();
                    }
                };
            mpSpinner.ValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if( !ignoreChanges )
                    {
                        character.MP = (uint)mpSpinner.Value;
                        UpdateMPToolTip();
                        FireDataChangedEvent();
                    }
                };
            paSpinner.ValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if( !ignoreChanges )
                    {
                        character.PA = (uint)paSpinner.Value;
                        UpdatePAToolTip();
                        FireDataChangedEvent();
                    }
                };
            maSpinner.ValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if( !ignoreChanges )
                    {
                        character.MA = (uint)maSpinner.Value;
                        UpdateMAToolTip();
                        FireDataChangedEvent();
                    }
                };
            genderComboBox.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    character.Gender = (Gender)genderComboBox.SelectedValue;
                    FireDataChangedEvent();
                };
            zodiacComboBox.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    character.ZodiacSign = (Zodiac)zodiacComboBox.SelectedValue;
                    FireDataChangedEvent();
                };
            braverySpinner.ValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    character.Bravery = (byte)braverySpinner.Value;
                    FireDataChangedEvent();
                };
            faithSpinner.ValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    character.Faith = (byte)faithSpinner.Value;
                    FireDataChangedEvent();
                };

            rightHandCombo.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if (!ignoreChanges)
                    {
                        ignoreChanges = true;
                        character.RightHand = (Item)rightHandCombo.SelectedItem;
                        UpdateRightWeapon();
                        UpdateMove();
                        UpdateJump();
                        UpdateSPValue();
                        UpdateHPValue();
                        UpdatePAValue();
                        UpdateMAValue();
                        UpdateMPValue();
                        UpdateSEV();
                        UpdateAEV();
                        ignoreChanges = false;
                        FireDataChangedEvent();
                    }
                };
            rightShieldCombo.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if (!ignoreChanges)
                    {
                        ignoreChanges = true;
                        character.RightShield = (Item)rightShieldCombo.SelectedItem;
                        UpdateMove();
                        UpdateJump();
                        UpdateSPValue();
                        UpdateHPValue();
                        UpdatePAValue();
                        UpdateMAValue();
                        UpdateMPValue();
                        UpdateSEV();
                        UpdateAEV();
                        ignoreChanges = false;
                        FireDataChangedEvent();
                    }
                };
            leftHandCombo.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if (!ignoreChanges)
                    {
                        ignoreChanges = true;
                        character.LeftHand = (Item)leftHandCombo.SelectedItem;
                        UpdateLeftWeapon();
                        UpdateMove();
                        UpdateJump();
                        UpdateSPValue();
                        UpdateHPValue();
                        UpdatePAValue();
                        UpdateMAValue();
                        UpdateMPValue();
                        UpdateSEV();
                        UpdateAEV();
                        ignoreChanges = false;
                        FireDataChangedEvent();
                    }
                };
            leftShieldCombo.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if (!ignoreChanges)
                    {
                        ignoreChanges = true;
                        character.LeftShield = (Item)leftShieldCombo.SelectedItem;
                        UpdateMove();
                        UpdateJump();
                        UpdateSPValue();
                        UpdateHPValue();
                        UpdatePAValue();
                        UpdateMAValue();
                        UpdateMPValue();
                        UpdateSEV();
                        UpdateAEV();
                        ignoreChanges = false;
                        FireDataChangedEvent();
                    }
                };
            headCombo.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if (!ignoreChanges)
                    {
                        ignoreChanges = true;
                        character.Head = (Item)headCombo.SelectedItem;
                        UpdateMove();
                        UpdateJump();
                        UpdateSPValue();
                        UpdateHPValue();
                        UpdatePAValue();
                        UpdateMAValue();
                        UpdateMPValue();
                        UpdateSEV();
                        UpdateAEV();
                        ignoreChanges = false;
                        FireDataChangedEvent();
                    }
                };
            bodyCombo.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if (!ignoreChanges)
                    {
                        ignoreChanges = true;
                        character.Body = (Item)bodyCombo.SelectedItem;
                        UpdateMove();
                        UpdateJump();
                        UpdateSPValue();
                        UpdateHPValue();
                        UpdatePAValue();
                        UpdateMAValue();
                        UpdateMPValue();
                        UpdateSEV();
                        UpdateAEV();
                        ignoreChanges = false;
                        FireDataChangedEvent();
                    }
                };
            accessoryCombo.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if (!ignoreChanges)
                    {
                        ignoreChanges = true;
                        character.Accessory = (Item)accessoryCombo.SelectedItem;
                        UpdateMove();
                        UpdateJump();
                        UpdateSPValue();
                        UpdateHPValue();
                        UpdatePAValue();
                        UpdateMAValue();
                        UpdateMPValue();
                        UpdateSEV();
                        UpdateAEV();
                        ignoreChanges = false;
                        FireDataChangedEvent();
                    }
                };
            secondaryCombo.SelectedIndexChanged +=
                delegate( object sender, EventArgs e )
                {
                    character.SecondaryAction = (SecondaryAction)secondaryCombo.SelectedItem;
                    FireDataChangedEvent();
                };
            reactionCombo.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if (!ignoreChanges)
                    {
                        ignoreChanges = true;
                        character.ReactAbility = (Ability)reactionCombo.SelectedItem;
                        UpdateMove();
                        UpdateJump();
                        UpdateHPValue();
                        ignoreChanges = false;
                        FireDataChangedEvent();
                    }
                };
            supportCombo.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if (!ignoreChanges)
                    {
                        ignoreChanges = true;
                        character.SupportAbility = (Ability)supportCombo.SelectedItem;
                        UpdateMove();
                        UpdateJump();
                        UpdateHPValue();
                        ignoreChanges = false;
                        FireDataChangedEvent();
                    }
                };
            movementCombo.SelectedValueChanged +=
                delegate( object sender, EventArgs e )
                {
                    if (!ignoreChanges)
                    {
                        ignoreChanges = true;
                        character.MovementAbility = (Ability)movementCombo.SelectedItem;
                        UpdateMove();
                        UpdateJump();
                        UpdateHPValue();
                        ignoreChanges = false;
                        FireDataChangedEvent();
                    }
                };

        }
Example #2
0
        private void SetupEvents()
        {
            // TODO: make these delegates not anonymous
            killsSpinner.ValueChanged +=
                delegate(object sender, EventArgs e)
            {
                character.Kills = (byte)killsSpinner.Value;
                FireDataChangedEvent();
            };

            randomNameButton.Click +=
                delegate(object sender, EventArgs e)
            {
                string s = character.GetRandomName();
                nameTextBox.Text = s;
                character.Name   = s;
                FireDataChangedEvent();
            };

            unavailableCheckbox.CheckedChanged +=
                delegate(object sender, EventArgs e)
            {
                character.OnProposition = unavailableCheckbox.Checked;
                FireDataChangedEvent();
            };
            jobButton.Click +=
                delegate(object sender, EventArgs e)
            {
                JobsAndAbilitiesEditor editor = new JobsAndAbilitiesEditor(character.JobsAndAbilities, character.SpriteSet.Value);
                editor.ShowDialog(this);
                if (editor.ChangesMade)
                {
                    FireDataChangedEvent();
                }
            };
            classComboBox.SelectedIndexChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    character.Job = (Class)classComboBox.SelectedItem;
                    ignoreChanges = true;
                    UpdateMove();
                    UpdateJump();
                    UpdateSPValue();
                    UpdateMAValue();
                    UpdatePAValue();
                    UpdateCEV();
                    UpdateHPValue();
                    UpdateMPValue();
                    UpdateSkillLabel();
                    ignoreChanges = false;
                    FireDataChangedEvent();
                }
            };
            nameTextBox.Validated +=
                delegate(object sender, EventArgs e)
            {
                character.Name = nameTextBox.Text;
                FireDataChangedEvent();
            };
            spriteSetCombo.SelectedIndexChanged +=
                delegate(object sender, EventArgs e)
            {
                character.SpriteSet = (SpriteSet)spriteSetCombo.SelectedItem;
                FireDataChangedEvent();
            };
            levelSpinner.ValueChanged +=
                delegate(object sender, EventArgs e)
            {
                character.Level = (byte)levelSpinner.Value;
                FireDataChangedEvent();
            };
            experienceSpinner.ValueChanged +=
                delegate(object sender, EventArgs e)
            {
                character.Experience = (byte)experienceSpinner.Value;
                FireDataChangedEvent();
            };
            hpSpinner.ValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    character.HP = (uint)hpSpinner.Value;
                    UpdateHPToolTip();
                    FireDataChangedEvent();
                }
            };
            speedSpinner.ValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    character.Speed = (uint)speedSpinner.Value;
                    UpdateSpeedToolTip();
                    FireDataChangedEvent();
                }
            };
            mpSpinner.ValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    character.MP = (uint)mpSpinner.Value;
                    UpdateMPToolTip();
                    FireDataChangedEvent();
                }
            };
            paSpinner.ValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    character.PA = (uint)paSpinner.Value;
                    UpdatePAToolTip();
                    FireDataChangedEvent();
                }
            };
            maSpinner.ValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    character.MA = (uint)maSpinner.Value;
                    UpdateMAToolTip();
                    FireDataChangedEvent();
                }
            };
            genderComboBox.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                character.Gender = (Gender)genderComboBox.SelectedValue;
                FireDataChangedEvent();
            };
            zodiacComboBox.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                character.ZodiacSign = (Zodiac)zodiacComboBox.SelectedValue;
                FireDataChangedEvent();
            };
            braverySpinner.ValueChanged +=
                delegate(object sender, EventArgs e)
            {
                character.Bravery = (byte)braverySpinner.Value;
                FireDataChangedEvent();
            };
            faithSpinner.ValueChanged +=
                delegate(object sender, EventArgs e)
            {
                character.Faith = (byte)faithSpinner.Value;
                FireDataChangedEvent();
            };

            rightHandCombo.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    ignoreChanges       = true;
                    character.RightHand = (Item)rightHandCombo.SelectedItem;
                    UpdateRightWeapon();
                    UpdateMove();
                    UpdateJump();
                    UpdateSPValue();
                    UpdateHPValue();
                    UpdatePAValue();
                    UpdateMAValue();
                    UpdateMPValue();
                    UpdateSEV();
                    UpdateAEV();
                    ignoreChanges = false;
                    FireDataChangedEvent();
                }
            };
            rightShieldCombo.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    ignoreChanges         = true;
                    character.RightShield = (Item)rightShieldCombo.SelectedItem;
                    UpdateMove();
                    UpdateJump();
                    UpdateSPValue();
                    UpdateHPValue();
                    UpdatePAValue();
                    UpdateMAValue();
                    UpdateMPValue();
                    UpdateSEV();
                    UpdateAEV();
                    ignoreChanges = false;
                    FireDataChangedEvent();
                }
            };
            leftHandCombo.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    ignoreChanges      = true;
                    character.LeftHand = (Item)leftHandCombo.SelectedItem;
                    UpdateLeftWeapon();
                    UpdateMove();
                    UpdateJump();
                    UpdateSPValue();
                    UpdateHPValue();
                    UpdatePAValue();
                    UpdateMAValue();
                    UpdateMPValue();
                    UpdateSEV();
                    UpdateAEV();
                    ignoreChanges = false;
                    FireDataChangedEvent();
                }
            };
            leftShieldCombo.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    ignoreChanges        = true;
                    character.LeftShield = (Item)leftShieldCombo.SelectedItem;
                    UpdateMove();
                    UpdateJump();
                    UpdateSPValue();
                    UpdateHPValue();
                    UpdatePAValue();
                    UpdateMAValue();
                    UpdateMPValue();
                    UpdateSEV();
                    UpdateAEV();
                    ignoreChanges = false;
                    FireDataChangedEvent();
                }
            };
            headCombo.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    ignoreChanges  = true;
                    character.Head = (Item)headCombo.SelectedItem;
                    UpdateMove();
                    UpdateJump();
                    UpdateSPValue();
                    UpdateHPValue();
                    UpdatePAValue();
                    UpdateMAValue();
                    UpdateMPValue();
                    UpdateSEV();
                    UpdateAEV();
                    ignoreChanges = false;
                    FireDataChangedEvent();
                }
            };
            bodyCombo.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    ignoreChanges  = true;
                    character.Body = (Item)bodyCombo.SelectedItem;
                    UpdateMove();
                    UpdateJump();
                    UpdateSPValue();
                    UpdateHPValue();
                    UpdatePAValue();
                    UpdateMAValue();
                    UpdateMPValue();
                    UpdateSEV();
                    UpdateAEV();
                    ignoreChanges = false;
                    FireDataChangedEvent();
                }
            };
            accessoryCombo.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    ignoreChanges       = true;
                    character.Accessory = (Item)accessoryCombo.SelectedItem;
                    UpdateMove();
                    UpdateJump();
                    UpdateSPValue();
                    UpdateHPValue();
                    UpdatePAValue();
                    UpdateMAValue();
                    UpdateMPValue();
                    UpdateSEV();
                    UpdateAEV();
                    ignoreChanges = false;
                    FireDataChangedEvent();
                }
            };
            secondaryCombo.SelectedIndexChanged +=
                delegate(object sender, EventArgs e)
            {
                character.SecondaryAction = (SecondaryAction)secondaryCombo.SelectedItem;
                FireDataChangedEvent();
            };
            reactionCombo.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    ignoreChanges          = true;
                    character.ReactAbility = (Ability)reactionCombo.SelectedItem;
                    UpdateMove();
                    UpdateJump();
                    UpdateHPValue();
                    ignoreChanges = false;
                    FireDataChangedEvent();
                }
            };
            supportCombo.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    ignoreChanges            = true;
                    character.SupportAbility = (Ability)supportCombo.SelectedItem;
                    UpdateMove();
                    UpdateJump();
                    UpdateHPValue();
                    ignoreChanges = false;
                    FireDataChangedEvent();
                }
            };
            movementCombo.SelectedValueChanged +=
                delegate(object sender, EventArgs e)
            {
                if (!ignoreChanges)
                {
                    ignoreChanges             = true;
                    character.MovementAbility = (Ability)movementCombo.SelectedItem;
                    UpdateMove();
                    UpdateJump();
                    UpdateHPValue();
                    ignoreChanges = false;
                    FireDataChangedEvent();
                }
            };
        }