示例#1
0
        private void cbRace_SelectedIndexChanged(object sender, EventArgs e)
        {
            //do this if an existing character file was open OR if a new character was built
            if (CurrentCharacter != null)
            {
                CurrentCharacter.SetRace((Race)cbRace.SelectedValue);

                CreatureBuilder cb = new CreatureBuilder((Race)cbRace.SelectedItem);
                Creature        nc = cb.NewCreature;

                rtbRaceDescription.Text = nc.GetDescription();

                ShouldSave = true;

                return;
            }

            //do this if CurrentCharacter is null, but the Race combobox is having its options cycled through
            if (cbRace.SelectedItem != null)
            {
                Race race = (Race)cbRace.SelectedItem;

                CreatureBuilder cb = new CreatureBuilder(race);
                Creature        nc = cb.NewCreature;

                rtbRaceDescription.Text = nc.GetDescription();

                ShouldSave = true;
            }
            else
            {
                return;
            }

            //if all else fails, clear the race description rtb
            rtbRaceDescription.Clear();
        }