- Game World Auto-save property now fully implemented. However, the Game world saving mechanics are not fully implemented. As additional components are implemented, they will be auto-saved if the property is set to true. - Game.AutoSaveInterval property added for setting how often the Game will save all objects in the world (incase run-time changes to environments/objects were made, they must be saved). - Player walk command now supports Game.AutoSave. Every-time the player changes location they will be saved. - ScriptEngine now supports Initializing both Assembly and Source based scripts at the same time via the new ScriptTypes.Both element. - ScriptEngine now auto-loads previously saved settings from Settings.ini - Game.ObjectIdentifierCollection renamed to Game.WorldObjects. Type collection changed from that of Int32 to BaseObject. - Game.update now contains the code needed to update the World Time and Auto-Save the world if needed. - Game.AddObject method added for adding World Objects to the Game.WorldObjects collection
91 lines
2.6 KiB
C#
91 lines
2.6 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(GameManagement.Game game) : base(game)
|
|
{
|
|
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 GetZoneByID(Int32 id)
|
|
{
|
|
foreach (Zone zone in ZoneCollection)
|
|
{
|
|
if (zone.ID == id)
|
|
return zone;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public List<Zone> GetZoneByName(string name)
|
|
{
|
|
|
|
List<Zone> zones = new List<Zone>();
|
|
|
|
foreach (Zone zone in ZoneCollection)
|
|
{
|
|
if (zone.Name == name)
|
|
zones.Add(zone);
|
|
}
|
|
|
|
return zones;
|
|
}
|
|
|
|
public void AddZone(Zone zone)
|
|
{
|
|
if (zone.IsInitialZone)
|
|
{
|
|
foreach (Zone z in ZoneCollection)
|
|
{
|
|
if (z.IsInitialZone)
|
|
{
|
|
z.IsInitialZone = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if (zone.IsInitialZone)
|
|
InitialZone = zone;
|
|
|
|
//TODO: Check fo duplicates
|
|
ZoneCollection.Add(zone);
|
|
zone.Realm = Name;
|
|
}
|
|
}
|
|
}
|