MudEngine:
- BaseObject save code re-wrote - Added Inventory property to BaseCharacter - BaseCharacter Save() now called when players are being disconnected. - Adjusted how objects Filenames are generated.
This commit is contained in:
parent
2152a139b0
commit
e822537128
4 changed files with 28 additions and 6 deletions
|
@ -64,6 +64,8 @@ namespace MudEngine.GameObjects
|
|||
set
|
||||
{
|
||||
string extension = "." + this.GetType().Name;
|
||||
if (extension.StartsWith("Base"))
|
||||
extension = extension.Substring("Base".Length);
|
||||
if (!value.EndsWith(extension))
|
||||
value += extension;
|
||||
|
||||
|
@ -153,12 +155,14 @@ namespace MudEngine.GameObjects
|
|||
/// Saves the current object with the supplied filename
|
||||
/// </summary>
|
||||
/// <param name="filename"></param>
|
||||
public void Save(string filename)
|
||||
public void Save()
|
||||
{
|
||||
string directory = Path.GetDirectoryName(filename);
|
||||
string directory = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Root), "Saved", "Players");
|
||||
|
||||
if (!Directory.Exists(directory))
|
||||
Directory.CreateDirectory(directory);
|
||||
FileManager.Save(filename, this);
|
||||
|
||||
FileManager.Save(Filename, this);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue