Test Designer:

- UIControls namespace renamed to UIWidgets
 - RealmExplorer Control renamed to RealmWidget
 - RealmWidget now handles scanning and populating the Widget with existing realms rather than the designer handling it.
 - Object saving re-wrote
 - Zone Creation implemented
 - Adding Zones to Realms implemented
 - Removal of Zones from within Realms implemented
 - Support for stand-alone Zones added. Unlike the previous version of the 'Mud Designer Realm Explorer & Zone Builder', Zones can be built without being placed within a Realm
 - Deleting a Zone removes it from the Realms collection
 - Custom UITypeEditor added for adding Zones to Realms.
 - Menu item Project->Game Management has been re-structured
 - Saved file extensions on objects changed from .XML back to .ObjectType (example .realm)
 - RefreshProjectExplorer method added for refreshing the project explorer's directory structure
 - All calls to btnRefreshObjects_Click has been replaced with RefreshProjectExplorer()
 - The Project Explorer can now delete any object (file or folder) underneath the Project Root node.
 - The Project Explorer now has the files it contains highlighted as blue to help readability.
 - Changed the Project Explorer's root object from "Game Objects" to "Project"
 - Began implementation of the Project Explorer's search feature.
 - SaveSelected method added to save the current object contained within the property grid.
 - Anytime an Objects Property is changed the designer now automatically saves the object.
 - Object Properties label now displays the Type of object being edited and the objects name (Example 'Zone Properties (Village of Tespa)')

Mud Designer:
 - The New Test Designer has been set as the startup object, as the old designer toolkit is being phased out.

Mud Engine:
 - Added UIRealmControl class, a custom control used by the designer to edit the Realm.Zones property.
 - UIRealmEditor class added, manages the UIRealmControl.
This commit is contained in:
Scionwest_cp 2010-01-09 16:44:05 -08:00
parent 83311d4200
commit ae672a29e1
14 changed files with 765 additions and 267 deletions

View file

@ -29,7 +29,7 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Game Objects"); System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Project");
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Designer)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Designer));
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.mnuFile = new System.Windows.Forms.ToolStripMenuItem(); this.mnuFile = new System.Windows.Forms.ToolStripMenuItem();
@ -49,8 +49,9 @@
this.mnuPreferences = new System.Windows.Forms.ToolStripMenuItem(); this.mnuPreferences = new System.Windows.Forms.ToolStripMenuItem();
this.mnuProject = new System.Windows.Forms.ToolStripMenuItem(); this.mnuProject = new System.Windows.Forms.ToolStripMenuItem();
this.mnuGameManagement = new System.Windows.Forms.ToolStripMenuItem(); this.mnuGameManagement = new System.Windows.Forms.ToolStripMenuItem();
this.currencyEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuProjectInformation = new System.Windows.Forms.ToolStripMenuItem(); this.mnuProjectInformation = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.currencyEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuQuestBuilder = new System.Windows.Forms.ToolStripMenuItem(); this.mnuQuestBuilder = new System.Windows.Forms.ToolStripMenuItem();
this.mnuGameObjects = new System.Windows.Forms.ToolStripMenuItem(); this.mnuGameObjects = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEnvironments = new System.Windows.Forms.ToolStripMenuItem(); this.mnuEnvironments = new System.Windows.Forms.ToolStripMenuItem();
@ -73,23 +74,22 @@
this.treeExplorer = new System.Windows.Forms.TreeView(); this.treeExplorer = new System.Windows.Forms.TreeView();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnuEditObject = new System.Windows.Forms.ToolStripMenuItem(); this.mnuEditObject = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.deleteObjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.btnRefreshObjects = new System.Windows.Forms.ToolStripButton(); this.btnRefreshObjects = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.toolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox(); this.txtSearch = new System.Windows.Forms.ToolStripTextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.propertyObject = new System.Windows.Forms.PropertyGrid(); this.lblObjectProperties = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.toolstripObjectProperties = new System.Windows.Forms.ToolStrip(); this.toolstripObjectProperties = new System.Windows.Forms.ToolStrip();
this.btnSaveObject = new System.Windows.Forms.ToolStripButton(); this.btnSaveObject = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.btnValidate = new System.Windows.Forms.ToolStripButton(); this.btnValidate = new System.Windows.Forms.ToolStripButton();
this.label2 = new System.Windows.Forms.Label(); this.propertyObject = new System.Windows.Forms.PropertyGrid();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.flowContainer = new System.Windows.Forms.FlowLayoutPanel();
this.realmExplorer1 = new MudDesigner.UIControls.RealmExplorer();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.containerMain.Panel1.SuspendLayout();
this.containerMain.Panel2.SuspendLayout(); this.containerMain.Panel2.SuspendLayout();
this.containerMain.SuspendLayout(); this.containerMain.SuspendLayout();
this.containerSidebar.Panel1.SuspendLayout(); this.containerSidebar.Panel1.SuspendLayout();
@ -98,7 +98,6 @@
this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
this.toolstripObjectProperties.SuspendLayout(); this.toolstripObjectProperties.SuspendLayout();
this.flowContainer.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// menuStrip1 // menuStrip1
@ -237,31 +236,38 @@
// mnuGameManagement // mnuGameManagement
// //
this.mnuGameManagement.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuGameManagement.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.currencyEditorToolStripMenuItem,
this.mnuProjectInformation, this.mnuProjectInformation,
this.toolStripMenuItem2,
this.currencyEditorToolStripMenuItem,
this.mnuQuestBuilder}); this.mnuQuestBuilder});
this.mnuGameManagement.Name = "mnuGameManagement"; this.mnuGameManagement.Name = "mnuGameManagement";
this.mnuGameManagement.Size = new System.Drawing.Size(179, 22); this.mnuGameManagement.Size = new System.Drawing.Size(179, 22);
this.mnuGameManagement.Text = "Game Management"; this.mnuGameManagement.Text = "Game Management";
// //
// currencyEditorToolStripMenuItem
//
this.currencyEditorToolStripMenuItem.Name = "currencyEditorToolStripMenuItem";
this.currencyEditorToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.currencyEditorToolStripMenuItem.Text = "Currency Editor";
this.currencyEditorToolStripMenuItem.Click += new System.EventHandler(this.currencyEditorToolStripMenuItem_Click);
//
// mnuProjectInformation // mnuProjectInformation
// //
this.mnuProjectInformation.Name = "mnuProjectInformation"; this.mnuProjectInformation.Name = "mnuProjectInformation";
this.mnuProjectInformation.Size = new System.Drawing.Size(177, 22); this.mnuProjectInformation.Size = new System.Drawing.Size(159, 22);
this.mnuProjectInformation.Text = "Project Information"; this.mnuProjectInformation.Text = "Project Settings";
this.mnuProjectInformation.Click += new System.EventHandler(this.mnuProjectInformation_Click); this.mnuProjectInformation.Click += new System.EventHandler(this.mnuProjectInformation_Click);
// //
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(156, 6);
//
// currencyEditorToolStripMenuItem
//
this.currencyEditorToolStripMenuItem.Name = "currencyEditorToolStripMenuItem";
this.currencyEditorToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
this.currencyEditorToolStripMenuItem.Text = "Create Currency";
this.currencyEditorToolStripMenuItem.Click += new System.EventHandler(this.currencyEditorToolStripMenuItem_Click);
//
// mnuQuestBuilder // mnuQuestBuilder
// //
this.mnuQuestBuilder.Enabled = false;
this.mnuQuestBuilder.Name = "mnuQuestBuilder"; this.mnuQuestBuilder.Name = "mnuQuestBuilder";
this.mnuQuestBuilder.Size = new System.Drawing.Size(177, 22); this.mnuQuestBuilder.Size = new System.Drawing.Size(159, 22);
this.mnuQuestBuilder.Text = "Quest Builder"; this.mnuQuestBuilder.Text = "Quest Builder";
// //
// mnuGameObjects // mnuGameObjects
@ -279,27 +285,28 @@
this.mnuRealmEditor, this.mnuRealmEditor,
this.mnuZoneBuilder}); this.mnuZoneBuilder});
this.mnuEnvironments.Name = "mnuEnvironments"; this.mnuEnvironments.Name = "mnuEnvironments";
this.mnuEnvironments.Size = new System.Drawing.Size(152, 22); this.mnuEnvironments.Size = new System.Drawing.Size(147, 22);
this.mnuEnvironments.Text = "Environments"; this.mnuEnvironments.Text = "Environments";
// //
// mnuRealmEditor // mnuRealmEditor
// //
this.mnuRealmEditor.Name = "mnuRealmEditor"; this.mnuRealmEditor.Name = "mnuRealmEditor";
this.mnuRealmEditor.Size = new System.Drawing.Size(152, 22); this.mnuRealmEditor.Size = new System.Drawing.Size(134, 22);
this.mnuRealmEditor.Text = "Realm Editor"; this.mnuRealmEditor.Text = "New Realm";
this.mnuRealmEditor.Click += new System.EventHandler(this.mnuRealmEditor_Click); this.mnuRealmEditor.Click += new System.EventHandler(this.mnuRealmEditor_Click);
// //
// mnuZoneBuilder // mnuZoneBuilder
// //
this.mnuZoneBuilder.Name = "mnuZoneBuilder"; this.mnuZoneBuilder.Name = "mnuZoneBuilder";
this.mnuZoneBuilder.Size = new System.Drawing.Size(152, 22); this.mnuZoneBuilder.Size = new System.Drawing.Size(134, 22);
this.mnuZoneBuilder.Text = "Zone Builder"; this.mnuZoneBuilder.Text = "New Zone";
this.mnuZoneBuilder.Click += new System.EventHandler(this.mnuZoneBuilder_Click);
// //
// mnuItems // mnuItems
// //
this.mnuItems.Enabled = false; this.mnuItems.Enabled = false;
this.mnuItems.Name = "mnuItems"; this.mnuItems.Name = "mnuItems";
this.mnuItems.Size = new System.Drawing.Size(152, 22); this.mnuItems.Size = new System.Drawing.Size(147, 22);
this.mnuItems.Text = "Items"; this.mnuItems.Text = "Items";
// //
// customObjectsToolStripMenuItem // customObjectsToolStripMenuItem
@ -383,15 +390,11 @@
this.containerMain.Location = new System.Drawing.Point(0, 24); this.containerMain.Location = new System.Drawing.Point(0, 24);
this.containerMain.Name = "containerMain"; this.containerMain.Name = "containerMain";
// //
// containerMain.Panel1
//
this.containerMain.Panel1.Controls.Add(this.flowContainer);
//
// containerMain.Panel2 // containerMain.Panel2
// //
this.containerMain.Panel2.Controls.Add(this.containerSidebar); this.containerMain.Panel2.Controls.Add(this.containerSidebar);
this.containerMain.Size = new System.Drawing.Size(784, 540); this.containerMain.Size = new System.Drawing.Size(784, 540);
this.containerMain.SplitterDistance = 526; this.containerMain.SplitterDistance = 511;
this.containerMain.TabIndex = 1; this.containerMain.TabIndex = 1;
// //
// containerSidebar // containerSidebar
@ -412,8 +415,8 @@
// //
this.containerSidebar.Panel2.Controls.Add(this.propertyObject); this.containerSidebar.Panel2.Controls.Add(this.propertyObject);
this.containerSidebar.Panel2.Controls.Add(this.toolstripObjectProperties); this.containerSidebar.Panel2.Controls.Add(this.toolstripObjectProperties);
this.containerSidebar.Panel2.Controls.Add(this.label2); this.containerSidebar.Panel2.Controls.Add(this.lblObjectProperties);
this.containerSidebar.Size = new System.Drawing.Size(254, 540); this.containerSidebar.Size = new System.Drawing.Size(269, 540);
this.containerSidebar.SplitterDistance = 244; this.containerSidebar.SplitterDistance = 244;
this.containerSidebar.TabIndex = 0; this.containerSidebar.TabIndex = 0;
// //
@ -423,37 +426,51 @@
this.treeExplorer.Dock = System.Windows.Forms.DockStyle.Fill; this.treeExplorer.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeExplorer.Location = new System.Drawing.Point(0, 38); this.treeExplorer.Location = new System.Drawing.Point(0, 38);
this.treeExplorer.Name = "treeExplorer"; this.treeExplorer.Name = "treeExplorer";
treeNode1.Name = "nodeGameObjects"; treeNode1.Name = "nodeProject";
treeNode1.Text = "Game Objects"; treeNode1.Text = "Project";
this.treeExplorer.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { this.treeExplorer.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode1}); treeNode1});
this.treeExplorer.Size = new System.Drawing.Size(252, 204); this.treeExplorer.Size = new System.Drawing.Size(267, 204);
this.treeExplorer.TabIndex = 5; this.treeExplorer.TabIndex = 5;
// //
// contextMenuStrip1 // contextMenuStrip1
// //
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuEditObject}); this.mnuEditObject,
this.toolStripMenuItem1,
this.deleteObjectToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(133, 26); this.contextMenuStrip1.Size = new System.Drawing.Size(146, 54);
// //
// mnuEditObject // mnuEditObject
// //
this.mnuEditObject.Name = "mnuEditObject"; this.mnuEditObject.Name = "mnuEditObject";
this.mnuEditObject.Size = new System.Drawing.Size(132, 22); this.mnuEditObject.Size = new System.Drawing.Size(145, 22);
this.mnuEditObject.Text = "Edit Object"; this.mnuEditObject.Text = "Edit Object";
this.mnuEditObject.Click += new System.EventHandler(this.mnuEditObject_Click); this.mnuEditObject.Click += new System.EventHandler(this.mnuEditObject_Click);
// //
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(142, 6);
//
// deleteObjectToolStripMenuItem
//
this.deleteObjectToolStripMenuItem.Name = "deleteObjectToolStripMenuItem";
this.deleteObjectToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
this.deleteObjectToolStripMenuItem.Text = "Delete Object";
this.deleteObjectToolStripMenuItem.Click += new System.EventHandler(this.deleteObjectToolStripMenuItem_Click);
//
// toolStrip1 // toolStrip1
// //
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnRefreshObjects, this.btnRefreshObjects,
this.toolStripSeparator2, this.toolStripSeparator2,
this.toolStripLabel1, this.toolStripLabel1,
this.toolStripTextBox1}); this.txtSearch});
this.toolStrip1.Location = new System.Drawing.Point(0, 13); this.toolStrip1.Location = new System.Drawing.Point(0, 13);
this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(252, 25); this.toolStrip1.Size = new System.Drawing.Size(267, 25);
this.toolStrip1.TabIndex = 4; this.toolStrip1.TabIndex = 4;
this.toolStrip1.Text = "toolStrip1"; this.toolStrip1.Text = "toolStrip1";
// //
@ -479,10 +496,11 @@
this.toolStripLabel1.Size = new System.Drawing.Size(33, 22); this.toolStripLabel1.Size = new System.Drawing.Size(33, 22);
this.toolStripLabel1.Text = "Find:"; this.toolStripLabel1.Text = "Find:";
// //
// toolStripTextBox1 // txtSearch
// //
this.toolStripTextBox1.Name = "toolStripTextBox1"; this.txtSearch.Name = "txtSearch";
this.toolStripTextBox1.Size = new System.Drawing.Size(100, 25); this.txtSearch.Size = new System.Drawing.Size(100, 25);
this.txtSearch.Enter += new System.EventHandler(this.txtSearch_Enter);
// //
// label1 // label1
// //
@ -491,18 +509,20 @@
this.label1.ForeColor = System.Drawing.Color.Silver; this.label1.ForeColor = System.Drawing.Color.Silver;
this.label1.Location = new System.Drawing.Point(0, 0); this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(252, 13); this.label1.Size = new System.Drawing.Size(267, 13);
this.label1.TabIndex = 2; this.label1.TabIndex = 2;
this.label1.Text = "Project Explorer"; this.label1.Text = "Project Explorer";
// //
// propertyObject // lblObjectProperties
// //
this.propertyObject.Dock = System.Windows.Forms.DockStyle.Fill; this.lblObjectProperties.Dock = System.Windows.Forms.DockStyle.Top;
this.propertyObject.Location = new System.Drawing.Point(0, 38); this.lblObjectProperties.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.propertyObject.Name = "propertyObject"; this.lblObjectProperties.ForeColor = System.Drawing.Color.Silver;
this.propertyObject.Size = new System.Drawing.Size(252, 252); this.lblObjectProperties.Location = new System.Drawing.Point(0, 0);
this.propertyObject.TabIndex = 5; this.lblObjectProperties.Name = "lblObjectProperties";
this.propertyObject.ToolbarVisible = false; this.lblObjectProperties.Size = new System.Drawing.Size(267, 13);
this.lblObjectProperties.TabIndex = 3;
this.lblObjectProperties.Text = "Object Properties";
// //
// toolstripObjectProperties // toolstripObjectProperties
// //
@ -512,8 +532,8 @@
this.btnValidate}); this.btnValidate});
this.toolstripObjectProperties.Location = new System.Drawing.Point(0, 13); this.toolstripObjectProperties.Location = new System.Drawing.Point(0, 13);
this.toolstripObjectProperties.Name = "toolstripObjectProperties"; this.toolstripObjectProperties.Name = "toolstripObjectProperties";
this.toolstripObjectProperties.Size = new System.Drawing.Size(252, 25); this.toolstripObjectProperties.Size = new System.Drawing.Size(267, 25);
this.toolstripObjectProperties.TabIndex = 4; this.toolstripObjectProperties.TabIndex = 7;
this.toolstripObjectProperties.Text = "toolStrip1"; this.toolstripObjectProperties.Text = "toolStrip1";
// //
// btnSaveObject // btnSaveObject
@ -525,7 +545,6 @@
this.btnSaveObject.Size = new System.Drawing.Size(73, 22); this.btnSaveObject.Size = new System.Drawing.Size(73, 22);
this.btnSaveObject.Text = "Save Object"; this.btnSaveObject.Text = "Save Object";
this.btnSaveObject.ToolTipText = "Save the current object"; this.btnSaveObject.ToolTipText = "Save the current object";
this.btnSaveObject.Click += new System.EventHandler(this.btnSaveObject_Click);
// //
// toolStripSeparator1 // toolStripSeparator1
// //
@ -535,6 +554,7 @@
// btnValidate // btnValidate
// //
this.btnValidate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.btnValidate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.btnValidate.Enabled = false;
this.btnValidate.Image = ((System.Drawing.Image)(resources.GetObject("btnValidate.Image"))); this.btnValidate.Image = ((System.Drawing.Image)(resources.GetObject("btnValidate.Image")));
this.btnValidate.ImageTransparentColor = System.Drawing.Color.Magenta; this.btnValidate.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnValidate.Name = "btnValidate"; this.btnValidate.Name = "btnValidate";
@ -543,35 +563,14 @@
this.btnValidate.ToolTipText = "Checks the current object to ensure that there are no errors. \r\nThis is just an e" + 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."; "rror check, and is not required.";
// //
// label2 // propertyObject
// //
this.label2.Dock = System.Windows.Forms.DockStyle.Top; this.propertyObject.Dock = System.Windows.Forms.DockStyle.Fill;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.propertyObject.Location = new System.Drawing.Point(0, 38);
this.label2.ForeColor = System.Drawing.Color.Silver; this.propertyObject.Name = "propertyObject";
this.label2.Location = new System.Drawing.Point(0, 0); this.propertyObject.Size = new System.Drawing.Size(267, 252);
this.label2.Name = "label2"; this.propertyObject.TabIndex = 8;
this.label2.Size = new System.Drawing.Size(252, 13); this.propertyObject.ToolbarVisible = false;
this.label2.TabIndex = 3;
this.label2.Text = "Object Properties";
//
// flowContainer
//
this.flowContainer.Controls.Add(this.realmExplorer1);
this.flowContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowContainer.Location = new System.Drawing.Point(0, 0);
this.flowContainer.Name = "flowContainer";
this.flowContainer.Size = new System.Drawing.Size(526, 540);
this.flowContainer.TabIndex = 0;
//
// realmExplorer1
//
this.realmExplorer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.realmExplorer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.realmExplorer1.IsSplashVisible = true;
this.realmExplorer1.Location = new System.Drawing.Point(3, 3);
this.realmExplorer1.Name = "realmExplorer1";
this.realmExplorer1.Size = new System.Drawing.Size(526, 0);
this.realmExplorer1.TabIndex = 1;
// //
// Designer // Designer
// //
@ -581,12 +580,13 @@
this.ClientSize = new System.Drawing.Size(784, 564); this.ClientSize = new System.Drawing.Size(784, 564);
this.Controls.Add(this.containerMain); this.Controls.Add(this.containerMain);
this.Controls.Add(this.menuStrip1); this.Controls.Add(this.menuStrip1);
this.IsMdiContainer = true;
this.Name = "Designer"; this.Name = "Designer";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Mud Designer Replacement Test"; this.Text = "Mud Designer Replacement Test";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
this.containerMain.Panel1.ResumeLayout(false);
this.containerMain.Panel2.ResumeLayout(false); this.containerMain.Panel2.ResumeLayout(false);
this.containerMain.ResumeLayout(false); this.containerMain.ResumeLayout(false);
this.containerSidebar.Panel1.ResumeLayout(false); this.containerSidebar.Panel1.ResumeLayout(false);
@ -599,7 +599,6 @@
this.toolStrip1.PerformLayout(); this.toolStrip1.PerformLayout();
this.toolstripObjectProperties.ResumeLayout(false); this.toolstripObjectProperties.ResumeLayout(false);
this.toolstripObjectProperties.PerformLayout(); this.toolstripObjectProperties.PerformLayout();
this.flowContainer.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -652,18 +651,19 @@
private System.Windows.Forms.ToolStripButton btnRefreshObjects; private System.Windows.Forms.ToolStripButton btnRefreshObjects;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripLabel toolStripLabel1; private System.Windows.Forms.ToolStripLabel toolStripLabel1;
private System.Windows.Forms.ToolStripTextBox toolStripTextBox1; private System.Windows.Forms.ToolStripTextBox txtSearch;
private System.Windows.Forms.Label lblObjectProperties;
private System.Windows.Forms.ToolStripMenuItem currencyEditorToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem mnuEditObject;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
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.ToolStrip toolstripObjectProperties;
private System.Windows.Forms.ToolStripButton btnSaveObject; private System.Windows.Forms.ToolStripButton btnSaveObject;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripButton btnValidate; private System.Windows.Forms.ToolStripButton btnValidate;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.PropertyGrid propertyObject;
private System.Windows.Forms.ToolStripMenuItem currencyEditorToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem mnuEditObject;
private System.Windows.Forms.FlowLayoutPanel flowContainer;
private MudDesigner.UIControls.RealmExplorer realmExplorer1;

View file

@ -61,33 +61,8 @@ namespace MudDesigner
private void InstallWidgetRealms(string projectPath) private void InstallWidgetRealms(string projectPath)
{ {
ValidatePath(Path.Combine(projectPath, "Realms")); ValidatePath(Path.Combine(projectPath, "Realms"));
string[] files = Directory.GetFiles(Path.Combine(projectPath, "Realms"), "*.xml"); containerMain.Panel1.Controls.Clear();
containerMain.Panel1.Controls.Add(new UIWidgets.RealmExplorer().InstallControl(projectPath));
if (files.Length == 0)
return;
UninstallWidget();
foreach (string realmFile in files)
{
Realm realm = new Realm();
realm = (Realm)FileManager.Load(realmFile, realm);
Button button = new Button();
button.FlatStyle = FlatStyle.Flat;
button.BackColor = System.Drawing.Color.FromArgb(48,48,48 );
button.Size = new System.Drawing.Size(130,100);
button.Name = "btn" + realm.Name;
button.Text = realm.Name;
flowContainer.Controls.Add(button);
}
}
/// <summary>
/// Uninstalls the currently installed widget
/// </summary>
public void UninstallWidget()
{
flowContainer.Controls.Clear();
} }
private void btnSaveObject_Click(object sender, EventArgs e) private void btnSaveObject_Click(object sender, EventArgs e)
@ -96,7 +71,7 @@ namespace MudDesigner
Type t = propertyObject.SelectedObject.GetType(); Type t = propertyObject.SelectedObject.GetType();
//We can use to get a copy of the currently selected object //We can use to get a copy of the currently selected object
//if it is a BaseObject (Aquire it's BaseObject.Filename) //if it is a BaseObject (Aquire it's BaseObject.Filename)
BaseObject obj = new BaseObject(); var obj = new BaseObject();
//Filepaths //Filepaths
string projectPath = Path.Combine(Application.StartupPath, "Project"); string projectPath = Path.Combine(Application.StartupPath, "Project");
@ -111,7 +86,7 @@ namespace MudDesigner
} }
else if (t == typeof(Currency)) else if (t == typeof(Currency))
{ {
obj = (BaseObject)propertyObject.SelectedObject; obj = (Currency)propertyObject.SelectedObject;
objectPath = Path.Combine(projectPath, "Currencies"); objectPath = Path.Combine(projectPath, "Currencies");
ValidatePath(objectPath); ValidatePath(objectPath);
filename = Path.Combine(objectPath, obj.Filename); filename = Path.Combine(objectPath, obj.Filename);
@ -119,49 +94,93 @@ namespace MudDesigner
} }
else if (t == typeof(Realm)) else if (t == typeof(Realm))
{ {
obj = (BaseObject)propertyObject.SelectedObject; obj = (Realm)propertyObject.SelectedObject;
objectPath = Path.Combine(projectPath, "Realms"); objectPath = Path.Combine(projectPath, "Realms");
ValidatePath(objectPath); objectPath = Path.Combine(objectPath, obj.Name);
filename = Path.Combine(objectPath, obj.Filename); filename = Path.Combine(objectPath, obj.Filename);
objectPath = Path.Combine(objectPath, "Zones");
ValidatePath(objectPath);
FileManager.Save(filename, obj); FileManager.Save(filename, obj);
} }
else if (t == typeof(Zone))
{
Zone zone = (Zone)propertyObject.SelectedObject;
if (string.IsNullOrEmpty(zone.Realm))
{
objectPath = Path.Combine(projectPath, "Zones");
objectPath = Path.Combine(objectPath, zone.Name);
}
else
{
objectPath = Path.Combine(projectPath, "Realms");
objectPath = Path.Combine(objectPath, zone.Realm);
objectPath = Path.Combine(objectPath, "Zones");
objectPath = Path.Combine(objectPath, zone.Name);
filename = Path.Combine(objectPath, zone.Filename);
}
ValidatePath(objectPath);
filename = Path.Combine(objectPath, zone.Filename);
FileManager.Save(filename, zone);
}
btnRefreshObjects_Click(null, null); RefreshProjectExplorer();
} }
private void LoadObject(TreeNode selectedNode) private void LoadObject(TreeNode selectedNode)
{ {
string projectPath = Path.Combine(Application.StartupPath, "Project"); string projectPath = Path.Combine(Application.StartupPath, "Project");
string objectPath = "";
string objectFilename = ""; string objectFilename = "";
if (selectedNode.Text == "Game Objects") if (selectedNode.Text == "Project")
{ {
MessageBox.Show("You cannot edit the Game Object node in the Project Explorer."); MessageBox.Show("You cannot edit the Project node in the Project Explorer.");
return; return;
} }
switch (selectedNode.Parent.Text) //for root objects
if (selectedNode.Parent.Text == "Project")
{ {
case "Game Objects":
if (selectedNode.Text == "Game.xml") if (selectedNode.Text == "Game.xml")
{ {
objectFilename = Path.Combine(projectPath, selectedNode.Text); objectFilename = selectedNode.FullPath;
propertyObject.SelectedObject = (ProjectInformation)FileManager.Load(objectFilename, new ProjectInformation()); ProjectInformation project = new ProjectInformation();
project = (ProjectInformation)FileManager.Load(objectFilename, project);
lblObjectProperties.Text = "Project Properties (" + project.GameTitle + ")";
propertyObject.SelectedObject = project;
} }
break; }
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;
case "Currencies": Realm realm = new Realm();
objectPath = Path.Combine(projectPath, selectedNode.Parent.Text); realm= (Realm)FileManager.Load(objectFilename, realm);
objectFilename = Path.Combine(objectPath, selectedNode.Text); lblObjectProperties.Text = "Realm Properties (" + realm.Name + ")";
propertyObject.SelectedObject = (Currency)FileManager.Load(objectFilename, new Currency()); propertyObject.SelectedObject = realm;
break; }
else if (selectedNode.Parent.Parent.Text == "Zones")
{
//Zone selected already contained within a Realm
objectFilename = selectedNode.FullPath;
case "Realms": //incase a directory was selected instead of a file to be edited.
objectPath = Path.Combine(projectPath, selectedNode.Parent.Text); if (Path.GetExtension(objectFilename) == "")
objectFilename = Path.Combine(objectPath, selectedNode.Text); return;
propertyObject.SelectedObject = (Realm)FileManager.Load(objectFilename, new Realm()); Zone zone = new Zone();
break; zone= (Zone)FileManager.Load(objectFilename, zone);
lblObjectProperties.Text = "Zone Properties (" + zone.Name + ")";
propertyObject.SelectedObject = zone;
} }
} }
@ -172,7 +191,7 @@ namespace MudDesigner
string projectPath = Path.Combine(Application.StartupPath, "Project"); string projectPath = Path.Combine(Application.StartupPath, "Project");
btnRefreshObjects_Click(null, null); RefreshProjectExplorer();
} }
private void PopulateTree(string dir, TreeNode node) private void PopulateTree(string dir, TreeNode node)
@ -195,6 +214,7 @@ namespace MudDesigner
// create a new node // create a new node
TreeNode t = new TreeNode(f.Name); TreeNode t = new TreeNode(f.Name);
// add it to the "master" // add it to the "master"
t.ForeColor = System.Drawing.Color.Blue;
node.Nodes.Add(t); node.Nodes.Add(t);
} }
@ -204,18 +224,12 @@ namespace MudDesigner
private void btnRefreshObjects_Click(object sender, EventArgs e) private void btnRefreshObjects_Click(object sender, EventArgs e)
{ {
treeExplorer.Nodes.Clear(); treeExplorer.Nodes.Clear();
TreeNode node = new TreeNode("Game Objects"); TreeNode node = new TreeNode("Project");
treeExplorer.Nodes.Add(node); treeExplorer.Nodes.Add(node);
string projectPath = Path.Combine(Application.StartupPath, "Project"); string projectPath = Path.Combine(Application.StartupPath, "Project");
PopulateTree(projectPath, node); PopulateTree(projectPath, node);
} }
private void currencyEditorToolStripMenuItem_Click(object sender, EventArgs e)
{
Currency obj = new Currency();
propertyObject.SelectedObject = obj;
}
private void mnuEditObject_Click(object sender, EventArgs e) private void mnuEditObject_Click(object sender, EventArgs e)
{ {
LoadObject(treeExplorer.SelectedNode); LoadObject(treeExplorer.SelectedNode);
@ -230,5 +244,146 @@ namespace MudDesigner
{ {
propertyObject.SelectedObject = new Realm(); 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);
}
} }
} }

View file

@ -121,10 +121,10 @@
<value>19, 12</value> <value>19, 12</value>
</metadata> </metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>710, 17</value> <value>128, 15</value>
</metadata> </metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>417, 17</value> <value>382, 17</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnRefreshObjects.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="btnRefreshObjects.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -143,7 +143,7 @@
</value> </value>
</data> </data>
<metadata name="toolstripObjectProperties.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolstripObjectProperties.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>522, 17</value> <value>678, 16</value>
</metadata> </metadata>
<data name="btnSaveObject.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="btnSaveObject.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
@ -176,7 +176,7 @@
</value> </value>
</data> </data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>320, 17</value> <value>287, 15</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>42</value> <value>42</value>

View file

@ -140,6 +140,13 @@
</Compile> </Compile>
<Compile Include="MudEngine\FileSystem\FileManager.cs" /> <Compile Include="MudEngine\FileSystem\FileManager.cs" />
<Compile Include="MudEngine\GameManagement\QuestSetup.cs" /> <Compile Include="MudEngine\GameManagement\QuestSetup.cs" />
<Compile Include="MudEngine\UITypeEditors\UIRealmControl.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MudEngine\UITypeEditors\UIRealmControl.Designer.cs">
<DependentUpon>UIRealmControl.cs</DependentUpon>
</Compile>
<Compile Include="MudEngine\UITypeEditors\UIRealmEditor.cs" />
<Compile Include="MudEngine\UITypeEditors\UIScriptControl.cs"> <Compile Include="MudEngine\UITypeEditors\UIScriptControl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
@ -184,6 +191,10 @@
<DependentUpon>Designer.cs</DependentUpon> <DependentUpon>Designer.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="MudEngine\UITypeEditors\UIRealmControl.resx">
<DependentUpon>UIRealmControl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="MudEngine\UITypeEditors\UIScriptControl.resx"> <EmbeddedResource Include="MudEngine\UITypeEditors\UIScriptControl.resx">
<DependentUpon>UIScriptControl.cs</DependentUpon> <DependentUpon>UIScriptControl.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@ -193,8 +204,8 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UIControls\RealmExplorer.resx"> <EmbeddedResource Include="UIWidgets\RealmWidget.resx">
<DependentUpon>RealmExplorer.cs</DependentUpon> <DependentUpon>RealmWidget.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
@ -214,11 +225,11 @@
<Compile Include="MudEngine\FileSystem\XmlSerialization.cs" /> <Compile Include="MudEngine\FileSystem\XmlSerialization.cs" />
<Compile Include="Settings.cs" /> <Compile Include="Settings.cs" />
<Compile Include="MudEngine\UITypeEditors\UIScriptEditor.cs" /> <Compile Include="MudEngine\UITypeEditors\UIScriptEditor.cs" />
<Compile Include="UIControls\RealmExplorer.cs"> <Compile Include="UIWidgets\RealmWidget.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="UIControls\RealmExplorer.Designer.cs"> <Compile Include="UIWidgets\RealmWidget.Designer.cs">
<DependentUpon>RealmExplorer.cs</DependentUpon> <DependentUpon>RealmWidget.cs</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO;
namespace MudDesigner.MudEngine.FileSystem namespace MudDesigner.MudEngine.FileSystem
{ {
@ -121,5 +122,7 @@ namespace MudDesigner.MudEngine.FileSystem
{ {
return System.IO.Path.Combine(GetDataPath(Realm, Zone), Room); return System.IO.Path.Combine(GetDataPath(Realm, Zone), Room);
} }
//TODO Write CopyDirectory method.
} }
} }

View file

@ -24,7 +24,7 @@ namespace MudDesigner.MudEngine.GameObjects
set set
{ {
this._Name = value; this._Name = value;
this.Filename = value + ".xml"; this.Filename = value + "." + this.GetType().Name;
} }
} }
@ -50,7 +50,7 @@ namespace MudDesigner.MudEngine.GameObjects
} }
set set
{ {
string extension = ".xml"; string extension = "." + this.GetType().Name;
if (!value.EndsWith(extension)) if (!value.EndsWith(extension))
value += extension; value += extension;
@ -91,7 +91,7 @@ namespace MudDesigner.MudEngine.GameObjects
{ {
Script = ""; Script = "";
_Name = "New " + this.GetType().Name; _Name = "New " + this.GetType().Name;
_Filename = _Name + ".xml"; _Filename = _Name + "." + this.GetType().Name;
this.Feel = "You feel nothing."; this.Feel = "You feel nothing.";
this.Listen = "You hear nothing of interest."; this.Listen = "You hear nothing of interest.";

View file

@ -7,12 +7,15 @@ using System.ComponentModel;
using MudDesigner.MudEngine.FileSystem; using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameObjects; using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.UITypeEditors;
namespace MudDesigner.MudEngine.GameObjects.Environment namespace MudDesigner.MudEngine.GameObjects.Environment
{ {
public class Realm : BaseObject public class Realm : BaseObject
{ {
[Browsable(false)]
[Category("Realm Information")]
[EditorAttribute(typeof(UIRealmEditor), typeof(System.Drawing.Design.UITypeEditor))]
public List<string> Zones { get; set; } public List<string> Zones { get; set; }
public Realm() public Realm()

View file

@ -0,0 +1,155 @@
namespace MudDesigner.MudEngine.UITypeEditors
{
partial class UIRealmControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.label1 = new System.Windows.Forms.Label();
this.lstRealmMembers = new System.Windows.Forms.ListBox();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.viewPropertiesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.lstAvailableZones = new System.Windows.Forms.ListBox();
this.label2 = new System.Windows.Forms.Label();
this.btnAdd = new System.Windows.Forms.Button();
this.btnRemove = new System.Windows.Forms.Button();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.Silver;
this.label1.Location = new System.Drawing.Point(-1, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(96, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Realm Members";
//
// lstRealmMembers
//
this.lstRealmMembers.ContextMenuStrip = this.contextMenuStrip1;
this.lstRealmMembers.FormattingEnabled = true;
this.lstRealmMembers.Location = new System.Drawing.Point(2, 21);
this.lstRealmMembers.Name = "lstRealmMembers";
this.lstRealmMembers.Size = new System.Drawing.Size(160, 238);
this.lstRealmMembers.TabIndex = 1;
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.viewPropertiesToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(156, 26);
//
// viewPropertiesToolStripMenuItem
//
this.viewPropertiesToolStripMenuItem.Name = "viewPropertiesToolStripMenuItem";
this.viewPropertiesToolStripMenuItem.Size = new System.Drawing.Size(155, 22);
this.viewPropertiesToolStripMenuItem.Text = "View Properties";
//
// lstAvailableZones
//
this.lstAvailableZones.ContextMenuStrip = this.contextMenuStrip1;
this.lstAvailableZones.FormattingEnabled = true;
this.lstAvailableZones.Location = new System.Drawing.Point(237, 21);
this.lstAvailableZones.Name = "lstAvailableZones";
this.lstAvailableZones.Size = new System.Drawing.Size(160, 238);
this.lstAvailableZones.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.Color.Silver;
this.label2.Location = new System.Drawing.Point(234, 5);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(98, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Available Zones";
//
// btnAdd
//
this.btnAdd.Location = new System.Drawing.Point(165, 31);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(66, 35);
this.btnAdd.TabIndex = 4;
this.btnAdd.Text = "<<<";
this.btnAdd.UseVisualStyleBackColor = true;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnRemove
//
this.btnRemove.Location = new System.Drawing.Point(165, 72);
this.btnRemove.Name = "btnRemove";
this.btnRemove.Size = new System.Drawing.Size(66, 35);
this.btnRemove.TabIndex = 5;
this.btnRemove.Text = ">>>";
this.btnRemove.UseVisualStyleBackColor = true;
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
//
// UIRealmControl
//
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(403, 268);
this.Controls.Add(this.btnRemove);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.lstAvailableZones);
this.Controls.Add(this.label2);
this.Controls.Add(this.lstRealmMembers);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "UIRealmControl";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Zone Collection Editor";
this.Load += new System.EventHandler(this.UIRealmControl_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UIRealmControl_FormClosing);
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ListBox lstRealmMembers;
private System.Windows.Forms.ListBox lstAvailableZones;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Button btnRemove;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem viewPropertiesToolStripMenuItem;
}
}

View file

@ -0,0 +1,197 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
using MudDesigner.MudEngine.GameManagement;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.GameObjects.Environment;
using MudDesigner.MudEngine.FileSystem;
namespace MudDesigner.MudEngine.UITypeEditors
{
public partial class UIRealmControl : Form
{
private Realm _Realm;
private string realmPath = "";
string projectPath = "";
private List<string> zones;
public List<string> Zones
{
get
{
return zones;
}
}
public UIRealmControl(Realm realm)
{
InitializeComponent();
_Realm = realm;
zones = new List<string>();
projectPath = Path.Combine(Application.StartupPath, "Project");
realmPath = Path.Combine(projectPath, "Realms");
realmPath = Path.Combine(realmPath, _Realm.Name);
string realmZones = Path.Combine(realmPath, "Zones");
if (!Directory.Exists(realmZones))
{
MessageBox.Show("You must save the Realm prior to adding Zones to it.", "Mud Designer");
this.Close();
}
foreach (string zone in _Realm.Zones)
{
zones.Add(zone);
}
}
private void UIRealmControl_Load(object sender, EventArgs e)
{
string zonePath = Path.Combine(projectPath, "Zones");
foreach (string zone in _Realm.Zones)
{
lstRealmMembers.Items.Add(zone);
}
string[] zones = Directory.GetFiles(zonePath, "*.zone", SearchOption.AllDirectories);
foreach (string zone in zones)
{
Zone z = new Zone();
z = (Zone)FileManager.Load(zone, z);
lstAvailableZones.Items.Add(z.Filename);
}
}
private void btnAdd_Click(object sender, EventArgs e)
{
if (lstAvailableZones.SelectedIndex == -1)
{
MessageBox.Show("Select a Zone to add first!", "Mud Designer");
return;
}
Zone zone = new Zone();
//Set the paths
string zoneRoot = Path.Combine(projectPath, "Zones");
string realmZones = Path.Combine(realmPath, "Zones");
string[] files = Directory.GetFiles(zoneRoot, "*.zone", SearchOption.AllDirectories);
string originalFile = "";
if (files.Length == 0)
zone = null;
foreach (string file in files)
{
if (Path.GetFileName(file) == lstAvailableZones.SelectedItem.ToString())
{
zone = (Zone)FileManager.Load(file, zone);
originalFile = file;
zone.Realm = _Realm.Name;
FileManager.Save(file, zone);
}
else
zone = null;
}
//check if we have a zone
if (zone == null)
{
MessageBox.Show("Unable to locate the zone specified!", "Mud Designer");
return;
}
//get the new path for the zone within the realm directory
string zonePath = Path.Combine(realmZones, zone.Name);
if (!Directory.Exists(zonePath))
Directory.CreateDirectory(zonePath);
zones.Add(lstAvailableZones.SelectedItem.ToString());
lstRealmMembers.Items.Add(lstAvailableZones.SelectedItem);
//copy the file
string newFile = Path.Combine(zonePath, lstAvailableZones.SelectedItem.ToString());
File.Copy(originalFile, newFile, true);
File.Delete(originalFile);
Directory.Delete(Path.Combine(zoneRoot, zone.Name), true);
lstAvailableZones.Items.Remove(lstAvailableZones.SelectedItem);
}
private void UIRealmControl_FormClosing(object sender, FormClosingEventArgs e)
{
Designer form = (Designer)Program.CurrentEditor;
form.SaveSelected();
}
private void btnRemove_Click(object sender, EventArgs e)
{
if (lstRealmMembers.SelectedIndex == -1)
{
MessageBox.Show("You will need to select a Zone to remove from this Realm first.", "Mud Designer");
return;
}
string projectPath = Path.Combine(Application.StartupPath, "Project");
string realmPath = Path.Combine(projectPath, "Realms");
string realmRoot = Path.Combine(realmPath, _Realm.Name);
string[] zones = Directory.GetFiles(realmRoot, "*.zone", SearchOption.AllDirectories);
//Find the zone that we need to remove from the realm
foreach(string zone in zones)
{
Zone z = new Zone();
z = (Zone)FileManager.Load(zone, z);
//We found the zone, remove it from the realm
//the zone file gets placed back in the Zones directory
//now that it is no longer part of a realm
if (z.Filename == lstRealmMembers.SelectedItem.ToString())
{
_Realm.Zones.Remove(z.Filename);
string zonePath = Path.Combine(projectPath, "Zones");
string zoneRoot = Path.Combine(zonePath, z.Name);
string newFile = Path.Combine(zoneRoot, Path.GetFileName(zone));
if (!Directory.Exists(zoneRoot))
Directory.CreateDirectory(zoneRoot);
//Copy all of the rooms assigned to this zone.
string oldZonePath = Path.GetFullPath(zone).Substring(0, Path.GetFullPath(zone).Length - Path.GetFileName(zone).Length);
if (Directory.Exists(Path.Combine(oldZonePath, "Rooms")))
{
if (!Directory.Exists(Path.Combine(zoneRoot, "Rooms")))
Directory.CreateDirectory(Path.Combine(zoneRoot, "Rooms"));
string[] rooms = Directory.GetFiles(Path.Combine(oldZonePath, "Rooms"), "*.room");
foreach (string room in rooms)
{
string roomFile = Path.Combine(zoneRoot, "Rooms");
roomFile = Path.Combine(roomFile, Path.GetFileName(room));
File.Copy(room, roomFile);
File.Delete(room);
}
}
//finally copy the zone file
File.Copy(zone, newFile);
File.Delete(zone);
Directory.Delete(oldZonePath, true);
lstRealmMembers.Items.Remove(lstRealmMembers.SelectedItem);
break;
}
}
}
}
}

View file

@ -117,4 +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="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

View file

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.GameObjects.Environment;
using System.Windows.Forms;
namespace MudDesigner.MudEngine.UITypeEditors
{
public class UIRealmEditor : System.Drawing.Design.UITypeEditor
{
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
{
Realm obj = (Realm)context.Instance;
List<string> zones = new List<string>();
UIRealmControl ctl = new UIRealmControl(obj);
if (ctl.IsDisposed)
//return the previous zones collection, incase the control error'd out
//we aren't overriding and loosing content.
return obj.Zones;
ctl.ShowDialog();
while (ctl.Created)
{
Application.DoEvents();
}
if (Program.CurrentEditor is Designer)
{
Designer form = (Designer)Program.CurrentEditor;
form.RefreshProjectExplorer();
}
return ctl.Zones;
/*
if (Program.CurrentEditor is Designer)
{
UIRealmControl control = new UIRealmControl();
control.Dock = DockStyle.Fill;
Designer frm = (Designer)Program.CurrentEditor;
//frm.ControlContainer.Panel1.Controls.Clear();
//frm.ControlContainer.Panel1.Controls.Add(control);
string script = "";
while (control.Created)
{
//if (!frm.ControlContainer.Panel1.Controls.Contains(control))
//break;
Application.DoEvents();
}
control = null;
frm = null;
return script;
}
return null;
* */
}
public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return System.Drawing.Design.UITypeEditorEditStyle.Modal;
}
}
}

View file

@ -55,7 +55,8 @@ namespace MudDesigner
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
//Run the toolkit //Run the toolkit
Application.Run(new MudDesigner.Editors.ToolkitLauncher()); CurrentEditor = new Designer();
Application.Run(CurrentEditor);
} }
} }
} }

View file

@ -1,66 +0,0 @@
namespace MudDesigner.UIControls
{
partial class RealmExplorer
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnSplash = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnSplash
//
this.btnSplash.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnSplash.FlatAppearance.BorderColor = System.Drawing.Color.Silver;
this.btnSplash.FlatAppearance.BorderSize = 2;
this.btnSplash.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.btnSplash.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.btnSplash.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSplash.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnSplash.Location = new System.Drawing.Point(0, 0);
this.btnSplash.Name = "btnSplash";
this.btnSplash.Size = new System.Drawing.Size(537, 502);
this.btnSplash.TabIndex = 0;
this.btnSplash.Text = "No Realms Available";
this.btnSplash.UseVisualStyleBackColor = true;
//
// RealmExplorer
//
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.Controls.Add(this.btnSplash);
this.Name = "RealmExplorer";
this.Size = new System.Drawing.Size(537, 502);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnSplash;
}
}

View file

@ -1,35 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MudDesigner.UIControls
{
public partial class RealmExplorer : UserControl
{
public bool IsSplashVisible
{
set
{
if (value == true)
btnSplash.Visible = true;
else
btnSplash.Visible = false;
}
get
{
return btnSplash.Visible;
}
}
public RealmExplorer()
{
InitializeComponent();
this.Dock = DockStyle.Fill;
}
}
}