MUD Engine:
- Added additional script over-rideable Methods. - Room Designer can now compile scripts for error checking.
This commit is contained in:
parent
bc6bfeaecd
commit
8486088e17
3 changed files with 55 additions and 26 deletions
|
@ -343,5 +343,20 @@ namespace RoomDesigner
|
|||
txtScript.Text = _CurrentRoom.Script;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCheckScript_Click(object sender, EventArgs e)
|
||||
{
|
||||
_ScriptEngine.Compiler = ManagedScripting.ScriptingEngine.CompilerSelections.SourceCompiler;
|
||||
_ScriptEngine.AddReference(Application.StartupPath + "/MUDEngine.dll");
|
||||
ManagedScripting.CodeBuilding.ClassGenerator newClass = new ManagedScripting.CodeBuilding.ClassGenerator();
|
||||
string code = "namespace MUDEngine.Objects.Environment\n"
|
||||
+ "{\n"
|
||||
+ " public class " + _CurrentRoom.Name.Replace(" ", "") + " : Room\n"
|
||||
+ " {\n"
|
||||
+ " " + txtScript.Text + "\n"
|
||||
+ " }\n"
|
||||
+ "}\n";
|
||||
MessageBox.Show(_ScriptEngine.Compile(code), "Script Compiling", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue