(53c44ee8a) Disallow shooting and attacking when hovering over a GUIComponent + added guimessagebox command

This commit is contained in:
Joonas Rikkonen
2019-06-09 17:36:48 +03:00
parent aefa46eaa5
commit 85d19d7f3c
3 changed files with 34 additions and 1 deletions
@@ -1172,6 +1172,12 @@ namespace Barotrauma
if (args.Length == 0) return; if (args.Length == 0) return;
LocalizationCSVtoXML.Convert(args[0]); LocalizationCSVtoXML.Convert(args[0]);
})); }));
commands.Add(new Command("guimessagebox", "guimessagebox [msg] -> Creates a message box with the parameter as a message.", (string[] args) =>
{
if (args.Length == 0) return;
var dialog = new GUIMessageBox("Message box", args[0]);
}));
#endif #endif
commands.Add(new Command("cleanbuild", "", (string[] args) => commands.Add(new Command("cleanbuild", "", (string[] args) =>
@@ -157,6 +157,33 @@ namespace Barotrauma
get { return GameMain.Config.KeyBind(inputType); } get { return GameMain.Config.KeyBind(inputType); }
} }
private static bool AllowOnGUI(InputType input)
{
switch (input)
{
case InputType.Attack:
case InputType.Shoot:
return GUI.MouseOn == null;
default:
return true;
}
}
public KeyOrMouse State
{
get { return binding; }
}
public void SetState()
{
hit = binding.IsHit() && AllowOnGUI(inputType);
if (hit) hitQueue = true;
held = binding.IsDown() && AllowOnGUI(inputType);
if (held) heldQueue = true;
}
#endif
public KeyOrMouse State public KeyOrMouse State
{ {
get { return binding; } get { return binding; }