Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            switch ((SpecialType)specialCopy.Type)
            {
            case SpecialType.Controls:
                Edit.Type   = (byte)SpecialType.Controls;
                Edit.Object = $"controls,{gameControl.Type.ToString().ToLower()}";
                break;

            case SpecialType.Flower:
                Edit.Type   = (byte)SpecialType.Flower;
                Edit.Object = $"flower,{Reader.ShortToCoordinate(flower.Color)},{flower.Radius}";
                break;

            default:
                levelEdit.SaveLevel();
                string state = level.State == 0 ? "" : $",{level.State}";
                Edit.Type   = (byte)SpecialType.Level;
                Edit.Object = $"level,{level.File},{level.Style},{level.Number}{state}";
                level       = specialCopy.GetLevel();
                break;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemplo n.º 2
0
        private void SpecialEdit_Load(object sender, EventArgs e)
        {
            specialCopy = (Special)Edit.Copy();

            levelEdit                 = new LevelEdit();
            levelEdit.Palette         = Palette;
            levelEdit.LevelList       = LevelList;
            levelEdit.NoIcon          = true;
            levelEdit.BackColor       = this.BackColor;
            levelEdit.FormBorderStyle = FormBorderStyle.None;
            levelEdit.TopLevel        = false;
            levelEdit.Parent          = panelLevelEdit;

            foreach (ControlType type in Enum.GetValues(typeof(ControlType)))
            {
                if (type != ControlType.Unknown)
                {
                    cboControls.Items.Add(type);
                }
            }

            switch ((SpecialType)specialCopy.Type)
            {
            case SpecialType.Controls:
                gameControl         = specialCopy.GetGameControl();
                chkControls.Checked = true;
                break;

            case SpecialType.Flower:
                flower            = specialCopy.GetFlower();
                chkFlower.Checked = true;
                break;

            default:
                level = specialCopy.GetLevel();
                int size = LevelList.Count;
                for (int i = 0; i < size; i++)
                {
                    ListItem item = LevelList[i];
                    Grid     map  = (Grid)item.Value;
                    if (map.FileName == level.File)
                    {
                        level.Name = map.Name;
                        break;
                    }
                }
                chkLevel.Checked = true;
                break;
            }
        }