added OnValueEnteredHandler handler
This commit is contained in:
@@ -33,60 +33,60 @@ namespace Barotrauma
|
|||||||
|
|
||||||
{
|
{
|
||||||
object Call(object function, params object[] arguments) => GameMain.LuaCs.CallLuaFunction(function, arguments);
|
object Call(object function, params object[] arguments) => GameMain.LuaCs.CallLuaFunction(function, arguments);
|
||||||
void RegisterHandler<T>(Func<Closure, object> converter)
|
void RegisterHandler<T>(Func<Closure, T> converter)
|
||||||
{
|
=> Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(DataType.Function, typeof(T), v => converter(v.Function));
|
||||||
Script.GlobalOptions.CustomConverters.SetScriptToClrCustomConversion(DataType.Function, typeof(T), v => converter(v.Function));
|
|
||||||
}
|
|
||||||
|
|
||||||
RegisterHandler<GUIComponent.SecondaryButtonDownHandler>(f =>
|
RegisterHandler(f => (GUIComponent.SecondaryButtonDownHandler)(
|
||||||
(GUIComponent.SecondaryButtonDownHandler)((GUIComponent a1, object a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
(a1, a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
||||||
|
|
||||||
RegisterHandler<GUIButton.OnClickedHandler>(f =>
|
RegisterHandler(f => (GUIButton.OnClickedHandler)(
|
||||||
(GUIButton.OnClickedHandler)((GUIButton a1, object a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
(a1, a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
||||||
RegisterHandler<GUIButton.OnButtonDownHandler>(f =>
|
RegisterHandler(f => (GUIButton.OnButtonDownHandler)(
|
||||||
(GUIButton.OnButtonDownHandler)(() => new LuaResult(Call(f)).Bool()));
|
() => new LuaResult(Call(f)).Bool()));
|
||||||
RegisterHandler<GUIButton.OnPressedHandler>(f =>
|
RegisterHandler(f => (GUIButton.OnPressedHandler)(
|
||||||
(GUIButton.OnPressedHandler)(() => new LuaResult(Call(f)).Bool()));
|
() => new LuaResult(Call(f)).Bool()));
|
||||||
|
|
||||||
RegisterHandler<GUIColorPicker.OnColorSelectedHandler>(f =>
|
RegisterHandler(f => (GUIColorPicker.OnColorSelectedHandler)(
|
||||||
(GUIColorPicker.OnColorSelectedHandler)((GUIColorPicker a1, Color a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
(a1, a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
||||||
|
|
||||||
RegisterHandler<GUIDropDown.OnSelectedHandler>(f =>
|
RegisterHandler(f => (GUIDropDown.OnSelectedHandler)(
|
||||||
(GUIDropDown.OnSelectedHandler)((GUIComponent a1, object a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
(a1, a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
||||||
|
|
||||||
RegisterHandler<GUIListBox.OnSelectedHandler>(f =>
|
RegisterHandler(f => (GUIListBox.OnSelectedHandler)(
|
||||||
(GUIListBox.OnSelectedHandler)((GUIComponent a1, object a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
(a1, a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
||||||
RegisterHandler<GUIListBox.OnRearrangedHandler>(f =>
|
RegisterHandler(f => (GUIListBox.OnRearrangedHandler)(
|
||||||
(GUIListBox.OnRearrangedHandler)((GUIListBox a1, object a2) => Call(f, a1, a2)));
|
(a1, a2) => Call(f, a1, a2)));
|
||||||
RegisterHandler<GUIListBox.CheckSelectedHandler>(f =>
|
RegisterHandler(f => (GUIListBox.CheckSelectedHandler)(
|
||||||
(GUIListBox.CheckSelectedHandler)(() => new LuaResult(Call(f)).Object()));
|
() => new LuaResult(Call(f)).Object()));
|
||||||
|
|
||||||
RegisterHandler<GUINumberInput.OnValueChangedHandler>(f =>
|
RegisterHandler(f => (GUINumberInput.OnValueEnteredHandler)(
|
||||||
(GUINumberInput.OnValueChangedHandler)((GUINumberInput a1) => Call(f, a1)));
|
(a1) => Call(f, a1)));
|
||||||
|
RegisterHandler(f => (GUINumberInput.OnValueChangedHandler)(
|
||||||
|
(a1) => Call(f, a1)));
|
||||||
|
|
||||||
RegisterHandler<GUIProgressBar.ProgressGetterHandler>(f =>
|
RegisterHandler(f => (GUIProgressBar.ProgressGetterHandler)(
|
||||||
(GUIProgressBar.ProgressGetterHandler)(() => new LuaResult(Call(f)).Float()));
|
() => new LuaResult(Call(f)).Float()));
|
||||||
|
|
||||||
RegisterHandler<GUIRadioButtonGroup.RadioButtonGroupDelegate>(f =>
|
RegisterHandler(f => (GUIRadioButtonGroup.RadioButtonGroupDelegate)(
|
||||||
(GUIRadioButtonGroup.RadioButtonGroupDelegate)((GUIRadioButtonGroup a1, int? a2) => Call(f, a1, a2)));
|
(a1, a2) => Call(f, a1, a2)));
|
||||||
|
|
||||||
RegisterHandler<GUIScrollBar.OnMovedHandler>(f =>
|
RegisterHandler(f => (GUIScrollBar.OnMovedHandler)(
|
||||||
(GUIScrollBar.OnMovedHandler)((GUIScrollBar a1, float a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
(a1, a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
||||||
RegisterHandler<GUIScrollBar.ScrollConversion>(f =>
|
RegisterHandler(f => (GUIScrollBar.ScrollConversion)(
|
||||||
(GUIScrollBar.ScrollConversion)((GUIScrollBar a1, float a2) => new LuaResult(Call(f, a1, a2)).Float()));
|
(a1, a2) => new LuaResult(Call(f, a1, a2)).Float()));
|
||||||
|
|
||||||
RegisterHandler<GUITextBlock.TextGetterHandler>(f =>
|
RegisterHandler(f => (GUITextBlock.TextGetterHandler)(
|
||||||
(GUITextBlock.TextGetterHandler)(() => new LuaResult(Call(f, new object[] { })).String()));
|
() => new LuaResult(Call(f, new object[] { })).String()));
|
||||||
|
|
||||||
RegisterHandler<GUITextBox.OnEnterHandler>(f =>
|
RegisterHandler(f => (GUITextBox.OnEnterHandler)(
|
||||||
(GUITextBox.OnEnterHandler)((GUITextBox a1, string a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
(a1, a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
||||||
RegisterHandler<GUITextBox.OnTextChangedHandler>(f =>
|
RegisterHandler(f => (GUITextBox.OnTextChangedHandler)(
|
||||||
(GUITextBox.OnTextChangedHandler)((GUITextBox a1, string a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
(a1, a2) => new LuaResult(Call(f, a1, a2)).Bool()));
|
||||||
RegisterHandler<TextBoxEvent>(f =>
|
RegisterHandler(f => (TextBoxEvent)(
|
||||||
(TextBoxEvent)((GUITextBox a1, Microsoft.Xna.Framework.Input.Keys a2) => Call(f, a1, a2)));
|
(a1, a2) => Call(f, a1, a2)));
|
||||||
|
|
||||||
RegisterHandler<GUITickBox.OnSelectedHandler>(f =>
|
RegisterHandler(f => (GUITickBox.OnSelectedHandler)(
|
||||||
(GUITickBox.OnSelectedHandler)((GUITickBox a1) => new LuaResult(Call(f, a1)).Bool()));
|
(a1) => new LuaResult(Call(f, a1)).Bool()));
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user