- Zones build their Room collection during instancing.
- Zones can not be instanced without providing the owning realm in its constructor. - Started adding tooltips to the editors. - Zone Builder now checks if a Realm has been loaded yet or not prior to creating Zones. - Zone Builder will not allow Rooms to be created within new Zones until the Zone has been saved. - Zone Builder checks if a New Zone has not been saved yet prior to creating another New Zone - Renamed Room.ParentZone to Room.Zone to be consistent with the Realm and Zone classes.
This commit is contained in:
parent
f35e1b2ea7
commit
44431ecade
8 changed files with 460 additions and 98 deletions
|
|
@ -1,14 +1,19 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using MudDesigner.MudEngine.FileSystem;
|
||||
using MudDesigner.MudEngine.GameObjects;
|
||||
|
||||
namespace MudDesigner.MudEngine.GameObjects.Environment
|
||||
{
|
||||
[XmlInclude(typeof(Room))]
|
||||
public class Zone : BaseObject
|
||||
{
|
||||
|
||||
[Category("Environment Information")]
|
||||
[DefaultValue(0)]
|
||||
public int StatDrainAmount
|
||||
|
|
@ -32,13 +37,43 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
|
|||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
internal List<Room> Rooms { get; set; }
|
||||
|
||||
|
||||
|
||||
public Zone()
|
||||
{
|
||||
throw new NotSupportedException("Parameterless constructors of Type " + this.GetType().FullName + " is not supported.");
|
||||
}
|
||||
|
||||
public Zone(Realm realm)
|
||||
{
|
||||
Rooms = new List<Room>();
|
||||
//incase a realm hasn't been assigned to it yet.
|
||||
if (this.Realm == null)
|
||||
return;
|
||||
|
||||
//Create our collection of Rooms.
|
||||
string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), realm.Name);
|
||||
string zonePath = Path.Combine(realmPath, this.Name);
|
||||
string[] rooms = Directory.GetFiles(zonePath, "*.room");
|
||||
|
||||
foreach (string file in rooms)
|
||||
{
|
||||
Room r = new Room();
|
||||
r = (Room)FileManager.Load(file, r);
|
||||
this.Rooms.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
public Room GetRoom(string RoomName)
|
||||
{
|
||||
foreach (Room r in Rooms)
|
||||
{
|
||||
if (r.Name == RoomName)
|
||||
return r;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue