Frame field "Layer" controls render order and prevents event bubbling.
Reworked GUI events.
This commit is contained in:
@@ -53,10 +53,12 @@ namespace DepthsBelow
|
||||
{
|
||||
private LuaInterface.Lua lua;
|
||||
|
||||
private List<string> filesToRun;
|
||||
|
||||
public Lua()
|
||||
{
|
||||
ResetContext();
|
||||
ExposeLibraries();
|
||||
filesToRun = new List<string>();
|
||||
Initialize();
|
||||
|
||||
/*lua.DoString(@"
|
||||
local frame = CreateFrame('Frame');
|
||||
@@ -71,6 +73,15 @@ namespace DepthsBelow
|
||||
");*/
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
if (lua == null)
|
||||
{
|
||||
lua = new LuaInterface.Lua();
|
||||
ExposeLibraries();
|
||||
}
|
||||
}
|
||||
|
||||
public void ExposeLibraries()
|
||||
{
|
||||
lua.NewTable("Console");
|
||||
@@ -120,7 +131,13 @@ namespace DepthsBelow
|
||||
if (lua != null)
|
||||
lua.Dispose();
|
||||
|
||||
lua = new LuaInterface.Lua();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void Reload()
|
||||
{
|
||||
ResetContext();
|
||||
LoadScripts();
|
||||
}
|
||||
|
||||
public void LoadScripts()
|
||||
@@ -128,7 +145,7 @@ namespace DepthsBelow
|
||||
// Load scripts from script folder
|
||||
// HACK: This needs to load files on the fly instead of loading precompiled files by the content manager.
|
||||
// http://xbox.create.msdn.com/en-US/education/catalog/sample/winforms_series_2 maybe?
|
||||
var scripts = GameServices.GetService<ContentManager>().LoadContent<string>("scripts");
|
||||
/*var scripts = GameServices.GetService<ContentManager>().LoadContent<string>("scripts");
|
||||
foreach (var script in scripts)
|
||||
{
|
||||
try
|
||||
@@ -140,9 +157,19 @@ namespace DepthsBelow
|
||||
Console.WriteLine("Lua error: " + e.Message);
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
foreach (var fileName in filesToRun)
|
||||
{
|
||||
lua.DoFile(GameServices.GetService<ContentManager>().RootDirectory + "/" + fileName);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddFile(string fileName)
|
||||
{
|
||||
filesToRun.Add(fileName);
|
||||
}
|
||||
|
||||
public T GetObject<T>(string obj)
|
||||
{
|
||||
return (T)lua[obj];
|
||||
|
||||
Reference in New Issue
Block a user