- Zones build their Room collection during instancing.

- Zones can not be instanced without providing the owning realm in its constructor.
 - Started adding tooltips to the editors.
 - Zone Builder now checks if a Realm has been loaded yet or not prior to creating Zones.
 - Zone Builder will not allow Rooms to be created within new Zones until the Zone has been saved.
 - Zone Builder checks if a New Zone has not been saved yet prior to creating another New Zone
 - Renamed Room.ParentZone to Room.Zone to be consistent with the Realm and Zone classes.
This commit is contained in:
Scionwest_cp 2009-12-08 15:49:43 -08:00
parent f35e1b2ea7
commit 44431ecade
8 changed files with 460 additions and 98 deletions

View file

@ -31,13 +31,9 @@ namespace MudDesigner.Editors
//instance our collections
realms = new List<Realm>();
zones = new List<Zone>();
rooms = new List<Room>();
//instance the environments
Program.Zone = new Zone();
Program.Realm = new Realm();
Program.Room = new Room();
//instance the script engine
Program.ScriptEngine = new ScriptingEngine();
@ -92,8 +88,6 @@ namespace MudDesigner.Editors
{
//Reinstance all of our environments
Program.Realm = new Realm();
Program.Zone = new Zone();
Program.Room = new Room();
propertyRealm.SelectedObject = Program.Realm;
txtScript.Text = Program.Realm.Script;
@ -188,15 +182,6 @@ namespace MudDesigner.Editors
break;
}
}
//now that the realm is loaded, we need to loop through each
//zone within the realm, and load it's rooms, scanning for available
//exists for the realm to use.
foreach (string zone in Program.Realm.Zones)
{
Zone z = new Zone();
z = Program.Realm.GetZone(zone);
}
}
private void txtScript_TextChanged(object sender, EventArgs e)

View file

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.btnLogo = new System.Windows.Forms.Button();
this.tabEditors = new System.Windows.Forms.TabControl();
@ -36,6 +37,7 @@
this.btnProjectSettings = new System.Windows.Forms.Button();
this.btnCurrencyEditor = new System.Windows.Forms.Button();
this.btnRealmExplorer = new System.Windows.Forms.Button();
this.btnZoneBuilder = new System.Windows.Forms.Button();
this.tabFunctions = new System.Windows.Forms.TabPage();
this.groupBox9 = new System.Windows.Forms.GroupBox();
this.groupBox14 = new System.Windows.Forms.GroupBox();
@ -48,7 +50,7 @@
this.groupBox8 = new System.Windows.Forms.GroupBox();
this.txtScript = new System.Windows.Forms.RichTextBox();
this.tabVariables = new System.Windows.Forms.TabPage();
this.btnZoneBuilder = new System.Windows.Forms.Button();
this.Help = new System.Windows.Forms.ToolTip(this.components);
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
@ -78,7 +80,7 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.tabEditors);
this.splitContainer1.Size = new System.Drawing.Size(639, 383);
this.splitContainer1.Size = new System.Drawing.Size(627, 383);
this.splitContainer1.SplitterDistance = 154;
this.splitContainer1.TabIndex = 0;
//
@ -95,7 +97,7 @@
this.btnLogo.ForeColor = System.Drawing.Color.Gray;
this.btnLogo.Location = new System.Drawing.Point(0, 0);
this.btnLogo.Name = "btnLogo";
this.btnLogo.Size = new System.Drawing.Size(639, 154);
this.btnLogo.Size = new System.Drawing.Size(627, 154);
this.btnLogo.TabIndex = 0;
this.btnLogo.Text = "MUD Designer HUB \r\nPreview Release 1\r\n";
this.btnLogo.UseVisualStyleBackColor = false;
@ -107,7 +109,7 @@
this.tabEditors.Location = new System.Drawing.Point(0, 0);
this.tabEditors.Name = "tabEditors";
this.tabEditors.SelectedIndex = 0;
this.tabEditors.Size = new System.Drawing.Size(639, 225);
this.tabEditors.Size = new System.Drawing.Size(627, 225);
this.tabEditors.TabIndex = 0;
//
// tabPage1
@ -116,7 +118,7 @@
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(631, 199);
this.tabPage1.Size = new System.Drawing.Size(619, 199);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Available Editors";
this.tabPage1.UseVisualStyleBackColor = true;
@ -130,7 +132,7 @@
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(625, 193);
this.flowLayoutPanel1.Size = new System.Drawing.Size(613, 193);
this.flowLayoutPanel1.TabIndex = 1;
//
// btnProjectSettings
@ -142,6 +144,8 @@
this.btnProjectSettings.Size = new System.Drawing.Size(147, 55);
this.btnProjectSettings.TabIndex = 0;
this.btnProjectSettings.Text = "Project Settings";
this.Help.SetToolTip(this.btnProjectSettings, "Managed your MUDs project settings. \r\nSettings include day/night transitions, sta" +
"rting locations and various other MUD startup options");
this.btnProjectSettings.UseVisualStyleBackColor = true;
this.btnProjectSettings.Click += new System.EventHandler(this.btnProjectSettings_Click);
//
@ -154,6 +158,8 @@
this.btnCurrencyEditor.Size = new System.Drawing.Size(147, 55);
this.btnCurrencyEditor.TabIndex = 1;
this.btnCurrencyEditor.Text = "Currency Editor";
this.Help.SetToolTip(this.btnCurrencyEditor, "Edits the currency that players will use for transactions\r\nduring your MUDs gamep" +
"lay.");
this.btnCurrencyEditor.UseVisualStyleBackColor = true;
this.btnCurrencyEditor.Click += new System.EventHandler(this.btnCurrencyEditor_Click);
//
@ -166,9 +172,26 @@
this.btnRealmExplorer.Size = new System.Drawing.Size(147, 55);
this.btnRealmExplorer.TabIndex = 3;
this.btnRealmExplorer.Text = "Realm Explorer";
this.Help.SetToolTip(this.btnRealmExplorer, "Create and manage Realms using the Explorer.\r\nRealms contain the Zones & Rooms of" +
" your MUD, allowing\r\nplayers to traverse your MUD.");
this.btnRealmExplorer.UseVisualStyleBackColor = true;
this.btnRealmExplorer.Click += new System.EventHandler(this.btnRealmExplorer_Click);
//
// btnZoneBuilder
//
this.btnZoneBuilder.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnZoneBuilder.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnZoneBuilder.Location = new System.Drawing.Point(462, 3);
this.btnZoneBuilder.Name = "btnZoneBuilder";
this.btnZoneBuilder.Size = new System.Drawing.Size(147, 55);
this.btnZoneBuilder.TabIndex = 4;
this.btnZoneBuilder.Text = "Zone Builder";
this.Help.SetToolTip(this.btnZoneBuilder, "The Zone Builder provides tools to create and manage your MUDs\r\nZones & Rooms. Cr" +
"eate Rooms, link them together via Doors and\r\nconnect Zones together either with" +
"in the same Realm or cross-realms.");
this.btnZoneBuilder.UseVisualStyleBackColor = true;
this.btnZoneBuilder.Click += new System.EventHandler(this.btnZoneBuilder_Click);
//
// tabFunctions
//
this.tabFunctions.Controls.Add(this.groupBox9);
@ -302,23 +325,20 @@
this.tabVariables.Text = "Variables";
this.tabVariables.UseVisualStyleBackColor = true;
//
// btnZoneBuilder
// Help
//
this.btnZoneBuilder.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnZoneBuilder.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnZoneBuilder.Location = new System.Drawing.Point(462, 3);
this.btnZoneBuilder.Name = "btnZoneBuilder";
this.btnZoneBuilder.Size = new System.Drawing.Size(147, 55);
this.btnZoneBuilder.TabIndex = 4;
this.btnZoneBuilder.Text = "Zone Builder";
this.btnZoneBuilder.UseVisualStyleBackColor = true;
this.btnZoneBuilder.Click += new System.EventHandler(this.btnZoneBuilder_Click);
this.Help.AutoPopDelay = 8000;
this.Help.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.Help.InitialDelay = 500;
this.Help.IsBalloon = true;
this.Help.ReshowDelay = 100;
this.Help.ToolTipTitle = "Toolkit Help";
//
// ToolkitLauncher
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(639, 383);
this.ClientSize = new System.Drawing.Size(627, 383);
this.Controls.Add(this.splitContainer1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
@ -366,6 +386,7 @@
private System.Windows.Forms.TabPage tabVariables;
private System.Windows.Forms.Button btnRealmExplorer;
private System.Windows.Forms.Button btnZoneBuilder;
private System.Windows.Forms.ToolTip Help;
}
}

View file

@ -120,4 +120,10 @@
<metadata name="splitContainer1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Help.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="Help.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -22,6 +22,8 @@ namespace MudDesigner.Editors
{
internal bool IsEditingExisting = false;
bool IsRealmLoaded = false;
bool IsZoneLoaded = false;
bool IsCreatingZone = false;
List<Zone> _Zones = new List<Zone>();
public ZoneBuilder()
@ -29,12 +31,11 @@ namespace MudDesigner.Editors
InitializeComponent();
//Reinstance all of our environments
Program.Realm = new Realm();
Program.Zone = new Zone();
Program.Room = new Room();
}
private void btnNewRealm_Click(object sender, EventArgs e)
private void btnNewZone_Click(object sender, EventArgs e)
{
//Check if a realm is loaded
if (!IsRealmLoaded)
{
MessageBox.Show("You need to select a Realm to create a Zone in first.",
@ -42,12 +43,34 @@ namespace MudDesigner.Editors
return;
}
Program.Zone = new Zone();
if (IsCreatingZone)
{
DialogResult result = MessageBox.Show("You are currently editing a new Zone, are you sure you want to re-create a new Zone?",
"Zone Builder", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No)
return;
}
//re-instance our zone and room
Program.Zone = new Zone(Program.Realm);
//Assign the realm to the zone
Program.Zone.Realm = Program.Realm.Name;
//Assign to the property view
propertyZone.SelectedObject = Program.Zone;
//Zone is in 'create' mode, and has not been saved/loaded fully yet.
IsZoneLoaded = false;
IsCreatingZone = true;
//Reset our room, as we are creating a new zone, there will be no rooms.
propertyRoom.SelectedObject = null;
lstRooms.Items.Clear();
}
private void btnSaveRealm_Click(object sender, EventArgs e)
private void btnSaveZone_Click(object sender, EventArgs e)
{
//Get the realm and zone path setup first
string realmPath = System.IO.Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), Program.Realm.Name);
@ -85,6 +108,8 @@ namespace MudDesigner.Editors
}
//Add the zone to our collection
_Zones.Add(Program.Zone);
IsZoneLoaded = true;
IsCreatingZone = false;
}
private void btnSelectRealm_Click(object sender, EventArgs e)
@ -116,9 +141,10 @@ namespace MudDesigner.Editors
this.Text = "Zone Builder: (" + Program.Realm.Name + ")";
IsRealmLoaded = true;
//realm is loaded, now clear out the list of zones and show the zones contained
//realm is loaded, now clear out the list of zones & rooms and show the zones contained
//within the new realm
lstZones.Items.Clear();
lstRooms.Items.Clear();
_Zones.Clear();
string[] files = Directory.GetFiles(realmPath, "*.zone", SearchOption.AllDirectories);
@ -127,7 +153,7 @@ namespace MudDesigner.Editors
string filename = Path.GetFileName(file);
if (Program.Realm.Zones.Contains(filename))
{
Zone zone = new Zone();
Zone zone = new Zone(Program.Realm);
zone = (Zone)FileManager.Load(file, zone);
_Zones.Add(zone);
lstZones.Items.Add(zone.Name);
@ -137,7 +163,7 @@ namespace MudDesigner.Editors
}
}
private void btnLoadRealm_Click(object sender, EventArgs e)
private void btnLoadZone_Click(object sender, EventArgs e)
{
if (!IsRealmLoaded)
{
@ -152,6 +178,15 @@ namespace MudDesigner.Editors
return;
}
if (IsCreatingZone)
{
DialogResult result = MessageBox.Show("You are currently editing a new Zone, are you sure you want to re-create a new Zone?",
"Zone Builder", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No)
return;
}
//Loop through the collection we generated when we selected our realm
//and find the zone that the user selected to load
foreach (Zone zone in _Zones)
@ -163,7 +198,106 @@ namespace MudDesigner.Editors
}
}
//Loop through the zones collection of rooms and add them to the
//room list.
lstRooms.Items.Clear();
foreach (Room room in Program.Zone.Rooms)
{
lstRooms.Items.Add(room.Name);
}
propertyZone.SelectedObject = Program.Zone;
IsZoneLoaded = true;
IsCreatingZone = false;
}
private void btnNewRoom_Click(object sender, EventArgs e)
{
if (!IsZoneLoaded)
{
string msg = "";
if (IsCreatingZone)
{
msg = "You will need to save the Zone prior to creating a new Room.";
}
else
{
msg = "You will need to load a Zone prior to creating a new Room.";
}
MessageBox.Show(msg,
"Zone Builder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
Program.Room = new Room();
Program.Room.Zone = Program.Zone.Name;
propertyRoom.SelectedObject = Program.Room;
}
private void btnSaveRoom_Click(object sender, EventArgs e)
{
//Get the realm, zone & room path setup first
string realmPath = System.IO.Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), Program.Realm.Name);
string zonePath = Path.Combine(realmPath, Program.Zone.Name);
string roomFile = Path.Combine(zonePath, Program.Room.Filename);
//adjust our Zone. Zones are added to the Zone.Rooms
//collection when the Zone is instanced, anything created
//after the Zone is instanced will need to be added manually.
//Zone does not need to be re-saved like Realms would need to be
//as Zones load all of the Rooms it contains on its own when instanced.
if (Program.Zone.GetRoom(Program.Room.Name) == null)
Program.Zone.Rooms.Add(Program.Room);
//save the Room
FileManager.Save(roomFile, Program.Room);
//add it to the list box if it isn't already there
if (!lstRooms.Items.Contains(Program.Room.Name))
lstRooms.Items.Add(Program.Room.Name);
}
private void btnLoadRoom_Click(object sender, EventArgs e)
{
if (!IsZoneLoaded)
{
MessageBox.Show("You must first load a Zone in order to aquire Rooms for loading.",
"Zone Builder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (lstRooms.SelectedIndex == -1)
{
MessageBox.Show("Select a Room to load first.", "Zone Builder", MessageBoxButtons.OK);
return;
}
if (IsCreatingZone)
{
MessageBox.Show("You are currently editing a new Zone, you must save the Zone prior to attempting to load a Room.",
"Zone Builder", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
return;
}
bool found = false;
foreach (Room room in Program.Zone.Rooms)
{
if (room.Name == lstRooms.SelectedItem.ToString())
{
Program.Room = room;
found = true;
break;
}
}
if (!found)
{
MessageBox.Show("Failed loading room. Unable to locate the selected room within the Zone.",
"Zone Builder", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
propertyRoom.SelectedObject = Program.Room;
}
}
}

View file

@ -34,15 +34,28 @@
this.lstZones = new System.Windows.Forms.ListBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnSelectRealm = new System.Windows.Forms.Button();
this.btnLoadRealm = new System.Windows.Forms.Button();
this.btnSaveRealm = new System.Windows.Forms.Button();
this.btnDeleteRealm = new System.Windows.Forms.Button();
this.btnNewRealm = new System.Windows.Forms.Button();
this.btnLoadZone = new System.Windows.Forms.Button();
this.btnSaveZone = new System.Windows.Forms.Button();
this.btnDeleteZone = new System.Windows.Forms.Button();
this.btnNewZone = new System.Windows.Forms.Button();
this.tabZoneBuilder = new System.Windows.Forms.TabControl();
this.tabZone = new System.Windows.Forms.TabPage();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.propertyZone = new System.Windows.Forms.PropertyGrid();
this.tabRoomDesigner = new System.Windows.Forms.TabPage();
this.tabRoomEditor = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.propertyRoom = new System.Windows.Forms.PropertyGrid();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.lstRooms = new System.Windows.Forms.ListBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.btnLoadRoom = new System.Windows.Forms.Button();
this.btnSaveRoom = new System.Windows.Forms.Button();
this.btnDeleteRoom = new System.Windows.Forms.Button();
this.btnNewRoom = new System.Windows.Forms.Button();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.Help = new System.Windows.Forms.ToolTip(this.components);
this.containerMain.Panel1.SuspendLayout();
this.containerMain.Panel2.SuspendLayout();
@ -52,6 +65,12 @@
this.tabZoneBuilder.SuspendLayout();
this.tabZone.SuspendLayout();
this.groupBox3.SuspendLayout();
this.tabRoomDesigner.SuspendLayout();
this.tabRoomEditor.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox7.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox5.SuspendLayout();
this.SuspendLayout();
//
// containerMain
@ -68,8 +87,8 @@
// containerMain.Panel2
//
this.containerMain.Panel2.Controls.Add(this.tabZoneBuilder);
this.containerMain.Size = new System.Drawing.Size(650, 471);
this.containerMain.SplitterDistance = 195;
this.containerMain.Size = new System.Drawing.Size(700, 471);
this.containerMain.SplitterDistance = 210;
this.containerMain.TabIndex = 0;
//
// groupBox1
@ -78,7 +97,7 @@
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(0, 100);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(195, 371);
this.groupBox1.Size = new System.Drawing.Size(210, 371);
this.groupBox1.TabIndex = 37;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Zone List";
@ -89,21 +108,23 @@
this.lstZones.FormattingEnabled = true;
this.lstZones.Location = new System.Drawing.Point(3, 16);
this.lstZones.Name = "lstZones";
this.lstZones.Size = new System.Drawing.Size(189, 342);
this.lstZones.Size = new System.Drawing.Size(204, 342);
this.lstZones.Sorted = true;
this.lstZones.TabIndex = 17;
this.Help.SetToolTip(this.lstZones, "A collection of Zones that have already been created\r\nand stored within the selec" +
"ted Realm.");
//
// groupBox2
//
this.groupBox2.Controls.Add(this.btnSelectRealm);
this.groupBox2.Controls.Add(this.btnLoadRealm);
this.groupBox2.Controls.Add(this.btnSaveRealm);
this.groupBox2.Controls.Add(this.btnDeleteRealm);
this.groupBox2.Controls.Add(this.btnNewRealm);
this.groupBox2.Controls.Add(this.btnLoadZone);
this.groupBox2.Controls.Add(this.btnSaveZone);
this.groupBox2.Controls.Add(this.btnDeleteZone);
this.groupBox2.Controls.Add(this.btnNewZone);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox2.Location = new System.Drawing.Point(0, 0);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(195, 100);
this.groupBox2.Size = new System.Drawing.Size(210, 100);
this.groupBox2.TabIndex = 35;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Zone Setup";
@ -113,50 +134,51 @@
this.btnSelectRealm.Dock = System.Windows.Forms.DockStyle.Bottom;
this.btnSelectRealm.Location = new System.Drawing.Point(3, 74);
this.btnSelectRealm.Name = "btnSelectRealm";
this.btnSelectRealm.Size = new System.Drawing.Size(189, 23);
this.btnSelectRealm.Size = new System.Drawing.Size(204, 23);
this.btnSelectRealm.TabIndex = 12;
this.btnSelectRealm.Text = "Select Realm";
this.Help.SetToolTip(this.btnSelectRealm, "Selects the Realm that your new Zones will be created within");
this.btnSelectRealm.UseVisualStyleBackColor = true;
this.btnSelectRealm.Click += new System.EventHandler(this.btnSelectRealm_Click);
//
// btnLoadRealm
// btnLoadZone
//
this.btnLoadRealm.Location = new System.Drawing.Point(106, 19);
this.btnLoadRealm.Name = "btnLoadRealm";
this.btnLoadRealm.Size = new System.Drawing.Size(85, 23);
this.btnLoadRealm.TabIndex = 11;
this.btnLoadRealm.Text = "Load Zone";
this.btnLoadRealm.UseVisualStyleBackColor = true;
this.btnLoadRealm.Click += new System.EventHandler(this.btnLoadRealm_Click);
this.btnLoadZone.Location = new System.Drawing.Point(122, 48);
this.btnLoadZone.Name = "btnLoadZone";
this.btnLoadZone.Size = new System.Drawing.Size(85, 23);
this.btnLoadZone.TabIndex = 11;
this.btnLoadZone.Text = "Load Zone";
this.btnLoadZone.UseVisualStyleBackColor = true;
this.btnLoadZone.Click += new System.EventHandler(this.btnLoadZone_Click);
//
// btnSaveRealm
// btnSaveZone
//
this.btnSaveRealm.Location = new System.Drawing.Point(107, 48);
this.btnSaveRealm.Name = "btnSaveRealm";
this.btnSaveRealm.Size = new System.Drawing.Size(84, 23);
this.btnSaveRealm.TabIndex = 10;
this.btnSaveRealm.Text = "Save Zone";
this.btnSaveRealm.UseVisualStyleBackColor = true;
this.btnSaveRealm.Click += new System.EventHandler(this.btnSaveRealm_Click);
this.btnSaveZone.Location = new System.Drawing.Point(123, 19);
this.btnSaveZone.Name = "btnSaveZone";
this.btnSaveZone.Size = new System.Drawing.Size(84, 23);
this.btnSaveZone.TabIndex = 10;
this.btnSaveZone.Text = "Save Zone";
this.btnSaveZone.UseVisualStyleBackColor = true;
this.btnSaveZone.Click += new System.EventHandler(this.btnSaveZone_Click);
//
// btnDeleteRealm
// btnDeleteZone
//
this.btnDeleteRealm.Location = new System.Drawing.Point(6, 48);
this.btnDeleteRealm.Name = "btnDeleteRealm";
this.btnDeleteRealm.Size = new System.Drawing.Size(85, 23);
this.btnDeleteRealm.TabIndex = 9;
this.btnDeleteRealm.Text = "Delete Zone";
this.btnDeleteRealm.UseVisualStyleBackColor = true;
this.btnDeleteZone.Location = new System.Drawing.Point(6, 48);
this.btnDeleteZone.Name = "btnDeleteZone";
this.btnDeleteZone.Size = new System.Drawing.Size(85, 23);
this.btnDeleteZone.TabIndex = 9;
this.btnDeleteZone.Text = "Delete Zone";
this.btnDeleteZone.UseVisualStyleBackColor = true;
//
// btnNewRealm
// btnNewZone
//
this.btnNewRealm.Location = new System.Drawing.Point(6, 19);
this.btnNewRealm.Name = "btnNewRealm";
this.btnNewRealm.Size = new System.Drawing.Size(85, 23);
this.btnNewRealm.TabIndex = 8;
this.btnNewRealm.Text = "New Zone";
this.btnNewRealm.UseVisualStyleBackColor = true;
this.btnNewRealm.Click += new System.EventHandler(this.btnNewRealm_Click);
this.btnNewZone.Location = new System.Drawing.Point(6, 19);
this.btnNewZone.Name = "btnNewZone";
this.btnNewZone.Size = new System.Drawing.Size(85, 23);
this.btnNewZone.TabIndex = 8;
this.btnNewZone.Text = "New Zone";
this.btnNewZone.UseVisualStyleBackColor = true;
this.btnNewZone.Click += new System.EventHandler(this.btnNewZone_Click);
//
// tabZoneBuilder
//
@ -166,20 +188,29 @@
this.tabZoneBuilder.Location = new System.Drawing.Point(0, 0);
this.tabZoneBuilder.Name = "tabZoneBuilder";
this.tabZoneBuilder.SelectedIndex = 0;
this.tabZoneBuilder.Size = new System.Drawing.Size(451, 471);
this.tabZoneBuilder.Size = new System.Drawing.Size(486, 471);
this.tabZoneBuilder.TabIndex = 0;
//
// tabZone
//
this.tabZone.Controls.Add(this.groupBox4);
this.tabZone.Controls.Add(this.groupBox3);
this.tabZone.Location = new System.Drawing.Point(4, 22);
this.tabZone.Name = "tabZone";
this.tabZone.Padding = new System.Windows.Forms.Padding(3);
this.tabZone.Size = new System.Drawing.Size(443, 445);
this.tabZone.Size = new System.Drawing.Size(478, 445);
this.tabZone.TabIndex = 0;
this.tabZone.Text = "Zone Editing";
this.tabZone.UseVisualStyleBackColor = true;
//
// groupBox4
//
this.groupBox4.Location = new System.Drawing.Point(262, 3);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(208, 436);
this.groupBox4.TabIndex = 1;
this.groupBox4.TabStop = false;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.propertyZone);
@ -202,25 +233,156 @@
//
// tabRoomDesigner
//
this.tabRoomDesigner.Controls.Add(this.tabRoomEditor);
this.tabRoomDesigner.Location = new System.Drawing.Point(4, 22);
this.tabRoomDesigner.Name = "tabRoomDesigner";
this.tabRoomDesigner.Padding = new System.Windows.Forms.Padding(3);
this.tabRoomDesigner.Size = new System.Drawing.Size(443, 445);
this.tabRoomDesigner.Size = new System.Drawing.Size(478, 445);
this.tabRoomDesigner.TabIndex = 1;
this.tabRoomDesigner.Text = "Room Designer";
this.tabRoomDesigner.UseVisualStyleBackColor = true;
//
// tabRoomEditor
//
this.tabRoomEditor.Controls.Add(this.tabPage1);
this.tabRoomEditor.Controls.Add(this.tabPage2);
this.tabRoomEditor.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabRoomEditor.Location = new System.Drawing.Point(3, 3);
this.tabRoomEditor.Name = "tabRoomEditor";
this.tabRoomEditor.SelectedIndex = 0;
this.tabRoomEditor.Size = new System.Drawing.Size(472, 439);
this.tabRoomEditor.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.groupBox7);
this.tabPage1.Controls.Add(this.groupBox6);
this.tabPage1.Controls.Add(this.groupBox5);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(464, 413);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Room Setup";
this.tabPage1.UseVisualStyleBackColor = true;
//
// groupBox7
//
this.groupBox7.Controls.Add(this.propertyRoom);
this.groupBox7.Location = new System.Drawing.Point(222, 6);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(239, 404);
this.groupBox7.TabIndex = 39;
this.groupBox7.TabStop = false;
this.groupBox7.Text = "Room Properties";
//
// propertyRoom
//
this.propertyRoom.Dock = System.Windows.Forms.DockStyle.Fill;
this.propertyRoom.Location = new System.Drawing.Point(3, 16);
this.propertyRoom.Name = "propertyRoom";
this.propertyRoom.Size = new System.Drawing.Size(233, 385);
this.propertyRoom.TabIndex = 0;
this.propertyRoom.ToolbarVisible = false;
//
// groupBox6
//
this.groupBox6.Controls.Add(this.lstRooms);
this.groupBox6.Location = new System.Drawing.Point(6, 87);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(210, 323);
this.groupBox6.TabIndex = 38;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "Room List";
//
// lstRooms
//
this.lstRooms.Dock = System.Windows.Forms.DockStyle.Fill;
this.lstRooms.FormattingEnabled = true;
this.lstRooms.Location = new System.Drawing.Point(3, 16);
this.lstRooms.Name = "lstRooms";
this.lstRooms.Size = new System.Drawing.Size(204, 303);
this.lstRooms.Sorted = true;
this.lstRooms.TabIndex = 17;
this.Help.SetToolTip(this.lstRooms, "A collection of Rooms that have already been created\r\nand stored within the curre" +
"ntly loaded Zone.");
//
// groupBox5
//
this.groupBox5.Controls.Add(this.btnLoadRoom);
this.groupBox5.Controls.Add(this.btnSaveRoom);
this.groupBox5.Controls.Add(this.btnDeleteRoom);
this.groupBox5.Controls.Add(this.btnNewRoom);
this.groupBox5.Location = new System.Drawing.Point(6, 6);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(210, 75);
this.groupBox5.TabIndex = 36;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Room Setup";
//
// btnLoadRoom
//
this.btnLoadRoom.Location = new System.Drawing.Point(122, 46);
this.btnLoadRoom.Name = "btnLoadRoom";
this.btnLoadRoom.Size = new System.Drawing.Size(85, 23);
this.btnLoadRoom.TabIndex = 11;
this.btnLoadRoom.Text = "Load Room";
this.btnLoadRoom.UseVisualStyleBackColor = true;
this.btnLoadRoom.Click += new System.EventHandler(this.btnLoadRoom_Click);
//
// btnSaveRoom
//
this.btnSaveRoom.Location = new System.Drawing.Point(123, 19);
this.btnSaveRoom.Name = "btnSaveRoom";
this.btnSaveRoom.Size = new System.Drawing.Size(84, 23);
this.btnSaveRoom.TabIndex = 10;
this.btnSaveRoom.Text = "Save Room";
this.btnSaveRoom.UseVisualStyleBackColor = true;
this.btnSaveRoom.Click += new System.EventHandler(this.btnSaveRoom_Click);
//
// btnDeleteRoom
//
this.btnDeleteRoom.Location = new System.Drawing.Point(6, 48);
this.btnDeleteRoom.Name = "btnDeleteRoom";
this.btnDeleteRoom.Size = new System.Drawing.Size(85, 23);
this.btnDeleteRoom.TabIndex = 9;
this.btnDeleteRoom.Text = "Delete Room";
this.btnDeleteRoom.UseVisualStyleBackColor = true;
//
// btnNewRoom
//
this.btnNewRoom.Location = new System.Drawing.Point(6, 19);
this.btnNewRoom.Name = "btnNewRoom";
this.btnNewRoom.Size = new System.Drawing.Size(85, 23);
this.btnNewRoom.TabIndex = 8;
this.btnNewRoom.Text = "New Room";
this.btnNewRoom.UseVisualStyleBackColor = true;
this.btnNewRoom.Click += new System.EventHandler(this.btnNewRoom_Click);
//
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(464, 413);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Room Doorways";
this.tabPage2.UseVisualStyleBackColor = true;
//
// Help
//
this.Help.AutoPopDelay = 5000;
this.Help.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.Help.InitialDelay = 1000;
this.Help.IsBalloon = true;
this.Help.ReshowDelay = 100;
this.Help.ToolTipTitle = "Zone Designer";
//
// ZoneBuilder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(650, 471);
this.ClientSize = new System.Drawing.Size(700, 471);
this.Controls.Add(this.containerMain);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
@ -236,6 +398,12 @@
this.tabZoneBuilder.ResumeLayout(false);
this.tabZone.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.tabRoomDesigner.ResumeLayout(false);
this.tabRoomEditor.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.groupBox6.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -245,10 +413,10 @@
private System.Windows.Forms.SplitContainer containerMain;
private System.Windows.Forms.ToolTip Help;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button btnLoadRealm;
private System.Windows.Forms.Button btnSaveRealm;
private System.Windows.Forms.Button btnDeleteRealm;
private System.Windows.Forms.Button btnNewRealm;
private System.Windows.Forms.Button btnLoadZone;
private System.Windows.Forms.Button btnSaveZone;
private System.Windows.Forms.Button btnDeleteZone;
private System.Windows.Forms.Button btnNewZone;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ListBox lstZones;
private System.Windows.Forms.TabControl tabZoneBuilder;
@ -257,6 +425,19 @@
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.PropertyGrid propertyZone;
private System.Windows.Forms.Button btnSelectRealm;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.TabControl tabRoomEditor;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.Button btnLoadRoom;
private System.Windows.Forms.Button btnSaveRoom;
private System.Windows.Forms.Button btnDeleteRoom;
private System.Windows.Forms.Button btnNewRoom;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.ListBox lstRooms;
private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.PropertyGrid propertyRoom;
}
}

View file

@ -31,7 +31,7 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
//get a collection of all the zones within the realm
string[] files = Directory.GetFiles(realmPath, "*.zone");
Zone zone = new Zone();
Zone zone = new Zone(this);
//look four our zone file
foreach (string file in files)

View file

@ -37,7 +37,7 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
public List<Door> InstalledDoors;
[Browsable(false)]
public string ParentZone
public string Zone
{
get;
set;

View file

@ -1,14 +1,19 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameObjects;
namespace MudDesigner.MudEngine.GameObjects.Environment
{
[XmlInclude(typeof(Room))]
public class Zone : BaseObject
{
[Category("Environment Information")]
[DefaultValue(0)]
public int StatDrainAmount
@ -32,13 +37,43 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
get;
set;
}
internal List<Room> Rooms { get; set; }
public Zone()
{
throw new NotSupportedException("Parameterless constructors of Type " + this.GetType().FullName + " is not supported.");
}
public Zone(Realm realm)
{
Rooms = new List<Room>();
//incase a realm hasn't been assigned to it yet.
if (this.Realm == null)
return;
//Create our collection of Rooms.
string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), realm.Name);
string zonePath = Path.Combine(realmPath, this.Name);
string[] rooms = Directory.GetFiles(zonePath, "*.room");
foreach (string file in rooms)
{
Room r = new Room();
r = (Room)FileManager.Load(file, r);
this.Rooms.Add(r);
}
}
public Room GetRoom(string RoomName)
{
foreach (Room r in Rooms)
{
if (r.Name == RoomName)
return r;
}
return null;
}
}
}