Began work on Environment save code.
Restructured the project save data folder layout when the engine starts. The XMLData class now creates directories if they are missing. Individual classes no longer need to check if a path is valid before saving. Filenames are now automatically generated and no longer assigned by developers. This change has been made across all classes that are savable which required some changing of the Save() method arguments.
This commit is contained in:
parent
a6d346da3d
commit
ee3cd897f2
12 changed files with 101 additions and 28 deletions
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
using MudEngine.Core.Interfaces;
|
||||
using MudEngine.GameScripts;
|
||||
|
@ -12,6 +13,15 @@ namespace MudEngine.Game.Environment
|
|||
{
|
||||
public class Zone : Environment
|
||||
{
|
||||
public new String Filename
|
||||
{
|
||||
get
|
||||
{
|
||||
String path = Path.Combine(this.Game.SavePaths.GetPath(DAL.DataTypes.Environments), this.Realm.Name, "Zones", this.Name + "." + this.GetType().Name);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the what stats
|
||||
/// </summary>
|
||||
|
@ -26,6 +36,16 @@ namespace MudEngine.Game.Environment
|
|||
this._RoomCollection = new List<Room>();
|
||||
}
|
||||
|
||||
public override bool Save()
|
||||
{
|
||||
if (!base.Save(true))
|
||||
return false;
|
||||
|
||||
this.SaveData.AddSaveData("Safe", this.Safe.ToString());
|
||||
this.SaveData.Save(this.Filename);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Room CreateRoom(String name, String description)
|
||||
{
|
||||
Room room = new Room(this.Game, name, description, this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue