diff --git a/CurrencyEditor/CurrencyEditor.csproj b/CurrencyEditor/CurrencyEditor.csproj new file mode 100644 index 0000000..fea4399 --- /dev/null +++ b/CurrencyEditor/CurrencyEditor.csproj @@ -0,0 +1,133 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {FF28EB1C-F811-40CF-91B1-1D9F5EB5A233} + WinExe + Properties + CurrencyEditor + Currency Editor + v3.5 + 512 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + Form + + + frmMain.cs + + + + + frmMain.cs + Designer + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + False + .NET Framework 2.0 %28x86%29 + false + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + true + + + False + Windows Installer 3.1 + true + + + + + {33828B3B-F227-4726-8FCD-3D9D780E643D} + MUDEngine + + + + + \ No newline at end of file diff --git a/CurrencyEditor/CurrencyEditor.csproj.user b/CurrencyEditor/CurrencyEditor.csproj.user new file mode 100644 index 0000000..e50fd5e --- /dev/null +++ b/CurrencyEditor/CurrencyEditor.csproj.user @@ -0,0 +1,15 @@ + + + publish\ + + + + + + + + + en-US + false + + \ No newline at end of file diff --git a/CurrencyEditor/Program.cs b/CurrencyEditor/Program.cs new file mode 100644 index 0000000..d798248 --- /dev/null +++ b/CurrencyEditor/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace CurrencyEditor +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + MUDEngine.Engine.ValidateProjectPath(Application.StartupPath); + MUDEngine.FileSystem.FileSystem.FileType = MUDEngine.FileSystem.FileSystem.OutputFormats.XML; + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new frmMain()); + } + } +} diff --git a/CurrencyEditor/Properties/AssemblyInfo.cs b/CurrencyEditor/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3123fe8 --- /dev/null +++ b/CurrencyEditor/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Currency Editor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Currency Editor")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5f283635-f313-48df-8ca5-61ebfe3c839f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CurrencyEditor/Properties/Resources.Designer.cs b/CurrencyEditor/Properties/Resources.Designer.cs new file mode 100644 index 0000000..45211e1 --- /dev/null +++ b/CurrencyEditor/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4200 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CurrencyEditor.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CurrencyEditor.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/CurrencyEditor/Properties/Resources.resx b/CurrencyEditor/Properties/Resources.resx new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/CurrencyEditor/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CurrencyEditor/Properties/Settings.Designer.cs b/CurrencyEditor/Properties/Settings.Designer.cs new file mode 100644 index 0000000..36a7850 --- /dev/null +++ b/CurrencyEditor/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.4200 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CurrencyEditor.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/CurrencyEditor/Properties/Settings.settings b/CurrencyEditor/Properties/Settings.settings new file mode 100644 index 0000000..abf36c5 --- /dev/null +++ b/CurrencyEditor/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/CurrencyEditor/frmMain.Designer.cs b/CurrencyEditor/frmMain.Designer.cs new file mode 100644 index 0000000..e0e613b --- /dev/null +++ b/CurrencyEditor/frmMain.Designer.cs @@ -0,0 +1,161 @@ +namespace CurrencyEditor +{ + partial class frmMain + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.lstCurrencies = new System.Windows.Forms.ListBox(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.btnNewCurrency = new System.Windows.Forms.Button(); + this.btnSaveCurrency = new System.Windows.Forms.Button(); + this.btnDeleteCurrency = new System.Windows.Forms.Button(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.propertyGrid1); + this.groupBox2.Location = new System.Drawing.Point(1, 136); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(323, 214); + this.groupBox2.TabIndex = 6; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Currency Setup"; + // + // propertyGrid1 + // + this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill; + this.propertyGrid1.Location = new System.Drawing.Point(3, 16); + this.propertyGrid1.Name = "propertyGrid1"; + this.propertyGrid1.Size = new System.Drawing.Size(317, 195); + this.propertyGrid1.TabIndex = 0; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.lstCurrencies); + this.groupBox1.Location = new System.Drawing.Point(1, 0); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(323, 130); + this.groupBox1.TabIndex = 5; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Currencies"; + // + // lstCurrencies + // + this.lstCurrencies.Dock = System.Windows.Forms.DockStyle.Fill; + this.lstCurrencies.FormattingEnabled = true; + this.lstCurrencies.Location = new System.Drawing.Point(3, 16); + this.lstCurrencies.Name = "lstCurrencies"; + this.lstCurrencies.Size = new System.Drawing.Size(317, 108); + this.lstCurrencies.TabIndex = 0; + this.lstCurrencies.SelectedIndexChanged += new System.EventHandler(this.lstCurrencies_SelectedIndexChanged); + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.btnDeleteCurrency); + this.groupBox3.Controls.Add(this.btnSaveCurrency); + this.groupBox3.Controls.Add(this.btnNewCurrency); + this.groupBox3.Location = new System.Drawing.Point(1, 353); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(323, 54); + this.groupBox3.TabIndex = 7; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Options"; + // + // btnNewCurrency + // + this.btnNewCurrency.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnNewCurrency.Location = new System.Drawing.Point(3, 16); + this.btnNewCurrency.Name = "btnNewCurrency"; + this.btnNewCurrency.Size = new System.Drawing.Size(100, 31); + this.btnNewCurrency.TabIndex = 0; + this.btnNewCurrency.Text = "New Currency"; + this.btnNewCurrency.UseVisualStyleBackColor = true; + this.btnNewCurrency.Click += new System.EventHandler(this.btnNewCurrency_Click); + // + // btnSaveCurrency + // + this.btnSaveCurrency.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnSaveCurrency.Location = new System.Drawing.Point(109, 16); + this.btnSaveCurrency.Name = "btnSaveCurrency"; + this.btnSaveCurrency.Size = new System.Drawing.Size(100, 31); + this.btnSaveCurrency.TabIndex = 1; + this.btnSaveCurrency.Text = "Save Currency"; + this.btnSaveCurrency.UseVisualStyleBackColor = true; + this.btnSaveCurrency.Click += new System.EventHandler(this.btnSaveCurrency_Click); + // + // btnDeleteCurrency + // + this.btnDeleteCurrency.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnDeleteCurrency.Location = new System.Drawing.Point(215, 16); + this.btnDeleteCurrency.Name = "btnDeleteCurrency"; + this.btnDeleteCurrency.Size = new System.Drawing.Size(100, 31); + this.btnDeleteCurrency.TabIndex = 2; + this.btnDeleteCurrency.Text = "Delete Currency"; + this.btnDeleteCurrency.UseVisualStyleBackColor = true; + this.btnDeleteCurrency.Click += new System.EventHandler(this.btnDeleteCurrency_Click); + // + // frmMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(326, 410); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "frmMain"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Currency Editor"; + this.groupBox2.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.PropertyGrid propertyGrid1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.ListBox lstCurrencies; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.Button btnNewCurrency; + private System.Windows.Forms.Button btnSaveCurrency; + private System.Windows.Forms.Button btnDeleteCurrency; + + } +} + diff --git a/CurrencyEditor/frmMain.cs b/CurrencyEditor/frmMain.cs new file mode 100644 index 0000000..ff6a721 --- /dev/null +++ b/CurrencyEditor/frmMain.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +//MudEngine +using MUDEngine.FileSystem; +using MUDEngine.Objects; +using MUDEngine.Objects.Environment; + +namespace CurrencyEditor +{ + public partial class frmMain : Form + { + Currency _Currency; + + public frmMain() + { + InitializeComponent(); + _Currency = new Currency(); + propertyGrid1.SelectedObject = _Currency; + } + + private void btnNewCurrency_Click(object sender, EventArgs e) + { + _Currency = new Currency(); + propertyGrid1.SelectedObject = _Currency; + } + + 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; + } + + FileSystem.Save(Application.StartupPath + @"\Data\Currency\" + _Currency.Name + ".xml", _Currency); + lstCurrencies.Items.Add(_Currency.Name); + } + + private void lstCurrencies_SelectedIndexChanged(object sender, EventArgs e) + { + //nothing selected. + if (lstCurrencies.SelectedIndex == -1) + return; + + _Currency = (Currency)FileSystem.Load(Application.StartupPath + @"\Data\Currency\" + lstCurrencies.SelectedItem.ToString() + ".xml", _Currency); + propertyGrid1.SelectedObject = _Currency; + } + + private void btnDeleteCurrency_Click(object sender, EventArgs e) + { + //Check if a currency is selected. + if (lstCurrencies.SelectedIndex == -1) + { + MessageBox.Show("Select a currency to delete first!", "Currency Deletion", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + //Ask if its ok to delete first. + DialogResult result = MessageBox.Show("Are you sure you want to delete " + _Currency.Name + "?", + "Currency Deletion", + MessageBoxButtons.YesNo, + MessageBoxIcon.Question); + + if (result == DialogResult.No) + return; + + //Delete the files and remove from the list. + System.IO.File.Delete(Application.StartupPath + @"\Data\Currency\" + lstCurrencies.SelectedItem.ToString() + ".xml"); + lstCurrencies.Items.Remove(lstCurrencies.SelectedItem); + + //Re-instance the currency and set it within the propertygrid. + _Currency = new Currency(); + propertyGrid1.SelectedObject = _Currency; + } + } +} diff --git a/CurrencyEditor/frmMain.resx b/CurrencyEditor/frmMain.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/CurrencyEditor/frmMain.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MUDEngine/Engine.cs b/MUDEngine/Engine.cs index 52f5573..69f9634 100644 --- a/MUDEngine/Engine.cs +++ b/MUDEngine/Engine.cs @@ -19,7 +19,7 @@ namespace MUDEngine System.IO.Directory.CreateDirectory(dataPath); //begin checking directories - string[] paths = { "Rooms", "Zones", "Realms" }; + string[] paths = { "Rooms", "Zones", "Realms", "Currency" }; foreach (var path in paths) { diff --git a/MUDEngine/Environment/Door.cs b/MUDEngine/Environment/Door.cs deleted file mode 100644 index f685382..0000000 --- a/MUDEngine/Environment/Door.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace MUDEngine.Environment -{ - /// - /// Doors connect two Rooms together, allowing a player to move from one room to the next. - /// - public class Door - { - } -} diff --git a/MUDEngine/Environment/Realm.cs b/MUDEngine/Environment/Realm.cs deleted file mode 100644 index 1bd652f..0000000 --- a/MUDEngine/Environment/Realm.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace MUDEngine.Environment -{ - /// - /// A Realm contains an unlimited number of Zones, allowing developers to split their worlds up into chunks. - /// - public class Realm - { - /// - /// The name of the realm. - /// - public string Name - { - get; - set; - } - - /// - /// Description of the Realm. - /// - public string Description - { - get; - set; - } - } -} diff --git a/MUDEngine/Environment/Room.cs b/MUDEngine/Environment/Room.cs deleted file mode 100644 index 0f0e0b4..0000000 --- a/MUDEngine/Environment/Room.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace MUDEngine.Environment -{ - /// - /// Rooms are traversable by players during gameplay. They are connected via Door objects, that allow players - /// to move from one room to another. - /// - public class Room : Zone - { - } -} diff --git a/MUDEngine/Environment/Zone.cs b/MUDEngine/Environment/Zone.cs deleted file mode 100644 index 82f6ed7..0000000 --- a/MUDEngine/Environment/Zone.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace MUDEngine.Environment -{ - /// - /// Zones contain an unlimited number of Rooms. - /// - public class Zone : Realm - { - } -} diff --git a/MUDEngine/MUDEngine.csproj b/MUDEngine/MUDEngine.csproj index 65ea6e4..8cb0fb4 100644 --- a/MUDEngine/MUDEngine.csproj +++ b/MUDEngine/MUDEngine.csproj @@ -50,12 +50,14 @@ - - - - + + + + + +