muddesigner/Mud Designer/MudEngine/GameObjects/Environment/Realm.cs
Scionwest_cp 0395acb0f9 Designer:
- Renamed SaveSelected() to SaveObject()
 - Added additional commenting
 - Re-formatted the document
 - Moved the search code out from the text box and into its own method SearchForObject()
 - Changed search method for the text box from txtSearch_Enter to txtSearch_KeyDown
 - Re-write of object save code finished.

Engine:
 - Realm.GetZone() re-wrote to use LINQ.
 - Zone.GetRoom() renamed to Zone.GetRoomByName() for searching for a Room by name
 - Zone.GetRoomByFilename() added for searching by filename for a Room.
 - Re-wrote Adding Zones into Realms via the UIRealmControl. Uses 54% less source, and better readability.
 - UIRealmEditor now stores a proper backup of Zones incase of UIRealmControl instancing failure.
2010-01-19 13:09:33 -08:00

46 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.ComponentModel;
using MudDesigner.MudEngine.FileSystem;
using MudDesigner.MudEngine.GameObjects;
using MudDesigner.MudEngine.UITypeEditors;
namespace MudDesigner.MudEngine.GameObjects.Environment
{
public class Realm : BaseObject
{
[Category("Environment Information")]
[Description("A collection of Zones that are contained within this Realm. Players can traverse the world be traveling through Rooms that are contained within Zones. Note that it is not required to place a Zone into a Realm.")]
[EditorAttribute(typeof(UIRealmEditor), typeof(System.Drawing.Design.UITypeEditor))]
public List<string> Zones { get; set; }
public Realm()
{
Zones = new List<string>();
}
/// <summary>
/// Returns the requested Zone if the Zone exists within this Realm.
/// </summary>
/// <param name="zoneName"></param>
/// <returns></returns>
public Zone GetZone(string filename)
{
var filterQuery =
from zone in Zones
where zone == filename
select zone;
Zone z = new Zone();
foreach (var zone in filterQuery)
return (Zone)z.Load(zone); ;
return null;
}
}
}