diff --git a/Mud Designer/Designer.Designer.cs b/Mud Designer/Designer.Designer.cs
index 7ab5cc3..b17d2c1 100644
--- a/Mud Designer/Designer.Designer.cs
+++ b/Mud Designer/Designer.Designer.cs
@@ -29,7 +29,7 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("Project");
+ System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Project");
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Designer));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.mnuFile = new System.Windows.Forms.ToolStripMenuItem();
@@ -57,6 +57,7 @@
this.mnuEnvironments = new System.Windows.Forms.ToolStripMenuItem();
this.mnuRealmEditor = new System.Windows.Forms.ToolStripMenuItem();
this.mnuZoneBuilder = new System.Windows.Forms.ToolStripMenuItem();
+ this.newRoomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuItems = new System.Windows.Forms.ToolStripMenuItem();
this.customObjectsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
@@ -83,10 +84,6 @@
this.txtSearch = new System.Windows.Forms.ToolStripTextBox();
this.label1 = new System.Windows.Forms.Label();
this.propertyObject = new System.Windows.Forms.PropertyGrid();
- this.toolstripObjectProperties = new System.Windows.Forms.ToolStrip();
- this.btnSaveObject = new System.Windows.Forms.ToolStripButton();
- this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
- this.btnValidate = new System.Windows.Forms.ToolStripButton();
this.lblObjectProperties = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.menuStrip1.SuspendLayout();
@@ -97,7 +94,6 @@
this.containerSidebar.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
- this.toolstripObjectProperties.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
@@ -124,7 +120,7 @@
// mnuExit
//
this.mnuExit.Name = "mnuExit";
- this.mnuExit.Size = new System.Drawing.Size(152, 22);
+ this.mnuExit.Size = new System.Drawing.Size(92, 22);
this.mnuExit.Text = "Exit";
this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);
//
@@ -285,7 +281,8 @@
//
this.mnuEnvironments.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuRealmEditor,
- this.mnuZoneBuilder});
+ this.mnuZoneBuilder,
+ this.newRoomToolStripMenuItem});
this.mnuEnvironments.Name = "mnuEnvironments";
this.mnuEnvironments.Size = new System.Drawing.Size(147, 22);
this.mnuEnvironments.Text = "Environments";
@@ -304,6 +301,13 @@
this.mnuZoneBuilder.Text = "New Zone";
this.mnuZoneBuilder.Click += new System.EventHandler(this.mnuZoneBuilder_Click);
//
+ // newRoomToolStripMenuItem
+ //
+ this.newRoomToolStripMenuItem.Name = "newRoomToolStripMenuItem";
+ this.newRoomToolStripMenuItem.Size = new System.Drawing.Size(134, 22);
+ this.newRoomToolStripMenuItem.Text = "New Room";
+ this.newRoomToolStripMenuItem.Click += new System.EventHandler(this.newRoomToolStripMenuItem_Click);
+ //
// mnuItems
//
this.mnuItems.Enabled = false;
@@ -382,7 +386,7 @@
// mnuAbout
//
this.mnuAbout.Name = "mnuAbout";
- this.mnuAbout.Size = new System.Drawing.Size(152, 22);
+ this.mnuAbout.Size = new System.Drawing.Size(107, 22);
this.mnuAbout.Text = "About";
this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click);
//
@@ -417,7 +421,6 @@
// containerSidebar.Panel2
//
this.containerSidebar.Panel2.Controls.Add(this.propertyObject);
- this.containerSidebar.Panel2.Controls.Add(this.toolstripObjectProperties);
this.containerSidebar.Panel2.Controls.Add(this.lblObjectProperties);
this.containerSidebar.Size = new System.Drawing.Size(269, 540);
this.containerSidebar.SplitterDistance = 244;
@@ -429,12 +432,14 @@
this.treeExplorer.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeExplorer.Location = new System.Drawing.Point(0, 38);
this.treeExplorer.Name = "treeExplorer";
- treeNode2.Name = "nodeProject";
- treeNode2.Text = "Project";
+ treeNode1.Name = "nodeProject";
+ treeNode1.Text = "Project";
this.treeExplorer.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
- treeNode2});
+ treeNode1});
this.treeExplorer.Size = new System.Drawing.Size(267, 204);
this.treeExplorer.TabIndex = 5;
+ this.toolTip1.SetToolTip(this.treeExplorer, resources.GetString("treeExplorer.ToolTip"));
+ this.treeExplorer.DoubleClick += new System.EventHandler(this.treeExplorer_DoubleClick);
//
// contextMenuStrip1
//
@@ -443,24 +448,24 @@
this.toolStripMenuItem1,
this.deleteObjectToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
- this.contextMenuStrip1.Size = new System.Drawing.Size(146, 54);
+ this.contextMenuStrip1.Size = new System.Drawing.Size(153, 76);
//
// mnuEditObject
//
this.mnuEditObject.Name = "mnuEditObject";
- this.mnuEditObject.Size = new System.Drawing.Size(145, 22);
+ this.mnuEditObject.Size = new System.Drawing.Size(152, 22);
this.mnuEditObject.Text = "Edit Object";
this.mnuEditObject.Click += new System.EventHandler(this.mnuEditObject_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
- this.toolStripMenuItem1.Size = new System.Drawing.Size(142, 6);
+ this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6);
//
// deleteObjectToolStripMenuItem
//
this.deleteObjectToolStripMenuItem.Name = "deleteObjectToolStripMenuItem";
- this.deleteObjectToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
+ this.deleteObjectToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.deleteObjectToolStripMenuItem.Text = "Delete Object";
this.deleteObjectToolStripMenuItem.Click += new System.EventHandler(this.deleteObjectToolStripMenuItem_Click);
//
@@ -519,53 +524,14 @@
// propertyObject
//
this.propertyObject.Dock = System.Windows.Forms.DockStyle.Fill;
- this.propertyObject.Location = new System.Drawing.Point(0, 38);
+ this.propertyObject.Location = new System.Drawing.Point(0, 13);
this.propertyObject.Name = "propertyObject";
- this.propertyObject.Size = new System.Drawing.Size(267, 252);
+ this.propertyObject.Size = new System.Drawing.Size(267, 277);
this.propertyObject.TabIndex = 8;
this.propertyObject.ToolbarVisible = false;
+ this.toolTip1.SetToolTip(this.propertyObject, resources.GetString("propertyObject.ToolTip"));
this.propertyObject.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyObject_PropertyValueChanged);
//
- // toolstripObjectProperties
- //
- this.toolstripObjectProperties.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.btnSaveObject,
- this.toolStripSeparator1,
- this.btnValidate});
- this.toolstripObjectProperties.Location = new System.Drawing.Point(0, 13);
- this.toolstripObjectProperties.Name = "toolstripObjectProperties";
- this.toolstripObjectProperties.Size = new System.Drawing.Size(267, 25);
- this.toolstripObjectProperties.TabIndex = 7;
- this.toolstripObjectProperties.Text = "toolStrip1";
- //
- // btnSaveObject
- //
- this.btnSaveObject.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
- this.btnSaveObject.Image = ((System.Drawing.Image)(resources.GetObject("btnSaveObject.Image")));
- this.btnSaveObject.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.btnSaveObject.Name = "btnSaveObject";
- this.btnSaveObject.Size = new System.Drawing.Size(73, 22);
- this.btnSaveObject.Text = "Save Object";
- this.btnSaveObject.ToolTipText = "Save the current object";
- this.btnSaveObject.Click += new System.EventHandler(this.btnSaveObject_Click);
- //
- // toolStripSeparator1
- //
- this.toolStripSeparator1.Name = "toolStripSeparator1";
- this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
- //
- // btnValidate
- //
- this.btnValidate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
- this.btnValidate.Enabled = false;
- this.btnValidate.Image = ((System.Drawing.Image)(resources.GetObject("btnValidate.Image")));
- this.btnValidate.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.btnValidate.Name = "btnValidate";
- this.btnValidate.Size = new System.Drawing.Size(91, 22);
- this.btnValidate.Text = "Validate Object";
- this.btnValidate.ToolTipText = "Checks the current object to ensure that there are no errors. \r\nThis is just an e" +
- "rror check, and is not required.";
- //
// lblObjectProperties
//
this.lblObjectProperties.Dock = System.Windows.Forms.DockStyle.Top;
@@ -577,6 +543,18 @@
this.lblObjectProperties.TabIndex = 3;
this.lblObjectProperties.Text = "Object Properties";
//
+ // toolTip1
+ //
+ this.toolTip1.AutoPopDelay = 10000;
+ this.toolTip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
+ this.toolTip1.ForeColor = System.Drawing.Color.Black;
+ this.toolTip1.InitialDelay = 500;
+ this.toolTip1.IsBalloon = true;
+ this.toolTip1.OwnerDraw = true;
+ this.toolTip1.ReshowDelay = 100;
+ this.toolTip1.ShowAlways = true;
+ this.toolTip1.ToolTipTitle = "Mud Designer Help";
+ //
// Designer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -597,13 +575,10 @@
this.containerSidebar.Panel1.ResumeLayout(false);
this.containerSidebar.Panel1.PerformLayout();
this.containerSidebar.Panel2.ResumeLayout(false);
- this.containerSidebar.Panel2.PerformLayout();
this.containerSidebar.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
- this.toolstripObjectProperties.ResumeLayout(false);
- this.toolstripObjectProperties.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -665,10 +640,7 @@
private System.Windows.Forms.ToolStripMenuItem deleteObjectToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
private System.Windows.Forms.PropertyGrid propertyObject;
- private System.Windows.Forms.ToolStrip toolstripObjectProperties;
- private System.Windows.Forms.ToolStripButton btnSaveObject;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
- private System.Windows.Forms.ToolStripButton btnValidate;
+ private System.Windows.Forms.ToolStripMenuItem newRoomToolStripMenuItem;
diff --git a/Mud Designer/Designer.cs b/Mud Designer/Designer.cs
index df70a88..44f400f 100644
--- a/Mud Designer/Designer.cs
+++ b/Mud Designer/Designer.cs
@@ -18,8 +18,14 @@ namespace MudDesigner
{
public partial class Designer : Form
{
+ enum ObjectType
+ {
+ Zone,
+ Room,
+ }
ProjectInformation _Project;
BaseObject _GameObject;
+ bool IsSaved;
public Designer()
{
@@ -29,6 +35,7 @@ namespace MudDesigner
//for use during our runtime
_GameObject = new BaseObject();
_Project = new ProjectInformation();
+ IsSaved = true;
//Get out saved project file
string projectPath = Path.Combine(Application.StartupPath, "Project");
@@ -51,9 +58,6 @@ namespace MudDesigner
title.Append(_Project.Version);
this.Text = title.ToString();
- //Assign our Project Information to the propertygrid
- propertyObject.SelectedObject = _Project;
-
//build a collection of Realms for viewing
InstallWidgetRealms(projectPath);
}
@@ -65,7 +69,325 @@ namespace MudDesigner
containerMain.Panel1.Controls.Add(new UIWidgets.RealmExplorer().InstallControl(projectPath));
}
- private void btnSaveObject_Click(object sender, EventArgs e)
+ private void LoadObject(TreeNode selectedNode)
+ {
+ string projectPath = Path.Combine(Application.StartupPath, "Project");
+ string objectFilename = "";
+
+ if (selectedNode.Text == "Project")
+ {
+ MessageBox.Show("You cannot edit the Project node in the Project Explorer.");
+ return;
+ }
+
+ //for root objects
+ if (selectedNode.Parent.Text == "Project")
+ {
+ if (selectedNode.Text == "Game.xml")
+ {
+ objectFilename = selectedNode.FullPath;
+ ProjectInformation project = new ProjectInformation();
+ project = (ProjectInformation)FileManager.Load(objectFilename, project);
+ lblObjectProperties.Text = "Project Properties (" + project.GameTitle + ")";
+ propertyObject.SelectedObject = project;
+ }
+ }
+ else if (selectedNode.Parent.Text == "Currencies")
+ {
+ objectFilename = selectedNode.FullPath;
+ Currency currency = new Currency();
+ currency = (Currency)FileManager.Load(objectFilename, currency);
+ lblObjectProperties.Text = "Currency Properties (" + currency.Name + ")";
+ propertyObject.SelectedObject = currency;
+ }
+ else if (selectedNode.Parent.Parent.Text == "Realms")
+ {
+ objectFilename = selectedNode.FullPath;
+ //incase a directory was selected instead of a file to be edited.
+ if (Path.GetExtension(objectFilename) == "")
+ return;
+
+ Realm realm = new Realm();
+ realm= (Realm)FileManager.Load(objectFilename, realm);
+ lblObjectProperties.Text = "Realm Properties (" + realm.Name + ")";
+ propertyObject.SelectedObject = realm;
+ }
+ else if (selectedNode.Parent.Parent.Text == "Zones")
+ {
+ //Zone selected already contained within a Realm
+ objectFilename = selectedNode.FullPath;
+ Zone z = new Zone();
+
+ //incase a directory was selected instead of a file to be edited.
+ if (Path.GetExtension(objectFilename) == "")
+ return;
+ Zone zone = new Zone();
+ zone= (Zone)FileManager.Load(objectFilename, zone);
+ lblObjectProperties.Text = "Zone Properties (" + zone.Name + ")";
+ propertyObject.SelectedObject = zone;
+ }
+ }
+
+ private void ValidatePath(string path)
+ {
+ if (!Directory.Exists(path))
+ Directory.CreateDirectory(path);
+
+ string projectPath = Path.Combine(Application.StartupPath, "Project");
+
+ RefreshProjectExplorer();
+ }
+
+ private void PopulateTree(string dir, TreeNode node)
+ {
+ // get the information of the directory
+ DirectoryInfo directory = new DirectoryInfo(dir);
+
+ // loop through each subdirectory
+ foreach (DirectoryInfo d in directory.GetDirectories())
+ {
+ // create a new node
+ TreeNode t = new TreeNode(d.Name);
+ // populate the new node recursively
+ PopulateTree(d.FullName, t);
+ node.Nodes.Add(t); // add the node to the "master" node
+ }
+ // lastly, loop through each file in the directory, and add these as nodes
+ foreach (FileInfo f in directory.GetFiles())
+ {
+ // create a new node
+ TreeNode t = new TreeNode(f.Name);
+ // add it to the "master"
+ t.ForeColor = System.Drawing.Color.Blue;
+
+ if (node.Text == "Rooms")
+ t.ForeColor = System.Drawing.Color.Red;
+ node.Nodes.Add(t);
+ }
+
+ treeExplorer.SelectedNode = node;
+ }
+
+ private void btnRefreshObjects_Click(object sender, EventArgs e)
+ {
+ treeExplorer.Nodes.Clear();
+ TreeNode node = new TreeNode("Project");
+ treeExplorer.Nodes.Add(node);
+ string projectPath = Path.Combine(Application.StartupPath, "Project");
+ PopulateTree(projectPath, node);
+ }
+
+ private void mnuEditObject_Click(object sender, EventArgs e)
+ {
+ if (CheckSavedState())
+ LoadObject(treeExplorer.SelectedNode);
+ }
+
+ private void mnuProjectInformation_Click(object sender, EventArgs e)
+ {
+ if (CheckSavedState())
+ propertyObject.SelectedObject = _Project;
+ }
+
+ private void mnuRealmEditor_Click(object sender, EventArgs e)
+ {
+ if (CheckSavedState())
+ propertyObject.SelectedObject = new Realm();
+ }
+
+ private void currencyEditorToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (CheckSavedState())
+ propertyObject.SelectedObject = new Currency();
+ }
+
+ private void mnuZoneBuilder_Click(object sender, EventArgs e)
+ {
+ if (CheckSavedState())
+ propertyObject.SelectedObject = new Zone();
+ }
+
+ private bool CheckSavedState()
+ {
+ if (IsSaved)
+ return true;
+
+ DialogResult result = MessageBox.Show(lblObjectProperties.Text + " has not been saved! Do you wish to save it?", "Mud Designer", MessageBoxButtons.YesNoCancel);
+
+ if (result == DialogResult.No)
+ return true;
+ else if (result == DialogResult.Cancel)
+ return false;
+ else
+ SaveSelected();
+
+ return true;
+ }
+ private void txtSearch_Enter(object sender, EventArgs e)
+ {
+ if (txtSearch.Text == "")
+ return;
+
+ TreeNode node = FindNode(txtSearch.Text, treeExplorer.Nodes[0]);
+ if (node == null)
+ MessageBox.Show("No results found!", "Mud Designer");
+ else
+ {
+ //TODO select the node
+ }
+ }
+
+ private TreeNode FindNode(string nodeText, TreeNode startNode)
+ {
+ foreach (TreeNode node in startNode.Nodes)
+ {
+ if (node.Text == nodeText)
+ {
+ return node;
+ }
+ if (node.Nodes.Count != 0)
+ {
+ TreeNode n = FindNode(nodeText, node);
+ if (n == null) continue;
+ else return n;
+ }
+ }
+
+ return null;
+ }
+
+ private void deleteObjectToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ //Check if we are trying to delete the root node
+ if (treeExplorer.SelectedNode.Text == "Project")
+ {
+ MessageBox.Show("You cannot delete the root item 'Project'", "Mud Designer");
+ return;
+ }
+
+ DialogResult result;
+ ObjectType objectType = new ObjectType();
+
+ //Check if we are deleting a realm or zone, if so inform the user that
+ //all zones/rooms within the object will be deleted as well.
+ string fullPath = treeExplorer.SelectedNode.FullPath;
+ TreeNode selectedNode = treeExplorer.SelectedNode;
+
+ if (fullPath.Contains("Realms") || fullPath.Contains("Zones"))
+ {
+ //ask if we want to delete this
+ result = MessageBox.Show("Are you sure you want to delete"
+ + treeExplorer.SelectedNode.Text + "?\nAll Rooms or Zones within this item will be deleted!", "Mud Designer", MessageBoxButtons.YesNo);
+ }
+ else
+ //ask if we want to delete this
+ result = MessageBox.Show("Are you sure you want to delete"
+ + treeExplorer.SelectedNode.Text + "?", "Mud Designer", MessageBoxButtons.YesNo);
+
+ //User hit no, cancel
+ if (result == DialogResult.No)
+ return;
+
+ //Find out what we are deleting
+ if (Path.GetExtension(fullPath) == "")
+ {
+ if (selectedNode.Text == "Zones")
+ objectType = ObjectType.Zone;
+ else if (selectedNode.Text == "Rooms")
+ objectType = ObjectType.Room;
+ }
+ else if (Path.GetExtension(fullPath) == ".Room")
+ {
+ objectType = ObjectType.Room;
+ }
+ else if (Path.GetExtension(fullPath) == "Zone")
+ {
+ objectType = ObjectType.Zone;
+ }
+
+ if (objectType == ObjectType.Zone)
+ {
+ Zone z = new Zone();
+ string filename = Path.Combine(Application.StartupPath, treeExplorer.SelectedNode.FullPath);
+ if (Path.GetExtension(treeExplorer.SelectedNode.FullPath) == "")
+ {
+ string[] zone = Directory.GetFiles(filename, "*.zone");
+ if (zone.Length != 0)
+ {
+ filename = zone[0];
+ }
+ else
+ {
+ Directory.Delete(treeExplorer.SelectedNode.FullPath, true);
+ return;
+ }
+ }
+ z = (Zone)FileManager.Load(filename, z);
+ if (z.Realm != "")
+ {
+ string projectPath = Path.Combine(Application.StartupPath, "Project");
+ string[] files = Directory.GetFiles(Path.Combine(projectPath, "Realms"), "*.realm", SearchOption.AllDirectories);
+
+ foreach (string file in files)
+ {
+ Realm r = new Realm();
+ r = (Realm)FileManager.Load(file, r);
+ if (r.Name == z.Realm)
+ {
+ r.Zones.Remove(z.Filename);
+ FileManager.Save(file, r);
+ break;
+ }
+ }
+ }
+ }//end if(object is zone)
+ else if (objectType == ObjectType.Room)
+ {
+ //TODO Delete rooms from owning zone
+ }
+
+ //Its a directory to delete if we have no extension assigned to it
+ if (Path.GetExtension(treeExplorer.SelectedNode.FullPath) == "")
+ {
+ Directory.Delete(Path.Combine(Application.StartupPath, treeExplorer.SelectedNode.FullPath), true);
+ }
+ else
+ {
+ string filename = Path.GetFileName(treeExplorer.SelectedNode.FullPath);
+ fullPath = treeExplorer.SelectedNode.FullPath;
+ string deletePath = fullPath.Substring(0, fullPath.Length - filename.Length);
+ File.Delete(Path.Combine(Application.StartupPath, treeExplorer.SelectedNode.FullPath));
+ Directory.Delete(Path.Combine(Application.StartupPath, deletePath), true);
+ }
+ //Just incase we have the zone or the realm selected that the zone belonged too.
+ //users can re-save the current realm and if it contained the zone we just deleted
+ //the zone will be still be saved as part of the realm.
+ propertyObject.SelectedObject = null;
+ RefreshProjectExplorer();
+ }
+
+ public void RefreshProjectExplorer()
+ {
+ btnRefreshObjects_Click(null, null);
+ }
+
+ private void propertyObject_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
+ {
+ IsSaved = false;
+ if (propertyObject.SelectedObject is BaseObject)
+ {
+ BaseObject obj = (BaseObject)propertyObject.SelectedObject;
+
+ //Don't auto-save if we haven't assigned a valid name
+ if (obj.Name == "New " + obj.GetType().Name)
+ return;
+ }
+ SaveSelected();
+ IsSaved = true;
+ RefreshProjectExplorer();
+ }
+
+ public void SaveSelected()
{
//Get the object Type
Type t = propertyObject.SelectedObject.GetType();
@@ -126,266 +448,6 @@ namespace MudDesigner
RefreshProjectExplorer();
}
- private void LoadObject(TreeNode selectedNode)
- {
- string projectPath = Path.Combine(Application.StartupPath, "Project");
- string objectFilename = "";
-
- if (selectedNode.Text == "Project")
- {
- MessageBox.Show("You cannot edit the Project node in the Project Explorer.");
- return;
- }
-
- //for root objects
- if (selectedNode.Parent.Text == "Project")
- {
- if (selectedNode.Text == "Game.xml")
- {
- objectFilename = selectedNode.FullPath;
- ProjectInformation project = new ProjectInformation();
- project = (ProjectInformation)FileManager.Load(objectFilename, project);
- lblObjectProperties.Text = "Project Properties (" + project.GameTitle + ")";
- propertyObject.SelectedObject = project;
- }
- }
- else if (selectedNode.Parent.Text == "Currencies")
- {
- objectFilename = selectedNode.FullPath;
- Currency currency = new Currency();
- currency = (Currency)FileManager.Load(objectFilename, currency);
- lblObjectProperties.Text = "Currency Properties (" + currency.Name + ")";
- propertyObject.SelectedObject = currency;
- }
- else if (selectedNode.Parent.Parent.Text == "Realms")
- {
- objectFilename = selectedNode.FullPath;
- //incase a directory was selected instead of a file to be edited.
- if (Path.GetExtension(objectFilename) == "")
- return;
-
- Realm realm = new Realm();
- realm= (Realm)FileManager.Load(objectFilename, realm);
- lblObjectProperties.Text = "Realm Properties (" + realm.Name + ")";
- propertyObject.SelectedObject = realm;
- }
- else if (selectedNode.Parent.Parent.Text == "Zones")
- {
- //Zone selected already contained within a Realm
- objectFilename = selectedNode.FullPath;
-
- //incase a directory was selected instead of a file to be edited.
- if (Path.GetExtension(objectFilename) == "")
- return;
- Zone zone = new Zone();
- zone= (Zone)FileManager.Load(objectFilename, zone);
- lblObjectProperties.Text = "Zone Properties (" + zone.Name + ")";
- propertyObject.SelectedObject = zone;
- }
- }
-
- private void ValidatePath(string path)
- {
- if (!Directory.Exists(path))
- Directory.CreateDirectory(path);
-
- string projectPath = Path.Combine(Application.StartupPath, "Project");
-
- RefreshProjectExplorer();
- }
-
- private void PopulateTree(string dir, TreeNode node)
- {
- // get the information of the directory
- DirectoryInfo directory = new DirectoryInfo(dir);
-
- // loop through each subdirectory
- foreach (DirectoryInfo d in directory.GetDirectories())
- {
- // create a new node
- TreeNode t = new TreeNode(d.Name);
- // populate the new node recursively
- PopulateTree(d.FullName, t);
- node.Nodes.Add(t); // add the node to the "master" node
- }
- // lastly, loop through each file in the directory, and add these as nodes
- foreach (FileInfo f in directory.GetFiles())
- {
- // create a new node
- TreeNode t = new TreeNode(f.Name);
- // add it to the "master"
- t.ForeColor = System.Drawing.Color.Blue;
- node.Nodes.Add(t);
- }
-
- treeExplorer.SelectedNode = node;
- }
-
- private void btnRefreshObjects_Click(object sender, EventArgs e)
- {
- treeExplorer.Nodes.Clear();
- TreeNode node = new TreeNode("Project");
- treeExplorer.Nodes.Add(node);
- string projectPath = Path.Combine(Application.StartupPath, "Project");
- PopulateTree(projectPath, node);
- }
-
- private void mnuEditObject_Click(object sender, EventArgs e)
- {
- LoadObject(treeExplorer.SelectedNode);
- }
-
- private void mnuProjectInformation_Click(object sender, EventArgs e)
- {
- propertyObject.SelectedObject = _Project;
- }
-
- private void mnuRealmEditor_Click(object sender, EventArgs e)
- {
- propertyObject.SelectedObject = new Realm();
- }
-
- private void currencyEditorToolStripMenuItem_Click(object sender, EventArgs e)
- {
- propertyObject.SelectedObject = new Currency();
- }
-
- private void mnuZoneBuilder_Click(object sender, EventArgs e)
- {
- propertyObject.SelectedObject = new Zone();
- }
-
- private void txtSearch_Enter(object sender, EventArgs e)
- {
- if (txtSearch.Text == "")
- return;
-
- TreeNode node = FindNode(txtSearch.Text, treeExplorer.Nodes[0]);
- if (node == null)
- MessageBox.Show("No results found!", "Mud Designer");
- else
- {
- //TODO select the node
- }
- }
-
- private TreeNode FindNode(string nodeText, TreeNode startNode)
- {
- foreach (TreeNode node in startNode.Nodes)
- {
- if (node.Text == nodeText)
- {
- return node;
- }
- if (node.Nodes.Count != 0)
- {
- TreeNode n = FindNode(nodeText, node);
- if (n == null) continue;
- else return n;
- }
- }
-
- return null;
- }
-
- private void deleteObjectToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (treeExplorer.SelectedNode.Text == "Project")
- {
- MessageBox.Show("You cannot delete the root item 'Project'", "Mud Designer");
- return;
- }
- DialogResult result;
- bool IsZone = false;
- //Check if we are deleting a realm or zone, if so inform the user that
- //all zones/rooms within the object will be deleted as well.
- if (treeExplorer.SelectedNode.FullPath.Contains("Realms") || treeExplorer.SelectedNode.FullPath.Contains("Zones"))
- {
- result = MessageBox.Show("Are you sure you want to delete"
- + treeExplorer.SelectedNode.Text + "?\nAll Rooms or Zones within this item will be deleted!", "Mud Designer", MessageBoxButtons.YesNo);
- if (treeExplorer.SelectedNode.FullPath.Contains("Zones"))
- IsZone = true;
- }
- else
- result = MessageBox.Show("Are you sure you want to delete"
- + treeExplorer.SelectedNode.Text + "?", "Mud Designer", MessageBoxButtons.YesNo);
-
- if (result == DialogResult.No)
- return;
-
- if (IsZone)
- {
- Zone z = new Zone();
- string filename = Path.Combine(Application.StartupPath, treeExplorer.SelectedNode.FullPath);
- if (Path.GetExtension(treeExplorer.SelectedNode.FullPath) == "")
- {
- string[] zone = Directory.GetFiles(filename, "*.zone");
- if (zone.Length != 0)
- {
- filename = zone[0];
- }
- else
- {
- Directory.Delete(treeExplorer.SelectedNode.FullPath, true);
- return;
- }
- }
- z = (Zone)FileManager.Load(filename, z);
- if (z.Realm != "")
- {
- string projectPath = Path.Combine(Application.StartupPath, "Project");
- string[] files = Directory.GetFiles(Path.Combine(projectPath, "Realms"), "*.realm", SearchOption.AllDirectories);
-
- foreach (string file in files)
- {
- Realm r = new Realm();
- r = (Realm)FileManager.Load(file, r);
- if (r.Name == z.Realm)
- {
- r.Zones.Remove(z.Filename);
- FileManager.Save(file, r);
- break;
- }
- }
- }
- }
-
- //Its a directory to delete if we have no extension assigned to it
- if (Path.GetExtension(treeExplorer.SelectedNode.FullPath) == "")
- {
- Directory.Delete(Path.Combine(Application.StartupPath, treeExplorer.SelectedNode.FullPath), true);
- }
- else
- {
- string filename = Path.GetFileName(treeExplorer.SelectedNode.FullPath);
- string fullPath = treeExplorer.SelectedNode.FullPath;
- string deletePath = fullPath.Substring(0, fullPath.Length - filename.Length);
- File.Delete(Path.Combine(Application.StartupPath, treeExplorer.SelectedNode.FullPath));
- Directory.Delete(deletePath, true);
- }
- //Just incase we have the zone or the realm selected that the zone belonged too.
- //users can re-save the current realm and if it contained the zone we just deleted
- //the zone will be still be saved as part of the realm.
- propertyObject.SelectedObject = null;
- RefreshProjectExplorer();
- }
-
- public void RefreshProjectExplorer()
- {
- btnRefreshObjects_Click(null, null);
- }
-
- private void propertyObject_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
- {
- SaveSelected();
- RefreshProjectExplorer();
- }
-
- public void SaveSelected()
- {
- btnSaveObject_Click(null, null);
- }
-
private void mnuAbout_Click(object sender, EventArgs e)
{
MessageBox.Show("Mud Designer.\n\nDownload at http://MudDesigner.Codeplex.com\n"
@@ -396,5 +458,28 @@ namespace MudDesigner
{
Application.Exit();
}
+
+ private void treeExplorer_DoubleClick(object sender, EventArgs e)
+ {
+ if (treeExplorer.SelectedNode.Text == "Project")
+ return;
+ mnuEditObject_Click(sender, e);
+ }
+
+ private void newRoomToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (propertyObject.SelectedObject is Zone)
+ {
+ MudDesigner.MudEngine.UITypeEditors.UIRoomControl control = new MudDesigner.MudEngine.UITypeEditors.UIRoomControl((Zone)propertyObject.SelectedObject);
+
+ control.ShowDialog();
+ }
+ else
+ {
+ MessageBox.Show("You must have a zone loaded prior to attempting to create a Room!\n\n"
+ + "You can use a loaded Zones 'Rooms' property via the Object Properties pane to create and manage Rooms as well.", "Mud Designer");
+ return;
+ }
+ }
}
}
diff --git a/Mud Designer/Designer.resx b/Mud Designer/Designer.resx
index 6c1dbeb..09581c8 100644
--- a/Mud Designer/Designer.resx
+++ b/Mud Designer/Designer.resx
@@ -123,12 +123,19 @@
128, 15
+
+ 287, 15
+
+
+ Objects currently created and saved within your project.
+
+* Black Objects are folders that contain saved objects and cannot be edited
+* Red Objects cannot be edited within the main Designer. They are only editable within a mini designer.
+* Blue denotes objects that can be edited by double clicking or right-clicking and editing within the Main Designer.
+
382, 17
-
- 678, 16
-
@@ -145,39 +152,11 @@
s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC
-
-
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAgxJREFUOE+lkvtL
- U2EYx+0PEbtpFwnBKPGKiJImGP0gYhIYs1E5GF5gIxkpA00JRSmMEF0ohMh+GaRWYlqabMVcNdS2QpaI
- VqiDIYhk397vA6fXhCjyhYdzeM/5fp7vczkAdeL2cwho7v/wWzT1zcN+Pwhr51uY2/y41PQaF+wzKKiZ
- QvaN58g0jyLd5KEUcQbg+84P/Cm2tncQjW3j68YWIqubCC3FcOJc478BAuGoZM6zvoRnakXEruEIjhc4
- /g5gZop9c+voGAyLbQIfeBZxLL9BA1jzXvuGbWamuKh+GmmVbswE19A59FEBbmoAG7YbsLtm2mZmiml9
- cvabNDwpz6YB7LYBoMXCumkJr7LOmnnHzBQ/9X2Bo2cOibm1GsBREbAQiYmw/8lnuCeWkVzcgnZlnw1j
- 3HV/wuNXK6i/9x5Hc6wawDlTXHbLJ+LZUBQPRyKwdQdxutwl1h+NLXHh5Ht1ewBHsiwawCW57HyDAfWR
- dvl0uhZQ1eqX8aVc7EKLqrum651ATLf9OJx5XQM4KmY0xPzZ0hFAiQJnXB0WwME0E3IsL5B17ZlADqWb
- NYDrOepdlcysmTWWOrxqbceRWtaLk0VO1XW72D5Vckd2gMBfq8zdpmUG62NJvKM4+XyziDk24xmfWoGE
- s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC
-
+
+ The properties of the currently loaded object are editable with the Object Properties window. Object changes are automatically saved.
+
+Note that new objects are not saved until their Name value is changed.
-
-
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAgxJREFUOE+lkvtL
- U2EYx+0PEbtpFwnBKPGKiJImGP0gYhIYs1E5GF5gIxkpA00JRSmMEF0ohMh+GaRWYlqabMVcNdS2QpaI
- VqiDIYhk397vA6fXhCjyhYdzeM/5fp7vczkAdeL2cwho7v/wWzT1zcN+Pwhr51uY2/y41PQaF+wzKKiZ
- QvaN58g0jyLd5KEUcQbg+84P/Cm2tncQjW3j68YWIqubCC3FcOJc478BAuGoZM6zvoRnakXEruEIjhc4
- /g5gZop9c+voGAyLbQIfeBZxLL9BA1jzXvuGbWamuKh+GmmVbswE19A59FEBbmoAG7YbsLtm2mZmiml9
- cvabNDwpz6YB7LYBoMXCumkJr7LOmnnHzBQ/9X2Bo2cOibm1GsBREbAQiYmw/8lnuCeWkVzcgnZlnw1j
- 3HV/wuNXK6i/9x5Hc6wawDlTXHbLJ+LZUBQPRyKwdQdxutwl1h+NLXHh5Ht1ewBHsiwawCW57HyDAfWR
- dvl0uhZQ1eqX8aVc7EKLqrum651ATLf9OJx5XQM4KmY0xPzZ0hFAiQJnXB0WwME0E3IsL5B17ZlADqWb
- NYDrOepdlcysmTWWOrxqbceRWtaLk0VO1XW72D5Vckd2gMBfq8zdpmUG62NJvKM4+XyziDk24xmfWoGE
- s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC
-
-
-
- 287, 15
-
42
diff --git a/Mud Designer/MudEngine/Attributes/UnusableAttribute.cs b/Mud Designer/MudEngine/Attributes/UnusableAttribute.cs
index 3f58de2..94004cc 100644
--- a/Mud Designer/MudEngine/Attributes/UnusableAttribute.cs
+++ b/Mud Designer/MudEngine/Attributes/UnusableAttribute.cs
@@ -5,6 +5,9 @@ using System.Text;
namespace MudDesigner.MudEngine.Attributes
{
+ ///
+ /// Used to assign an un
+ ///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
public class UnusableAttribute : System.Attribute
{
diff --git a/Mud Designer/MudEngine/FileSystem/FileManager.cs b/Mud Designer/MudEngine/FileSystem/FileManager.cs
index 7308eed..4b8c5cb 100644
--- a/Mud Designer/MudEngine/FileSystem/FileManager.cs
+++ b/Mud Designer/MudEngine/FileSystem/FileManager.cs
@@ -6,6 +6,9 @@ using System.IO;
namespace MudDesigner.MudEngine.FileSystem
{
+ ///
+ /// Handles saving and loading of engine objects
+ ///
public static class FileManager
{
public enum OutputFormats
@@ -99,7 +102,7 @@ namespace MudDesigner.MudEngine.FileSystem
string assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName;
string assemblyName = System.IO.Path.GetFileName(assemblyPath);
string installBase = assemblyPath.Substring(0, assemblyPath.Length - assemblyName.Length);
- string rootPath = System.IO.Path.Combine(installBase, "Data");
+ string rootPath = System.IO.Path.Combine(installBase, "Project");
if (DataType == SaveDataTypes.Root)
return rootPath;
@@ -112,10 +115,13 @@ namespace MudDesigner.MudEngine.FileSystem
string assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName;
string assemblyName = System.IO.Path.GetFileName(assemblyPath);
string installBase = assemblyPath.Substring(0, assemblyPath.Length - assemblyName.Length);
- string rootPath = System.IO.Path.Combine(installBase, "Data");
- string realmsPath = System.IO.Path.Combine(rootPath, Realm);
+ string rootPath = System.IO.Path.Combine(installBase, "Project");
+ string realmsPath = System.IO.Path.Combine(rootPath, "Realms");
+ string requestRealm = Path.Combine(realmsPath, Realm);
+ string requestedRealmZones = Path.Combine(requestRealm, "Zones");
+ string requestedZone = Path.Combine(requestedRealmZones, Zone);
- return System.IO.Path.Combine(realmsPath, Zone);
+ return requestedZone;
}
public static string GetDataPath(string Realm, string Zone, string Room)
diff --git a/Mud Designer/MudEngine/FileSystem/SaveDataTypes.cs b/Mud Designer/MudEngine/FileSystem/SaveDataTypes.cs
index f77267b..d1fdf3d 100644
--- a/Mud Designer/MudEngine/FileSystem/SaveDataTypes.cs
+++ b/Mud Designer/MudEngine/FileSystem/SaveDataTypes.cs
@@ -5,5 +5,6 @@
Root,
Currency,
Realms,
+ Zones,
}
}
\ No newline at end of file
diff --git a/Mud Designer/MudEngine/GameManagement/ProjectInformation.cs b/Mud Designer/MudEngine/GameManagement/ProjectInformation.cs
index 2e4c4f4..a4cea6b 100644
--- a/Mud Designer/MudEngine/GameManagement/ProjectInformation.cs
+++ b/Mud Designer/MudEngine/GameManagement/ProjectInformation.cs
@@ -14,6 +14,9 @@ using MudDesigner.MudEngine.GameObjects.Environment;
namespace MudDesigner.MudEngine.GameManagement
{
+ ///
+ /// Manages all of the projects settings.
+ ///
[XmlInclude(typeof(StartingLocation))]
[XmlInclude(typeof(Currency))]
public class ProjectInformation
@@ -26,34 +29,39 @@ namespace MudDesigner.MudEngine.GameManagement
}
[Category("Company Settings")]
+ [Description("The name of the Company or Author building the game.")]
///
/// Gets or Sets the name of the company
///
public string CompanyName { get; set; }
[Category("Company Settings")]
+ [Description("The website URL that a player can visit to view additional information related to the game")]
///
/// Gets or Sets the companies website for this project
///
public string Website { get; set; }
[Category("Project Settings")]
- [Description("The name of the game.")]
+ [Description("The name of the game displayed to the users, and title bar of the runtime.")]
public string GameTitle { get; set; }
[Category("Project Settings")]
+ [Description("Enable or Disable Auto-saving of players when the player travels")]
///
/// Gets or Sets if the game autosaves when the player changes locations.
///
public bool AutoSave { get; set; }
[Category("Project Settings")]
+ [Description("Hide Room names from being outputted to the console.")]
///
/// Gets or Sets if room names are hidden during console output.
///
public bool HideRoomNames { get; set; }
[Category("Day Management")]
+ [Description("Set what time of day the world will take place in.")]
public TimeOfDayOptions TimeOfDay
{
get;
@@ -77,6 +85,7 @@ namespace MudDesigner.MudEngine.GameManagement
}
[Category("Project Settings")]
+ [Description("The current working version of the game.")]
public string Version { get; set; }
[Category("Game Currency")]
@@ -90,6 +99,10 @@ namespace MudDesigner.MudEngine.GameManagement
//TODO: Add Party support.
+ [Category("Project Settings")]
+ [Description("If enabled, all objects will be loaded during server startup resulting in a slower server start time, but faster load time during gameplay")]
+ public bool PreCacheObjects { get; set; }
+
[Browsable(false)]
public List CurrencyList { get; set; }
diff --git a/Mud Designer/MudEngine/GameObjects/BaseObject.cs b/Mud Designer/MudEngine/GameObjects/BaseObject.cs
index 67703ce..83d8993 100644
--- a/Mud Designer/MudEngine/GameObjects/BaseObject.cs
+++ b/Mud Designer/MudEngine/GameObjects/BaseObject.cs
@@ -13,6 +13,7 @@ namespace MudDesigner.MudEngine.GameObjects
public class BaseObject : IGameObject
{
[Category("Object Setup")]
+ [Description("The Display Name assigned to this object.")]
//Required to refresh Filename property in the editors propertygrid
[RefreshProperties(RefreshProperties.All)]
public string Name
@@ -29,6 +30,7 @@ namespace MudDesigner.MudEngine.GameObjects
}
[Category("Object Setup")]
+ [Description("A brief description of this object. The description is displayed to users when they use a command for investigating an object")]
public string Description
{
get;
@@ -36,10 +38,13 @@ namespace MudDesigner.MudEngine.GameObjects
}
[Category("Object Setup")]
+ [Description("The object script that can manipulate the object during the games life.")]
[EditorAttribute(typeof(UIScriptEditor), typeof(System.Drawing.Design.UITypeEditor))]
public string Script { get; set; }
[Category("Object Setup")]
+ [ReadOnly(true)]
+ [Description("The filename of the current object. This is assigned by the engine and not editable.")]
public string Filename
{
//Returns the name of the object + the objects Type as it's extension.
@@ -59,6 +64,7 @@ namespace MudDesigner.MudEngine.GameObjects
}
[Category("Senses")]
+ [Description("If a user asks to use his/her senses to investigate an area, this is one of the results that will be displayed. Senses can be used to assist blind characters.")]
[DefaultValue("You don't smell anything unsual.")]
public string Smell
{
@@ -67,6 +73,7 @@ namespace MudDesigner.MudEngine.GameObjects
}
[Category("Senses")]
+ [Description("If a user asks to use his/her senses to investigate an area, this is one of the results that will be displayed. Senses can be used to assist blind characters.")]
[DefaultValue("You hear nothing of interest.")]
public string Listen
{
@@ -75,6 +82,7 @@ namespace MudDesigner.MudEngine.GameObjects
}
[Category("Senses")]
+ [Description("If a user asks to use his/her senses to investigate an area, this is one of the results that will be displayed. Senses can be used to assist blind characters.")]
[DefaultValue("You feel nothing.")]
public string Feel
{
diff --git a/Mud Designer/MudEngine/GameObjects/Currency.cs b/Mud Designer/MudEngine/GameObjects/Currency.cs
index 473df5e..a77469e 100644
--- a/Mud Designer/MudEngine/GameObjects/Currency.cs
+++ b/Mud Designer/MudEngine/GameObjects/Currency.cs
@@ -9,6 +9,7 @@ namespace MudDesigner.MudEngine.GameObjects
public class Currency : BaseObject
{
[Category("Currency Settings")]
+ [Description("The value of the currency is based off the BaseCurrencyValue set in the Project Information. If BaseCurrencyValue is 1, and a new Currency is 10, then it will take 10 BaseCurrency to equal 1 of the new Currencies.")]
[DefaultValue(100)]
///
/// The value of this currency. It should be how many 'base currency' it takes to equal 1 of this currency
diff --git a/Mud Designer/MudEngine/GameObjects/Environment/Realm.cs b/Mud Designer/MudEngine/GameObjects/Environment/Realm.cs
index 465ac64..70c1d3f 100644
--- a/Mud Designer/MudEngine/GameObjects/Environment/Realm.cs
+++ b/Mud Designer/MudEngine/GameObjects/Environment/Realm.cs
@@ -15,6 +15,7 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
{
[Category("Environment Information")]
+ [Description("A collection of Zones that are contained within this Realm. Players can traverse the world be traveling through Rooms that are contained within Zones. Note that it is not required to place a Zone into a Realm.")]
[EditorAttribute(typeof(UIRealmEditor), typeof(System.Drawing.Design.UITypeEditor))]
public List Zones { get; set; }
@@ -23,26 +24,32 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
Zones = new List();
}
- public Zone GetZone(string ZoneName)
+ ///
+ /// Returns the requested Zone if the Zone exists within this Realm.
+ ///
+ ///
+ ///
+ public Zone GetZone(string zoneName)
{
+ string zoneFilename = "";
//correct the zonename if needed
- if (!ZoneName.EndsWith(".zone"))
- ZoneName += ".zone";
-
- //build our path
- string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), this.Name);
-
- //get a collection of all the zones within the realm
- string[] files = Directory.GetFiles(realmPath, "*.zone");
- Zone zone = new Zone();
-
- //look four our zone file
- foreach (string file in files)
+ if (!zoneName.EndsWith(".zone"))
+ zoneFilename = zoneName + ".zone";
+ else
{
- if (file == ZoneName)
- {
- string zonePath = Path.Combine(realmPath, Path.GetDirectoryName(file));
- }
+ zoneName = Path.GetFileNameWithoutExtension(zoneName);
+ zoneFilename = zoneName;
+ }
+
+ string zonePath = FileManager.GetDataPath(this.Name, zoneFilename);
+ zonePath = Path.Combine(zonePath, zoneName);
+ zoneFilename = Path.Combine(zonePath, zoneFilename);
+
+ if (File.Exists(zoneFilename))
+ {
+ Zone z = new Zone();
+ z = (Zone)FileManager.Load(zoneFilename, z);
+ return z;
}
return null;
diff --git a/Mud Designer/MudEngine/GameObjects/Environment/Room.cs b/Mud Designer/MudEngine/GameObjects/Environment/Room.cs
index 64cff82..ec4920a 100644
--- a/Mud Designer/MudEngine/GameObjects/Environment/Room.cs
+++ b/Mud Designer/MudEngine/GameObjects/Environment/Room.cs
@@ -10,7 +10,8 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
{
public class Room : BaseObject
{
- [Category("Room Information")]
+ [Category("Environment Information")]
+ [Description("Shows what rooms are currently created and linked to within this Room.")]
[ReadOnly(true)]
public string DoorList
{
@@ -34,10 +35,13 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
}
}
- [Browsable(false)]
+ [Category("Environment Information")]
+ [Description("Allows for linking of Rooms together via Doorways")]
public List InstalledDoors;
- [Browsable(false)]
+ [ReadOnly(true)]
+ [Description("This is the Zone that the Room is currently assigned to.")]
+ [Category("Environment Information")]
public string Zone
{
get;
@@ -46,6 +50,7 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
[Category("Environment Information")]
[DefaultValue(false)]
+ [Description("Determins if the Player can be attacked within this Room or not.")]
public bool IsSafe
{
get;
@@ -56,6 +61,7 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
public Room()
{
InstalledDoors = new List();
+ IsSafe = false;
}
}
}
diff --git a/Mud Designer/MudEngine/GameObjects/Environment/Zone.cs b/Mud Designer/MudEngine/GameObjects/Environment/Zone.cs
index fe39375..765724f 100644
--- a/Mud Designer/MudEngine/GameObjects/Environment/Zone.cs
+++ b/Mud Designer/MudEngine/GameObjects/Environment/Zone.cs
@@ -18,6 +18,7 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
{
[Category("Environment Information")]
[DefaultValue(0)]
+ [Description("The amount to drain each stat by if StatDrain is enabled.")]
public int StatDrainAmount
{
get;
@@ -25,6 +26,7 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
}
[Category("Environment Information")]
+ [Description("Enable or Disable the ability for draining stats while traversing.")]
[DefaultValue(false)]
public bool StatDrain
{
@@ -34,6 +36,7 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
[ReadOnly(true)]
[Category("Environment Information")]
+ [Description("The Realm that this Zone is assigned to. It is not required to be contained within a Realm.")]
public string Realm
{
get;
@@ -41,6 +44,7 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
}
[Category("Environment Information")]
+ [Description("Determins if the Player can be attacked within this Room or not.")]
[DefaultValue(false)]
public bool IsSafe
{
@@ -50,12 +54,13 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
[Category("Environment Information")]
[EditorAttribute(typeof(UIRoomEditor), typeof(UITypeEditor))]
- [ReadOnly(false)]
+ [Description("Collection of Rooms that have been created. Editing the Rooms Collection lets you manage the Zones rooms.")]
public List Rooms { get; set; }
public Zone()
{
Rooms = new List();
+ IsSafe = false;
//throw new NotSupportedException("Parameterless constructors of Type " + this.GetType().FullName + " is not supported.");
}
diff --git a/Mud Designer/MudEngine/UITypeEditors/UIRealmControl.cs b/Mud Designer/MudEngine/UITypeEditors/UIRealmControl.cs
index 097fb40..e0d894c 100644
--- a/Mud Designer/MudEngine/UITypeEditors/UIRealmControl.cs
+++ b/Mud Designer/MudEngine/UITypeEditors/UIRealmControl.cs
@@ -124,6 +124,25 @@ namespace MudDesigner.MudEngine.UITypeEditors
//copy the file
string newFile = Path.Combine(zonePath, lstAvailableZones.SelectedItem.ToString());
File.Copy(originalFile, newFile, true);
+ //copy all of its rooms if they exist
+ string originalPath = originalFile.Substring(0, originalFile.Length - Path.GetFileName(originalFile).Length);
+ string roomPath = Path.Combine(originalPath, "Rooms");
+ string[] rooms = Directory.GetFiles(roomPath);
+
+ if (rooms.Length != 0)
+ {
+ string newPath = newFile.Substring(0, newFile.Length - Path.GetFileName(newFile).Length);
+ string newRooms = Path.Combine(newPath, "Rooms");
+ if (!Directory.Exists(newRooms))
+ Directory.CreateDirectory(newRooms);
+
+ foreach (string room in rooms)
+ {
+ newFile = Path.Combine(newRooms, Path.GetFileName(room));
+ File.Copy(room, newFile);
+ File.Delete(room);
+ }
+ }
File.Delete(originalFile);
Directory.Delete(Path.Combine(zoneRoot, zone.Name), true);
lstAvailableZones.Items.Remove(lstAvailableZones.SelectedItem);
@@ -144,9 +163,12 @@ namespace MudDesigner.MudEngine.UITypeEditors
}
string projectPath = Path.Combine(Application.StartupPath, "Project");
+ //Project/Realms
string realmPath = Path.Combine(projectPath, "Realms");
+ //Project/Realms/RealmName
string realmRoot = Path.Combine(realmPath, _Realm.Name);
string[] zones = Directory.GetFiles(realmRoot, "*.zone", SearchOption.AllDirectories);
+ bool IsFound = false;
//Find the zone that we need to remove from the realm
foreach(string zone in zones)
@@ -159,8 +181,11 @@ namespace MudDesigner.MudEngine.UITypeEditors
//now that it is no longer part of a realm
if (z.Filename == lstRealmMembers.SelectedItem.ToString())
{
+ IsFound = true;
+ z.Realm = "";
_Realm.Zones.Remove(z.Filename);
-
+ FileManager.Save(zone, z);
+
string zonePath = Path.Combine(projectPath, "Zones");
string zoneRoot = Path.Combine(zonePath, z.Name);
string newFile = Path.Combine(zoneRoot, Path.GetFileName(zone));
@@ -191,9 +216,18 @@ namespace MudDesigner.MudEngine.UITypeEditors
File.Copy(zone, newFile);
File.Delete(zone);
Directory.Delete(oldZonePath, true);
+ lstAvailableZones.Items.Add(lstRealmMembers.SelectedItem);
lstRealmMembers.Items.Remove(lstRealmMembers.SelectedItem);
break;
}
+ }//End of foreach
+ if (!IsFound)
+ {
+ _Realm.Zones.Remove(lstRealmMembers.SelectedItem.ToString());
+ string filename = Path.Combine(realmRoot, _Realm.Filename);
+ FileManager.Save(filename, _Realm);
+ lstAvailableZones.Items.Add(lstRealmMembers.SelectedItem);
+ lstRealmMembers.Items.Remove(lstRealmMembers.SelectedItem);
}
}
}
diff --git a/Mud Designer/MudEngine/UITypeEditors/UIRealmEditor.cs b/Mud Designer/MudEngine/UITypeEditors/UIRealmEditor.cs
index 851e80a..c5b11c0 100644
--- a/Mud Designer/MudEngine/UITypeEditors/UIRealmEditor.cs
+++ b/Mud Designer/MudEngine/UITypeEditors/UIRealmEditor.cs
@@ -22,18 +22,7 @@ namespace MudDesigner.MudEngine.UITypeEditors
ctl.ShowDialog();
- while (ctl.Created)
- {
- Application.DoEvents();
- }
-
- if (Program.CurrentEditor is Designer)
- {
- Designer form = (Designer)Program.CurrentEditor;
- form.RefreshProjectExplorer();
- }
-
- return ctl.Zones;
+ return obj.Zones;
}
public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
diff --git a/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.Designer.cs b/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.Designer.cs
index d1e92b4..7dd3ed6 100644
--- a/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.Designer.cs
+++ b/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.Designer.cs
@@ -28,25 +28,135 @@
///
private void InitializeComponent()
{
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UIRoomControl));
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.lstRooms = new System.Windows.Forms.ListBox();
+ this.toolStrip1 = new System.Windows.Forms.ToolStrip();
+ this.btnNewRoom = new System.Windows.Forms.ToolStripButton();
+ this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
+ this.txtFindRoom = new System.Windows.Forms.ToolStripTextBox();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.propertyRoom = new System.Windows.Forms.PropertyGrid();
+ this.groupBox1.SuspendLayout();
+ this.toolStrip1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.lstRooms);
+ this.groupBox1.Controls.Add(this.toolStrip1);
+ this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.groupBox1.ForeColor = System.Drawing.Color.Silver;
+ this.groupBox1.Location = new System.Drawing.Point(12, 12);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(239, 336);
+ this.groupBox1.TabIndex = 0;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Members in Zone";
+ //
+ // lstRooms
+ //
+ this.lstRooms.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lstRooms.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lstRooms.FormattingEnabled = true;
+ this.lstRooms.Location = new System.Drawing.Point(3, 41);
+ this.lstRooms.Name = "lstRooms";
+ this.lstRooms.Size = new System.Drawing.Size(233, 290);
+ this.lstRooms.TabIndex = 1;
+ //
+ // toolStrip1
+ //
+ this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.btnNewRoom,
+ this.toolStripLabel1,
+ this.txtFindRoom});
+ this.toolStrip1.Location = new System.Drawing.Point(3, 16);
+ this.toolStrip1.Name = "toolStrip1";
+ this.toolStrip1.Size = new System.Drawing.Size(233, 25);
+ this.toolStrip1.TabIndex = 0;
+ this.toolStrip1.Text = "toolStrip1";
+ //
+ // btnNewRoom
+ //
+ this.btnNewRoom.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.btnNewRoom.ForeColor = System.Drawing.Color.Black;
+ this.btnNewRoom.Image = ((System.Drawing.Image)(resources.GetObject("btnNewRoom.Image")));
+ this.btnNewRoom.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.btnNewRoom.Name = "btnNewRoom";
+ this.btnNewRoom.Size = new System.Drawing.Size(70, 22);
+ this.btnNewRoom.Text = "New Room";
+ this.btnNewRoom.Click += new System.EventHandler(this.btnNewRoom_Click);
+ //
+ // toolStripLabel1
+ //
+ this.toolStripLabel1.ForeColor = System.Drawing.Color.Black;
+ this.toolStripLabel1.Name = "toolStripLabel1";
+ this.toolStripLabel1.Size = new System.Drawing.Size(33, 22);
+ this.toolStripLabel1.Text = "Find:";
+ //
+ // txtFindRoom
+ //
+ this.txtFindRoom.Name = "txtFindRoom";
+ this.txtFindRoom.Size = new System.Drawing.Size(100, 25);
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.Add(this.propertyRoom);
+ this.groupBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.groupBox2.ForeColor = System.Drawing.Color.Silver;
+ this.groupBox2.Location = new System.Drawing.Point(258, 12);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(239, 336);
+ this.groupBox2.TabIndex = 1;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Text = "Members in Zone";
+ //
+ // 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, 317);
+ this.propertyRoom.TabIndex = 1;
+ this.propertyRoom.ToolbarVisible = false;
+ this.propertyRoom.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyRoom_PropertyValueChanged);
+ //
// UIRoomControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
- this.ClientSize = new System.Drawing.Size(600, 461);
+ this.ClientSize = new System.Drawing.Size(512, 356);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "UIRoomControl";
+ this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Room Designer";
+ this.Load += new System.EventHandler(this.UIRoomControl_Load);
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.toolStrip1.ResumeLayout(false);
+ this.toolStrip1.PerformLayout();
+ this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
+
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.ToolStrip toolStrip1;
+ private System.Windows.Forms.ToolStripButton btnNewRoom;
+ private System.Windows.Forms.ToolStripLabel toolStripLabel1;
+ private System.Windows.Forms.ToolStripTextBox txtFindRoom;
+ private System.Windows.Forms.ListBox lstRooms;
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.PropertyGrid propertyRoom;
}
}
\ No newline at end of file
diff --git a/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.cs b/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.cs
index 96d997f..7b50839 100644
--- a/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.cs
+++ b/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.cs
@@ -2,18 +2,147 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
+using System.IO;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
+using MudDesigner.MudEngine.FileSystem;
+using MudDesigner.MudEngine.GameObjects;
+using MudDesigner.MudEngine.GameObjects.Environment;
+
namespace MudDesigner.MudEngine.UITypeEditors
{
public partial class UIRoomControl : Form
{
- public UIRoomControl()
+ bool IsSaved;
+ Room _Room;
+ string savePath = "";
+
+ public UIRoomControl(Zone zone)
{
InitializeComponent();
+ IsSaved = true;
+ _Room = new Room();
+
+ string projectPath = Path.Combine(Application.StartupPath, "Project");
+ string zonesPath = Path.Combine(projectPath, "Zones");
+ string realmsPath = Path.Combine(projectPath, "Realms");
+ savePath = "";
+
+ if (string.IsNullOrEmpty(zone.Realm))
+ {
+ //Project/Zones/ZoneName
+ savePath = Path.Combine(zonesPath, zone.Name);
+ //Project/Zones/ZoneName/Rooms
+ savePath = Path.Combine(savePath, "Rooms");
+ }
+ else
+ {
+ //Project/Realms/RealmName
+ savePath = Path.Combine(realmsPath, zone.Realm);
+ //Project/Realms/RealmName/Zones
+ savePath = Path.Combine(savePath, "Zones");
+ //Project/Realms/RealmName/Zones/ZoneName
+ savePath = Path.Combine(savePath, zone.Name);
+ //Project/Realms/RealmName/Zones/ZoneName/Rooms
+ savePath = Path.Combine(savePath, "Rooms");
+ }
+ }
+
+ private bool CheckSavedState()
+ {
+ if (IsSaved)
+ return true;
+
+ DialogResult result = MessageBox.Show(_Room.Name + " has not been saved! Do you wish to save it?", "Mud Designer", MessageBoxButtons.YesNoCancel);
+
+ if (result == DialogResult.No)
+ return true;
+ else if (result == DialogResult.Cancel)
+ return false;
+ else
+ SaveSelected();
+
+ return true;
+ }
+
+ private void SaveSelected()
+ {
+ if (!Directory.Exists(savePath))
+ Directory.CreateDirectory(savePath);
+
+ _Room = (Room)propertyRoom.SelectedObject;
+
+ string filename = Path.Combine(savePath, _Room.Filename);
+ FileManager.Save(filename, _Room);
+
+ if (!lstRooms.Items.Contains(_Room.Filename))
+ lstRooms.Items.Add(_Room.Filename);
+
+ IsSaved = true;
+ }
+
+ private void propertyRoom_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
+ {
+ IsSaved = false;
+ if (propertyRoom.SelectedObject is BaseObject)
+ {
+ BaseObject obj = (BaseObject)propertyRoom.SelectedObject;
+
+ //Don't auto-save if we haven't assigned a valid name
+ if (obj.Name == "New " + obj.GetType().Name)
+ return;
+
+ if (e.ChangedItem.Label == "Name")
+ {
+ if (e.ChangedItem.Value != e.OldValue)
+ {
+ if (File.Exists(Path.Combine(savePath, e.ChangedItem.Value + ".Room")))
+ {
+ MessageBox.Show("A Room with that name already exists!", "Mud Designer");
+ _Room = (Room)propertyRoom.SelectedObject;
+ _Room.Name = e.OldValue.ToString();
+ propertyRoom.Refresh();
+ return;
+ }
+ StringBuilder filename = new StringBuilder();
+ filename.Append(e.OldValue);
+ filename.Append(".room");
+ string fullFilename = Path.Combine(savePath, filename.ToString());
+ if (File.Exists(fullFilename))
+ {
+ File.Delete(Path.Combine(savePath, fullFilename));
+ lstRooms.Items.RemoveAt(lstRooms.Items.IndexOf(e.OldValue + ".Room"));
+ }
+ }
+ }
+
+ }
+ SaveSelected();
+ }
+
+ private void btnNewRoom_Click(object sender, EventArgs e)
+ {
+ if (CheckSavedState())
+ {
+ propertyRoom.SelectedObject = new Room();
+ IsSaved = false;
+ }
+ }
+
+ private void UIRoomControl_Load(object sender, EventArgs e)
+ {
+ if (Directory.Exists(savePath))
+ {
+ string[] files = Directory.GetFiles(savePath);
+
+ foreach (string file in files)
+ {
+ lstRooms.Items.Add(Path.GetFileName(file));
+ }
+ }
}
}
}
diff --git a/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.resx b/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.resx
index ff31a6d..ffe8b9e 100644
--- a/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.resx
+++ b/Mud Designer/MudEngine/UITypeEditors/UIRoomControl.resx
@@ -117,4 +117,23 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAgxJREFUOE+lkvtL
+ U2EYx+0PEbtpFwnBKPGKiJImGP0gYhIYs1E5GF5gIxkpA00JRSmMEF0ohMh+GaRWYlqabMVcNdS2QpaI
+ VqiDIYhk397vA6fXhCjyhYdzeM/5fp7vczkAdeL2cwho7v/wWzT1zcN+Pwhr51uY2/y41PQaF+wzKKiZ
+ QvaN58g0jyLd5KEUcQbg+84P/Cm2tncQjW3j68YWIqubCC3FcOJc478BAuGoZM6zvoRnakXEruEIjhc4
+ /g5gZop9c+voGAyLbQIfeBZxLL9BA1jzXvuGbWamuKh+GmmVbswE19A59FEBbmoAG7YbsLtm2mZmiml9
+ cvabNDwpz6YB7LYBoMXCumkJr7LOmnnHzBQ/9X2Bo2cOibm1GsBREbAQiYmw/8lnuCeWkVzcgnZlnw1j
+ 3HV/wuNXK6i/9x5Hc6wawDlTXHbLJ+LZUBQPRyKwdQdxutwl1h+NLXHh5Ht1ewBHsiwawCW57HyDAfWR
+ dvl0uhZQ1eqX8aVc7EKLqrum651ATLf9OJx5XQM4KmY0xPzZ0hFAiQJnXB0WwME0E3IsL5B17ZlADqWb
+ NYDrOepdlcysmTWWOrxqbceRWtaLk0VO1XW72D5Vckd2gMBfq8zdpmUG62NJvKM4+XyziDk24xmfWoGE
+ s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC
+
+
\ No newline at end of file
diff --git a/Mud Designer/MudEngine/UITypeEditors/UIRoomEditor.cs b/Mud Designer/MudEngine/UITypeEditors/UIRoomEditor.cs
index 6a9c5c9..73ac084 100644
--- a/Mud Designer/MudEngine/UITypeEditors/UIRoomEditor.cs
+++ b/Mud Designer/MudEngine/UITypeEditors/UIRoomEditor.cs
@@ -15,29 +15,12 @@ namespace MudDesigner.MudEngine.UITypeEditors
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
{
Zone obj = (Zone)context.Instance;
+ UIRoomControl ctl;
- List Rooms = new List();
-
- UIRoomControl ctl = new UIRoomControl();
-
- if (ctl.IsDisposed)
- //return the previous zones collection, incase the control error'd out
- //we aren't overriding and loosing content.
- return obj.Rooms;
+ ctl = new UIRoomControl(obj);
ctl.ShowDialog();
- while (ctl.Created)
- {
- Application.DoEvents();
- }
-
- if (Program.CurrentEditor is Designer)
- {
- Designer form = (Designer)Program.CurrentEditor;
- form.RefreshProjectExplorer();
- }
-
return new List();
}
diff --git a/Mud Designer/Program.cs b/Mud Designer/Program.cs
index 6dd78ba..dbc0175 100644
--- a/Mud Designer/Program.cs
+++ b/Mud Designer/Program.cs
@@ -17,39 +17,14 @@ namespace MudDesigner
{
static class Program
{
- public static ProjectInformation Project { get; set; }
- public static Realm Realm { get; set; }
- public static Zone Zone {get;set;}
- public static Room Room { get; set; }
- public static ScriptingEngine ScriptEngine { get; set; }
public static Form CurrentEditor { get; set; }
- public static Settings Settings { get; set; }
-
+
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
- //Creates a new instance of the project and settings
- Project = new ProjectInformation();
- Settings = new Settings();
-
- //Make sure our directory structure is created
- FileManager.ValidateDataPaths();
- //Setup what fileformat we are going to use.
- FileManager.FileType = FileManager.OutputFormats.XML;
-
- //Load the MUD project if the file exists
- string filename = System.IO.Path.Combine(FileManager.GetDataPath(SaveDataTypes.Root), "Project.Xml");
- if (System.IO.File.Exists(filename))
- Project = (ProjectInformation)FileManager.Load(filename, Project);
-
- //Load the toolkit settings if it exists.
- filename = System.IO.Path.Combine(Application.StartupPath, "Toolkit.xml");
- if (System.IO.File.Exists(filename))
- Settings = (Settings)FileManager.Load(filename, Settings);
-
//Setup default application properties
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);