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)))
{
string dataType = value.ToString();
if (value.ToString() == "Root")
continue;
if (!System.IO.Directory.Exists(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.Text;
using System.ComponentModel;
using System.Collections.Generic;
namespace MUDEngine.Objects
{

View file

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

View file

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

View file

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

View file

@ -31,6 +31,10 @@
<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>

View file

@ -32,28 +32,28 @@
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.lstRealms = new System.Windows.Forms.ListBox();
this.propertyRealm = new System.Windows.Forms.PropertyGrid();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnRealm = new System.Windows.Forms.Button();
this.btnDeleteRealm = 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.groupBox4 = new System.Windows.Forms.GroupBox();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.lstZonesInRealm = new System.Windows.Forms.ListBox();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lstAvailableZones = new System.Windows.Forms.ListBox();
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.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
@ -103,6 +103,7 @@
this.lstRealms.Name = "lstRealms";
this.lstRealms.Size = new System.Drawing.Size(193, 212);
this.lstRealms.TabIndex = 0;
this.lstRealms.SelectedIndexChanged += new System.EventHandler(this.lstRealms_SelectedIndexChanged);
//
// propertyRealm
//
@ -113,73 +114,36 @@
this.propertyRealm.TabIndex = 0;
this.propertyRealm.ToolbarVisible = false;
//
// groupBox1
// groupBox4
//
this.groupBox1.Controls.Add(this.btnClose);
this.groupBox1.Controls.Add(this.btnSaveRealm);
this.groupBox1.Controls.Add(this.btnDeleteRealm);
this.groupBox1.Controls.Add(this.btnRealm);
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(260, 77);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Realm Setup";
this.groupBox4.Controls.Add(this.button2);
this.groupBox4.Controls.Add(this.button1);
this.groupBox4.Location = new System.Drawing.Point(2, 233);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(260, 66);
this.groupBox4.TabIndex = 3;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Realm Zone Setup";
//
// btnRealm
// button2
//
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.button2.Dock = System.Windows.Forms.DockStyle.Top;
this.button2.Location = new System.Drawing.Point(3, 39);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(254, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Remove Zone From Realm";
this.button2.UseVisualStyleBackColor = true;
//
// btnDeleteRealm
// button1
//
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;
//
// 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;
this.button1.Dock = System.Windows.Forms.DockStyle.Top;
this.button1.Location = new System.Drawing.Point(3, 16);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(254, 23);
this.button1.TabIndex = 1;
this.button1.Text = "Insert Zone Into Realm";
this.button1.UseVisualStyleBackColor = true;
//
// groupBox3
//
@ -200,36 +164,75 @@
this.lstZonesInRealm.Size = new System.Drawing.Size(254, 160);
this.lstZonesInRealm.TabIndex = 1;
//
// groupBox4
// groupBox2
//
this.groupBox4.Controls.Add(this.button2);
this.groupBox4.Controls.Add(this.button1);
this.groupBox4.Location = new System.Drawing.Point(2, 233);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(260, 66);
this.groupBox4.TabIndex = 3;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Realm Zone Setup";
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";
//
// button1
// lstAvailableZones
//
this.button1.Dock = System.Windows.Forms.DockStyle.Top;
this.button1.Location = new System.Drawing.Point(3, 16);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(254, 23);
this.button1.TabIndex = 1;
this.button1.Text = "Insert Zone Into Realm";
this.button1.UseVisualStyleBackColor = true;
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;
//
// button2
// groupBox1
//
this.button2.Dock = System.Windows.Forms.DockStyle.Top;
this.button2.Location = new System.Drawing.Point(3, 39);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(254, 23);
this.button2.TabIndex = 2;
this.button2.Text = "Remove Zone From Realm";
this.button2.UseVisualStyleBackColor = true;
this.groupBox1.Controls.Add(this.btnClose);
this.groupBox1.Controls.Add(this.btnSaveRealm);
this.groupBox1.Controls.Add(this.btnDeleteRealm);
this.groupBox1.Controls.Add(this.btnRealm);
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
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
//
@ -246,10 +249,10 @@
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
this.splitContainer2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}

View file

@ -15,23 +15,80 @@ namespace RealmExplorer
{
Zone _Zone;
Realm _Realm;
List<Zone> _AvailableZones;
public frmMain()
{
InitializeComponent();
_Zone = new Zone();
_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)
{
_Zone = new Zone();
_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.Size = new System.Drawing.Size(203, 451);
this.propertyRoom.TabIndex = 3;
this.propertyRoom.ToolbarVisible = false;
//
// containerDesigner
//
@ -305,6 +306,7 @@
this.propertyDoor.Name = "propertyDoor";
this.propertyDoor.Size = new System.Drawing.Size(350, 183);
this.propertyDoor.TabIndex = 4;
this.propertyDoor.ToolbarVisible = false;
this.propertyDoor.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyDoor_PropertyValueChanged);
//
// groupBox6

View file

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