- Realms, Zones and Room editors now are all working together.

- Deleting Realms now deletes all zones and rooms attached to it.
This commit is contained in:
Scionwest_cp 2009-12-04 23:56:32 -08:00
parent 3cfa72ef69
commit 1206fccc9d
8 changed files with 176 additions and 165 deletions

View file

@ -45,7 +45,9 @@ namespace MudDesigner.Editors
return; return;
} }
FileManager.Save(Application.StartupPath + @"\Data\Currency\" + _Currency.Name + ".xml", _Currency); string currencyPath = FileManager.GetDataPath(SaveDataTypes.Currency);
string currencyFile = System.IO.Path.Combine(currencyPath, _Currency.Filename);
FileManager.Save(currencyFile, _Currency);
lstCurrencies.Items.Add(_Currency.Name); lstCurrencies.Items.Add(_Currency.Name);
} }

View file

@ -52,14 +52,7 @@ namespace MudDesigner.Editors
private void btnSaveRealm_Click(object sender, EventArgs e) private void btnSaveRealm_Click(object sender, EventArgs e)
{ {
string path = FileManager.GetDataPath(SaveDataTypes.Realms); string path = FileManager.GetDataPath(SaveDataTypes.Realms);
string realmFile = System.IO.Path.Combine(path, Program.Realm.Name + ".realm"); string realmFile = System.IO.Path.Combine(path, Program.Realm.Filename);
if (System.IO.File.Exists(realmFile))
{
DialogResult result = MessageBox.Show("File exists!\nOverwrite?", "Realm Explorer", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No)
return;
}
FileManager.Save(realmFile, Program.Realm); FileManager.Save(realmFile, Program.Realm);
@ -90,14 +83,29 @@ namespace MudDesigner.Editors
return; return;
} }
DialogResult result = MessageBox.Show("Are you sure you want to delete the " + lstRealms.SelectedItem.ToString() + " Realm?", DialogResult result = MessageBox.Show("Are you sure you want to delete the " + lstRealms.SelectedItem.ToString() + " Realm?\n\nWarning! All Zones & Rooms contained within this Realm will be deleted!",
"Realm Explorer", MessageBoxButtons.YesNo, MessageBoxIcon.Question); "Realm Explorer", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No) if (result == DialogResult.No)
return; return;
string path = FileManager.GetDataPath(SaveDataTypes.Realms); string realmPath = FileManager.GetDataPath(SaveDataTypes.Realms);
string realmFile = System.IO.Path.Combine(path, lstRealms.SelectedItem.ToString() + ".realm"); string realmFile = System.IO.Path.Combine(realmPath, lstRealms.SelectedItem.ToString() + ".realm");
foreach (Zone zone in Program.Realm.Zones)
{
foreach (Room room in zone.Rooms)
{
string roomPath = FileManager.GetDataPath(SaveDataTypes.Rooms);
string roomFile = System.IO.Path.Combine(roomPath, room.Filename);
System.IO.File.Delete(roomFile);
}
string zonePath = FileManager.GetDataPath(SaveDataTypes.Zones);
string zoneFile = System.IO.Path.Combine(zonePath, zone.Filename);
System.IO.File.Delete(zoneFile);
}
//loop through each zone first and delete them all, along with their there rooms.
System.IO.File.Delete(realmFile); System.IO.File.Delete(realmFile);
lstRealms.Items.Remove(lstRealms.SelectedItem); lstRealms.Items.Remove(lstRealms.SelectedItem);
} }
@ -198,7 +206,7 @@ namespace MudDesigner.Editors
if (System.IO.File.Exists(filename)) if (System.IO.File.Exists(filename))
System.IO.File.Delete(filename); System.IO.File.Delete(filename);
filename = System.IO.Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), Program.Realm.Name + ".realm"); filename = System.IO.Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), Program.Realm.Filename);
lstZones.Items.Remove(lstZones.SelectedItem); lstZones.Items.Remove(lstZones.SelectedItem);
FileManager.Save(filename, Program.Realm); FileManager.Save(filename, Program.Realm);
} }
@ -207,5 +215,10 @@ namespace MudDesigner.Editors
{ {
btnBuildZone.Text = "Edit Selected Zone"; btnBuildZone.Text = "Edit Selected Zone";
} }
private void txtScript_TextChanged(object sender, EventArgs e)
{
Program.Realm.Script = txtScript.Text;
}
} }
} }

View file

@ -313,6 +313,7 @@
this.txtScript.Size = new System.Drawing.Size(312, 385); this.txtScript.Size = new System.Drawing.Size(312, 385);
this.txtScript.TabIndex = 11; this.txtScript.TabIndex = 11;
this.txtScript.Text = ""; this.txtScript.Text = "";
this.txtScript.TextChanged += new System.EventHandler(this.txtScript_TextChanged);
// //
// btnValidateScript // btnValidateScript
// //

View file

@ -18,19 +18,29 @@ namespace MudDesigner.Editors
{ {
public partial class RoomDesigner : Form public partial class RoomDesigner : Form
{ {
internal bool IsEditingExisting = false;
ZoneBuilder _ZoneBuilder;
//Doorway currently loaded. //Doorway currently loaded.
Door _CurrentDoor; Door _CurrentDoor;
//Collection of plugins from within the 'plugins' folder //Collection of plugins from within the 'plugins' folder
List<System.Reflection.Assembly> _Plugins; List<System.Reflection.Assembly> _Plugins;
public RoomDesigner(params object[] parameters) public RoomDesigner(ZoneBuilder designer)
{ {
InitializeComponent(); InitializeComponent();
SetupEditor(parameters); SetupEditor();
_ZoneBuilder = designer;
} }
private void SetupEditor(params object[] parameters) public RoomDesigner()
{
InitializeComponent();
SetupEditor();
}
private void SetupEditor()
{ {
//Initialize the Room & Doorway //Initialize the Room & Doorway
Program.Room = new Room(); Program.Room = new Room();
@ -54,60 +64,11 @@ namespace MudDesigner.Editors
Program.ScriptEngine.CompileStyle = ManagedScripting.Compilers.BaseCompiler.ScriptCompileStyle.CompileToMemory; Program.ScriptEngine.CompileStyle = ManagedScripting.Compilers.BaseCompiler.ScriptCompileStyle.CompileToMemory;
Program.ScriptEngine.KeepTempFiles = false; Program.ScriptEngine.KeepTempFiles = false;
//Get the current rooms scripts.
//TODO: Add Doorway script support
//SetupRoomScript();
if (parameters.Length != 0)
{
foreach (object argument in parameters)
{
if (argument.ToString().ToLower().StartsWith("room="))
{
string roomPath = FileManager.GetDataPath(SaveDataTypes.Rooms);
string room = argument.ToString().Substring("room=".Length);
string filename = System.IO.Path.Combine(roomPath, room.ToString());
//Room to load should always be the first arg.
if (System.IO.File.Exists(filename))
{
Program.Room = (Room)FileManager.Load(filename, Program.Room);
}
}
}
}
//Show the user(s) the rooms properties //Show the user(s) the rooms properties
propertyRoom.SelectedObject = Program.Room; propertyRoom.SelectedObject = Program.Room;
txtScript.Text = Program.Room.Script; txtScript.Text = Program.Room.Script;
} }
private void SetupRoomScript()
{
//Check if the rooms script is empty. If so then generate a standard script for it.
if (String.IsNullOrEmpty(Program.Room.Script))
{
//Instance a new method helper class
ManagedScripting.CodeBuilding.MethodSetup method = new ManagedScripting.CodeBuilding.MethodSetup();
string script = "";
//Setup our method. All objects inheriting from BaseObject will have the standard
//methods created for them.
string[] names = new string[] { "OnCreate", "OnDestroy", "OnEnter", "OnExit" };
foreach (string name in names)
{
method = new ManagedScripting.CodeBuilding.MethodSetup();
method.Name = name;
method.ReturnType = "void";
method.IsOverride = true;
method.Modifier = ManagedScripting.CodeBuilding.ClassGenerator.Modifiers.Public;
method.Code = new string[] { "base." + method.Name + "();" };
script = script.Insert(Program.Room.Script.Length, method.Create() + "\n");
}
Program.Room.Script = script;
}
}
private void BuildDoorwayList() private void BuildDoorwayList()
{ {
AvailableTravelDirections direction = new AvailableTravelDirections(); AvailableTravelDirections direction = new AvailableTravelDirections();
@ -311,7 +272,6 @@ namespace MudDesigner.Editors
Program.Room = new Room(); Program.Room = new Room();
_CurrentDoor = new Door(AvailableTravelDirections.None); _CurrentDoor = new Door(AvailableTravelDirections.None);
SetupRoomScript();
propertyDoor.SelectedObject = null; propertyDoor.SelectedObject = null;
propertyRoom.SelectedObject = Program.Room; propertyRoom.SelectedObject = Program.Room;
@ -319,19 +279,20 @@ namespace MudDesigner.Editors
private void btnSaveRoom_Click(object sender, EventArgs e) private void btnSaveRoom_Click(object sender, EventArgs e)
{ {
string savePath = FileManager.GetDataPath(SaveDataTypes.Rooms); string roomPath = FileManager.GetDataPath(SaveDataTypes.Rooms);
string filePath = System.IO.Path.Combine(savePath, Program.Room.Name + ".room"); string roomFile = System.IO.Path.Combine(roomPath, Program.Room.Filename);
if (System.IO.File.Exists(filePath)) FileManager.Save(roomFile, Program.Room);
{
DialogResult result = MessageBox.Show("File exists! Overwrite?", "Room Designer", MessageBoxButtons.YesNo);
if (result == DialogResult.No) if (!_ZoneBuilder.lstRooms.Items.Contains(Program.Room.Name))
return; _ZoneBuilder.lstRooms.Items.Add(Program.Room.Name);
}
FileManager.Save(filePath, Program.Room); Program.Zone.Rooms.Add(Program.Room);
MessageBox.Show("Saved.", "Room Designer"); string zonePath = FileManager.GetDataPath(SaveDataTypes.Zones);
string zoneFile = System.IO.Path.Combine(zonePath, Program.Zone.Filename);
FileManager.Save(zoneFile, Program.Zone);
Program.Room = new Room();
this.Close();
} }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
@ -361,5 +322,17 @@ namespace MudDesigner.Editors
{ {
Program.Room.Script = txtScript.Text; Program.Room.Script = txtScript.Text;
} }
private void RoomDesigner_Load(object sender, EventArgs e)
{
if (IsEditingExisting)
{
string roomPath = FileManager.GetDataPath(SaveDataTypes.Rooms);
string roomFile = System.IO.Path.Combine(roomPath, _ZoneBuilder.lstRooms.SelectedItem.ToString() + ".room");
Program.Room = (Room)FileManager.Load(roomFile, Program.Room);
propertyRoom.SelectedObject = Program.Room;
txtScript.Text = Program.Room.Script;
}
}
} }
} }

View file

@ -32,7 +32,6 @@
this.containerSidebar = new System.Windows.Forms.SplitContainer(); this.containerSidebar = new System.Windows.Forms.SplitContainer();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnCloseEditor = new System.Windows.Forms.Button(); this.btnCloseEditor = new System.Windows.Forms.Button();
this.btnCheckScript = new System.Windows.Forms.Button();
this.btnSaveRoom = new System.Windows.Forms.Button(); this.btnSaveRoom = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.propertyRoom = new System.Windows.Forms.PropertyGrid(); this.propertyRoom = new System.Windows.Forms.PropertyGrid();
@ -41,6 +40,7 @@
this.tabObjects = new System.Windows.Forms.TabControl(); this.tabObjects = new System.Windows.Forms.TabControl();
this.tabScript = new System.Windows.Forms.TabPage(); this.tabScript = new System.Windows.Forms.TabPage();
this.txtScript = new System.Windows.Forms.RichTextBox(); this.txtScript = new System.Windows.Forms.RichTextBox();
this.btnCheckScript = new System.Windows.Forms.Button();
this.groupBox5 = new System.Windows.Forms.GroupBox(); this.groupBox5 = new System.Windows.Forms.GroupBox();
this.groupBox7 = new System.Windows.Forms.GroupBox(); this.groupBox7 = new System.Windows.Forms.GroupBox();
this.groupBox10 = new System.Windows.Forms.GroupBox(); this.groupBox10 = new System.Windows.Forms.GroupBox();
@ -100,18 +100,17 @@
// //
this.containerSidebar.Panel2.Controls.Add(this.groupBox2); this.containerSidebar.Panel2.Controls.Add(this.groupBox2);
this.containerSidebar.Size = new System.Drawing.Size(209, 562); this.containerSidebar.Size = new System.Drawing.Size(209, 562);
this.containerSidebar.SplitterDistance = 88; this.containerSidebar.SplitterDistance = 66;
this.containerSidebar.TabIndex = 0; this.containerSidebar.TabIndex = 0;
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.btnCloseEditor); this.groupBox1.Controls.Add(this.btnCloseEditor);
this.groupBox1.Controls.Add(this.btnCheckScript);
this.groupBox1.Controls.Add(this.btnSaveRoom); this.groupBox1.Controls.Add(this.btnSaveRoom);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(0, 0); this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(209, 88); this.groupBox1.Size = new System.Drawing.Size(209, 66);
this.groupBox1.TabIndex = 4; this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Room Options"; this.groupBox1.Text = "Room Options";
@ -119,7 +118,7 @@
// btnCloseEditor // btnCloseEditor
// //
this.btnCloseEditor.Dock = System.Windows.Forms.DockStyle.Bottom; this.btnCloseEditor.Dock = System.Windows.Forms.DockStyle.Bottom;
this.btnCloseEditor.Location = new System.Drawing.Point(3, 62); this.btnCloseEditor.Location = new System.Drawing.Point(3, 40);
this.btnCloseEditor.Name = "btnCloseEditor"; this.btnCloseEditor.Name = "btnCloseEditor";
this.btnCloseEditor.Size = new System.Drawing.Size(203, 23); this.btnCloseEditor.Size = new System.Drawing.Size(203, 23);
this.btnCloseEditor.TabIndex = 10; this.btnCloseEditor.TabIndex = 10;
@ -127,17 +126,6 @@
this.btnCloseEditor.UseVisualStyleBackColor = true; this.btnCloseEditor.UseVisualStyleBackColor = true;
this.btnCloseEditor.Click += new System.EventHandler(this.btnCloseEditor_Click); this.btnCloseEditor.Click += new System.EventHandler(this.btnCloseEditor_Click);
// //
// btnCheckScript
//
this.btnCheckScript.Dock = System.Windows.Forms.DockStyle.Top;
this.btnCheckScript.Location = new System.Drawing.Point(3, 39);
this.btnCheckScript.Name = "btnCheckScript";
this.btnCheckScript.Size = new System.Drawing.Size(203, 23);
this.btnCheckScript.TabIndex = 9;
this.btnCheckScript.Text = "Validate Script";
this.btnCheckScript.UseVisualStyleBackColor = true;
this.btnCheckScript.Click += new System.EventHandler(this.btnCheckScript_Click);
//
// btnSaveRoom // btnSaveRoom
// //
this.btnSaveRoom.Dock = System.Windows.Forms.DockStyle.Top; this.btnSaveRoom.Dock = System.Windows.Forms.DockStyle.Top;
@ -155,7 +143,7 @@
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(0, 0); this.groupBox2.Location = new System.Drawing.Point(0, 0);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(209, 470); this.groupBox2.Size = new System.Drawing.Size(209, 492);
this.groupBox2.TabIndex = 0; this.groupBox2.TabIndex = 0;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "Room Setup"; this.groupBox2.Text = "Room Setup";
@ -165,7 +153,7 @@
this.propertyRoom.Dock = System.Windows.Forms.DockStyle.Fill; this.propertyRoom.Dock = System.Windows.Forms.DockStyle.Fill;
this.propertyRoom.Location = new System.Drawing.Point(3, 16); this.propertyRoom.Location = new System.Drawing.Point(3, 16);
this.propertyRoom.Name = "propertyRoom"; this.propertyRoom.Name = "propertyRoom";
this.propertyRoom.Size = new System.Drawing.Size(203, 451); this.propertyRoom.Size = new System.Drawing.Size(203, 473);
this.propertyRoom.TabIndex = 3; this.propertyRoom.TabIndex = 3;
this.propertyRoom.ToolbarVisible = false; this.propertyRoom.ToolbarVisible = false;
// //
@ -212,6 +200,7 @@
// tabScript // tabScript
// //
this.tabScript.Controls.Add(this.txtScript); this.tabScript.Controls.Add(this.txtScript);
this.tabScript.Controls.Add(this.btnCheckScript);
this.tabScript.Location = new System.Drawing.Point(4, 22); this.tabScript.Location = new System.Drawing.Point(4, 22);
this.tabScript.Name = "tabScript"; this.tabScript.Name = "tabScript";
this.tabScript.Padding = new System.Windows.Forms.Padding(3); this.tabScript.Padding = new System.Windows.Forms.Padding(3);
@ -224,12 +213,23 @@
// //
this.txtScript.AcceptsTab = true; this.txtScript.AcceptsTab = true;
this.txtScript.Dock = System.Windows.Forms.DockStyle.Fill; this.txtScript.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtScript.Location = new System.Drawing.Point(3, 3); this.txtScript.Location = new System.Drawing.Point(3, 26);
this.txtScript.Name = "txtScript"; this.txtScript.Name = "txtScript";
this.txtScript.Size = new System.Drawing.Size(555, 267); this.txtScript.Size = new System.Drawing.Size(555, 244);
this.txtScript.TabIndex = 0; this.txtScript.TabIndex = 11;
this.txtScript.Text = ""; this.txtScript.Text = "";
this.txtScript.TextChanged += new System.EventHandler(this.txtScript_TextChanged); this.txtScript.Click += new System.EventHandler(this.txtScript_TextChanged);
//
// btnCheckScript
//
this.btnCheckScript.Dock = System.Windows.Forms.DockStyle.Top;
this.btnCheckScript.Location = new System.Drawing.Point(3, 3);
this.btnCheckScript.Name = "btnCheckScript";
this.btnCheckScript.Size = new System.Drawing.Size(555, 23);
this.btnCheckScript.TabIndex = 10;
this.btnCheckScript.Text = "Validate Script";
this.btnCheckScript.UseVisualStyleBackColor = true;
this.btnCheckScript.Click += new System.EventHandler(this.btnCheckScript_Click);
// //
// groupBox5 // groupBox5
// //
@ -296,7 +296,7 @@
this.lstDirections.TabIndex = 0; this.lstDirections.TabIndex = 0;
this.lstDirections.SelectedIndexChanged += new System.EventHandler(this.lstDirections_SelectedIndexChanged); this.lstDirections.SelectedIndexChanged += new System.EventHandler(this.lstDirections_SelectedIndexChanged);
// //
// frmMain // RoomDesigner
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@ -305,9 +305,10 @@
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "frmMain"; this.Name = "RoomDesigner";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Mud Designer: Room Designer"; this.Text = "Mud Designer: Room Designer";
this.Load += new System.EventHandler(this.RoomDesigner_Load);
this.containerMain.Panel1.ResumeLayout(false); this.containerMain.Panel1.ResumeLayout(false);
this.containerMain.Panel2.ResumeLayout(false); this.containerMain.Panel2.ResumeLayout(false);
this.containerMain.ResumeLayout(false); this.containerMain.ResumeLayout(false);
@ -347,10 +348,10 @@
private System.Windows.Forms.GroupBox groupBox10; private System.Windows.Forms.GroupBox groupBox10;
private System.Windows.Forms.PropertyGrid propertyDoor; private System.Windows.Forms.PropertyGrid propertyDoor;
private System.Windows.Forms.Button btnCloseEditor; private System.Windows.Forms.Button btnCloseEditor;
private System.Windows.Forms.Button btnCheckScript;
private System.Windows.Forms.Button btnSaveRoom; private System.Windows.Forms.Button btnSaveRoom;
private System.Windows.Forms.TabPage tabScript; private System.Windows.Forms.TabPage tabScript;
private System.Windows.Forms.RichTextBox txtScript; private System.Windows.Forms.RichTextBox txtScript;
private System.Windows.Forms.Button btnCheckScript;
} }
} }

View file

@ -28,32 +28,19 @@ namespace MudDesigner.Editors
private void btnRoomEditor_Click(object sender, EventArgs e) private void btnRoomEditor_Click(object sender, EventArgs e)
{ {
DialogResult result; RoomDesigner form = new RoomDesigner(this);
RoomDesigner form = new RoomDesigner(); if (!btnRoomEditor.Text.Equals("Build A Room"))
Program.Room = new Room();
//Check if we have a room selected, if so we are going to ask if the user wants to edit it.
if (lstRooms.SelectedItem != null)
{ {
result = MessageBox.Show("You have a room selected, are you wanting to edit it?", form.IsEditingExisting = true;
"Zone Builder", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
switch (result)
{
case DialogResult.Yes:
form = new RoomDesigner(lstRooms.SelectedItem.ToString());
string filename = System.IO.Path.Combine(FileManager.GetDataPath(SaveDataTypes.Rooms), lstRooms.SelectedItem.ToString());
Program.Room = (Room)FileManager.Load(filename, Program.Room);
break;
case DialogResult.Cancel:
return;
}
} }
form.Show(); form.Show();
this.Hide(); this.Hide();
while (form.Created) while (form.Created)
{
Application.DoEvents(); Application.DoEvents();
}
form = null; form = null;
@ -64,9 +51,9 @@ namespace MudDesigner.Editors
{ {
//build the save file name //build the save file name
string path = FileManager.GetDataPath(SaveDataTypes.Zones); string path = FileManager.GetDataPath(SaveDataTypes.Zones);
string zoneFile = System.IO.Path.Combine(path, Program.Zone.Name + ".zone"); string zoneFile = System.IO.Path.Combine(path, Program.Zone.Filename);
path = FileManager.GetDataPath(SaveDataTypes.Realms); path = FileManager.GetDataPath(SaveDataTypes.Realms);
string realmFile = System.IO.Path.Combine(path, Program.Realm.Name + ".realm"); string realmFile = System.IO.Path.Combine(path, Program.Realm.Filename);
//get a copy of the currently running (but hidden) realm explorer //get a copy of the currently running (but hidden) realm explorer
RealmExplorer form = (RealmExplorer)Program.CurrentEditor; RealmExplorer form = (RealmExplorer)Program.CurrentEditor;
@ -95,13 +82,6 @@ namespace MudDesigner.Editors
this.Close(); this.Close();
} }
private void btnNewZone_Click(object sender, EventArgs e)
{
Program.Zone = new Zone();
Program.Room = new Room();
propertyZone.SelectedObject = Program.Zone;
}
private void btnValidateScript_Click(object sender, EventArgs e) private void btnValidateScript_Click(object sender, EventArgs e)
{ {
Program.ScriptEngine.Compiler = ManagedScripting.ScriptingEngine.CompilerSelections.SourceCompiler; Program.ScriptEngine.Compiler = ManagedScripting.ScriptingEngine.CompilerSelections.SourceCompiler;
@ -146,5 +126,26 @@ namespace MudDesigner.Editors
} }
} }
private void txtScript_TextChanged(object sender, EventArgs e)
{
Program.Zone.Script = txtScript.Text;
}
private void btnCloseBuilder_Click(object sender, EventArgs e)
{
this.Close();
}
private void lstRooms_SelectedIndexChanged(object sender, EventArgs e)
{
btnRoomEditor.Text = "Edit Selected Room";
}
private void btnUnselectRoom_Click(object sender, EventArgs e)
{
lstRooms.SelectedIndex = -1;
btnRoomEditor.Text = "Build A Room";
}
} }
} }

View file

@ -31,16 +31,17 @@
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.propertyZone = new System.Windows.Forms.PropertyGrid(); this.propertyZone = new System.Windows.Forms.PropertyGrid();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnValidateScript = new System.Windows.Forms.Button(); this.btnCloseBuilder = new System.Windows.Forms.Button();
this.btnSaveZone = new System.Windows.Forms.Button(); this.btnSaveZone = new System.Windows.Forms.Button();
this.btnNewZone = new System.Windows.Forms.Button();
this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabZoneCreation = new System.Windows.Forms.TabPage(); this.tabZoneCreation = new System.Windows.Forms.TabPage();
this.tabScript = new System.Windows.Forms.TabPage(); this.tabScript = new System.Windows.Forms.TabPage();
this.txtScript = new System.Windows.Forms.RichTextBox(); this.txtScript = new System.Windows.Forms.RichTextBox();
this.btnValidateScript = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lstRooms = new System.Windows.Forms.ListBox(); this.lstRooms = new System.Windows.Forms.ListBox();
this.btnUnselectRoom = new System.Windows.Forms.Button();
this.btnRoomEditor = new System.Windows.Forms.Button(); this.btnRoomEditor = new System.Windows.Forms.Button();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
@ -83,9 +84,8 @@
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.btnValidateScript); this.groupBox1.Controls.Add(this.btnCloseBuilder);
this.groupBox1.Controls.Add(this.btnSaveZone); this.groupBox1.Controls.Add(this.btnSaveZone);
this.groupBox1.Controls.Add(this.btnNewZone);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top; this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Location = new System.Drawing.Point(0, 0); this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
@ -94,37 +94,28 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Zone Setup"; this.groupBox1.Text = "Zone Setup";
// //
// btnValidateScript // btnCloseBuilder
// //
this.btnValidateScript.Dock = System.Windows.Forms.DockStyle.Bottom; this.btnCloseBuilder.Dock = System.Windows.Forms.DockStyle.Top;
this.btnValidateScript.Location = new System.Drawing.Point(3, 45); this.btnCloseBuilder.Location = new System.Drawing.Point(3, 39);
this.btnValidateScript.Name = "btnValidateScript"; this.btnCloseBuilder.Name = "btnCloseBuilder";
this.btnValidateScript.Size = new System.Drawing.Size(204, 23); this.btnCloseBuilder.Size = new System.Drawing.Size(204, 23);
this.btnValidateScript.TabIndex = 13; this.btnCloseBuilder.TabIndex = 12;
this.btnValidateScript.Text = "Validate Script"; this.btnCloseBuilder.Text = "Close Builder";
this.btnValidateScript.UseVisualStyleBackColor = true; this.btnCloseBuilder.UseVisualStyleBackColor = true;
this.btnValidateScript.Click += new System.EventHandler(this.btnValidateScript_Click); this.btnCloseBuilder.Click += new System.EventHandler(this.btnCloseBuilder_Click);
// //
// btnSaveZone // btnSaveZone
// //
this.btnSaveZone.Location = new System.Drawing.Point(110, 19); this.btnSaveZone.Dock = System.Windows.Forms.DockStyle.Top;
this.btnSaveZone.Location = new System.Drawing.Point(3, 16);
this.btnSaveZone.Name = "btnSaveZone"; this.btnSaveZone.Name = "btnSaveZone";
this.btnSaveZone.Size = new System.Drawing.Size(97, 23); this.btnSaveZone.Size = new System.Drawing.Size(204, 23);
this.btnSaveZone.TabIndex = 11; this.btnSaveZone.TabIndex = 11;
this.btnSaveZone.Text = "Save Zone"; this.btnSaveZone.Text = "Save Zone";
this.btnSaveZone.UseVisualStyleBackColor = true; this.btnSaveZone.UseVisualStyleBackColor = true;
this.btnSaveZone.Click += new System.EventHandler(this.btnSaveZone_Click); this.btnSaveZone.Click += new System.EventHandler(this.btnSaveZone_Click);
// //
// btnNewZone
//
this.btnNewZone.Location = new System.Drawing.Point(3, 19);
this.btnNewZone.Name = "btnNewZone";
this.btnNewZone.Size = new System.Drawing.Size(102, 23);
this.btnNewZone.TabIndex = 9;
this.btnNewZone.Text = "New Zone";
this.btnNewZone.UseVisualStyleBackColor = true;
this.btnNewZone.Click += new System.EventHandler(this.btnNewZone_Click);
//
// splitContainer2 // splitContainer2
// //
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
@ -166,6 +157,7 @@
// tabScript // tabScript
// //
this.tabScript.Controls.Add(this.txtScript); this.tabScript.Controls.Add(this.txtScript);
this.tabScript.Controls.Add(this.btnValidateScript);
this.tabScript.Location = new System.Drawing.Point(4, 22); this.tabScript.Location = new System.Drawing.Point(4, 22);
this.tabScript.Name = "tabScript"; this.tabScript.Name = "tabScript";
this.tabScript.Padding = new System.Windows.Forms.Padding(3); this.tabScript.Padding = new System.Windows.Forms.Padding(3);
@ -177,20 +169,33 @@
// txtScript // txtScript
// //
this.txtScript.Dock = System.Windows.Forms.DockStyle.Fill; this.txtScript.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtScript.Location = new System.Drawing.Point(3, 3); this.txtScript.Location = new System.Drawing.Point(3, 26);
this.txtScript.Name = "txtScript"; this.txtScript.Name = "txtScript";
this.txtScript.Size = new System.Drawing.Size(351, 542); this.txtScript.Size = new System.Drawing.Size(351, 519);
this.txtScript.TabIndex = 0; this.txtScript.TabIndex = 15;
this.txtScript.Text = ""; this.txtScript.Text = "";
this.txtScript.TextChanged += new System.EventHandler(this.txtScript_TextChanged);
//
// btnValidateScript
//
this.btnValidateScript.Dock = System.Windows.Forms.DockStyle.Top;
this.btnValidateScript.Location = new System.Drawing.Point(3, 3);
this.btnValidateScript.Name = "btnValidateScript";
this.btnValidateScript.Size = new System.Drawing.Size(351, 23);
this.btnValidateScript.TabIndex = 14;
this.btnValidateScript.Text = "Validate Script";
this.btnValidateScript.UseVisualStyleBackColor = true;
this.btnValidateScript.Click += new System.EventHandler(this.btnValidateScript_Click);
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.lstRooms); this.groupBox2.Controls.Add(this.lstRooms);
this.groupBox2.Controls.Add(this.btnUnselectRoom);
this.groupBox2.Controls.Add(this.btnRoomEditor); this.groupBox2.Controls.Add(this.btnRoomEditor);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Top; this.groupBox2.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox2.Location = new System.Drawing.Point(0, 0); this.groupBox2.Location = new System.Drawing.Point(0, 0);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(211, 168); this.groupBox2.Size = new System.Drawing.Size(211, 209);
this.groupBox2.TabIndex = 0; this.groupBox2.TabIndex = 0;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "Available Rooms"; this.groupBox2.Text = "Available Rooms";
@ -201,17 +206,29 @@
this.lstRooms.FormattingEnabled = true; this.lstRooms.FormattingEnabled = true;
this.lstRooms.Location = new System.Drawing.Point(3, 16); this.lstRooms.Location = new System.Drawing.Point(3, 16);
this.lstRooms.Name = "lstRooms"; this.lstRooms.Name = "lstRooms";
this.lstRooms.Size = new System.Drawing.Size(205, 121); this.lstRooms.Size = new System.Drawing.Size(205, 134);
this.lstRooms.TabIndex = 1; this.lstRooms.TabIndex = 3;
this.lstRooms.SelectedIndexChanged += new System.EventHandler(this.lstRooms_SelectedIndexChanged);
//
// btnUnselectRoom
//
this.btnUnselectRoom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.btnUnselectRoom.Location = new System.Drawing.Point(3, 160);
this.btnUnselectRoom.Name = "btnUnselectRoom";
this.btnUnselectRoom.Size = new System.Drawing.Size(205, 23);
this.btnUnselectRoom.TabIndex = 2;
this.btnUnselectRoom.Text = "Unselect Room";
this.btnUnselectRoom.UseVisualStyleBackColor = true;
this.btnUnselectRoom.Click += new System.EventHandler(this.btnUnselectRoom_Click);
// //
// btnRoomEditor // btnRoomEditor
// //
this.btnRoomEditor.Dock = System.Windows.Forms.DockStyle.Bottom; this.btnRoomEditor.Dock = System.Windows.Forms.DockStyle.Bottom;
this.btnRoomEditor.Location = new System.Drawing.Point(3, 142); this.btnRoomEditor.Location = new System.Drawing.Point(3, 183);
this.btnRoomEditor.Name = "btnRoomEditor"; this.btnRoomEditor.Name = "btnRoomEditor";
this.btnRoomEditor.Size = new System.Drawing.Size(205, 23); this.btnRoomEditor.Size = new System.Drawing.Size(205, 23);
this.btnRoomEditor.TabIndex = 0; this.btnRoomEditor.TabIndex = 0;
this.btnRoomEditor.Text = "Build-A-Room"; this.btnRoomEditor.Text = "Build A Room";
this.btnRoomEditor.UseVisualStyleBackColor = true; this.btnRoomEditor.UseVisualStyleBackColor = true;
this.btnRoomEditor.Click += new System.EventHandler(this.btnRoomEditor_Click); this.btnRoomEditor.Click += new System.EventHandler(this.btnRoomEditor_Click);
// //
@ -246,18 +263,19 @@
private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnValidateScript;
private System.Windows.Forms.Button btnSaveZone; private System.Windows.Forms.Button btnSaveZone;
private System.Windows.Forms.Button btnNewZone;
private System.Windows.Forms.PropertyGrid propertyZone; private System.Windows.Forms.PropertyGrid propertyZone;
private System.Windows.Forms.SplitContainer splitContainer2; private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ListBox lstRooms;
private System.Windows.Forms.Button btnRoomEditor; private System.Windows.Forms.Button btnRoomEditor;
private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabZoneCreation; private System.Windows.Forms.TabPage tabZoneCreation;
private System.Windows.Forms.TabPage tabScript; private System.Windows.Forms.TabPage tabScript;
private System.Windows.Forms.RichTextBox txtScript; private System.Windows.Forms.RichTextBox txtScript;
private System.Windows.Forms.Button btnValidateScript;
private System.Windows.Forms.Button btnCloseBuilder;
private System.Windows.Forms.Button btnUnselectRoom;
public System.Windows.Forms.ListBox lstRooms;
} }
} }

View file

@ -13,5 +13,7 @@ namespace MudDesigner.MudEngine.Objects.Environment
get; get;
set; set;
} }
public List<Room> Rooms { get; set; }
} }
} }