Engine:
- Removed the ManagedScripting Engine from the project. Scripting will be implemented at a later time using a custom build engine. - Room.Load was re-wrote to allow for loading a supplied room name (not a full filename). The Room will load the supplied Roomname by checking within it's current Zone. Rooms within different Zones can be loaded by supplying a Zone name as one of the optional parameters. Same goes for loading Rooms within a different Realm - All classes using the original Room.Load code have been tweaked to use the new code. Cuts the needed code used by each individual class by 80%. - Room.InstallPath Property added for returning the full filename and location of the Room where it's currently installed. Designer: - Room Designer now supports deleting Rooms. - Doorway Editor no longer fails when attempting to change doorway Traveling Directions. Runtime: - No longer prints blank lines if the object does not contain any text to print. - Added a 2nd Print method with a boolean argument for printing blank lines by force if needed. Note: Room Deleting and Room.Load code was only tested using Rooms within Root Zones. Rooms contained within a Zone owned by a Realm was not tested.
This commit is contained in:
parent
59502408ce
commit
f79a5d482b
15 changed files with 147 additions and 92 deletions
|
|
@ -6,7 +6,9 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using System.Drawing.Design;
|
||||
using System.IO;
|
||||
|
||||
using MudDesigner.MudEngine.FileSystem;
|
||||
using MudDesigner.MudEngine.UITypeEditors;
|
||||
|
||||
namespace MudDesigner.MudEngine.GameObjects.Environment
|
||||
|
|
@ -76,6 +78,26 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
|
|||
set;
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public string InstallPath
|
||||
{
|
||||
get
|
||||
{
|
||||
string zonePath = "";
|
||||
if (this.Realm == null || this.Realm == "No Realm Associated.")
|
||||
{
|
||||
zonePath = FileManager.GetDataPath(SaveDataTypes.Zones);
|
||||
zonePath = Path.Combine(zonePath, this.Zone);
|
||||
}
|
||||
else
|
||||
zonePath = FileManager.GetDataPath(this.Realm, this.Zone);
|
||||
|
||||
string roomPath = Path.Combine(zonePath, "Rooms");
|
||||
string filename = Path.Combine(roomPath, this.Filename);
|
||||
return filename;
|
||||
}
|
||||
}
|
||||
|
||||
public Room()
|
||||
{
|
||||
Doorways = new List<Door>();
|
||||
|
|
@ -103,5 +125,63 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load a Room that exists within the same Zone as the current Room
|
||||
/// </summary>
|
||||
/// <param name="roomName"></param>
|
||||
/// <returns></returns>
|
||||
public override object Load(string roomName)
|
||||
{
|
||||
//Correct the roomname incase it doesnt contain a file extension
|
||||
if (!roomName.ToLower().EndsWith(".room"))
|
||||
roomName += ".room";
|
||||
|
||||
//If the current room does not belong within a Realm, then load it from the
|
||||
//Zones root directory
|
||||
if (this.Realm != null || this.Realm != "No Realm Associated.")
|
||||
{
|
||||
return this.Load(roomName, this.Zone);
|
||||
}
|
||||
//This Zone is contained within a Realm so we have to load it from within the
|
||||
//Realm and not from within the Zones root directory
|
||||
else
|
||||
return this.Load(roomName, this.Zone, this.Realm);
|
||||
}
|
||||
|
||||
public object Load(string roomName, string zoneName)
|
||||
{
|
||||
string filename = "";
|
||||
if (!roomName.ToLower().EndsWith(".room"))
|
||||
roomName += ".room";
|
||||
|
||||
if (this.Realm != null && this.Realm != "No Realm Associated.")
|
||||
{
|
||||
return this.Load(roomName, zoneName, this.Realm);
|
||||
}
|
||||
else
|
||||
filename = FileManager.GetDataPath(SaveDataTypes.Zones);
|
||||
|
||||
filename = Path.Combine(filename, zoneName);
|
||||
filename = Path.Combine(filename, "Rooms");
|
||||
filename = Path.Combine(filename, roomName);
|
||||
|
||||
return base.Load(filename);
|
||||
}
|
||||
|
||||
public object Load(string roomName, string zoneName, string realmName)
|
||||
{
|
||||
if (!roomName.ToLower().EndsWith(".room"))
|
||||
roomName += ".room";
|
||||
|
||||
string filename = FileManager.GetDataPath(realmName, zoneName);
|
||||
filename = Path.Combine(filename, "Rooms");
|
||||
filename = Path.Combine(filename, roomName);
|
||||
|
||||
if (realmName == null || realmName == "No Realm Associated.")
|
||||
return this.Load(roomName, zoneName);
|
||||
|
||||
return base.Load(filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue