(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

View File

@@ -1172,6 +1172,12 @@ namespace Barotrauma
if (args.Length == 0) return;
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
commands.Add(new Command("cleanbuild", "", (string[] args) =>

View File

@@ -179,7 +179,7 @@ namespace Barotrauma
public bool Close(GUIButton button, object obj)
{
Close();
return true;
}

View File

@@ -157,6 +157,33 @@ namespace Barotrauma
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
{
get { return binding; }