Mud Designer:
- Currency Editor no longer adds duplicate currencies when saved. - Currency Editor now overwrites existing currencies. - Fixed Currency Editor looking for .xml filetypes instead of .currency filetypes. Saved Currencies now show up in the currency list Mud Engine: - Removed IsSafe property from BaseObject as not all objects will need this property. - Added IsSafe property to Zone.cs - Added IsSafe property to Room.cs.
This commit is contained in:
parent
a8ea7eecb8
commit
49a6e31019
4 changed files with 24 additions and 17 deletions
|
@ -25,7 +25,9 @@ namespace MudDesigner.Editors
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_Currency = new Currency();
|
_Currency = new Currency();
|
||||||
propertyGrid1.SelectedObject = _Currency;
|
propertyGrid1.SelectedObject = _Currency;
|
||||||
foreach (string currency in System.IO.Directory.GetFiles(FileManager.GetDataPath(SaveDataTypes.Currency), "*.xml"))
|
string path = FileManager.GetDataPath(SaveDataTypes.Currency);
|
||||||
|
|
||||||
|
foreach (string currency in System.IO.Directory.GetFiles(path, "*.currency"))
|
||||||
{
|
{
|
||||||
lstCurrencies.Items.Add(System.IO.Path.GetFileNameWithoutExtension(currency));
|
lstCurrencies.Items.Add(System.IO.Path.GetFileNameWithoutExtension(currency));
|
||||||
}
|
}
|
||||||
|
@ -39,16 +41,12 @@ namespace MudDesigner.Editors
|
||||||
|
|
||||||
private void btnSaveCurrency_Click(object sender, EventArgs e)
|
private void btnSaveCurrency_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (lstCurrencies.Items.Contains(_Currency.Name))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Currency already exists!", "Currency Creation", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string currencyPath = FileManager.GetDataPath(SaveDataTypes.Currency);
|
string currencyPath = FileManager.GetDataPath(SaveDataTypes.Currency);
|
||||||
string currencyFile = System.IO.Path.Combine(currencyPath, _Currency.Filename);
|
string currencyFile = System.IO.Path.Combine(currencyPath, _Currency.Filename);
|
||||||
FileManager.Save(currencyFile, _Currency);
|
FileManager.Save(currencyFile, _Currency);
|
||||||
lstCurrencies.Items.Add(_Currency.Name);
|
string file = System.IO.Path.GetFileNameWithoutExtension(_Currency.Filename);
|
||||||
|
if (!lstCurrencies.Items.Contains(file))
|
||||||
|
lstCurrencies.Items.Add(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lstCurrencies_SelectedIndexChanged(object sender, EventArgs e)
|
private void lstCurrencies_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
@ -57,7 +55,7 @@ namespace MudDesigner.Editors
|
||||||
if (lstCurrencies.SelectedIndex == -1)
|
if (lstCurrencies.SelectedIndex == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string filePath = System.IO.Path.Combine(FileManager.GetDataPath(SaveDataTypes.Currency), lstCurrencies.SelectedItem.ToString() + ".xml");
|
string filePath = System.IO.Path.Combine(FileManager.GetDataPath(SaveDataTypes.Currency), lstCurrencies.SelectedItem.ToString() + ".currency");
|
||||||
_Currency = (Currency)FileManager.Load(filePath, _Currency);
|
_Currency = (Currency)FileManager.Load(filePath, _Currency);
|
||||||
propertyGrid1.SelectedObject = _Currency;
|
propertyGrid1.SelectedObject = _Currency;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,14 +79,6 @@ namespace MudDesigner.MudEngine.GameObjects
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Category("Environment Information")]
|
|
||||||
[DefaultValue(false)]
|
|
||||||
public bool IsSafe
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _Filename = "";
|
private string _Filename = "";
|
||||||
private string _Name = "";
|
private string _Name = "";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -42,6 +42,15 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Category("Environment Information")]
|
||||||
|
[DefaultValue(false)]
|
||||||
|
public bool IsSafe
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public Room()
|
public Room()
|
||||||
{
|
{
|
||||||
InstalledDoors = new List<Door>();
|
InstalledDoors = new List<Door>();
|
||||||
|
|
|
@ -38,6 +38,14 @@ namespace MudDesigner.MudEngine.GameObjects.Environment
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Category("Environment Information")]
|
||||||
|
[DefaultValue(false)]
|
||||||
|
public bool IsSafe
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
internal List<Room> Rooms { get; set; }
|
internal List<Room> Rooms { get; set; }
|
||||||
|
|
||||||
public Zone()
|
public Zone()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue