Mud Engine:

- ValidateDataPaths no longer creates a ROOT folder as a child folder to the Data directory.
 - The Realm class now has a Zones collection property.
 - Adjusted Room and ProjectInformation Property Categories for Property Grid.

Realm Explorer:
 - Now Save and Loads Realms
 - Now calls MUDEngine.Engine.ValidateDataPaths() during startup to ensure all directories exists.
 - New Realms can be created.
 - Existing Realms are now loaded into the listbox.
 - Prototype code wrote for finding available and un-available Zones.
 - Almost complete UI

Zone Builder:
 - Now calls MUDEngine.Engine.ValidateDataPaths() during startup to ensure all directories exists.
This commit is contained in:
Scionwest_cp 2009-11-27 22:40:13 -08:00
parent 8486088e17
commit 1db34a469c
11 changed files with 197 additions and 116 deletions

View file

@ -43,6 +43,8 @@ namespace MUDEngine
foreach (SaveDataTypes value in Enum.GetValues(typeof(SaveDataTypes))) foreach (SaveDataTypes value in Enum.GetValues(typeof(SaveDataTypes)))
{ {
string dataType = value.ToString(); string dataType = value.ToString();
if (value.ToString() == "Root")
continue;
if (!System.IO.Directory.Exists(System.IO.Path.Combine(InstallPath, dataType))) if (!System.IO.Directory.Exists(System.IO.Path.Combine(InstallPath, dataType)))
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(InstallPath, dataType)); System.IO.Directory.CreateDirectory(System.IO.Path.Combine(InstallPath, dataType));

View file

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.ComponentModel; using System.ComponentModel;
using System.Collections.Generic;
namespace MUDEngine.Objects namespace MUDEngine.Objects
{ {

View file

@ -7,5 +7,12 @@ namespace MUDEngine.Objects.Environment
{ {
public class Realm : BaseObject public class Realm : BaseObject
{ {
[System.ComponentModel.Browsable(false)]
public List<Zone> Zones { get; set; }
public Realm()
{
this.Name = "New Realm";
}
} }
} }

View file

@ -9,7 +9,7 @@ namespace MUDEngine.Objects.Environment
{ {
public class Room : BaseObject public class Room : BaseObject
{ {
[Category("Room Information")] [Category("Room Senses")]
[DefaultValue("You don't smell anything unsual.")] [DefaultValue("You don't smell anything unsual.")]
public string Smell public string Smell
{ {
@ -17,7 +17,7 @@ namespace MUDEngine.Objects.Environment
set; set;
} }
[Category("Room Information")] [Category("Room Senses")]
[DefaultValue("You hear nothing of interest.")] [DefaultValue("You hear nothing of interest.")]
public string Listen public string Listen
{ {
@ -25,7 +25,7 @@ namespace MUDEngine.Objects.Environment
set; set;
} }
[Category("Room Information")] [Category("Room Senses")]
[DefaultValue("You feel nothing.")] [DefaultValue("You feel nothing.")]
public string Feel public string Feel
{ {
@ -61,6 +61,7 @@ namespace MUDEngine.Objects.Environment
public List<Door> InstalledDoors; public List<Door> InstalledDoors;
[XmlIgnore()] [XmlIgnore()]
[Browsable(false)]
public new Controls.RoomControl Control public new Controls.RoomControl Control
{ {
get get

View file

@ -24,13 +24,13 @@ namespace MUDEngine
Transition, Transition,
} }
[Category("Company Information")] [Category("Company Settings")]
/// <summary> /// <summary>
/// Gets or Sets the name of the company /// Gets or Sets the name of the company
/// </summary> /// </summary>
public string CompanyName { get; set; } public string CompanyName { get; set; }
[Category("Company Information")] [Category("Company Settings")]
/// <summary> /// <summary>
/// Gets or Sets the companies website for this project /// Gets or Sets the companies website for this project
/// </summary> /// </summary>
@ -52,14 +52,14 @@ namespace MUDEngine
/// </summary> /// </summary>
public bool HideRoomNames { get; set; } public bool HideRoomNames { get; set; }
[Category("Project Settings")] [Category("Day Management")]
public TimeOfDayOptions TimeOfDay public TimeOfDayOptions TimeOfDay
{ {
get; get;
set; set;
} }
[Category("Project Settings")] [Category("Day Management")]
[Description("Set how long in minutes it takes to transition from day to night.")] [Description("Set how long in minutes it takes to transition from day to night.")]
public int TimeOfDayTransition public int TimeOfDayTransition
{ {
@ -67,7 +67,7 @@ namespace MUDEngine
set; set;
} }
[Category("Project Settings")] [Category("Day Management")]
[Description("Sets how long in minutes a day lasts in the game world.")] [Description("Sets how long in minutes a day lasts in the game world.")]
public int DayLength public int DayLength
{ {
@ -75,15 +75,15 @@ namespace MUDEngine
set; set;
} }
[Category("Project Information")] [Category("Project Settings")]
public string Version { get; set; } public string Version { get; set; }
[Category("Project Information")] [Category("Game Currency")]
[Description("Sets the amount that the base currency is valued at.")] [Description("Sets the amount that the base currency is valued at.")]
public uint BaseCurrencyAmount { get; set; } public uint BaseCurrencyAmount { get; set; }
[Category("Project Information")] [Category("Game Currency")]
public string BaseCurrencyName { get; set; } public string BaseCurrencyName { get; set; }

View file

@ -13,6 +13,9 @@ namespace RealmExplorer
[STAThread] [STAThread]
static void Main() static void Main()
{ {
MUDEngine.Engine.ValidateDataPaths();
MUDEngine.FileSystem.FileSystem.FileType = MUDEngine.FileSystem.FileSystem.OutputFormats.XML;
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain()); Application.Run(new frmMain());

View file

@ -31,6 +31,10 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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" />
<Reference Include="System.Core"> <Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>

View file

@ -32,28 +32,28 @@
this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.lstRealms = new System.Windows.Forms.ListBox(); this.lstRealms = new System.Windows.Forms.ListBox();
this.propertyRealm = new System.Windows.Forms.PropertyGrid(); this.propertyRealm = new System.Windows.Forms.PropertyGrid();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox4 = new System.Windows.Forms.GroupBox();
this.btnRealm = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.btnDeleteRealm = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.btnSaveRealm = new System.Windows.Forms.Button();
this.btnClose = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lstAvailableZones = new System.Windows.Forms.ListBox();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.lstZonesInRealm = new System.Windows.Forms.ListBox(); this.lstZonesInRealm = new System.Windows.Forms.ListBox();
this.groupBox4 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button(); this.lstAvailableZones = new System.Windows.Forms.ListBox();
this.button2 = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnClose = new System.Windows.Forms.Button();
this.btnSaveRealm = new System.Windows.Forms.Button();
this.btnDeleteRealm = new System.Windows.Forms.Button();
this.btnRealm = new System.Windows.Forms.Button();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout(); this.splitContainer2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout(); this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// splitContainer1 // splitContainer1
@ -103,6 +103,7 @@
this.lstRealms.Name = "lstRealms"; this.lstRealms.Name = "lstRealms";
this.lstRealms.Size = new System.Drawing.Size(193, 212); this.lstRealms.Size = new System.Drawing.Size(193, 212);
this.lstRealms.TabIndex = 0; this.lstRealms.TabIndex = 0;
this.lstRealms.SelectedIndexChanged += new System.EventHandler(this.lstRealms_SelectedIndexChanged);
// //
// propertyRealm // propertyRealm
// //
@ -113,73 +114,36 @@
this.propertyRealm.TabIndex = 0; this.propertyRealm.TabIndex = 0;
this.propertyRealm.ToolbarVisible = false; this.propertyRealm.ToolbarVisible = false;
// //
// groupBox1 // groupBox4
// //
this.groupBox1.Controls.Add(this.btnClose); this.groupBox4.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.btnSaveRealm); this.groupBox4.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.btnDeleteRealm); this.groupBox4.Location = new System.Drawing.Point(2, 233);
this.groupBox1.Controls.Add(this.btnRealm); this.groupBox4.Name = "groupBox4";
this.groupBox1.Location = new System.Drawing.Point(0, 0); this.groupBox4.Size = new System.Drawing.Size(260, 66);
this.groupBox1.Name = "groupBox1"; this.groupBox4.TabIndex = 3;
this.groupBox1.Size = new System.Drawing.Size(260, 77); this.groupBox4.TabStop = false;
this.groupBox1.TabIndex = 0; this.groupBox4.Text = "Realm Zone Setup";
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Realm Setup";
// //
// btnRealm // button2
// //
this.btnRealm.Location = new System.Drawing.Point(6, 19); this.button2.Dock = System.Windows.Forms.DockStyle.Top;
this.btnRealm.Name = "btnRealm"; this.button2.Location = new System.Drawing.Point(3, 39);
this.btnRealm.Size = new System.Drawing.Size(114, 23); this.button2.Name = "button2";
this.btnRealm.TabIndex = 0; this.button2.Size = new System.Drawing.Size(254, 23);
this.btnRealm.Text = "New Realm"; this.button2.TabIndex = 2;
this.btnRealm.UseVisualStyleBackColor = true; this.button2.Text = "Remove Zone From Realm";
this.button2.UseVisualStyleBackColor = true;
// //
// btnDeleteRealm // button1
// //
this.btnDeleteRealm.Location = new System.Drawing.Point(6, 48); this.button1.Dock = System.Windows.Forms.DockStyle.Top;
this.btnDeleteRealm.Name = "btnDeleteRealm"; this.button1.Location = new System.Drawing.Point(3, 16);
this.btnDeleteRealm.Size = new System.Drawing.Size(114, 23); this.button1.Name = "button1";
this.btnDeleteRealm.TabIndex = 1; this.button1.Size = new System.Drawing.Size(254, 23);
this.btnDeleteRealm.Text = "Delete Realm"; this.button1.TabIndex = 1;
this.btnDeleteRealm.UseVisualStyleBackColor = true; this.button1.Text = "Insert Zone Into Realm";
// this.button1.UseVisualStyleBackColor = true;
// btnSaveRealm
//
this.btnSaveRealm.Location = new System.Drawing.Point(142, 19);
this.btnSaveRealm.Name = "btnSaveRealm";
this.btnSaveRealm.Size = new System.Drawing.Size(109, 23);
this.btnSaveRealm.TabIndex = 2;
this.btnSaveRealm.Text = "Save Realm";
this.btnSaveRealm.UseVisualStyleBackColor = true;
//
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(142, 48);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(109, 23);
this.btnClose.TabIndex = 3;
this.btnClose.Text = "Close Explorer";
this.btnClose.UseVisualStyleBackColor = true;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.lstAvailableZones);
this.groupBox2.Location = new System.Drawing.Point(0, 83);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(260, 144);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Available Zones";
//
// lstAvailableZones
//
this.lstAvailableZones.Dock = System.Windows.Forms.DockStyle.Fill;
this.lstAvailableZones.FormattingEnabled = true;
this.lstAvailableZones.Location = new System.Drawing.Point(3, 16);
this.lstAvailableZones.Name = "lstAvailableZones";
this.lstAvailableZones.Size = new System.Drawing.Size(254, 121);
this.lstAvailableZones.TabIndex = 1;
// //
// groupBox3 // groupBox3
// //
@ -200,36 +164,75 @@
this.lstZonesInRealm.Size = new System.Drawing.Size(254, 160); this.lstZonesInRealm.Size = new System.Drawing.Size(254, 160);
this.lstZonesInRealm.TabIndex = 1; this.lstZonesInRealm.TabIndex = 1;
// //
// groupBox4 // groupBox2
// //
this.groupBox4.Controls.Add(this.button2); this.groupBox2.Controls.Add(this.lstAvailableZones);
this.groupBox4.Controls.Add(this.button1); this.groupBox2.Location = new System.Drawing.Point(0, 83);
this.groupBox4.Location = new System.Drawing.Point(2, 233); this.groupBox2.Name = "groupBox2";
this.groupBox4.Name = "groupBox4"; this.groupBox2.Size = new System.Drawing.Size(260, 144);
this.groupBox4.Size = new System.Drawing.Size(260, 66); this.groupBox2.TabIndex = 1;
this.groupBox4.TabIndex = 3; this.groupBox2.TabStop = false;
this.groupBox4.TabStop = false; this.groupBox2.Text = "Available Zones";
this.groupBox4.Text = "Realm Zone Setup";
// //
// button1 // lstAvailableZones
// //
this.button1.Dock = System.Windows.Forms.DockStyle.Top; this.lstAvailableZones.Dock = System.Windows.Forms.DockStyle.Fill;
this.button1.Location = new System.Drawing.Point(3, 16); this.lstAvailableZones.FormattingEnabled = true;
this.button1.Name = "button1"; this.lstAvailableZones.Location = new System.Drawing.Point(3, 16);
this.button1.Size = new System.Drawing.Size(254, 23); this.lstAvailableZones.Name = "lstAvailableZones";
this.button1.TabIndex = 1; this.lstAvailableZones.Size = new System.Drawing.Size(254, 121);
this.button1.Text = "Insert Zone Into Realm"; this.lstAvailableZones.TabIndex = 1;
this.button1.UseVisualStyleBackColor = true;
// //
// button2 // groupBox1
// //
this.button2.Dock = System.Windows.Forms.DockStyle.Top; this.groupBox1.Controls.Add(this.btnClose);
this.button2.Location = new System.Drawing.Point(3, 39); this.groupBox1.Controls.Add(this.btnSaveRealm);
this.button2.Name = "button2"; this.groupBox1.Controls.Add(this.btnDeleteRealm);
this.button2.Size = new System.Drawing.Size(254, 23); this.groupBox1.Controls.Add(this.btnRealm);
this.button2.TabIndex = 2; this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.button2.Text = "Remove Zone From Realm"; this.groupBox1.Name = "groupBox1";
this.button2.UseVisualStyleBackColor = true; this.groupBox1.Size = new System.Drawing.Size(260, 77);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Realm Setup";
//
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(142, 48);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(109, 23);
this.btnClose.TabIndex = 3;
this.btnClose.Text = "Close Explorer";
this.btnClose.UseVisualStyleBackColor = true;
//
// btnSaveRealm
//
this.btnSaveRealm.Location = new System.Drawing.Point(142, 19);
this.btnSaveRealm.Name = "btnSaveRealm";
this.btnSaveRealm.Size = new System.Drawing.Size(109, 23);
this.btnSaveRealm.TabIndex = 2;
this.btnSaveRealm.Text = "Save Realm";
this.btnSaveRealm.UseVisualStyleBackColor = true;
this.btnSaveRealm.Click += new System.EventHandler(this.btnSaveRealm_Click);
//
// btnDeleteRealm
//
this.btnDeleteRealm.Location = new System.Drawing.Point(6, 48);
this.btnDeleteRealm.Name = "btnDeleteRealm";
this.btnDeleteRealm.Size = new System.Drawing.Size(114, 23);
this.btnDeleteRealm.TabIndex = 1;
this.btnDeleteRealm.Text = "Delete Realm";
this.btnDeleteRealm.UseVisualStyleBackColor = true;
//
// btnRealm
//
this.btnRealm.Location = new System.Drawing.Point(6, 19);
this.btnRealm.Name = "btnRealm";
this.btnRealm.Size = new System.Drawing.Size(114, 23);
this.btnRealm.TabIndex = 0;
this.btnRealm.Text = "New Realm";
this.btnRealm.UseVisualStyleBackColor = true;
this.btnRealm.Click += new System.EventHandler(this.btnNewRealm_Click);
// //
// frmMain // frmMain
// //
@ -246,10 +249,10 @@
this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false); this.splitContainer2.Panel2.ResumeLayout(false);
this.splitContainer2.ResumeLayout(false); this.splitContainer2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox4.ResumeLayout(false); this.groupBox4.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View file

@ -15,23 +15,80 @@ namespace RealmExplorer
{ {
Zone _Zone; Zone _Zone;
Realm _Realm; Realm _Realm;
List<Zone> _AvailableZones;
public frmMain() public frmMain()
{ {
InitializeComponent(); InitializeComponent();
_Zone = new Zone(); _Zone = new Zone();
_Realm = new Realm(); _Realm = new Realm();
_AvailableZones = new List<Zone>();
string[] zones = System.IO.Directory.GetFiles(Engine.GetDataPath(Engine.SaveDataTypes.Zones), "*.zone");
bool available = true;
foreach (string zone in zones)
{
string[] realms = System.IO.Directory.GetFiles(Engine.GetDataPath(Engine.SaveDataTypes.Realms), "*.realm");
foreach (string realm in realms)
{
Realm r = new Realm();
r = (Realm)ManagedScripting.XmlSerialization.Load(realm, r);
foreach (Zone z in r.Zones)
{
if (z.Name == System.IO.Path.GetFileNameWithoutExtension(zone))
{
available = false;
break;
}
}
if (!available)
break;
}
if (!available)
break;
else
{
lstAvailableZones.Items.Add(System.IO.Path.GetFileNameWithoutExtension(zone));
}
}
propertyRealm.SelectedObject = _Realm;
string[] existingRealms = System.IO.Directory.GetFiles(Engine.GetDataPath(Engine.SaveDataTypes.Realms));
foreach (string realm in existingRealms)
lstRealms.Items.Add(System.IO.Path.GetFileNameWithoutExtension(realm));
} }
private void btnNewRealm_Click(object sender, EventArgs e) private void btnNewRealm_Click(object sender, EventArgs e)
{ {
_Zone = new Zone(); _Zone = new Zone();
_Realm = new Realm(); _Realm = new Realm();
propertyRealm.SelectedObject = _Realm;
lstZonesInRealm.Items.Clear();
} }
private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e) private void btnSaveRealm_Click(object sender, EventArgs e)
{ {
string path = Engine.GetDataPath(Engine.SaveDataTypes.Realms);
string filename = System.IO.Path.Combine(path, _Realm.Name + ".realm");
MUDEngine.FileSystem.FileSystem.Save(filename, _Realm);
if (!lstRealms.Items.Contains(_Realm.Name))
lstRealms.Items.Add(_Realm.Name);
}
private void lstRealms_SelectedIndexChanged(object sender, EventArgs e)
{
string path = Engine.GetDataPath(Engine.SaveDataTypes.Realms);
string filename = System.IO.Path.Combine(path, lstRealms.SelectedItem.ToString() + ".realm");
_Realm = (Realm)ManagedScripting.XmlSerialization.Load(filename, _Realm);
propertyRealm.SelectedObject = _Realm;
} }
} }
} }

View file

@ -170,6 +170,7 @@
this.propertyRoom.Name = "propertyRoom"; this.propertyRoom.Name = "propertyRoom";
this.propertyRoom.Size = new System.Drawing.Size(203, 451); this.propertyRoom.Size = new System.Drawing.Size(203, 451);
this.propertyRoom.TabIndex = 3; this.propertyRoom.TabIndex = 3;
this.propertyRoom.ToolbarVisible = false;
// //
// containerDesigner // containerDesigner
// //
@ -305,6 +306,7 @@
this.propertyDoor.Name = "propertyDoor"; this.propertyDoor.Name = "propertyDoor";
this.propertyDoor.Size = new System.Drawing.Size(350, 183); this.propertyDoor.Size = new System.Drawing.Size(350, 183);
this.propertyDoor.TabIndex = 4; this.propertyDoor.TabIndex = 4;
this.propertyDoor.ToolbarVisible = false;
this.propertyDoor.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyDoor_PropertyValueChanged); this.propertyDoor.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyDoor_PropertyValueChanged);
// //
// groupBox6 // groupBox6

View file

@ -13,6 +13,9 @@ namespace ZoneBuilder
[STAThread] [STAThread]
static void Main() static void Main()
{ {
MUDEngine.Engine.ValidateDataPaths(Application.StartupPath);
MUDEngine.FileSystem.FileSystem.FileType = MUDEngine.FileSystem.FileSystem.OutputFormats.XML;
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain()); Application.Run(new frmMain());