private void compileToolStripMenuItem_Click(object sender, EventArgs e) { //CompileScripts(true); //ScriptsBuilder.ReloadScripts(); CompilerForm cf = new CompilerForm(); cf.ShowDialog(); }
/// <summary> /// /// </summary> public static void DebugGame() { if (SceneManager.ActiveScene == null) { KryptonMessageBox.Show("Ups!\n\nThere is no scene loaded", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SceneManager.GameProject.SceneStartPath = GibboHelper.MakeExclusiveRelativePath(SceneManager.GameProject.ProjectPath, SceneManager.ActiveScenePath); SaveProject(); SaveScene(false); if (File.Exists(SceneManager.GameProject.ProjectPath + "\\Gibbo.Engine.Windows.exe")) { if(File.Exists(SceneManager.GameProject.ProjectPath + "\\libs\\Scripts.dll")) File.Delete(SceneManager.GameProject.ProjectPath + "\\libs\\Scripts.dll"); if(!Directory.Exists(SceneManager.GameProject.ProjectPath + "\\libs")) Directory.CreateDirectory(SceneManager.GameProject.ProjectPath + "\\libs"); // Compile scripts: // old (depracated): CompileScripts(false); //if (SceneManager.ScriptsAssembly != null) //{ string dllpath = SceneManager.GameProject.ProjectPath + "\\bin\\" + (SceneManager.GameProject.Debug ? "Debug" : "Release") + "\\" + SceneManager.ScriptsAssembly.GetName().Name + ".dll"; // The scripts .dll exists? if (!File.Exists(dllpath)) { // Compile scripts CompilerForm cf = new CompilerForm(); if(cf.ShowDialog() != DialogResult.Yes) return; // Update path dllpath = SceneManager.GameProject.ProjectPath + "\\bin\\" + (SceneManager.GameProject.Debug ? "Debug" : "Release") + "\\" + SceneManager.ScriptsAssembly.GetName().Name + ".dll"; } File.Copy(dllpath, SceneManager.GameProject.ProjectPath + "\\libs\\Scripts.dll", true); //} Process debug = new Process(); debug.StartInfo.WorkingDirectory = SceneManager.GameProject.ProjectPath; debug.StartInfo.FileName = SceneManager.GameProject.ProjectPath + "\\Gibbo.Engine.Windows.exe"; debug.StartInfo.CreateNoWindow = true; debug.Start(); debug.WaitForExit(); debug.Close(); } else { KryptonMessageBox.Show("Ups!\n\nIt seems there is no engine set up for your game!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// /// </summary> /// <param name="filename"></param> /// <returns></returns> private bool LoadProject(string filename) { try { if (File.Exists(filename)) { SceneManager.GameProject = GibboProject.Load(filename); File.Copy("Gibbo.Library.dll", SceneManager.GameProject.ProjectPath + "\\Gibbo.Library.dll", true); File.Copy("Project Templates\\Gibbo.Engine.Windows.exe", SceneManager.GameProject.ProjectPath + "\\Gibbo.Engine.Windows.exe", true); GibboHelper.CopyDirectory("Project Templates\\libs", SceneManager.GameProject.ProjectPath + "", true); SceneManager.ActiveScene = null; EditorHandler.SceneTreeView.CreateView(); //CompileScripts(true); CompilerForm cf = new CompilerForm(); bool success = cf.ShowDialog() == System.Windows.Forms.DialogResult.Yes ? true : false; Reload(); if (success) { LoadLastScene(); EditorCommands.ShowOutputMessage("Project loaded with sucess"); kryptonNavigator1.SelectedIndex = 1; } else { EditorCommands.ShowOutputMessage("Project loaded with script errors"); } EditorHandler.Settings = new IniFile(SceneManager.GameProject.ProjectPath + "\\settings.ini"); return true; } } catch (Exception ex) { KryptonMessageBox.Show("Invalid File\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return false; }