- Re-worked the command system. All commands now only need 2 arguments rather than 4. The actual command string and the Player - All commands updated to work with the new command system - Look command now works in the example MudGame - Realm now contains InitialZone for the starting Zone within that Realm. - Zone now contains InitialRoom for the starting Room within that Zone. - All Environment objects now contains a Initial property and Add() method for adding child objects. - BaseCharacter now contains a copy of Game - Revised Realm.GetZone() - Revised Zone.GetRoom() - Removed Zone.RebuildRoomCollection as content is currently no longer stored using physical files. - Added GameManagement.Log for logging errors and warnings to file. Use Log.Write().
72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
//Microsoft .NET Framework
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.ComponentModel;
|
|
|
|
//MUD Engine
|
|
using MudEngine.FileSystem;
|
|
using MudEngine.GameObjects;
|
|
|
|
namespace 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<Zone> ZoneCollection { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets if this Realm is the starting realm for the game.
|
|
/// </summary>
|
|
public bool IsInitialRealm { get; set; }
|
|
|
|
/// <summary>
|
|
/// The Initial Starting Zone for this Realm.
|
|
/// </summary>
|
|
public Zone InitialZone { get; private set; }
|
|
|
|
public Realm()
|
|
{
|
|
ZoneCollection = new List<Zone>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the requested Zone if the Zone exists within this Realm.
|
|
/// </summary>
|
|
/// <param name="zoneName"></param>
|
|
/// <returns></returns>
|
|
public Zone GetZone(string filename)
|
|
{
|
|
foreach (Zone zone in ZoneCollection)
|
|
{
|
|
if (zone.Filename == filename)
|
|
return zone;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public void AddZone(Zone zone)
|
|
{
|
|
if (zone.IsInitialZone)
|
|
{
|
|
foreach (Zone z in ZoneCollection)
|
|
{
|
|
if (z.IsInitialZone)
|
|
{
|
|
z.IsInitialZone = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
InitialZone = zone;
|
|
ZoneCollection.Add(zone);
|
|
}
|
|
}
|
|
}
|