muddesigner/MudEngine/GameObjects/Environment/Room.cs
Scionwest_cp 9b023a2092 MudCompiler:
- Updated to work with ScriptingEngine changes.

MudEngine:
 - Game.PlayerCollection changed to a List<>. Server obtains a array version of it within Server.initialize() via players = pbs.ToArray().
 - All BaseObject classes now require a reference to the Game and contain a property called ActiveGame.
 - Player.Game removed and now uses it's parent objects ActiveGame property.
 - Player.Role property added. Uses the new SecurityRoles enum that specifies what level of access the player has.
 - ScriptEngine now loads all libraries found within the specified ScriptsPath directory, instances the scripts and places them into a collection.
 - Custom character script instancing is now supported, but not fully implemented throughout the engine. They can be loaded, but not used during runtime at this time.
2010-07-29 17:39:38 -07:00

123 lines
3.7 KiB
C#

//Microsoft .NET Framework
using System;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;
//MUD Engine
using MudEngine.FileSystem;
using MudEngine.GameObjects.Items;
using MudEngine.GameManagement;
namespace MudEngine.GameObjects.Environment
{
[XmlInclude(typeof(Door))]
public class Room : BaseObject
{
[Category("Environment Information")]
[Description("Allows for linking of Rooms together via Doorways")]
//[EditorAttribute(typeof(UIDoorwayEditor), typeof(UITypeEditor))]
[RefreshProperties(RefreshProperties.All)]
public List<Door> Doorways { get; internal set; }
[ReadOnly(true)]
[Description("This is the Zone that the Room is currently assigned to.")]
[Category("Environment Information")]
public string Zone
{
get;
set;
}
[ReadOnly(true)]
[Description("This is the Realm that the Room belongs to.")]
[Category("Environment Information")]
public string Realm
{
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;
}
[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;
}
}
/// <summary>
/// Gets or Sets if this is the starting room for the Zone that contains it.
/// </summary>
[Browsable(true)]
[Description("Sets if this is the starting room for the Zone that contains it.")]
public bool IsInitialRoom
{
get;
set;
}
public Room(Game game) :base(game)
{
Doorways = new List<Door>();
IsSafe = false;
}
/// <summary>
/// Checks to see if a doorway in the travelDirection exists.
/// </summary>
/// <param name="travelDirection"></param>
/// <returns></returns>
public bool DoorwayExist(AvailableTravelDirections travelDirection)
{
foreach (Door door in Doorways)
{
if (door.TravelDirection == travelDirection)
return true;
}
return false;
}
/// <summary>
/// Gets reference to the Rooms door connected in the supplied travelDirection
/// </summary>
/// <param name="travelDirection"></param>
/// <returns></returns>
public Door GetDoor(AvailableTravelDirections travelDirection)
{
foreach (Door door in this.Doorways)
{
if (door.TravelDirection == travelDirection)
return door;
}
return null;
}
}
}