mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-02-14 16:10:50 +00:00
Stair Sector Builder Mode: current settings can be now be saved as a default prefab that will always be loaded when using the Stair Sector Builder Mode
This commit is contained in:
parent
d66169f2cb
commit
4c40441e01
2 changed files with 66 additions and 20 deletions
|
@ -278,6 +278,16 @@ namespace CodeImp.DoomBuilder.StairSectorBuilderMode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if there's a "[Default]" prefab and load it if so
|
||||||
|
foreach (BuilderPlug.Prefab p in BuilderPlug.Me.Prefabs)
|
||||||
|
{
|
||||||
|
if(p.name == "[Default]")
|
||||||
|
{
|
||||||
|
LoadPrefab(p);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Show window
|
// Show window
|
||||||
base.Show(owner);
|
base.Show(owner);
|
||||||
}
|
}
|
||||||
|
@ -318,7 +328,21 @@ namespace CodeImp.DoomBuilder.StairSectorBuilderMode
|
||||||
|
|
||||||
private void btnOK_Click(object sender, EventArgs e)
|
private void btnOK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SavePrefab("[Previous]", true, 0);
|
int position = 0;
|
||||||
|
|
||||||
|
// We always want to have the "[Default]" prefab on top, so look for it and add "[Previous]" after that
|
||||||
|
for (int i = 0; i < BuilderPlug.Me.Prefabs.Count; i++)
|
||||||
|
{
|
||||||
|
BuilderPlug.Prefab p = BuilderPlug.Me.Prefabs[i];
|
||||||
|
|
||||||
|
if (p.name == "[Default]")
|
||||||
|
{
|
||||||
|
position = i+1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SavePrefab("[Previous]", true, position);
|
||||||
|
|
||||||
General.Editing.AcceptMode();
|
General.Editing.AcceptMode();
|
||||||
}
|
}
|
||||||
|
@ -638,10 +662,18 @@ namespace CodeImp.DoomBuilder.StairSectorBuilderMode
|
||||||
|
|
||||||
if(name == "[Previous]")
|
if(name == "[Previous]")
|
||||||
MessageBox.Show(Owner, "The prefab name \"[Previous]\" is reserved and can not be overwritten.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(Owner, "The prefab name \"[Previous]\" is reserved and can not be overwritten.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
else if (name == "[Default]")
|
||||||
|
MessageBox.Show(Owner, "The prefab name \"[Default]\" is reserved and can not be overwritten manually.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
else
|
else
|
||||||
SavePrefab(prefabname.Text.Trim(), false, -1);
|
SavePrefab(prefabname.Text.Trim(), false, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void prefabdefault_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SavePrefab("[Default]", true, 0);
|
||||||
|
}
|
||||||
|
|
||||||
private void SavePrefab(string name, bool forceoverwrite, int position)
|
private void SavePrefab(string name, bool forceoverwrite, int position)
|
||||||
{
|
{
|
||||||
int overwrite = -1;
|
int overwrite = -1;
|
||||||
|
@ -749,14 +781,15 @@ namespace CodeImp.DoomBuilder.StairSectorBuilderMode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prefabload_Click(object sender, EventArgs e)
|
private void LoadPrefab(int position)
|
||||||
{
|
{
|
||||||
if(prefabs.SelectedIndices.Count == 0) return;
|
LoadPrefab(BuilderPlug.Me.Prefabs[position]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadPrefab(BuilderPlug.Prefab p)
|
||||||
|
{
|
||||||
loadingprefab = true;
|
loadingprefab = true;
|
||||||
|
|
||||||
BuilderPlug.Prefab p = BuilderPlug.Me.Prefabs[prefabs.SelectedIndices[0]];
|
|
||||||
|
|
||||||
prefabname.Text = p.name;
|
prefabname.Text = p.name;
|
||||||
|
|
||||||
NumberOfSectors = (uint)p.numberofsectors;
|
NumberOfSectors = (uint)p.numberofsectors;
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
this.spacing = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
this.spacing = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||||
this.label11 = new System.Windows.Forms.Label();
|
this.label11 = new System.Windows.Forms.Label();
|
||||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.distinctsectors = new System.Windows.Forms.CheckBox();
|
||||||
this.singledirection = new System.Windows.Forms.CheckBox();
|
this.singledirection = new System.Windows.Forms.CheckBox();
|
||||||
this.singlesteps = new System.Windows.Forms.CheckBox();
|
this.singlesteps = new System.Windows.Forms.CheckBox();
|
||||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
|
@ -107,7 +108,7 @@
|
||||||
this.groupBox10 = new System.Windows.Forms.GroupBox();
|
this.groupBox10 = new System.Windows.Forms.GroupBox();
|
||||||
this.middletexturetexture = new CodeImp.DoomBuilder.Controls.TextureSelectorControl();
|
this.middletexturetexture = new CodeImp.DoomBuilder.Controls.TextureSelectorControl();
|
||||||
this.middletexture = new System.Windows.Forms.CheckBox();
|
this.middletexture = new System.Windows.Forms.CheckBox();
|
||||||
this.distinctsectors = new System.Windows.Forms.CheckBox();
|
this.prefabdefault = new System.Windows.Forms.Button();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.tabcontrol.SuspendLayout();
|
this.tabcontrol.SuspendLayout();
|
||||||
this.tabPage1.SuspendLayout();
|
this.tabPage1.SuspendLayout();
|
||||||
|
@ -258,6 +259,18 @@
|
||||||
this.groupBox3.TabStop = false;
|
this.groupBox3.TabStop = false;
|
||||||
this.groupBox3.Text = "Appearance";
|
this.groupBox3.Text = "Appearance";
|
||||||
//
|
//
|
||||||
|
// distinctsectors
|
||||||
|
//
|
||||||
|
this.distinctsectors.AutoSize = true;
|
||||||
|
this.distinctsectors.Enabled = false;
|
||||||
|
this.distinctsectors.Location = new System.Drawing.Point(10, 43);
|
||||||
|
this.distinctsectors.Name = "distinctsectors";
|
||||||
|
this.distinctsectors.Size = new System.Drawing.Size(101, 18);
|
||||||
|
this.distinctsectors.TabIndex = 2;
|
||||||
|
this.distinctsectors.Text = "Distinct sectors";
|
||||||
|
this.distinctsectors.UseVisualStyleBackColor = true;
|
||||||
|
this.distinctsectors.CheckedChanged += new System.EventHandler(this.distinctsectors_CheckedChanged);
|
||||||
|
//
|
||||||
// singledirection
|
// singledirection
|
||||||
//
|
//
|
||||||
this.singledirection.AutoSize = true;
|
this.singledirection.AutoSize = true;
|
||||||
|
@ -938,6 +951,7 @@
|
||||||
//
|
//
|
||||||
// groupBox11
|
// groupBox11
|
||||||
//
|
//
|
||||||
|
this.groupBox11.Controls.Add(this.prefabdefault);
|
||||||
this.groupBox11.Controls.Add(this.prefabload);
|
this.groupBox11.Controls.Add(this.prefabload);
|
||||||
this.groupBox11.Controls.Add(this.prefabdelete);
|
this.groupBox11.Controls.Add(this.prefabdelete);
|
||||||
this.groupBox11.Controls.Add(this.prefabsave);
|
this.groupBox11.Controls.Add(this.prefabsave);
|
||||||
|
@ -1043,17 +1057,15 @@
|
||||||
this.middletexture.UseVisualStyleBackColor = true;
|
this.middletexture.UseVisualStyleBackColor = true;
|
||||||
this.middletexture.CheckedChanged += new System.EventHandler(this.middletexture_CheckedChanged);
|
this.middletexture.CheckedChanged += new System.EventHandler(this.middletexture_CheckedChanged);
|
||||||
//
|
//
|
||||||
// distinctsectors
|
// prefabdefault
|
||||||
//
|
//
|
||||||
this.distinctsectors.AutoSize = true;
|
this.prefabdefault.Location = new System.Drawing.Point(247, 156);
|
||||||
this.distinctsectors.Enabled = false;
|
this.prefabdefault.Name = "prefabdefault";
|
||||||
this.distinctsectors.Location = new System.Drawing.Point(10, 43);
|
this.prefabdefault.Size = new System.Drawing.Size(70, 23);
|
||||||
this.distinctsectors.Name = "distinctsectors";
|
this.prefabdefault.TabIndex = 29;
|
||||||
this.distinctsectors.Size = new System.Drawing.Size(101, 18);
|
this.prefabdefault.Text = "Set default";
|
||||||
this.distinctsectors.TabIndex = 2;
|
this.prefabdefault.UseVisualStyleBackColor = true;
|
||||||
this.distinctsectors.Text = "Distinct sectors";
|
this.prefabdefault.Click += new System.EventHandler(this.prefabdefault_Click);
|
||||||
this.distinctsectors.UseVisualStyleBackColor = true;
|
|
||||||
this.distinctsectors.CheckedChanged += new System.EventHandler(this.distinctsectors_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// StairSectorBuilderForm
|
// StairSectorBuilderForm
|
||||||
//
|
//
|
||||||
|
@ -1202,5 +1214,6 @@
|
||||||
private CodeImp.DoomBuilder.Controls.TextureSelectorControl middletexturetexture;
|
private CodeImp.DoomBuilder.Controls.TextureSelectorControl middletexturetexture;
|
||||||
private System.Windows.Forms.CheckBox middletexture;
|
private System.Windows.Forms.CheckBox middletexture;
|
||||||
private System.Windows.Forms.CheckBox distinctsectors;
|
private System.Windows.Forms.CheckBox distinctsectors;
|
||||||
|
private System.Windows.Forms.Button prefabdefault;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue