Zone Builder now creates Zones within different Realms, save and loads them. You can have two Realms, each containing a Zone with the exact same name with the new folder setup.

This commit is contained in:
Scionwest_cp 2009-12-08 11:53:38 -08:00
parent 41047da6d1
commit dfbc92c5d0
9 changed files with 370 additions and 108 deletions

View file

@ -39,8 +39,9 @@
this.btnTransfer.Name = "btnTransfer"; this.btnTransfer.Name = "btnTransfer";
this.btnTransfer.Size = new System.Drawing.Size(242, 23); this.btnTransfer.Size = new System.Drawing.Size(242, 23);
this.btnTransfer.TabIndex = 1; this.btnTransfer.TabIndex = 1;
this.btnTransfer.Text = "Transfer Zone to Selected Realm"; this.btnTransfer.Text = "Select Realm";
this.btnTransfer.UseVisualStyleBackColor = true; this.btnTransfer.UseVisualStyleBackColor = true;
this.btnTransfer.Click += new System.EventHandler(this.btnTransfer_Click);
// //
// lstRealms // lstRealms
// //
@ -49,7 +50,8 @@
this.lstRealms.Location = new System.Drawing.Point(0, 0); this.lstRealms.Location = new System.Drawing.Point(0, 0);
this.lstRealms.Name = "lstRealms"; this.lstRealms.Name = "lstRealms";
this.lstRealms.Size = new System.Drawing.Size(242, 277); this.lstRealms.Size = new System.Drawing.Size(242, 277);
this.lstRealms.TabIndex = 2; this.lstRealms.TabIndex = 3;
this.lstRealms.SelectedIndexChanged += new System.EventHandler(this.lstRealms_SelectedIndexChanged);
// //
// ExistingRealms // ExistingRealms
// //

View file

@ -6,6 +6,7 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO;
using MudDesigner.MudEngine.FileSystem; using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameObjects; using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.GameObjects.Environment; using MudDesigner.MudEngine.GameObjects.Environment;
@ -14,22 +15,45 @@ namespace MudDesigner.Editors
{ {
public partial class ExistingRealms : Form public partial class ExistingRealms : Form
{ {
Zone _Zone; List<Realm> realms = new List<Realm>();
internal string _RealmFilename = "";
internal string _RealmName = "";
public ExistingRealms(string Zone) public ExistingRealms()
{ {
InitializeComponent(); InitializeComponent();
_Zone = new Zone();
string filename = System.IO.Path.Combine(FileManager.GetDataPath(Program.Realm.Name, Zone), Zone + ".zone");
_Zone = (Zone)FileManager.Load(filename, _Zone);
string[] realms = System.IO.Directory.GetFiles(FileManager.GetDataPath(SaveDataTypes.Realms), "*.realm"); string realmRoot = FileManager.GetDataPath(SaveDataTypes.Realms);
foreach (string file in realms) string[] realmFiles = Directory.GetFiles(realmRoot, "*.realm", SearchOption.AllDirectories);
foreach (string file in realmFiles)
{
Realm r = new Realm();
r = (Realm)FileManager.Load(file, r);
realms.Add(r);
}
foreach (Realm realm in realms)
{ {
Realm realm = new Realm();
realm = (Realm)FileManager.Load(file, realm);
lstRealms.Items.Add(realm.Name); lstRealms.Items.Add(realm.Name);
} }
} }
private void btnTransfer_Click(object sender, EventArgs e)
{
this.Close();
}
private void lstRealms_SelectedIndexChanged(object sender, EventArgs e)
{
foreach (Realm realm in realms)
{
if (realm.Name == lstRealms.SelectedItem.ToString())
{
_RealmFilename = realm.Filename;
_RealmName = realm.Name;
}
}
}
} }
} }

View file

@ -79,7 +79,7 @@ namespace MudDesigner.Editors
} }
} }
bool RealmExists(string realm) internal bool RealmExists(string realm)
{ {
string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), realm); string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), realm);
if (Directory.Exists(realm)) if (Directory.Exists(realm))

View file

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
@ -20,10 +21,149 @@ namespace MudDesigner.Editors
public partial class ZoneBuilder : Form public partial class ZoneBuilder : Form
{ {
internal bool IsEditingExisting = false; internal bool IsEditingExisting = false;
bool IsRealmLoaded = false;
List<Zone> _Zones = new List<Zone>();
public ZoneBuilder() public ZoneBuilder()
{ {
InitializeComponent(); 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)
{
if (!IsRealmLoaded)
{
MessageBox.Show("You need to select a Realm to create a Zone in first.",
"Zone Builder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
Program.Zone = new Zone();
Program.Zone.Realm = Program.Realm.Name;
propertyZone.SelectedObject = Program.Zone;
}
private void btnSaveRealm_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);
string zonePath = Path.Combine(realmPath, Program.Zone.Name);
string zoneFile = Path.Combine(zonePath, Program.Zone.Filename);
if (!Directory.Exists(zonePath))
Directory.CreateDirectory(zonePath);
//adjust our realm
if (!Program.Realm.Zones.Contains(Program.Zone.Filename))
Program.Realm.Zones.Add(Program.Zone.Filename);
//save the Zone
FileManager.Save(zoneFile, Program.Zone);
//Re-save the realm, as we have changed it's Zone collection
FileManager.Save(Path.Combine(realmPath, Program.Realm.Filename), Program.Realm);
//add it to the list box if it isn't already there
if (!lstZones.Items.Contains(Program.Zone.Name))
lstZones.Items.Add(Program.Zone.Name);
//Store it in our collection.
foreach (Zone zone in _Zones)
{
//Check if we have a zone that exists already
//with that name, incase the user is just editing it.
if (zone.Name == Program.Zone.Name)
{
//remove it.
_Zones.Remove(zone);
break;
}
}
//Add the zone to our collection
_Zones.Add(Program.Zone);
}
private void btnSelectRealm_Click(object sender, EventArgs e)
{
//instance a form displaying all of the realms
ExistingRealms form = new ExistingRealms();
form.Text = "Zones owning Realm.";
//show the form
form.Show();
this.Hide();
//wait for it to be closed
while (form.Created)
Application.DoEvents();
//Restore the zone builder
this.Show();
//Check if we have selected a realm or not
//if not, then cancel creating the zone
if (form.lstRealms.SelectedIndex == -1)
return;
//Load it
string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), form._RealmName);
string realmFile = Path.Combine(realmPath, form._RealmFilename);
Program.Realm = (Realm)FileManager.Load(realmFile, Program.Realm);
this.Text = "Zone Builder: (" + Program.Realm.Name + ")";
IsRealmLoaded = true;
//realm is loaded, now clear out the list of zones and show the zones contained
//within the new realm
lstZones.Items.Clear();
_Zones.Clear();
string[] files = Directory.GetFiles(realmPath, "*.zone", SearchOption.AllDirectories);
foreach (string file in files)
{
string filename = Path.GetFileName(file);
if (Program.Realm.Zones.Contains(filename))
{
Zone zone = new Zone();
zone = (Zone)FileManager.Load(file, zone);
_Zones.Add(zone);
lstZones.Items.Add(zone.Name);
}
else
continue;
}
}
private void btnLoadRealm_Click(object sender, EventArgs e)
{
if (!IsRealmLoaded)
{
MessageBox.Show("You must first select a realm in order to view Zones for loading.",
"Zone Builder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (lstZones.SelectedIndex == -1)
{
MessageBox.Show("Select a Zone to load first.", "Zone Builder", MessageBoxButtons.OK);
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)
{
if (zone.Name == lstZones.SelectedItem.ToString())
{
Program.Zone = zone;
break;
}
}
propertyZone.SelectedObject = Program.Zone;
} }
} }
} }

View file

@ -30,18 +30,28 @@
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.containerMain = new System.Windows.Forms.SplitContainer(); this.containerMain = new System.Windows.Forms.SplitContainer();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lstZones = new System.Windows.Forms.ListBox();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnSelectRealm = new System.Windows.Forms.Button();
this.btnLoadRealm = new System.Windows.Forms.Button(); this.btnLoadRealm = new System.Windows.Forms.Button();
this.btnSaveRealm = new System.Windows.Forms.Button(); this.btnSaveRealm = new System.Windows.Forms.Button();
this.btnDeleteRealm = new System.Windows.Forms.Button(); this.btnDeleteRealm = new System.Windows.Forms.Button();
this.btnNewRealm = new System.Windows.Forms.Button(); this.btnNewRealm = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.tabZoneBuilder = new System.Windows.Forms.TabControl();
this.lstZones = new System.Windows.Forms.ListBox(); this.tabZone = new System.Windows.Forms.TabPage();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.propertyZone = new System.Windows.Forms.PropertyGrid();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.Help = new System.Windows.Forms.ToolTip(this.components);
this.containerMain.Panel1.SuspendLayout(); this.containerMain.Panel1.SuspendLayout();
this.containerMain.Panel2.SuspendLayout();
this.containerMain.SuspendLayout(); this.containerMain.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.tabZoneBuilder.SuspendLayout();
this.tabZone.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// containerMain // containerMain
@ -54,18 +64,38 @@
// //
this.containerMain.Panel1.Controls.Add(this.groupBox1); this.containerMain.Panel1.Controls.Add(this.groupBox1);
this.containerMain.Panel1.Controls.Add(this.groupBox2); this.containerMain.Panel1.Controls.Add(this.groupBox2);
this.containerMain.Size = new System.Drawing.Size(758, 471); //
this.containerMain.SplitterDistance = 203; // containerMain.Panel2
//
this.containerMain.Panel2.Controls.Add(this.tabZoneBuilder);
this.containerMain.Size = new System.Drawing.Size(650, 471);
this.containerMain.SplitterDistance = 195;
this.containerMain.TabIndex = 0; this.containerMain.TabIndex = 0;
// //
// toolTip1 // groupBox1
// //
this.toolTip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); this.groupBox1.Controls.Add(this.lstZones);
this.toolTip1.IsBalloon = true; this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.toolTip1.ToolTipTitle = "Zone Designer"; this.groupBox1.Location = new System.Drawing.Point(0, 100);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(195, 371);
this.groupBox1.TabIndex = 37;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Zone List";
//
// lstZones
//
this.lstZones.Dock = System.Windows.Forms.DockStyle.Fill;
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.Sorted = true;
this.lstZones.TabIndex = 17;
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.btnSelectRealm);
this.groupBox2.Controls.Add(this.btnLoadRealm); this.groupBox2.Controls.Add(this.btnLoadRealm);
this.groupBox2.Controls.Add(this.btnSaveRealm); this.groupBox2.Controls.Add(this.btnSaveRealm);
this.groupBox2.Controls.Add(this.btnDeleteRealm); this.groupBox2.Controls.Add(this.btnDeleteRealm);
@ -73,11 +103,22 @@
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(203, 76); this.groupBox2.Size = new System.Drawing.Size(195, 100);
this.groupBox2.TabIndex = 35; this.groupBox2.TabIndex = 35;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "Zone Setup"; this.groupBox2.Text = "Zone Setup";
// //
// btnSelectRealm
//
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.TabIndex = 12;
this.btnSelectRealm.Text = "Select Realm";
this.btnSelectRealm.UseVisualStyleBackColor = true;
this.btnSelectRealm.Click += new System.EventHandler(this.btnSelectRealm_Click);
//
// btnLoadRealm // btnLoadRealm
// //
this.btnLoadRealm.Location = new System.Drawing.Point(106, 19); this.btnLoadRealm.Location = new System.Drawing.Point(106, 19);
@ -86,6 +127,7 @@
this.btnLoadRealm.TabIndex = 11; this.btnLoadRealm.TabIndex = 11;
this.btnLoadRealm.Text = "Load Zone"; this.btnLoadRealm.Text = "Load Zone";
this.btnLoadRealm.UseVisualStyleBackColor = true; this.btnLoadRealm.UseVisualStyleBackColor = true;
this.btnLoadRealm.Click += new System.EventHandler(this.btnLoadRealm_Click);
// //
// btnSaveRealm // btnSaveRealm
// //
@ -95,6 +137,7 @@
this.btnSaveRealm.TabIndex = 10; this.btnSaveRealm.TabIndex = 10;
this.btnSaveRealm.Text = "Save Zone"; this.btnSaveRealm.Text = "Save Zone";
this.btnSaveRealm.UseVisualStyleBackColor = true; this.btnSaveRealm.UseVisualStyleBackColor = true;
this.btnSaveRealm.Click += new System.EventHandler(this.btnSaveRealm_Click);
// //
// btnDeleteRealm // btnDeleteRealm
// //
@ -113,44 +156,86 @@
this.btnNewRealm.TabIndex = 8; this.btnNewRealm.TabIndex = 8;
this.btnNewRealm.Text = "New Zone"; this.btnNewRealm.Text = "New Zone";
this.btnNewRealm.UseVisualStyleBackColor = true; this.btnNewRealm.UseVisualStyleBackColor = true;
this.btnNewRealm.Click += new System.EventHandler(this.btnNewRealm_Click);
// //
// groupBox1 // tabZoneBuilder
// //
this.groupBox1.Controls.Add(this.lstZones); this.tabZoneBuilder.Controls.Add(this.tabZone);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabZoneBuilder.Controls.Add(this.tabPage2);
this.groupBox1.Location = new System.Drawing.Point(0, 76); this.tabZoneBuilder.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Name = "groupBox1"; this.tabZoneBuilder.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Size = new System.Drawing.Size(203, 395); this.tabZoneBuilder.Name = "tabZoneBuilder";
this.groupBox1.TabIndex = 37; this.tabZoneBuilder.SelectedIndex = 0;
this.groupBox1.TabStop = false; this.tabZoneBuilder.Size = new System.Drawing.Size(451, 471);
this.groupBox1.Text = "Zone List"; this.tabZoneBuilder.TabIndex = 0;
// //
// lstZones // tabZone
// //
this.lstZones.Dock = System.Windows.Forms.DockStyle.Fill; this.tabZone.Controls.Add(this.groupBox3);
this.lstZones.FormattingEnabled = true; this.tabZone.Location = new System.Drawing.Point(4, 22);
this.lstZones.Location = new System.Drawing.Point(3, 16); this.tabZone.Name = "tabZone";
this.lstZones.Name = "lstZones"; this.tabZone.Padding = new System.Windows.Forms.Padding(3);
this.lstZones.Size = new System.Drawing.Size(197, 368); this.tabZone.Size = new System.Drawing.Size(443, 445);
this.lstZones.Sorted = true; this.tabZone.TabIndex = 0;
this.lstZones.TabIndex = 17; this.tabZone.Text = "Zone Editing";
this.tabZone.UseVisualStyleBackColor = true;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.propertyZone);
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Left;
this.groupBox3.Location = new System.Drawing.Point(3, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(253, 439);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Zone Properties";
//
// propertyZone
//
this.propertyZone.Dock = System.Windows.Forms.DockStyle.Fill;
this.propertyZone.Location = new System.Drawing.Point(3, 16);
this.propertyZone.Name = "propertyZone";
this.propertyZone.Size = new System.Drawing.Size(247, 420);
this.propertyZone.TabIndex = 0;
this.propertyZone.ToolbarVisible = false;
//
// 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(443, 445);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
//
// Help
//
this.Help.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
this.Help.IsBalloon = true;
this.Help.ToolTipTitle = "Zone Designer";
// //
// ZoneBuilder // ZoneBuilder
// //
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;
this.ClientSize = new System.Drawing.Size(758, 471); this.ClientSize = new System.Drawing.Size(650, 471);
this.Controls.Add(this.containerMain); this.Controls.Add(this.containerMain);
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 = "ZoneBuilder"; this.Name = "ZoneBuilder";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Zone Builder"; this.Text = "Zone Builder (No Realm Selected)";
this.containerMain.Panel1.ResumeLayout(false); this.containerMain.Panel1.ResumeLayout(false);
this.containerMain.Panel2.ResumeLayout(false);
this.containerMain.ResumeLayout(false); this.containerMain.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.tabZoneBuilder.ResumeLayout(false);
this.tabZone.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -158,7 +243,7 @@
#endregion #endregion
private System.Windows.Forms.SplitContainer containerMain; private System.Windows.Forms.SplitContainer containerMain;
private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.ToolTip Help;
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button btnLoadRealm; private System.Windows.Forms.Button btnLoadRealm;
private System.Windows.Forms.Button btnSaveRealm; private System.Windows.Forms.Button btnSaveRealm;
@ -166,6 +251,12 @@
private System.Windows.Forms.Button btnNewRealm; private System.Windows.Forms.Button btnNewRealm;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ListBox lstZones; private System.Windows.Forms.ListBox lstZones;
private System.Windows.Forms.TabControl tabZoneBuilder;
private System.Windows.Forms.TabPage tabZone;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.PropertyGrid propertyZone;
private System.Windows.Forms.Button btnSelectRealm;
} }
} }

View file

@ -117,7 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="Help.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
</root> </root>

View file

@ -22,7 +22,7 @@ namespace MudDesigner.MudEngine.GameObjects
set set
{ {
this._Name = value; this._Name = value;
this.Filename = value + ".realm"; this.Filename = value + "." + this.GetType().Name.ToLower();
} }
} }
@ -37,7 +37,6 @@ namespace MudDesigner.MudEngine.GameObjects
public string Script { get; set; } public string Script { get; set; }
[Category("Object Setup")] [Category("Object Setup")]
[DefaultValue("New Realm.realm")]
public string Filename public string Filename
{ {
//Returns the name of the object + the objects Type as it's extension. //Returns the name of the object + the objects Type as it's extension.
@ -48,21 +47,60 @@ namespace MudDesigner.MudEngine.GameObjects
} }
set set
{ {
if (!value.EndsWith(".realm")) string extension = "." + this.GetType().Name.ToLower();
value += ".realm"; if (!value.EndsWith(extension))
value += extension;
this._Filename = value; this._Filename = value;
} }
} }
private string _Filename = "New Realm.realm"; [Category("Senses")]
private string _Name = "New Realm"; [DefaultValue("You don't smell anything unsual.")]
public string Smell
{
get;
set;
}
[Category("Senses")]
[DefaultValue("You hear nothing of interest.")]
public string Listen
{
get;
set;
}
[Category("Senses")]
[DefaultValue("You feel nothing.")]
public string Feel
{
get;
set;
}
[Category("Environment Information")]
[DefaultValue(false)]
public bool IsSafe
{
get;
set;
}
private string _Filename = "";
private string _Name = "";
/// <summary> /// <summary>
/// Initializes the base object /// Initializes the base object
/// </summary> /// </summary>
public BaseObject() public BaseObject()
{ {
Script = ""; Script = "";
_Name = "New " + this.GetType().Name;
_Filename = _Name + "." + this.GetType().Name.ToLower();
this.Feel = "You feel nothing.";
this.Listen = "You hear nothing of interest.";
this.Smell = "You don't smell anything unsual.";
this.Name = DefaultName(); this.Name = DefaultName();
SetupScript(); SetupScript();
} }

View file

@ -9,54 +9,6 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
{ {
public class Room : BaseObject public class Room : BaseObject
{ {
[Category("Room Senses")]
[DefaultValue("You don't smell anything unsual.")]
public string Smell
{
get;
set;
}
[Category("Room Senses")]
[DefaultValue("You hear nothing of interest.")]
public string Listen
{
get;
set;
}
[Category("Room Senses")]
[DefaultValue("You feel nothing.")]
public string Feel
{
get;
set;
}
[Category("Room Information")]
[DefaultValue(false)]
public bool StatDrain
{
get;
set;
}
[Category("Room Information")]
[DefaultValue(0)]
public int StatDrainAmount
{
get;
set;
}
[Category("Room Information")]
[DefaultValue(false)]
public bool IsSafeRoom
{
get;
set;
}
[Category("Room Information")] [Category("Room Information")]
[ReadOnly(true)] [ReadOnly(true)]
public string DoorList public string DoorList
@ -93,10 +45,6 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
public Room() public Room()
{ {
InstalledDoors = new List<Door>(); InstalledDoors = new List<Door>();
this.Feel = "You feel nothing.";
this.Listen = "You hear nothing of interest.";
this.Smell = "You don't smell anything unsual.";
this.StatDrainAmount = 0;
} }
} }
} }

View file

@ -2,20 +2,39 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.ComponentModel;
namespace MudDesigner.MudEngine.GameObjects.Environment namespace MudDesigner.MudEngine.GameObjects.Environment
{ {
public class Zone : BaseObject public class Zone : BaseObject
{ {
[System.ComponentModel.Browsable(false)]
public string Realm [Category("Environment Information")]
[DefaultValue(0)]
public int StatDrainAmount
{ {
get; get;
set; set;
} }
[System.ComponentModel.Browsable(false)] [Category("Environment Information")]
public List<Room> Rooms { get; set; } [DefaultValue(false)]
public bool StatDrain
{
get;
set;
}
[ReadOnly(true)]
[Category("Environment Information")]
public string Realm
{
get;
set;
}
internal List<Room> Rooms { get; set; }
public Zone() public Zone()
{ {