private void chkType_CheckedChanged(object sender, EventArgs e) { if (specialCopy == null) { return; } bool visible = sender == chkControls && chkControls.Checked; lblControl.Visible = visible; cboControls.Visible = visible; if (visible) { specialCopy.Type = (byte)SpecialType.Controls; ClientSize = new Size(ClientSize.Width, 119); if (gameControl == null) { specialCopy.Object = Special.CONTROLS; gameControl = specialCopy.GetGameControl(); } cboControls.SelectedItem = gameControl.Type; } visible = sender == chkFlower && chkFlower.Checked; lblRadius.Visible = visible; numRadius.Visible = visible; lblColor.Visible = visible; imgColor.Visible = visible; if (visible) { specialCopy.Type = (byte)SpecialType.Flower; ClientSize = new Size(ClientSize.Width, 170); if (flower == null) { specialCopy.Object = Special.FLOWER; flower = specialCopy.GetFlower(); } numRadius.Value = flower.Radius; imgColor.BackColor = Palette.Colors[flower.Color]; } visible = sender == chkLevel && chkLevel.Checked; panelLevelEdit.Visible = visible; if (visible) { specialCopy.Type = (byte)SpecialType.Level; ClientSize = new Size(ClientSize.Width, 314); if (level == null) { specialCopy.Object = $"level,{Map.FileName},2,0"; level = specialCopy.GetLevel(); } levelEdit.Edit = level; levelEdit.Show(); } else if (levelEdit.Visible) { levelEdit.Hide(); } }
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; } }