diff --git a/MUDCompiler/Program.cs b/MUDCompiler/Program.cs index 883be17..7669285 100644 --- a/MUDCompiler/Program.cs +++ b/MUDCompiler/Program.cs @@ -18,7 +18,8 @@ namespace MUDCompiler Console.WriteLine(); Console.WriteLine("1): Compile Scripts"); Console.WriteLine("2): Exit Compiler"); - Console.Write("Enter Selection: "); + //Console.Write("Enter Selection: "); + Console.WriteLine("Out of engine compiling is currently not supported."); String command = Console.ReadLine(); @@ -46,21 +47,6 @@ namespace MUDCompiler static void CompileScripts() { - MudEngine.GameManagement.Game game = new MudEngine.GameManagement.Game(); - ScriptEngine se = new ScriptEngine(game, ScriptEngine.ScriptTypes.SourceFiles); - Console.WriteLine(); - Console.WriteLine("Compiling..."); - - se.Initialize(); - se.ScriptExtension = ".mud"; - se.ScriptPath = "Scripts"; - if (se.CompileScripts()) - Console.WriteLine("Compiling completed without error."); - else - Console.WriteLine(se.ErrorMessage); - - Console.WriteLine("Press any key to exit."); - Console.Read(); } } } diff --git a/MudDesigner/frmProjectManager.cs b/MudDesigner/frmProjectManager.cs index 78eb5e3..9392ca1 100644 --- a/MudDesigner/frmProjectManager.cs +++ b/MudDesigner/frmProjectManager.cs @@ -17,144 +17,23 @@ namespace MudDesigner { public partial class frmProjectManager : Form { - String[] _ProjectFiles; - String _ProjectPath; - String _ScriptPath; - const String SettingsFile = "Settings.ini"; - - dynamic _Game; - ScriptEngine _ScriptEngine; - Client client; - Thread r; - public frmProjectManager() { InitializeComponent(); - _ProjectPath = Path.Combine(Environment.CurrentDirectory, "Projects"); - _ScriptPath = Path.Combine(Environment.CurrentDirectory, "Scripts"); - - if (!Directory.Exists(_ProjectPath)) - Directory.CreateDirectory(_ProjectPath); - - if (!Directory.Exists(_ScriptPath)) - Directory.CreateDirectory(_ScriptPath); - if (!File.Exists(SettingsFile)) - { - Log.Write("Settings.ini missing!", false); - FileManager.WriteLine(SettingsFile, "Scripts", "ScriptPath"); - FileManager.WriteLine(SettingsFile, ".cs", "ScriptExtension"); - FileManager.WriteLine(SettingsFile, "True", "ServerEnabled"); - } - - _ScriptEngine = new ScriptEngine(new Game(), ScriptEngine.ScriptTypes.Both); - _ScriptEngine.Initialize(); - - GameObject go = _ScriptEngine.GetObject("Game"); - - if (go == null) - { - _Game = new Game(); - go = new GameObject(_Game, "Game"); - _ScriptEngine = new ScriptEngine(_Game, ScriptEngine.ScriptTypes.Both); - } - else - { - _Game = (Game)go.Instance; - _ScriptEngine = new ScriptEngine(_Game, ScriptEngine.ScriptTypes.Both); - } - - //TODO: Do I need to Re-initialize _ScriptEngine? - - RefreshProjects(); - - client = new Client(); - client.Initialize("localhost", 555); - - comServerType.Items.Add("Local Server"); - comServerType.Items.Add("Test Server"); - comServerType.SelectedIndex = 0; } private void RefreshProjects() { - _ProjectFiles = Directory.GetFiles(Environment.CurrentDirectory, "*.ini"); - - foreach (String filename in _ProjectFiles) - { - if (Path.GetFileNameWithoutExtension(filename).ToLower() == "settings") - continue; - - _Game.Load(filename); - - lstProjects.Items.Add(_Game.GameTitle); - } } private void btnNewProject_Click(object sender, EventArgs e) { - frmInputBox input = new frmInputBox("Enter the name of your project."); - input.ShowDialog(); - - if (input.IsCancel) - return; - else if (String.IsNullOrEmpty(input.Input)) - return; - - lstProjects.Items.Add(input.Input); - - _Game.GameTitle = input.Input; - //Setup save data paths. - _Game.DataPaths = new SaveDataPaths(Path.Combine("Projects", _Game.GameTitle, _Game.DataPaths.Environment), Path.Combine("Projects", _Game.GameTitle, _Game.DataPaths.Players), Path.Combine("Projects", _Game.GameTitle, _Game.DataPath.Scripts)); - - _Game.Save(); - - input = null; - - ShowDesigner(); } private void ShowDesigner() { - frmDesigner form = new frmDesigner(_Game, client); - - form.Show(); - this.Hide(); - - if (comServerType.SelectedItem.ToString() == "Test Server") - { - } - else - { - frmInputBox input = new frmInputBox("Enter the Port that your local server is currently running on."); - - input.ShowDialog(); - - if (input.IsCancel) - return; - - client.Initialize("localhost", Convert.ToInt32(input.Input)); - - if (!client.Connect() || !client.Send("hello", false)) // test send + client data - { - MessageBox.Show("Failed to connect to a local server. Is the server running?", "Mud Designer"); - return; - } - } - - while (form.Visible) - { - Application.DoEvents(); - } - - //Refresh the project list incase the project was renamed. - lstProjects.Items.Clear(); - - RefreshProjects(); - - this.Show(); - form = null; } private void btnClose_Click(object sender, EventArgs e) @@ -163,11 +42,7 @@ namespace MudDesigner } private void editProjectToolStripMenuItem_Click(object sender, EventArgs e) - { - if (File.Exists(lstProjects.SelectedItem.ToString() + ".ini")) - _Game.Load(lstProjects.SelectedItem.ToString() + ".ini"); - - ShowDesigner(); + { } } } diff --git a/MudEngine/GameManagement/Game.cs b/MudEngine/GameManagement/Game.cs index 24984f8..cd1a1ee 100644 --- a/MudEngine/GameManagement/Game.cs +++ b/MudEngine/GameManagement/Game.cs @@ -52,13 +52,7 @@ namespace MudEngine.GameManagement /// [Browsable(false)] public SaveDataPaths DataPaths { get; set; } - - /// - /// Gets the scripting engine used by the game. - /// - [Browsable(false)] - public ScriptEngine scriptEngine { get; internal set; } - + [Browsable(false)] public rScripting.CompileEngine Scripting { get; internal set; } @@ -201,7 +195,6 @@ namespace MudEngine.GameManagement { //Instance all of the Games Objects. CurrencyList = new List(); - scriptEngine = new Scripting.ScriptEngine(this); //TODO - Remove Scripting = new rScripting.CompileEngine(".cs"); World = new GameWorld(this); WorldTime = new GameTime(this); @@ -246,17 +239,9 @@ namespace MudEngine.GameManagement if (!Directory.Exists(DataPaths.Players)) Directory.CreateDirectory(DataPaths.Players); - //Load both pre-compiled and file based scripts - TODO - Remove - //scriptEngine.ScriptType = ScriptEngine.ScriptTypes.Both; - //scriptEngine.Initialize(); - - //Instance the new scripting engine Scripting.Compiler = "MudScriptCompiler"; - if (!System.IO.File.Exists("MudEngine.dll")) - Log.Write("CRITICAL ERROR: Un-able to locate MudEngine.dll"); - - Scripting.AddAssemblyReference("MudEngine.dll"); + //Check for compiler errors after script compiling completes. if (!Scripting.Compile(DataPaths.Scripts)) { Log.Write("CRITICAL ERROR: Game Script Repository failed to compile!"); diff --git a/MudEngine/MudEngine.csproj b/MudEngine/MudEngine.csproj index 531af46..bc186f2 100644 --- a/MudEngine/MudEngine.csproj +++ b/MudEngine/MudEngine.csproj @@ -86,9 +86,6 @@ - - -