This commit is contained in:
parent
dbe4a45738
commit
c7f5a9b2a7
24 changed files with 566 additions and 1315 deletions
|
@ -7,7 +7,7 @@ using System.Windows.Forms;
|
|||
using System.Xml.Serialization;
|
||||
using MudDesigner.MudEngine.Interfaces;
|
||||
|
||||
namespace MudDesigner.MudEngine.Objects
|
||||
namespace MudDesigner.MudEngine.GameObjects
|
||||
{
|
||||
public class BaseObject : IGameObject
|
||||
{
|
||||
|
@ -15,8 +15,15 @@ namespace MudDesigner.MudEngine.Objects
|
|||
[RefreshProperties(RefreshProperties.All)] //Required to refresh Filename property in the editors propertygrid
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
get
|
||||
{
|
||||
return this._Name;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._Name = value;
|
||||
this.Filename = value + ".realm";
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Object Setup")]
|
||||
|
@ -29,20 +36,27 @@ namespace MudDesigner.MudEngine.Objects
|
|||
[Browsable(false)]
|
||||
public string Script { get; set; }
|
||||
|
||||
[ReadOnly(true)]
|
||||
[Category("Object Setup")]
|
||||
[DefaultValue("New Realm.realm")]
|
||||
public string Filename
|
||||
{
|
||||
//Returns the name of the object + the objects Type as it's extension.
|
||||
//Filenames are generated by the class itself, users can not assign it.
|
||||
get
|
||||
{
|
||||
string fileExtension = this.GetType().Name.ToLower();
|
||||
return this._Filename;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!value.EndsWith(".realm"))
|
||||
value += ".realm";
|
||||
|
||||
return this.Name + "." + fileExtension;
|
||||
this._Filename = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string _Filename = "New Realm.realm";
|
||||
private string _Name = "New Realm";
|
||||
/// <summary>
|
||||
/// Initializes the base object
|
||||
/// </summary>
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace MudDesigner.MudEngine.Objects
|
||||
namespace MudDesigner.MudEngine.GameObjects
|
||||
{
|
||||
public class Currency : BaseObject
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Text;
|
|||
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace MudDesigner.MudEngine.Objects.Environment
|
||||
namespace MudDesigner.MudEngine.GameObjects.Environment
|
||||
{
|
||||
public class Door
|
||||
{
|
||||
|
@ -38,6 +38,15 @@ namespace MudDesigner.MudEngine.Objects.Environment
|
|||
set;
|
||||
}
|
||||
|
||||
[Category("Door Settings")]
|
||||
[DefaultValue(false)]
|
||||
public bool IsRealmEntrance
|
||||
{ get; set; }
|
||||
|
||||
[Category("Door Settings")]
|
||||
[DefaultValue(false)]
|
||||
public bool IsRealmExit { get; set; }
|
||||
|
||||
[Category("Door Settings")]
|
||||
[Description("Sets if the door is installed and useable within the room or not.")]
|
||||
[DefaultValue(AvailableDoorStates.Uninstalled)]
|
||||
|
|
|
@ -2,25 +2,44 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace MudDesigner.MudEngine.Objects.Environment
|
||||
using MudDesigner.MudEngine.FileSystem;
|
||||
using MudDesigner.MudEngine.GameObjects;
|
||||
|
||||
namespace MudDesigner.MudEngine.GameObjects.Environment
|
||||
{
|
||||
public class Realm : BaseObject
|
||||
{
|
||||
[System.ComponentModel.Browsable(false)]
|
||||
public List<Zone> Zones { get; set; }
|
||||
[Browsable(false)]
|
||||
public List<string> Zones { get; set; }
|
||||
|
||||
public Realm()
|
||||
{
|
||||
Zones = new List<Zone>();
|
||||
Zones = new List<string>();
|
||||
}
|
||||
|
||||
public Zone GetZone(string ZoneName)
|
||||
{
|
||||
foreach(Zone zone in Zones)
|
||||
//correct the zonename if needed
|
||||
if (!ZoneName.EndsWith(".zone"))
|
||||
ZoneName += ".zone";
|
||||
|
||||
//build our path
|
||||
string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), this.Name);
|
||||
|
||||
//get a collection of all the zones within the realm
|
||||
string[] files = Directory.GetFiles(realmPath, "*.zone");
|
||||
Zone zone = new Zone();
|
||||
|
||||
//look four our zone file
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (zone.Name == ZoneName)
|
||||
return zone;
|
||||
if (file == ZoneName)
|
||||
{
|
||||
string zonePath = Path.Combine(realmPath, Path.GetDirectoryName(file));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Text;
|
|||
using System.ComponentModel;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace MudDesigner.MudEngine.Objects.Environment
|
||||
namespace MudDesigner.MudEngine.GameObjects.Environment
|
||||
{
|
||||
public class Room : BaseObject
|
||||
{
|
||||
|
@ -57,9 +57,39 @@ namespace MudDesigner.MudEngine.Objects.Environment
|
|||
set;
|
||||
}
|
||||
|
||||
[Category("Room Information")]
|
||||
[ReadOnly(true)]
|
||||
public string DoorList
|
||||
{
|
||||
get
|
||||
{
|
||||
string installed = "";
|
||||
if (this.InstalledDoors.Count != 0)
|
||||
{
|
||||
foreach (Door d in InstalledDoors)
|
||||
{
|
||||
installed += d.TravelDirection.ToString() + ",";
|
||||
}
|
||||
if (InstalledDoors.Count >= 2)
|
||||
{
|
||||
installed = installed.Substring(0, installed.Length - 1);
|
||||
}
|
||||
return installed;
|
||||
}
|
||||
else
|
||||
return "None Installed.";
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public List<Door> InstalledDoors;
|
||||
|
||||
[Browsable(false)]
|
||||
public string ParentZone
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public Room()
|
||||
{
|
||||
InstalledDoors = new List<Door>();
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MudDesigner.MudEngine.Objects.Environment
|
||||
namespace MudDesigner.MudEngine.GameObjects.Environment
|
||||
{
|
||||
public class Zone : BaseObject
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue