1 using Microsoft.Xna.Framework;
5 static class LuaCsSettingsMenu
7 private static GUIFrame frame;
9 public static void Open(RectTransform rectTransform)
13 frame =
new GUIFrame(
new RectTransform(
new Vector2(0.4f, 0.6f), rectTransform,
Anchor.Center));
15 GUIListBox list =
new GUIListBox(
new RectTransform(
new Vector2(0.95f, 0.95f), frame.RectTransform,
Anchor.Center),
false);
17 new GUITextBlock(
new RectTransform(
new Vector2(1f, 0.1f), list.Content.RectTransform),
"LuaCs Settings", textAlignment: Alignment.Center);
20 new GUITickBox(
new RectTransform(
new Vector2(0.8f, 0.1f), list.Content.RectTransform),
"Enable CSharp Scripting")
22 Selected = GameMain.LuaCs.Config.EnableCsScripting,
23 ToolTip =
"This enables CSharp Scripting for mods to use, WARNING: CSharp is NOT sandboxed, be careful with what mods you download.",
24 OnSelected = (GUITickBox tick) =>
26 GameMain.LuaCs.Config.EnableCsScripting = tick.Selected;
27 GameMain.LuaCs.WriteSettings();
33 new GUITickBox(
new RectTransform(
new Vector2(0.8f, 0.1f), list.Content.RectTransform),
"Treat Forced Mods As Normal")
35 Selected = GameMain.LuaCs.Config.TreatForcedModsAsNormal,
36 ToolTip =
"This makes mods that were setup to run even when disabled to only run when enabled.",
37 OnSelected = (GUITickBox tick) =>
39 GameMain.LuaCs.Config.TreatForcedModsAsNormal = tick.Selected;
40 GameMain.LuaCs.WriteSettings();
46 new GUITickBox(
new RectTransform(
new Vector2(0.8f, 0.1f), list.Content.RectTransform),
"Prefer To Use Workshop Lua Setup")
48 Selected = GameMain.LuaCs.Config.PreferToUseWorkshopLuaSetup,
49 ToolTip =
"This makes Lua look first for the Lua/LuaSetup.lua located in the Workshop package instead of the one located locally.",
50 OnSelected = (GUITickBox tick) =>
52 GameMain.LuaCs.Config.PreferToUseWorkshopLuaSetup = tick.Selected;
53 GameMain.LuaCs.WriteSettings();
59 new GUITickBox(
new RectTransform(
new Vector2(0.8f, 0.1f), list.Content.RectTransform),
"Disable Error GUI Overlay")
61 Selected = GameMain.LuaCs.Config.DisableErrorGUIOverlay,
63 OnSelected = (GUITickBox tick) =>
65 GameMain.LuaCs.Config.DisableErrorGUIOverlay = tick.Selected;
66 GameMain.LuaCs.WriteSettings();
72 new GUITickBox(
new RectTransform(
new Vector2(0.8f, 0.1f), list.Content.RectTransform),
"Hide usernames In Error Logs")
74 Selected = GameMain.LuaCs.Config.HideUserNames,
75 ToolTip =
"Hides the operating system username when displaying error logs (eg your username on windows).",
76 OnSelected = (GUITickBox tick) =>
78 GameMain.LuaCs.Config.HideUserNames = tick.Selected;
79 GameMain.LuaCs.WriteSettings();
85 new GUIButton(
new RectTransform(
new Vector2(1f, 0.1f), list.Content.RectTransform), $
"Remove Client-Side LuaCs", style:
"GUIButtonSmall")
87 ToolTip =
"Remove Client-Side LuaCs.",
88 OnClicked = (tb, userdata) =>
90 LuaCsInstaller.Uninstall();
95 new GUIButton(
new RectTransform(
new Vector2(0.8f, 0.01f), frame.RectTransform,
Anchor.BottomCenter)
97 RelativeOffset = new Vector2(0f, 0.05f)
100 OnClicked = (GUIButton button,
object obj) =>
109 public static void Close()
111 frame?.Parent.RemoveChild(frame);