DataPath class is now completed and includes a new SetExtension() method for setting game object file extensions. Scripting support fully implemented. StandardGame now contains a Initialize() method for compiling scripts and searching for sub-classes of StandardGame Server app will now use a Scripted game class instead of the default StandardGame if one is present. StandardGame.Start() is now virtual so child classes can override it. Sample Game script created to show how to create a custom game script, including how to setup the game and create Rooms pragamatically. ScriptFactory has a new method for searching all scripts and scripts that inherit from a specified class. Renamed all of the Command scripts. They no longer start with 'Command'. Example: "CommandSay" has now become "Say". There is no need to preceed the command name with the word "Command" anymore.
74 lines
1.8 KiB
C#
74 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
using MudEngine.Game.Environment;
|
|
using MudEngine.Core.Interfaces;
|
|
|
|
namespace MudEngine.Game
|
|
{
|
|
public class World : IGameComponent
|
|
{
|
|
/// <summary>
|
|
/// Gets a reference to the currently running game.
|
|
/// </summary>
|
|
public StandardGame Game { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Gets or Sets the starting location for new characters.
|
|
/// </summary>
|
|
public Room StartLocation { get; set; }
|
|
|
|
public World(StandardGame game)
|
|
{
|
|
this.Game = game;
|
|
this._RealmCollection = new List<Realm>();
|
|
}
|
|
|
|
public void Initialize()
|
|
{
|
|
Realm realm = new Realm(this.Game, "Azeroth", "");
|
|
Zone zone = realm.CreateZone("Bablo", "");
|
|
|
|
zone.CreateRoom("Bedroom", "");
|
|
zone.CreateRoom("Hallway", "");
|
|
|
|
zone.LinkRooms("Bedroom", "Hallway", AvailableTravelDirections.East);
|
|
|
|
this.StartLocation = zone.GetRoom("Bedroom");
|
|
}
|
|
|
|
public void Save()
|
|
{
|
|
}
|
|
|
|
public void Load()
|
|
{
|
|
}
|
|
|
|
public void Destroy()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void CreateRealm(String name, String description)
|
|
{
|
|
Realm r = new Realm(this.Game, name, description);
|
|
|
|
this._RealmCollection.Add(r);
|
|
}
|
|
|
|
public Realm GetRealm(String name)
|
|
{
|
|
var v = from realm in this._RealmCollection
|
|
where realm.Name == name
|
|
select realm;
|
|
|
|
Realm r = v.First();
|
|
return r;
|
|
}
|
|
|
|
private List<Realm> _RealmCollection;
|
|
}
|
|
}
|