diff --git a/MUDEngine/Objects/BaseObject.cs b/MUDEngine/Objects/BaseObject.cs
index bc6cbb4..b76a648 100644
--- a/MUDEngine/Objects/BaseObject.cs
+++ b/MUDEngine/Objects/BaseObject.cs
@@ -11,22 +11,6 @@ namespace MUDEngine.Objects
{
public class BaseObject
{
- public virtual void OnEnter()
- {
- }
-
- public virtual void OnExit()
- {
- }
-
- public virtual void OnCreate()
- {
- }
-
- public virtual void OnDestroy()
- {
- }
-
[Category("Object Setup")]
[RefreshProperties(RefreshProperties.All)] //Required to refresh Filename property in the editors propertygrid
public string Name
@@ -59,29 +43,70 @@ namespace MUDEngine.Objects
}
}
- [Browsable(false)]
- [XmlIgnore()]
- public Controls.VisualContainer Control
- {
- get
- {
- return this._Control;
- }
- internal set
- {
- this._Control = value;
- }
- }
- private Controls.VisualContainer _Control;
-
///
/// Initializes the base object
///
public BaseObject()
{
- Control = new Controls.VisualContainer(this);
Script = "";
- this.Name = "New " + this.GetType().Name;
+ 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;
+ }
+ }
+
+ public virtual void OnEnter()
+ {
+ }
+
+ public virtual void OnExit()
+ {
+ }
+
+ public virtual void OnCreate()
+ {
+ }
+
+ public virtual void OnDestroy()
+ {
}
}
}
diff --git a/MUDEngine/Objects/Environment/Room.cs b/MUDEngine/Objects/Environment/Room.cs
index 708ffb6..50f9bcf 100644
--- a/MUDEngine/Objects/Environment/Room.cs
+++ b/MUDEngine/Objects/Environment/Room.cs
@@ -60,20 +60,6 @@ namespace MUDEngine.Objects.Environment
[Browsable(false)]
public List InstalledDoors;
- [XmlIgnore()]
- [Browsable(false)]
- public new Controls.RoomControl Control
- {
- get
- {
- return this._Control;
- }
- internal set
- {
- this._Control = value;
- }
- }
-
public Room()
{
InstalledDoors = new List();
diff --git a/MudDesigner.sln b/MudDesigner.sln
index fd3785c..b4d3e95 100644
--- a/MudDesigner.sln
+++ b/MudDesigner.sln
@@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoomDesigner", "RoomDesigne
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MudDesigner", "MudDesigner\MudDesigner.csproj", "{F782C36B-5A00-4BC9-BE4E-B631729DA40E}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualDesigner", "VisualDesigner\VisualDesigner.csproj", "{2E20971A-E968-4AE9-B7B2-58236D499618}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZoneBuilder", "ZoneBuilder\ZoneBuilder.csproj", "{C81C3F3F-1D36-451E-A17A-33E953C30307}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealmExplorer", "RealmExplorer\RealmExplorer.csproj", "{7CF280B2-883D-4218-AE39-6B511E2704A3}"
@@ -43,10 +41,6 @@ Global
{F782C36B-5A00-4BC9-BE4E-B631729DA40E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F782C36B-5A00-4BC9-BE4E-B631729DA40E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F782C36B-5A00-4BC9-BE4E-B631729DA40E}.Release|Any CPU.Build.0 = Release|Any CPU
- {2E20971A-E968-4AE9-B7B2-58236D499618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2E20971A-E968-4AE9-B7B2-58236D499618}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2E20971A-E968-4AE9-B7B2-58236D499618}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2E20971A-E968-4AE9-B7B2-58236D499618}.Release|Any CPU.Build.0 = Release|Any CPU
{C81C3F3F-1D36-451E-A17A-33E953C30307}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C81C3F3F-1D36-451E-A17A-33E953C30307}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C81C3F3F-1D36-451E-A17A-33E953C30307}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/RoomDesigner/Program.cs b/RoomDesigner/Program.cs
index 245c506..cba1a97 100644
--- a/RoomDesigner/Program.cs
+++ b/RoomDesigner/Program.cs
@@ -43,7 +43,7 @@ namespace RoomDesigner
if (File.Exists(file))
{
- Application.Run(new frmMain(room));
+ Application.Run(new frmMain(argument));
}
else
{
diff --git a/RoomDesigner/frmMain.Designer.cs b/RoomDesigner/frmMain.Designer.cs
index 558e723..87b1474 100644
--- a/RoomDesigner/frmMain.Designer.cs
+++ b/RoomDesigner/frmMain.Designer.cs
@@ -229,6 +229,7 @@
this.txtScript.Size = new System.Drawing.Size(555, 267);
this.txtScript.TabIndex = 0;
this.txtScript.Text = "";
+ this.txtScript.TextChanged += new System.EventHandler(this.txtScript_TextChanged);
//
// groupBox5
//
diff --git a/RoomDesigner/frmMain.cs b/RoomDesigner/frmMain.cs
index 6e822db..cffadcd 100644
--- a/RoomDesigner/frmMain.cs
+++ b/RoomDesigner/frmMain.cs
@@ -61,7 +61,7 @@ namespace RoomDesigner
//Get the current rooms scripts.
//TODO: Add Doorway script support
- SetupRoomScript();
+ //SetupRoomScript();
if (parameters.Length != 0)
{
@@ -69,13 +69,14 @@ namespace RoomDesigner
{
if (argument.ToString().ToLower().StartsWith("room="))
{
- string rooms = Engine.GetDataPath(Engine.SaveDataTypes.Rooms);
- string filename = System.IO.Path.Combine(rooms, argument.ToString());
+ string roomPath = Engine.GetDataPath(Engine.SaveDataTypes.Rooms);
+ string room = argument.ToString().Substring("room=".Length);
+ string filename = System.IO.Path.Combine(roomPath, room.ToString());
//Room to load should always be the first arg.
if (System.IO.File.Exists(filename))
{
- _CurrentRoom = (Room)ManagedScripting.XmlSerialization.Load(filename, _CurrentRoom);
+ _CurrentRoom = (Room)MUDEngine.FileSystem.FileSystem.Load(filename, _CurrentRoom);
}
}
}
@@ -84,6 +85,7 @@ namespace RoomDesigner
//Show the user(s) the rooms properties
propertyRoom.SelectedObject = _CurrentRoom;
+ txtScript.Text = _CurrentRoom.Script;
}
private void SetupRoomScript()
@@ -359,5 +361,10 @@ namespace RoomDesigner
+ "}\n";
MessageBox.Show(_ScriptEngine.Compile(code), "Script Compiling", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
+
+ private void txtScript_TextChanged(object sender, EventArgs e)
+ {
+ _CurrentRoom.Script = txtScript.Text;
+ }
}
}
diff --git a/ZoneBuilder/frmMain.cs b/ZoneBuilder/frmMain.cs
index ba24681..2e8f7a2 100644
--- a/ZoneBuilder/frmMain.cs
+++ b/ZoneBuilder/frmMain.cs
@@ -26,32 +26,7 @@ namespace ZoneBuilder
_CurrentRoom = new Room();
_CurrentZone = new Zone();
- SetupScript();
- }
-
- private void SetupScript()
- {
- //Check if the realm script is empty. If so then generate a standard script for it.
- if (String.IsNullOrEmpty(_CurrentZone.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(_CurrentZone.Script.Length, method.Create() + "\n");
- }
- _CurrentZone.Script = script;
- }
+ propertyZone.SelectedObject = _CurrentZone;
}
private void btnRoomEditor_Click(object sender, EventArgs e)