MudEngine:

- 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
This commit is contained in:
Scionwest_cp 2010-08-12 17:05:07 -07:00
parent d212f5b854
commit 7a4c9211d4
9 changed files with 105 additions and 61 deletions

View file

@ -23,7 +23,8 @@ namespace MudEngine.Scripting
public enum ScriptTypes
{
Assembly,
SourceFiles
SourceFiles,
Both
}
/// <summary>
@ -83,6 +84,7 @@ namespace MudEngine.Scripting
private Assembly _ScriptAssembly;
private List<Assembly> _AssemblyCollection;
private string[] _ErrorMessages;
private string _SettingsFile;
Game _Game;
public ScriptEngine(Game game) : this(game, ScriptTypes.Assembly)
@ -98,11 +100,17 @@ namespace MudEngine.Scripting
public ScriptEngine(Game game, ScriptTypes scriptTypes)
{
//Initialize our engine fields
ScriptType = scriptTypes;
ScriptExtension = ".cs";
_SettingsFile = "Settings.ini";
ScriptExtension = FileManager.GetData(_SettingsFile, "ScriptExtension");
if (String.IsNullOrEmpty(ScriptExtension))
ScriptExtension = ".cs";
//Get our current install path
ScriptPath = "Scripts";
ScriptPath = FileManager.GetData(_SettingsFile, "ScriptPath");
if (String.IsNullOrEmpty(ScriptPath))
ScriptPath = "Scripts";
InstallPath = Environment.CurrentDirectory;
GameObjects = new List<GameObject>();
_AssemblyCollection = new List<Assembly>();
@ -210,13 +218,15 @@ namespace MudEngine.Scripting
/// <param name="scriptAssembly"></param>
public void Initialize()
{
if (ScriptType == ScriptTypes.Assembly)
if ((ScriptType == ScriptTypes.Assembly) || (ScriptType == ScriptTypes.Both))
{
Log.Write("Loading Assembly based scripts...");
Log.Write("Loading Assembly based Scripts...");
InitializeAssembly();
}
else
if ((ScriptType == ScriptTypes.SourceFiles) || (ScriptType == ScriptTypes.Both))
{
Log.Write("Loading Source File based Scripts...");
InitializeSourceFiles();
}