some GUI
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Barotrauma.Networking;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -13,6 +14,12 @@ namespace Barotrauma
|
||||
public LuaGUI(LuaSetup _env)
|
||||
{
|
||||
env = _env;
|
||||
|
||||
RectTransform = UserData.CreateStatic<RectTransform>();
|
||||
GUILayoutGroup = UserData.CreateStatic<GUILayoutGroup>();
|
||||
GUIButton = UserData.CreateStatic<GUIButton>();
|
||||
GUITextBox = UserData.CreateStatic<GUITextBox>();
|
||||
Anchor = UserData.CreateStatic<Anchor>();
|
||||
}
|
||||
|
||||
public ChatBox ChatBox
|
||||
@@ -22,6 +29,12 @@ namespace Barotrauma
|
||||
return GameMain.Client.ChatBox;
|
||||
}
|
||||
}
|
||||
|
||||
public static object RectTransform;
|
||||
public static object GUILayoutGroup;
|
||||
public static object GUIButton;
|
||||
public static object GUITextBox;
|
||||
public static object Anchor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,6 +420,20 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
#endif
|
||||
new GUIButton(new RectTransform(new Point(300, 30), Frame.RectTransform, Anchor.TopRight) { AbsoluteOffset = new Point(40, 230) },
|
||||
"Remove Client-Side Lua", style: "GUIButtonLarge", color: GUI.Style.Red)
|
||||
{
|
||||
IgnoreLayoutGroups = true,
|
||||
UserData = Tab.Empty,
|
||||
ToolTip = "Remove Client-Side Lua.",
|
||||
OnClicked = (tb, userdata) =>
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var minButtonSize = new Point(120, 20);
|
||||
var maxButtonSize = new Point(480, 80);
|
||||
|
||||
|
||||
@@ -198,7 +198,16 @@ namespace Barotrauma
|
||||
|
||||
code = code + ")";
|
||||
|
||||
return lua.DoString(code, tbl);
|
||||
try
|
||||
{
|
||||
return lua.DoString(code, tbl);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
HandleLuaException(e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void AddCallMetaMember(IUserDataDescriptor IUDD)
|
||||
@@ -322,12 +331,20 @@ namespace Barotrauma
|
||||
AddCallMetaMember(UserData.RegisterType<CharacterInfo>());
|
||||
AddCallMetaMember(UserData.RegisterType<Signal>());
|
||||
AddCallMetaMember(UserData.RegisterType<Color>());
|
||||
AddCallMetaMember(UserData.RegisterType<Point>());
|
||||
|
||||
#if SERVER
|
||||
|
||||
#elif CLIENT
|
||||
UserData.RegisterType<LuaGUI>();
|
||||
UserData.RegisterType<ChatBox>();
|
||||
UserData.RegisterType<Anchor>();
|
||||
|
||||
AddCallMetaMember(UserData.RegisterType<GUILayoutGroup>());
|
||||
AddCallMetaMember(UserData.RegisterType<GUITextBox>());
|
||||
AddCallMetaMember(UserData.RegisterType<GUIButton>());
|
||||
AddCallMetaMember(UserData.RegisterType<RectTransform>());
|
||||
AddCallMetaMember(UserData.RegisterType<GUIFrame>());
|
||||
#endif
|
||||
lua = new Script(CoreModules.Preset_SoftSandbox);
|
||||
|
||||
@@ -380,6 +397,7 @@ namespace Barotrauma
|
||||
lua.Globals["Vector3"] = UserData.CreateStatic<Vector3>();
|
||||
lua.Globals["Vector4"] = UserData.CreateStatic<Vector4>();
|
||||
lua.Globals["Color"] = UserData.CreateStatic<Color>();
|
||||
lua.Globals["Point"] = UserData.CreateStatic<Point>();
|
||||
lua.Globals["ChatMessage"] = UserData.CreateStatic<ChatMessage>();
|
||||
lua.Globals["Hull"] = UserData.CreateStatic<Hull>();
|
||||
lua.Globals["InvSlotType"] = UserData.CreateStatic<InvSlotType>();
|
||||
|
||||
Reference in New Issue
Block a user