private void saveButton_Click(object sender, EventArgs e)
        {
            if (levelBox.SelectedIndex == -1 || clearStateBox.SelectedIndex == -1)
            {
                MessageBox.Show(Properties.Strings.FILL_IN_ALL_FIELDS_TEXT);
                return;
            }

            uint levelNumber = 0x0;
            uint clearState  = 0x0;
            bool scroll      = false;

            if (levelBox.SelectedIndex <= 4) // bosses come first in the list
            {
                levelNumber = Convert.ToUInt32(levelBox.SelectedIndex + 0x65);
            }
            else
            {
                levelNumber = Convert.ToUInt32(levelBox.SelectedIndex - 0x4);
            }

            if (levelBox.Enabled) // we're in edit mode if this is disabled
            {
                // check to make sure that this isn't already in the list
                SinglePlayerForm singlePlayerForm = (SinglePlayerForm)this.Owner;
                foreach (LevelData data in singlePlayerForm.levelSaveData)
                {
                    if (data.levelNumber == levelNumber)
                    {
                        // Refuse to save
                        MessageBox.Show(Properties.Strings.LEVEL_ALREADY_ADDED_TEXT);
                        return;
                    }
                }
            }

            uint selectedState = Convert.ToUInt32(clearStateBox.SelectedIndex);

            clearState = (selectedState != 0) ? selectedState + 1 : selectedState;

            scroll = scrollBox.Checked;

            if (levelData == null)
            {
                levelData = new LevelData(levelNumber, clearState, scroll);
            }
            else
            {
                levelData.levelNumber = levelNumber;
                levelData.clearState  = clearState;
                levelData.scroll      = scroll;
            }

            this.Close();
        }
Example #2
0
        private void singlePlayerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SinglePlayerForm singlePlayerForm = new SinglePlayerForm();

            singlePlayerForm.ShowDialog(this);
        }