- Corrected SaveDataTypes.Currency being named incorrectly. Changed to Currencies
 - ProjectInformation now inherits from the new IFileIO interface.
 - ProjectInformation.Load can be used instead of the FileManager now (note: Saving of ProjectInformation must still be done using FileManager)
 - Organizing of BaseObject done
 - BaseObject now supports BaseObject.Load. Use this instead of FileManager.Load
 - Fixed UIRealmControl error, attempting to deserialize into a null Zone Field
 - Program.cs is now encapsulated into a try/catch
 - IFileIO interface added for providing a blueprint on file I/O operations

Designer:
 - Additional ObjectTypes added to the ObjectTypes enum
 - Additional commenting provided throughout the source.
 - Re-organized the source code.
 - Simplified the Constructor code. Roughly 50% less code now.
 - Re-wrote the Object Load code to make it easier to read and maintain.
 - Renamed several menu items to conform to the projects naming conventions
This commit is contained in:
Scionwest_cp 2010-01-17 18:58:26 -08:00
parent 9311435007
commit afd74530cd
47 changed files with 4530 additions and 0 deletions

648
Mud Designer/Designer.Designer.cs generated Normal file
View file

@ -0,0 +1,648 @@
namespace MudDesigner
{
partial class Designer
{
/// <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();
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();
this.mnuExit = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEdit = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDuplicateObject = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDelete = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
this.mnuSearch = new System.Windows.Forms.ToolStripMenuItem();
this.findObjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.byNameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.byDescriptionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.byFilenameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.byTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.findInTextToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
this.mnuPreferences = new System.Windows.Forms.ToolStripMenuItem();
this.mnuProject = new System.Windows.Forms.ToolStripMenuItem();
this.mnuGameManagement = 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.mnuGameObjects = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEnvironments = new System.Windows.Forms.ToolStripMenuItem();
this.mnuRealmEditor = new System.Windows.Forms.ToolStripMenuItem();
this.mnuZoneBuilder = new System.Windows.Forms.ToolStripMenuItem();
this.mnuNewRoom = 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();
this.compileScriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator();
this.objectRepositoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.testProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.freshLoginToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.customCharacterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.playFromCurrentRoomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuHelp = new System.Windows.Forms.ToolStripMenuItem();
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
this.containerMain = new System.Windows.Forms.SplitContainer();
this.containerSidebar = new System.Windows.Forms.SplitContainer();
this.treeExplorer = new System.Windows.Forms.TreeView();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mnuEditObject = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.mnuDeleteSelectedObject = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.btnRefreshObjects = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.txtSearch = new System.Windows.Forms.ToolStripTextBox();
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.menuStrip1.SuspendLayout();
this.containerMain.Panel2.SuspendLayout();
this.containerMain.SuspendLayout();
this.containerSidebar.Panel1.SuspendLayout();
this.containerSidebar.Panel2.SuspendLayout();
this.containerSidebar.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuFile,
this.mnuEdit,
this.mnuProject,
this.mnuHelp});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(784, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// mnuFile
//
this.mnuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuExit});
this.mnuFile.Name = "mnuFile";
this.mnuFile.Size = new System.Drawing.Size(37, 20);
this.mnuFile.Text = "File";
//
// mnuExit
//
this.mnuExit.Name = "mnuExit";
this.mnuExit.Size = new System.Drawing.Size(92, 22);
this.mnuExit.Text = "Exit";
this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);
//
// mnuEdit
//
this.mnuEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuDuplicateObject,
this.mnuDelete,
this.toolStripMenuItem3,
this.mnuSearch,
this.toolStripMenuItem4,
this.mnuPreferences});
this.mnuEdit.Enabled = false;
this.mnuEdit.Name = "mnuEdit";
this.mnuEdit.Size = new System.Drawing.Size(39, 20);
this.mnuEdit.Text = "Edit";
//
// mnuDuplicateObject
//
this.mnuDuplicateObject.Name = "mnuDuplicateObject";
this.mnuDuplicateObject.Size = new System.Drawing.Size(162, 22);
this.mnuDuplicateObject.Text = "Duplicate Object";
//
// mnuDelete
//
this.mnuDelete.Name = "mnuDelete";
this.mnuDelete.Size = new System.Drawing.Size(162, 22);
this.mnuDelete.Text = "Delete";
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(159, 6);
//
// mnuSearch
//
this.mnuSearch.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.findObjectToolStripMenuItem,
this.findInTextToolStripMenuItem});
this.mnuSearch.Name = "mnuSearch";
this.mnuSearch.Size = new System.Drawing.Size(162, 22);
this.mnuSearch.Text = "Search";
//
// findObjectToolStripMenuItem
//
this.findObjectToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.byNameToolStripMenuItem,
this.byDescriptionToolStripMenuItem,
this.byFilenameToolStripMenuItem,
this.byTypeToolStripMenuItem});
this.findObjectToolStripMenuItem.Name = "findObjectToolStripMenuItem";
this.findObjectToolStripMenuItem.Size = new System.Drawing.Size(135, 22);
this.findObjectToolStripMenuItem.Text = "Find Object";
//
// byNameToolStripMenuItem
//
this.byNameToolStripMenuItem.Name = "byNameToolStripMenuItem";
this.byNameToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.byNameToolStripMenuItem.Text = "By Name";
//
// byDescriptionToolStripMenuItem
//
this.byDescriptionToolStripMenuItem.Name = "byDescriptionToolStripMenuItem";
this.byDescriptionToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.byDescriptionToolStripMenuItem.Text = "By Description";
//
// byFilenameToolStripMenuItem
//
this.byFilenameToolStripMenuItem.Name = "byFilenameToolStripMenuItem";
this.byFilenameToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.byFilenameToolStripMenuItem.Text = "By Filename";
//
// byTypeToolStripMenuItem
//
this.byTypeToolStripMenuItem.Name = "byTypeToolStripMenuItem";
this.byTypeToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.byTypeToolStripMenuItem.Text = "By Type";
//
// findInTextToolStripMenuItem
//
this.findInTextToolStripMenuItem.Name = "findInTextToolStripMenuItem";
this.findInTextToolStripMenuItem.Size = new System.Drawing.Size(135, 22);
this.findInTextToolStripMenuItem.Text = "Find Text";
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(159, 6);
//
// mnuPreferences
//
this.mnuPreferences.Name = "mnuPreferences";
this.mnuPreferences.Size = new System.Drawing.Size(162, 22);
this.mnuPreferences.Text = "Preferences";
//
// mnuProject
//
this.mnuProject.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuGameManagement,
this.mnuGameObjects,
this.customObjectsToolStripMenuItem,
this.toolStripMenuItem5,
this.compileScriptToolStripMenuItem,
this.toolStripMenuItem6,
this.objectRepositoryToolStripMenuItem,
this.testProjectToolStripMenuItem});
this.mnuProject.Name = "mnuProject";
this.mnuProject.Size = new System.Drawing.Size(56, 20);
this.mnuProject.Text = "Project";
//
// mnuGameManagement
//
this.mnuGameManagement.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuProjectInformation,
this.toolStripMenuItem2,
this.currencyEditorToolStripMenuItem,
this.mnuQuestBuilder});
this.mnuGameManagement.Name = "mnuGameManagement";
this.mnuGameManagement.Size = new System.Drawing.Size(179, 22);
this.mnuGameManagement.Text = "Game Management";
//
// mnuProjectInformation
//
this.mnuProjectInformation.Name = "mnuProjectInformation";
this.mnuProjectInformation.Size = new System.Drawing.Size(159, 22);
this.mnuProjectInformation.Text = "Project Settings";
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.mnuNewCurrency_Click);
//
// mnuQuestBuilder
//
this.mnuQuestBuilder.Enabled = false;
this.mnuQuestBuilder.Name = "mnuQuestBuilder";
this.mnuQuestBuilder.Size = new System.Drawing.Size(159, 22);
this.mnuQuestBuilder.Text = "Quest Builder";
//
// mnuGameObjects
//
this.mnuGameObjects.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuEnvironments,
this.mnuItems});
this.mnuGameObjects.Name = "mnuGameObjects";
this.mnuGameObjects.Size = new System.Drawing.Size(179, 22);
this.mnuGameObjects.Text = "Game Objects";
//
// mnuEnvironments
//
this.mnuEnvironments.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuRealmEditor,
this.mnuZoneBuilder,
this.mnuNewRoom});
this.mnuEnvironments.Name = "mnuEnvironments";
this.mnuEnvironments.Size = new System.Drawing.Size(147, 22);
this.mnuEnvironments.Text = "Environments";
//
// mnuRealmEditor
//
this.mnuRealmEditor.Name = "mnuRealmEditor";
this.mnuRealmEditor.Size = new System.Drawing.Size(134, 22);
this.mnuRealmEditor.Text = "New Realm";
this.mnuRealmEditor.Click += new System.EventHandler(this.mnuNewRealm_Click);
//
// mnuZoneBuilder
//
this.mnuZoneBuilder.Name = "mnuZoneBuilder";
this.mnuZoneBuilder.Size = new System.Drawing.Size(134, 22);
this.mnuZoneBuilder.Text = "New Zone";
this.mnuZoneBuilder.Click += new System.EventHandler(this.mnuNewZone_Click);
//
// mnuNewRoom
//
this.mnuNewRoom.Name = "mnuNewRoom";
this.mnuNewRoom.Size = new System.Drawing.Size(134, 22);
this.mnuNewRoom.Text = "New Room";
this.mnuNewRoom.Click += new System.EventHandler(this.mnuNewRoom_Click);
//
// mnuItems
//
this.mnuItems.Enabled = false;
this.mnuItems.Name = "mnuItems";
this.mnuItems.Size = new System.Drawing.Size(147, 22);
this.mnuItems.Text = "Items";
//
// customObjectsToolStripMenuItem
//
this.customObjectsToolStripMenuItem.Enabled = false;
this.customObjectsToolStripMenuItem.Name = "customObjectsToolStripMenuItem";
this.customObjectsToolStripMenuItem.Size = new System.Drawing.Size(179, 22);
this.customObjectsToolStripMenuItem.Text = "Custom Objects";
//
// toolStripMenuItem5
//
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
this.toolStripMenuItem5.Size = new System.Drawing.Size(176, 6);
//
// compileScriptToolStripMenuItem
//
this.compileScriptToolStripMenuItem.Enabled = false;
this.compileScriptToolStripMenuItem.Name = "compileScriptToolStripMenuItem";
this.compileScriptToolStripMenuItem.Size = new System.Drawing.Size(179, 22);
this.compileScriptToolStripMenuItem.Text = "Compile Script";
//
// toolStripMenuItem6
//
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(176, 6);
//
// objectRepositoryToolStripMenuItem
//
this.objectRepositoryToolStripMenuItem.Enabled = false;
this.objectRepositoryToolStripMenuItem.Name = "objectRepositoryToolStripMenuItem";
this.objectRepositoryToolStripMenuItem.Size = new System.Drawing.Size(179, 22);
this.objectRepositoryToolStripMenuItem.Text = "Object Repository";
//
// testProjectToolStripMenuItem
//
this.testProjectToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.freshLoginToolStripMenuItem,
this.customCharacterToolStripMenuItem,
this.playFromCurrentRoomToolStripMenuItem});
this.testProjectToolStripMenuItem.Enabled = false;
this.testProjectToolStripMenuItem.Name = "testProjectToolStripMenuItem";
this.testProjectToolStripMenuItem.Size = new System.Drawing.Size(179, 22);
this.testProjectToolStripMenuItem.Text = "Test Project";
//
// freshLoginToolStripMenuItem
//
this.freshLoginToolStripMenuItem.Name = "freshLoginToolStripMenuItem";
this.freshLoginToolStripMenuItem.Size = new System.Drawing.Size(205, 22);
this.freshLoginToolStripMenuItem.Text = "Fresh Login";
//
// customCharacterToolStripMenuItem
//
this.customCharacterToolStripMenuItem.Name = "customCharacterToolStripMenuItem";
this.customCharacterToolStripMenuItem.Size = new System.Drawing.Size(205, 22);
this.customCharacterToolStripMenuItem.Text = "Custom Character";
//
// playFromCurrentRoomToolStripMenuItem
//
this.playFromCurrentRoomToolStripMenuItem.Name = "playFromCurrentRoomToolStripMenuItem";
this.playFromCurrentRoomToolStripMenuItem.Size = new System.Drawing.Size(205, 22);
this.playFromCurrentRoomToolStripMenuItem.Text = "Play From Current Room";
//
// mnuHelp
//
this.mnuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuAbout});
this.mnuHelp.Name = "mnuHelp";
this.mnuHelp.Size = new System.Drawing.Size(44, 20);
this.mnuHelp.Text = "Help";
//
// mnuAbout
//
this.mnuAbout.Name = "mnuAbout";
this.mnuAbout.Size = new System.Drawing.Size(107, 22);
this.mnuAbout.Text = "About";
this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click);
//
// containerMain
//
this.containerMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.containerMain.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.containerMain.Location = new System.Drawing.Point(0, 24);
this.containerMain.Name = "containerMain";
//
// containerMain.Panel2
//
this.containerMain.Panel2.Controls.Add(this.containerSidebar);
this.containerMain.Size = new System.Drawing.Size(784, 540);
this.containerMain.SplitterDistance = 511;
this.containerMain.TabIndex = 1;
//
// containerSidebar
//
this.containerSidebar.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.containerSidebar.Dock = System.Windows.Forms.DockStyle.Fill;
this.containerSidebar.Location = new System.Drawing.Point(0, 0);
this.containerSidebar.Name = "containerSidebar";
this.containerSidebar.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// containerSidebar.Panel1
//
this.containerSidebar.Panel1.Controls.Add(this.treeExplorer);
this.containerSidebar.Panel1.Controls.Add(this.toolStrip1);
this.containerSidebar.Panel1.Controls.Add(this.label1);
//
// containerSidebar.Panel2
//
this.containerSidebar.Panel2.Controls.Add(this.propertyObject);
this.containerSidebar.Panel2.Controls.Add(this.lblObjectProperties);
this.containerSidebar.Size = new System.Drawing.Size(269, 540);
this.containerSidebar.SplitterDistance = 244;
this.containerSidebar.TabIndex = 0;
//
// treeExplorer
//
this.treeExplorer.ContextMenuStrip = this.contextMenuStrip1;
this.treeExplorer.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeExplorer.Location = new System.Drawing.Point(0, 38);
this.treeExplorer.Name = "treeExplorer";
treeNode1.Name = "nodeProject";
treeNode1.Text = "Project";
this.treeExplorer.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
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
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuEditObject,
this.toolStripMenuItem1,
this.mnuDeleteSelectedObject});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(153, 76);
//
// mnuEditObject
//
this.mnuEditObject.Name = "mnuEditObject";
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(149, 6);
//
// mnuDeleteSelectedObject
//
this.mnuDeleteSelectedObject.Name = "mnuDeleteSelectedObject";
this.mnuDeleteSelectedObject.Size = new System.Drawing.Size(152, 22);
this.mnuDeleteSelectedObject.Text = "Delete Object";
this.mnuDeleteSelectedObject.Click += new System.EventHandler(this.mnuDeleteSelectedObject_Click);
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnRefreshObjects,
this.toolStripSeparator2,
this.toolStripLabel1,
this.txtSearch});
this.toolStrip1.Location = new System.Drawing.Point(0, 13);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(267, 25);
this.toolStrip1.TabIndex = 4;
this.toolStrip1.Text = "toolStrip1";
//
// btnRefreshObjects
//
this.btnRefreshObjects.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.btnRefreshObjects.Image = ((System.Drawing.Image)(resources.GetObject("btnRefreshObjects.Image")));
this.btnRefreshObjects.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnRefreshObjects.Name = "btnRefreshObjects";
this.btnRefreshObjects.Size = new System.Drawing.Size(93, 22);
this.btnRefreshObjects.Text = "Refresh Objects";
this.btnRefreshObjects.ToolTipText = "Save the current object";
this.btnRefreshObjects.Click += new System.EventHandler(this.btnRefreshObjects_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
// toolStripLabel1
//
this.toolStripLabel1.Name = "toolStripLabel1";
this.toolStripLabel1.Size = new System.Drawing.Size(33, 22);
this.toolStripLabel1.Text = "Find:";
//
// txtSearch
//
this.txtSearch.Name = "txtSearch";
this.txtSearch.Size = new System.Drawing.Size(100, 25);
this.txtSearch.Enter += new System.EventHandler(this.txtSearch_Enter);
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
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(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(267, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Project Explorer";
//
// propertyObject
//
this.propertyObject.Dock = System.Windows.Forms.DockStyle.Fill;
this.propertyObject.Location = new System.Drawing.Point(0, 13);
this.propertyObject.Name = "propertyObject";
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);
//
// lblObjectProperties
//
this.lblObjectProperties.Dock = System.Windows.Forms.DockStyle.Top;
this.lblObjectProperties.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblObjectProperties.ForeColor = System.Drawing.Color.Silver;
this.lblObjectProperties.Location = new System.Drawing.Point(0, 0);
this.lblObjectProperties.Name = "lblObjectProperties";
this.lblObjectProperties.Size = new System.Drawing.Size(267, 13);
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);
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(784, 564);
this.Controls.Add(this.containerMain);
this.Controls.Add(this.menuStrip1);
this.IsMdiContainer = true;
this.Name = "Designer";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Mud Designer";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.containerMain.Panel2.ResumeLayout(false);
this.containerMain.ResumeLayout(false);
this.containerSidebar.Panel1.ResumeLayout(false);
this.containerSidebar.Panel1.PerformLayout();
this.containerSidebar.Panel2.ResumeLayout(false);
this.containerSidebar.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem mnuFile;
private System.Windows.Forms.ToolStripMenuItem mnuExit;
private System.Windows.Forms.ToolStripMenuItem mnuEdit;
private System.Windows.Forms.ToolStripMenuItem mnuDuplicateObject;
private System.Windows.Forms.ToolStripMenuItem mnuDelete;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
private System.Windows.Forms.ToolStripMenuItem mnuSearch;
private System.Windows.Forms.ToolStripMenuItem findObjectToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem byNameToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem byDescriptionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem byFilenameToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem byTypeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem findInTextToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
private System.Windows.Forms.ToolStripMenuItem mnuPreferences;
private System.Windows.Forms.ToolStripMenuItem mnuHelp;
private System.Windows.Forms.ToolStripMenuItem mnuAbout;
private System.Windows.Forms.ToolStripMenuItem mnuProject;
private System.Windows.Forms.ToolStripMenuItem mnuGameManagement;
private System.Windows.Forms.ToolStripMenuItem mnuQuestBuilder;
private System.Windows.Forms.ToolStripMenuItem mnuProjectInformation;
private System.Windows.Forms.ToolStripMenuItem mnuGameObjects;
private System.Windows.Forms.ToolStripMenuItem mnuEnvironments;
private System.Windows.Forms.ToolStripMenuItem mnuItems;
private System.Windows.Forms.ToolStripMenuItem mnuRealmEditor;
private System.Windows.Forms.ToolStripMenuItem mnuZoneBuilder;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem5;
private System.Windows.Forms.ToolStripMenuItem compileScriptToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem6;
private System.Windows.Forms.ToolStripMenuItem testProjectToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem freshLoginToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem customCharacterToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem playFromCurrentRoomToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem objectRepositoryToolStripMenuItem;
private System.Windows.Forms.SplitContainer containerMain;
private System.Windows.Forms.SplitContainer containerSidebar;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.ToolStripMenuItem customObjectsToolStripMenuItem;
private System.Windows.Forms.TreeView treeExplorer;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton btnRefreshObjects;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripLabel toolStripLabel1;
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 mnuDeleteSelectedObject;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
private System.Windows.Forms.PropertyGrid propertyObject;
private System.Windows.Forms.ToolStripMenuItem mnuNewRoom;
}
}

582
Mud Designer/Designer.cs Normal file
View file

@ -0,0 +1,582 @@
//.NET
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Text;
using System.Windows.Forms;
//Mud Designer
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameManagement;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.GameObjects.Environment;
using MudDesigner.MudEngine.GameObjects.Items;
using MudDesigner.UIWidgets;
namespace MudDesigner
{
public partial class Designer : Form
{
//The available object types that we can scan through
//while loading objects
enum ObjectType
{
Nothing,
Project,
Currency,
Realm,
ZoneRoot,
ZoneWithinRealm,
RoomRoot,
RoomWithinZone,
Zone,
Room,
}
//Currently loaded project
ProjectInformation _Project;
//Used for temporarily holding an object during load.
BaseObject _GameObject;
//Check for if the loaded object is saved yet or not.
bool IsSaved;
/// <summary>
/// Initializes the Designers Temporary objects, Project Information and varifies project paths.
/// </summary>
public Designer()
{
InitializeComponent();
//instance a baseObject so that we can store inherited classes
//for use during our runtime
_GameObject = new BaseObject();
_Project = new ProjectInformation();
IsSaved = true;
//Get out saved project file
string projectPath = FileManager.GetDataPath(SaveDataTypes.Root);
if (File.Exists(Path.Combine(projectPath, _Project.Filename)))
_Project = (ProjectInformation)_Project.Load(projectPath);
//ensure the path exists
ValidatePath(projectPath);
}
/// <summary>
/// Checks the provided treenode to see what Type of object it is.
/// The result is returned for use. This method is only useful for
/// Files that have been selected in the designer.
/// </summary>
/// <param name="node"></param>
/// <returns></returns>
private ObjectType GetNodeType(TreeNode node)
{
try
{
//The provided nodes parent node is aquired so we can
//find if we can get it's current type.
TreeNode parentNode = node.Parent;
//switch is only for ProjectInfo, Currency, un-owned Zones & Rooms
switch (parentNode.Text)
{
case "Project":
if (node.Text == _Project.Filename)
return ObjectType.Project;
break;
case "Currencies":
return ObjectType.Currency;
}
//Basic Root items where not found, do a deeper search now.
//Find Realms, owned Zones & owned Rooms
TreeNode grandparentNode = new TreeNode();
if (parentNode.Parent != null)
grandparentNode = parentNode.Parent;
switch (grandparentNode.Text)
{
case "Realms":
return ObjectType.Realm;
//Root Zones
case "Zones":
if (grandparentNode.Parent.Text == "Project")
return ObjectType.ZoneRoot;
else
return ObjectType.ZoneWithinRealm;
}
}
//Something happened, handle it with a message box.
catch (Exception ex)
{
MessageBox.Show("Internal Error: " + ex.Message);
}
return ObjectType.Nothing;
}
/// <summary>
/// Searchs to find what Type the selected TreeNode is, and loads
/// that objects into the propertygrid.
/// </summary>
/// <param name="selectedNode"></param>
private void LoadObject(TreeNode selectedNode)
{
///Method Fields we will need to use
string projectPath = FileManager.GetDataPath(SaveDataTypes.Root);
string objectFilename = "";
string objectPath = "";
string objectName = "";
string parentName = "";
ObjectType objType = GetNodeType(selectedNode);
//for root objects
switch (objType)
{
case ObjectType.Nothing:
return;
case ObjectType.Project:
_Project = (ProjectInformation)_Project.Load(FileManager.GetDataPath(SaveDataTypes.Root));
break;
case ObjectType.Currency:
Currency currency = new Currency();
objectFilename = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Currencies), selectedNode.Text);
propertyObject.SelectedObject = (Currency)currency.Load(objectFilename);
break;
case ObjectType.Realm:
objectName = Path.GetFileNameWithoutExtension(selectedNode.Parent.Text);
objectPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), objectName);
objectFilename = Path.Combine(objectPath, selectedNode.Text);
_GameObject = new Realm();
propertyObject.SelectedObject = _GameObject.Load(objectFilename);
break;
case ObjectType.ZoneRoot:
objectName = Path.GetFileNameWithoutExtension(selectedNode.Parent.Text);
objectPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Zones), objectName);
objectFilename = Path.Combine(objectPath, selectedNode.Text);
_GameObject = new Zone();
propertyObject.SelectedObject = _GameObject.Load(objectFilename);
break;
case ObjectType.ZoneWithinRealm:
TreeNode grandparent = selectedNode.Parent.Parent;
objectName = Path.GetFileNameWithoutExtension(selectedNode.Parent.Text);
parentName = grandparent.Parent.Text;
objectFilename = Path.Combine(FileManager.GetDataPath(parentName, objectName), selectedNode.Text);
_GameObject = new Zone();
propertyObject.SelectedObject = _GameObject.Load(objectFilename);
break;
}
}
/// <summary>
/// Checks the supplied path and creates it if the path does not exist.
/// </summary>
/// <param name="path"></param>
public static void ValidatePath(string path)
{
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
string projectPath = Path.Combine(Application.StartupPath, "Project");
}
/// <summary>
/// Checks to see if the curent object in the Properties Pane has been saved or not.
/// </summary>
/// <returns></returns>
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;
}
/// <summary>
/// Searches the Project Explorer for a TreeNode matching the supplied string
/// </summary>
/// <param name="nodeText"></param>
/// <param name="startNode"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Populates the Project Explorer with a directory hierarchy
/// </summary>
/// <param name="dir"></param>
/// <param name="node"></param>
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;
}
public void RefreshProjectExplorer()
{
treeExplorer.Nodes.Clear();
TreeNode node = new TreeNode("Project");
treeExplorer.Nodes.Add(node);
PopulateTree(FileManager.GetDataPath(SaveDataTypes.Root), node);
}
public void SaveSelected()
{
//Get the object Type
Type t = propertyObject.SelectedObject.GetType();
//We can use to get a copy of the currently selected object
//if it is a BaseObject (Aquire it's BaseObject.Filename)
var obj = new BaseObject();
//Filepaths
string projectPath = Path.Combine(Application.StartupPath, "Project");
string objectPath = "";
string filename = "";
//Start checking to see what object we are saving
if (t == typeof(ProjectInformation))
{
filename = Path.Combine(projectPath, "Game.xml");
FileManager.Save(filename, _Project);
}
else if (t == typeof(Currency))
{
obj = (Currency)propertyObject.SelectedObject;
objectPath = Path.Combine(projectPath, "Currencies");
ValidatePath(objectPath);
filename = Path.Combine(objectPath, obj.Filename);
FileManager.Save(filename, obj);
}
else if (t == typeof(Realm))
{
obj = (Realm)propertyObject.SelectedObject;
objectPath = Path.Combine(projectPath, "Realms");
objectPath = Path.Combine(objectPath, obj.Name);
filename = Path.Combine(objectPath, obj.Filename);
objectPath = Path.Combine(objectPath, "Zones");
ValidatePath(objectPath);
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);
}
RefreshProjectExplorer();
}
/// <summary>
/// Refreshes the Project Explorer incase the directory structure
/// has changed, but was not reflected in the Explorer
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnRefreshObjects_Click(object sender, EventArgs e)
{
RefreshProjectExplorer();
}
/// <summary>
/// Right-Click context menu for the Project Explorer.
/// Loads the currently selected object into the Property Pane
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mnuEditObject_Click(object sender, EventArgs e)
{
if (CheckSavedState())
LoadObject(treeExplorer.SelectedNode);
}
/// <summary>
/// Loads the Project Information for editing into the Properties Pane
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mnuProjectInformation_Click(object sender, EventArgs e)
{
if (CheckSavedState())
propertyObject.SelectedObject = _Project;
}
/// <summary>
/// Creates a new Realm for editing within the Properties Pane
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mnuNewRealm_Click(object sender, EventArgs e)
{
if (CheckSavedState())
propertyObject.SelectedObject = new Realm();
}
/// <summary>
/// Creates a new Currency for editing within the Properties Pane
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mnuNewCurrency_Click(object sender, EventArgs e)
{
if (CheckSavedState())
propertyObject.SelectedObject = new Currency();
}
/// <summary>
/// Creates a new Zone for editing within the Properties Pane
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mnuNewZone_Click(object sender, EventArgs e)
{
if (CheckSavedState())
propertyObject.SelectedObject = new Zone();
}
/// <summary>
/// Searchs the Project Explorer for a file or directory matching the supplied name
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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 void mnuDeleteSelectedObject_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();
}
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();
}
private void mnuAbout_Click(object sender, EventArgs e)
{
MessageBox.Show("Mud Designer.\n\nDownload at http://MudDesigner.Codeplex.com\n"
+ "Join the community at http://MudDesigner.DailyForum.net", "Mud Designer");
}
private void mnuExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void treeExplorer_DoubleClick(object sender, EventArgs e)
{
if (treeExplorer.SelectedNode.Text == "Project")
return;
mnuEditObject_Click(sender, e);
}
private void mnuNewRoom_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;
}
}
}
}

163
Mud Designer/Designer.resx Normal file
View file

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>19, 12</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>128, 15</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>287, 15</value>
</metadata>
<data name="treeExplorer.ToolTip" xml:space="preserve">
<value>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.</value>
</data>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>382, 17</value>
</metadata>
<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">
<value>
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
</value>
</data>
<data name="propertyObject.ToolTip" xml:space="preserve">
<value>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.</value>
</data>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>42</value>
</metadata>
</root>

View file

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F0C50EA1-80F7-4CE6-93A3-A4E9F34F0434}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MudDesigner</RootNamespace>
<AssemblyName>Mud Designer</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ManagedScriptingWIN, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ManagedScriptingWIN.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Designer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Designer.Designer.cs">
<DependentUpon>Designer.cs</DependentUpon>
</Compile>
<Compile Include="MudEngine\FileSystem\SaveDataTypes.cs" />
<Compile Include="MudEngine\GameManagement\GameScript.cs" />
<Compile Include="MudEngine\GameObjects\Bag.cs" />
<Compile Include="MudEngine\GameObjects\BaseObject.cs" />
<Compile Include="MudEngine\GameObjects\Currency.cs" />
<Compile Include="MudEngine\GameObjects\Environment\Door.cs" />
<Compile Include="MudEngine\GameObjects\Environment\StartingLocation.cs" />
<Compile Include="MudEngine\GameObjects\Environment\Realm.cs" />
<Compile Include="MudEngine\GameObjects\Environment\Room.cs" />
<Compile Include="MudEngine\GameObjects\Environment\TravelDirections.cs" />
<Compile Include="MudEngine\GameObjects\Environment\Zone.cs" />
<Compile Include="MudEngine\GameObjects\Items\BaseItem.cs" />
<Compile Include="MudEngine\Interfaces\IFileIO.cs" />
<Compile Include="MudEngine\Interfaces\IGameObject.cs" />
<Compile Include="MudEngine\Interfaces\IQuest.cs" />
<Compile Include="MudEngine\Interfaces\IRuleSet.cs" />
<Compile Include="MudEngine\GameManagement\ProjectInformation.cs" />
<Compile Include="MudEngine\FileSystem\FileManager.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\UIRoomControl.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MudEngine\UITypeEditors\UIRoomControl.Designer.cs">
<DependentUpon>UIRoomControl.cs</DependentUpon>
</Compile>
<Compile Include="MudEngine\UITypeEditors\UIRoomEditor.cs" />
<Compile Include="MudEngine\UITypeEditors\UIScriptControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="MudEngine\UITypeEditors\UIScriptControl.Designer.cs">
<DependentUpon>UIScriptControl.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Designer.resx">
<DependentUpon>Designer.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="MudEngine\UITypeEditors\UIRealmControl.resx">
<DependentUpon>UIRealmControl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="MudEngine\UITypeEditors\UIRoomControl.resx">
<DependentUpon>UIRoomControl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="MudEngine\UITypeEditors\UIScriptControl.resx">
<DependentUpon>UIScriptControl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="UIWidgets\RealmWidget.resx">
<DependentUpon>RealmWidget.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="MudEngine\FileSystem\XmlSerialization.cs" />
<Compile Include="MudEngine\UITypeEditors\UIScriptEditor.cs" />
<Compile Include="UIWidgets\IWidget.cs" />
<Compile Include="UIWidgets\RealmWidget.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UIWidgets\RealmWidget.Designer.cs">
<DependentUpon>RealmWidget.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,99 @@
//.NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
//Mud Designer
using MudDesigner.MudEngine.Interfaces;
namespace MudDesigner.MudEngine.FileSystem
{
/// <summary>
/// Handles saving and loading of engine objects
/// </summary>
public static class FileManager
{
public enum OutputFormats
{
XML = 0,
}
/// <summary>
/// The filetype that the MUDs files will be saved as
/// </summary>
public static OutputFormats FileType
{
get;
set;
}
/// <summary>
/// Saves the object using the specified output format
/// </summary>
/// <param name="Filename"></param>
/// <param name="o"></param>
public static void Save(string Filename, object o)
{
if (FileType == OutputFormats.XML)
{
XmlSerialization.Save(Filename, o);
}
}
/// <summary>
/// Loads the object using the specified FileType format
/// </summary>
/// <param name="Filename"></param>
/// <param name="o"></param>
/// <returns></returns>
public static object Load(string Filename, object o)
{
if (FileType == OutputFormats.XML)
{
return XmlSerialization.Load(Filename, o);
}
else return null;
}
/// <summary>
/// Returns the complete path to the specified data's save folder.
/// </summary>
/// <param name="DataType"></param>
/// <returns></returns>
public static string GetDataPath(SaveDataTypes DataType)
{
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, "Project");
if (DataType == SaveDataTypes.Root)
return rootPath;
else
return System.IO.Path.Combine(rootPath, DataType.ToString());
}
public static string GetDataPath(string Realm, string Zone)
{
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, "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 requestedZone;
}
public static string GetDataPath(string Realm, string Zone, string Room)
{
return System.IO.Path.Combine(GetDataPath(Realm, Zone), Room);
}
//TODO Write CopyDirectory method.
}
}

View file

@ -0,0 +1,10 @@
namespace MudDesigner.MudEngine.FileSystem
{
public enum SaveDataTypes
{
Root,
Currencies,
Realms,
Zones,
}
}

View file

@ -0,0 +1,42 @@
#region ====== Using Statements ======
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Xml;
using System.Xml.Serialization;
using System.IO;
#endregion
namespace MudDesigner.MudEngine.FileSystem
{
internal class XmlSerialization
{
internal static void Save(string Filename, object o)
{
Stream stream = File.Create(Filename);
XmlSerializer serializer = new XmlSerializer(o.GetType());
serializer.Serialize(stream, o);
stream.Close();
}
/// <summary>
/// Loads an item via Xml Deserialization
/// </summary>
/// <param name="Filename">The Xml document to deserialize.</param>
/// <returns></returns>
internal static object Load(string Filename, object o)
{
Stream stream = File.OpenRead(Filename);
object obj = new object();
XmlSerializer serializer = new XmlSerializer(o.GetType());
obj = (object)serializer.Deserialize(stream);
stream.Close();
return obj;
}
}
}

View file

@ -0,0 +1,24 @@
//.NET Framework
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//MudEngine
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameManagement;
using MudDesigner.MudEngine.GameObjects;
//ManagedScripting
using ManagedScripting;
using ManagedScripting.CodeBuilding;
namespace MudDesigner.MudEngine.GameManagement
{
public class GameScript
{
ScriptObject _ScriptObject;
public GameScript()
{
}
}
}

View file

@ -0,0 +1,162 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Xml;
using System.IO;
//MudEngine
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.GameObjects.Environment;
using MudDesigner.MudEngine.Interfaces;
namespace MudDesigner.MudEngine.GameManagement
{
/// <summary>
/// Manages all of the projects settings.
/// </summary>
[XmlInclude(typeof(StartingLocation))]
[XmlInclude(typeof(Currency))]
public class ProjectInformation : IFileIO
{
public enum TimeOfDayOptions
{
AlwaysDay,
AlwaysNight,
Transition,
}
[Category("Company Settings")]
[Description("The name of the Company or Author building the game.")]
/// <summary>
/// Gets or Sets the name of the company
/// </summary>
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")]
/// <summary>
/// Gets or Sets the companies website for this project
/// </summary>
public string Website { get; set; }
[Category("Project Settings")]
[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")]
/// <summary>
/// Gets or Sets if the game autosaves when the player changes locations.
/// </summary>
public bool AutoSave { get; set; }
[Category("Project Settings")]
[Description("Hide Room names from being outputted to the console.")]
/// <summary>
/// Gets or Sets if room names are hidden during console output.
/// </summary>
public bool HideRoomNames { get; set; }
[Category("Day Management")]
[Description("Set what time of day the world will take place in.")]
public TimeOfDayOptions TimeOfDay
{
get;
set;
}
[Category("Day Management")]
[Description("Set how long in minutes it takes to transition from day to night.")]
public int TimeOfDayTransition
{
get;
set;
}
[Category("Day Management")]
[Description("Sets how long in minutes a day lasts in the game world.")]
public int DayLength
{
get;
set;
}
[Category("Project Settings")]
[Description("The current working version of the game.")]
public string Version { get; set; }
[Category("Game Currency")]
[DefaultValue(1)]
[Description("Sets the amount that the base currency is valued at.")]
public uint BaseCurrencyAmount { get; set; }
[Category("Game Currency")]
[DefaultValue("Copper")]
public string BaseCurrencyName { get; set; }
//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<Currency> CurrencyList { get; set; }
[Browsable(false)]
public string ProjectPath { get; set; }
[Browsable(false)]
public StartingLocation InitialLocation
{
get;
set;
}
[Browsable(false)]
public string Story
{
get;
set;
}
public string Filename
{
get
{
return _Filename;
}
}
private string _Filename;
public ProjectInformation()
{
CurrencyList = new List<Currency>();
GameTitle = "New Game";
_Filename = "Game.xml";
BaseCurrencyAmount = 1;
BaseCurrencyName = "Copper";
}
public void Save(string filename)
{
}
public object Load(string path)
{
string fileName = Path.Combine(path, _Filename);
if (!File.Exists(fileName))
{
return null;
}
return FileManager.Load(fileName, this);
}
}
}

View file

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MudDesigner.MudEngine.GameManagement
{
public class QuestSetup
{
}
}

View file

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MudDesigner.MudEngine.GameObjects.Items;
namespace MudDesigner.MudEngine.GameObjects
{
public class Bag : BaseObject
{
/// <summary>
/// Gets or Sets the size of the bag.
/// </summary>
public int Size
{
get;
set;
}
private List<Items.BaseItem> Items { get; set; }
public void Add(BaseItem item)
{
if (Items.Count < Size)
Items.Add(item);
}
public int GetSlotsRemaining()
{
return Size - Items.Count;
}
}
}

View file

@ -0,0 +1,213 @@
//.NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows.Forms;
using System.Xml.Serialization;
using System.IO;
//Mud Designer
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.Interfaces;
using MudDesigner.MudEngine.UITypeEditors;
namespace MudDesigner.MudEngine.GameObjects
{
public class BaseObject : IGameObject, IFileIO
{
#region Properties & Fields
[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
{
get
{
return this._Name;
}
set
{
this._Name = value;
this.Filename = value + "." + this.GetType().Name;
}
}
[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;
set;
}
[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.
//Filenames are generated by the class itself, users can not assign it.
get
{
return this._Filename;
}
set
{
string extension = "." + this.GetType().Name;
if (!value.EndsWith(extension))
value += extension;
this._Filename = value;
}
}
[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
{
get;
set;
}
[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
{
get;
set;
}
[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
{
get;
set;
}
private string _Filename = "";
private string _Name = "";
#endregion
#region Constructor & Private Methods
/// <summary>
/// Initializes the base object
/// </summary>
public BaseObject()
{
Script = "";
_Name = "New " + this.GetType().Name;
_Filename = _Name + "." + this.GetType().Name;
this.Feel = "You feel nothing.";
this.Listen = "You hear nothing of interest.";
this.Smell = "You don't smell anything unsual.";
this.Name = DefaultName();
SetupScript();
}
private bool ShouldSerializeName()
{
return this.Name != DefaultName();
}
private void ResetName()
{
this.Name = DefaultName();
}
private string DefaultName()
{
return "New " + this.GetType().Name;
}
private void SetupScript()
{
//Check if the realm script is empty. If so then generate a standard script for it.
if (Script == "")
{
//Instance a new method helper class
ManagedScripting.CodeBuilding.MethodSetup method = new ManagedScripting.CodeBuilding.MethodSetup();
string script = "";
//Setup our method. All objects inheriting from BaseObject will have the standard
//methods created for them.
string[] names = new string[] { "OnCreate", "OnDestroy", "OnEnter", "OnExit" };
foreach (string name in names)
{
method = new ManagedScripting.CodeBuilding.MethodSetup();
method.Name = name;
method.ReturnType = "void";
method.IsOverride = true;
method.Modifier = ManagedScripting.CodeBuilding.ClassGenerator.Modifiers.Public;
method.Code = new string[] { "base." + method.Name + "();" };
script = script.Insert(Script.Length, method.Create() + "\n");
}
Script = script;
}
}
#endregion
#region Public Methods
public object Load(string filename)
{
if (!File.Exists(filename))
{
return null;
}
return FileManager.Load(filename, this);
}
public void Save(string filename)
{
}
public override string ToString()
{
return this.Name;
}
public virtual void OnEnter()
{
}
public virtual void OnExit()
{
}
public virtual void OnCreate()
{
}
public virtual void OnDestroy()
{
}
public virtual void OnEquip()
{
}
public virtual void OnUnequip()
{
}
public virtual void OnMount()
{
}
public virtual void OnDismount()
{
}
#endregion
}
}

View file

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
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)]
/// <summary>
/// The value of this currency. It should be how many 'base currency' it takes to equal 1 of this currency
/// </summary>
public int Value
{
get;
set;
}
public Currency()
{
this.Name = "New Currency";
this.Value = 100;
}
}
}

View file

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.ComponentModel;
namespace MudDesigner.MudEngine.GameObjects.Environment
{
[XmlInclude(typeof(ConnectedRoom))]
public class Door
{
public struct ConnectedRoom
{
public string Realm;
public string Zone;
public string Room;
public AvailableTravelDirections TravelDirection;
}
[Category("Door Settings")]
[DefaultValue(false)]
public bool IsLocked
{
get;
set;
}
[Category("Door Settings")]
public string RequiredKey
{
get;
set;
}
[Category("Door Settings")]
[DefaultValue(0)]
public int LevelRequirement
{
get;
set;
}
[Browsable(false)]
public AvailableTravelDirections TravelDirection
{
get;
set;
}
[ReadOnly(true)]
[Category("Door Settings")]
public ConnectedRoom TravelRoom
{
get;
set;
}
public Door(AvailableTravelDirections TravelDirection)
{
this.TravelDirection = TravelDirection;
}
public Door()
{
}
}
}

View file

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.ComponentModel;
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.UITypeEditors;
namespace MudDesigner.MudEngine.GameObjects.Environment
{
public class Realm : BaseObject
{
[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<string> Zones { get; set; }
public Realm()
{
Zones = new List<string>();
}
/// <summary>
/// Returns the requested Zone if the Zone exists within this Realm.
/// </summary>
/// <param name="zoneName"></param>
/// <returns></returns>
public Zone GetZone(string zoneName)
{
string zoneFilename = "";
//correct the zonename if needed
if (!zoneName.EndsWith(".zone"))
zoneFilename = zoneName + ".zone";
else
{
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;
}
}
}

View file

@ -0,0 +1,67 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;
namespace MudDesigner.MudEngine.GameObjects.Environment
{
public class Room : BaseObject
{
[Category("Environment Information")]
[Description("Shows what rooms are currently created and linked to within this Room.")]
[ReadOnly(true)]
public string DoorList
{
get
{
string installed = "";
if (this.InstalledDoors.Count != 0)
{
foreach (Door d in InstalledDoors)
{
installed += d.TravelDirection.ToString() + ",";
}
if (InstalledDoors.Count >= 2)
{
installed = installed.Substring(0, installed.Length - 1);
}
return installed;
}
else
return "None Installed.";
}
}
[Category("Environment Information")]
[Description("Allows for linking of Rooms together via Doorways")]
public List<Door> InstalledDoors;
[ReadOnly(true)]
[Description("This is the Zone that the Room is currently assigned to.")]
[Category("Environment Information")]
public string Zone
{
get;
set;
}
[Category("Environment Information")]
[DefaultValue(false)]
[Description("Determins if the Player can be attacked within this Room or not.")]
public bool IsSafe
{
get;
set;
}
public Room TestRoom { get; set; }
public Room()
{
InstalledDoors = new List<Door>();
IsSafe = false;
}
}
}

View file

@ -0,0 +1,14 @@
//MudEngine
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.GameObjects.Environment;
namespace MudDesigner.MudEngine.GameObjects.Environment
{
public struct StartingLocation
{
public string Room;
public string Zone;
public string Realm;
}
}

View file

@ -0,0 +1,56 @@
using System;
namespace MudDesigner.MudEngine.GameObjects
{
public enum AvailableTravelDirections
{
None = 0,
North,
South,
East,
West,
Up,
Down,
}
public static class TravelDirections
{
public static AvailableTravelDirections GetReverseDirection(AvailableTravelDirections Direction)
{
switch (Direction)
{
case AvailableTravelDirections.Down:
return AvailableTravelDirections.Up;
case AvailableTravelDirections.East:
return AvailableTravelDirections.West;
case AvailableTravelDirections.None:
return AvailableTravelDirections.None;
case AvailableTravelDirections.North:
return AvailableTravelDirections.South;
case AvailableTravelDirections.South:
return AvailableTravelDirections.North;
case AvailableTravelDirections.Up:
return AvailableTravelDirections.Down;
case AvailableTravelDirections.West:
return AvailableTravelDirections.East;
default:
return AvailableTravelDirections.None;
}
}
public static AvailableTravelDirections GetTravelDirectionValue(string Direction)
{
Array values = Enum.GetValues(typeof(AvailableTravelDirections));
foreach (int value in values)
{
string displayName = Enum.GetName(typeof(AvailableTravelDirections), value);
if (displayName == Direction)
return (AvailableTravelDirections)Enum.Parse(typeof(AvailableTravelDirections), displayName);
}
return AvailableTravelDirections.None;
}
}
}

View file

@ -0,0 +1,100 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Drawing.Design;
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.UITypeEditors;
namespace MudDesigner.MudEngine.GameObjects.Environment
{
[XmlInclude(typeof(Room))]
public class Zone : BaseObject
{
[Category("Environment Information")]
[DefaultValue(0)]
[Description("The amount to drain each stat by if StatDrain is enabled.")]
public int StatDrainAmount
{
get;
set;
}
[Category("Environment Information")]
[Description("Enable or Disable the ability for draining stats while traversing.")]
[DefaultValue(false)]
public bool StatDrain
{
get;
set;
}
[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;
set;
}
[Category("Environment Information")]
[Description("Determins if the Player can be attacked within this Room or not.")]
[DefaultValue(false)]
public bool IsSafe
{
get;
set;
}
[Category("Environment Information")]
[EditorAttribute(typeof(UIRoomEditor), typeof(UITypeEditor))]
[Description("Collection of Rooms that have been created. Editing the Rooms Collection lets you manage the Zones rooms.")]
public List<Room> Rooms { get; set; }
public Zone()
{
Rooms = new List<Room>();
IsSafe = false;
//throw new NotSupportedException("Parameterless constructors of Type " + this.GetType().FullName + " is not supported.");
}
public Room GetRoom(string RoomName)
{
foreach (Room r in Rooms)
{
if (r.Name == RoomName)
return r;
}
return null;
}
public void RefreshRoomList()
{
Rooms = new List<Room>();
//Create our collection of Rooms.
string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), this.Realm);
string zonePath = Path.Combine(realmPath, this.Name);
//incase the zone hasn't been saved yet.
if (!Directory.Exists(zonePath))
return;
//Zone exists, so it's already been saved.
string[] rooms = Directory.GetFiles(zonePath, "*.room");
foreach (string file in rooms)
{
Room r = new Room();
r = (Room)FileManager.Load(file, r);
this.Rooms.Add(r);
}
}
}
}

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MudDesigner.MudEngine.GameObjects.Items
{
public class BaseItem : BaseObject
{
}
}

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MudDesigner.MudEngine.Interfaces
{
public interface IFileIO
{
string Filename { get; }
Object Load(string filename);
void Save(string filename);
}
}

View file

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MudDesigner.MudEngine.Interfaces
{
public interface IGameObject
{
string Name { get; set; }
string Description { get; set; }
string Script { get; set; }
string Filename { get; }
void OnCreate();
void OnDestroy();
void OnEnter();
void OnExit();
void OnEquip();
void OnUnequip();
void OnMount();
void OnDismount();
}
}

View file

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MudDesigner.MudEngine.GameObjects;
namespace MudDesigner.MudEngine.Interfaces
{
interface IQuest
{
string Title { get; set; }
string Description { get; set; }
int ExperianceAward { get; set; }
int MinimumLevel { get; set; }
int MaximumLevel { get; set; }
//This or int? i'm not sure
Currency CurrencyAward { get; set; }
void AcceptQuest();
void CompleteQuest();
void TrashQuest();
}
}

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MudDesigner.MudEngine.Interfaces
{
public interface IRuleSet
{
void Initialize();
}
}

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,238 @@
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);
}
if (!Directory.Exists(zonePath))
Directory.CreateDirectory(zonePath);
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 = new Zone();
zone = (Zone)zone.Load(file);
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);
//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");
if (!Directory.Exists(roomPath))
Directory.CreateDirectory(roomPath);
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);
}
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");
//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)
{
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())
{
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));
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);
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);
}
}
}
}

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</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>

View file

@ -0,0 +1,33 @@
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();
return obj.Zones;
}
public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return System.Drawing.Design.UITypeEditorEditStyle.Modal;
}
}
}

View file

@ -0,0 +1,162 @@
namespace MudDesigner.MudEngine.UITypeEditors
{
partial class UIRoomControl
{
/// <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()
{
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(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;
}
}

View file

@ -0,0 +1,148 @@
using System;
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
{
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));
}
}
}
}
}

View file

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnNewRoom.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
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
</value>
</data>
</root>

View file

@ -0,0 +1,32 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Design;
using MudDesigner.MudEngine.GameObjects.Environment;
namespace MudDesigner.MudEngine.UITypeEditors
{
public class UIRoomEditor : System.Drawing.Design.UITypeEditor
{
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
{
Zone obj = (Zone)context.Instance;
UIRoomControl ctl;
ctl = new UIRoomControl(obj);
ctl.ShowDialog();
return new List<Room>();
}
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
}
}

View file

@ -0,0 +1,58 @@
namespace MudDesigner.MudEngine.UITypeEditors
{
partial class UIScriptControl
{
/// <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.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(599, 518);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
// UIScriptControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.richTextBox1);
this.Name = "UIScriptControl";
this.Size = new System.Drawing.Size(599, 518);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.RichTextBox richTextBox1;
}
}

View file

@ -0,0 +1,30 @@
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;
using MudDesigner.MudEngine.GameObjects;
namespace MudDesigner.MudEngine.UITypeEditors
{
public partial class UIScriptControl : UserControl
{
internal string Script
{
get
{
return richTextBox1.Text;
}
}
public UIScriptControl(BaseObject obj)
{
InitializeComponent();
richTextBox1.Text = obj.Script;
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,68 @@
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 UIScriptEditor : System.Drawing.Design.UITypeEditor
{
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
{
object obj = context.Instance;
Type[] types = System.Reflection.Assembly.GetExecutingAssembly().GetTypes();
BaseObject baseObj = new BaseObject();
bool IsOk = false;
foreach (Type type in types)
{
if (type == obj.GetType())
{
baseObj = (BaseObject)obj;
IsOk = true;
}
}
if (!IsOk)
{
MessageBox.Show("Unable to locate the Type specified\n"
+ obj.GetType().Name);
return null;
}
if (Program.CurrentEditor is Designer)
{
UIScriptControl control = new UIScriptControl(baseObj);
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();
script = control.Script;
}
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;
}
}
}

43
Mud Designer/Program.cs Normal file
View file

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
//MudEngine
using MudDesigner.MudEngine;
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameManagement;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.GameObjects.Environment;
//Script Engine
using ManagedScripting;
using ManagedScripting.CodeBuilding;
namespace MudDesigner
{
static class Program
{
public static Form CurrentEditor { get; set; }
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//Setup default application properties
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//Run the toolkit
try
{
CurrentEditor = new Designer();
Application.Run(CurrentEditor);
}
catch (Exception msg)
{
MessageBox.Show("Critical error!\n\n" + msg + "\n\nMud Designer shut down occured.", "Mud Designer", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View file

@ -0,0 +1,37 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Mud Designer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mud Designer")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("464bb276-5701-4663-9618-0d2617bccaf6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MudDesigner.Editors.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MudDesigner.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MudDesigner.Editors.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View file

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MudDesigner.UIWidgets
{
public interface IWidget
{
void InstallControl(string path);
}
}

View file

@ -0,0 +1,61 @@
namespace MudDesigner.UIWidgets
{
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.flowContainer = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
//
// flowContainer
//
this.flowContainer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flowContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowContainer.Location = new System.Drawing.Point(0, 0);
this.flowContainer.Name = "flowContainer";
this.flowContainer.Padding = new System.Windows.Forms.Padding(10);
this.flowContainer.Size = new System.Drawing.Size(537, 502);
this.flowContainer.TabIndex = 0;
//
// 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.flowContainer);
this.Name = "RealmExplorer";
this.Size = new System.Drawing.Size(537, 502);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FlowLayoutPanel flowContainer;
}
}

View file

@ -0,0 +1,55 @@
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;
using System.IO;
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.GameObjects.Environment;
namespace MudDesigner.UIWidgets
{
public partial class RealmExplorer : UserControl
{
public RealmExplorer()
{
InitializeComponent();
this.Dock = DockStyle.Fill;
}
public Control InstallControl(string projectPath)
{
string[] files = Directory.GetFiles(Path.Combine(projectPath, "Realms"), "*.realm", SearchOption.AllDirectories);
//TODO: Add if (files.length==0) statement and set a 'No Realms' label in container
foreach (string realmFile in files)
{
Realm realm = new Realm();
realm = (Realm)FileManager.Load(realmFile, realm);
Button button = new Button();
button.FlatStyle = FlatStyle.Flat;
button.Font = new Font(new FontFamily(System.Drawing.Text.GenericFontFamilies.Serif), 12f, FontStyle.Bold);
button.BackColor = System.Drawing.Color.FromArgb(48, 48, 48);
button.ForeColor = System.Drawing.Color.LightGray;
button.Size = new System.Drawing.Size(160,128);
button.Name = "btn" + realm.Name;
button.Text = realm.Name;
button.Click += new EventHandler(button_Click);
flowContainer.Controls.Add(button);
}
return this;
}
void button_Click(object sender, EventArgs e)
{
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

20
MudDesigner.sln Normal file
View file

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C# Express 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mud Designer", "Mud Designer\Mud Designer.csproj", "{F0C50EA1-80F7-4CE6-93A3-A4E9F34F0434}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F0C50EA1-80F7-4CE6-93A3-A4E9F34F0434}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F0C50EA1-80F7-4CE6-93A3-A4E9F34F0434}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F0C50EA1-80F7-4CE6-93A3-A4E9F34F0434}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F0C50EA1-80F7-4CE6-93A3-A4E9F34F0434}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal