5dc31c213f
commit 7245c721339885d062567befc052a592391b3b4a Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Sun Mar 10 15:22:31 2019 +0200 Fixed StatusEffects only applying afflictions to one limb even if the target is "Character" instead of "Limb", added a subtle screen distortion effect to heavy radiation sickness. Closes #1256 commit e0db27e62ec9546fd4b182a0cc97f7e5830645ae Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Sat Mar 9 21:53:51 2019 +0200 Fixed WrapText adding unnecessary spaces after every line break. Closes #1215 commit 988bc58d51c195ad9265b84a1e97e0101cd3f808 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Sat Mar 9 21:12:50 2019 +0200 Fixed crashing when attempting to create a body for a wall section that's less than 1 unit long (e.g. if a wall that's just slightly longer than the wall section size receives damage). commit 8c31157425a9e2ec02312618d1bfa359ab3ee87d Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Sat Mar 9 20:30:44 2019 +0200 Fixed clients being unable to toggle the respawn shuttle on/off commit a4ccb039219830efe9cd305c26942dda1bd04e9c Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Sat Mar 9 19:33:22 2019 +0200 Fixed inability to select the respawn shuttle as a client host commit b89b2d2c282d8c74d7ccd37b3f29dcab51eff680 Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Sat Mar 9 19:32:41 2019 +0200 Made it possible to edit the style of the ListBox under GUIDropDowns, increased the opacity of the listbox to make the contents more readable when there's text behind it commit 8f6d9aef3d637fe37a18c78f4b15ef8fd266374e Author: Joonas Rikkonen <poe.regalis@gmail.com> Date: Sat Mar 9 18:11:23 2019 +0200 Fixed NetLobbyScreen not showing the names of the submarines the client doesn't have
247 lines
5.6 KiB
C#
247 lines
5.6 KiB
C#
using Microsoft.Xna.Framework.Input;
|
|
|
|
namespace Barotrauma
|
|
{
|
|
|
|
public enum InputType
|
|
{
|
|
Select,
|
|
Use,
|
|
Aim,
|
|
Up, Down, Left, Right,
|
|
Attack,
|
|
Run, Crouch,
|
|
InfoTab, Chat, RadioChat, CrewOrders,
|
|
Ragdoll, Health, Grab,
|
|
SelectNextCharacter,
|
|
SelectPreviousCharacter,
|
|
Voice
|
|
}
|
|
|
|
public class KeyOrMouse
|
|
{
|
|
public Keys Key { get; private set; }
|
|
public int? MouseButton { get; private set; }
|
|
|
|
public KeyOrMouse(Keys keyBinding)
|
|
{
|
|
this.Key = keyBinding;
|
|
}
|
|
|
|
public KeyOrMouse(int mouseButton)
|
|
{
|
|
this.MouseButton = mouseButton;
|
|
}
|
|
|
|
public bool IsDown()
|
|
{
|
|
switch (MouseButton)
|
|
{
|
|
case null:
|
|
return PlayerInput.KeyDown(Key);
|
|
case 0:
|
|
return PlayerInput.LeftButtonHeld();
|
|
case 1:
|
|
return PlayerInput.RightButtonHeld();
|
|
case 2:
|
|
return PlayerInput.MidButtonHeld();
|
|
case 3:
|
|
return PlayerInput.Mouse4ButtonHeld();
|
|
case 4:
|
|
return PlayerInput.Mouse5ButtonHeld();
|
|
case 5: // No real way of "holding" a mouse wheel key, but then again it makes no sense to bind the key to this kind of task.
|
|
return PlayerInput.MouseWheelUpClicked();
|
|
case 6:
|
|
return PlayerInput.MouseWheelDownClicked();
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public bool IsHit()
|
|
{
|
|
switch (MouseButton)
|
|
{
|
|
case null:
|
|
return PlayerInput.KeyHit(Key);
|
|
case 0:
|
|
return PlayerInput.LeftButtonClicked();
|
|
case 1:
|
|
return PlayerInput.RightButtonClicked();
|
|
case 2:
|
|
return PlayerInput.MidButtonClicked();
|
|
case 3:
|
|
return PlayerInput.Mouse4ButtonClicked();
|
|
case 4:
|
|
return PlayerInput.Mouse5ButtonClicked();
|
|
case 5:
|
|
return PlayerInput.MouseWheelUpClicked();
|
|
case 6:
|
|
return PlayerInput.MouseWheelDownClicked();
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
switch (MouseButton)
|
|
{
|
|
case null:
|
|
return Key.ToString();
|
|
case 0:
|
|
return "Mouse1";
|
|
case 1:
|
|
return "Mouse2";
|
|
case 2:
|
|
return "Mouse3";
|
|
case 3:
|
|
return "Mouse4";
|
|
case 4:
|
|
return "Mouse5";
|
|
case 5:
|
|
return "MouseWheelUp";
|
|
case 6:
|
|
return "MouseWheelDown";
|
|
}
|
|
|
|
return "None";
|
|
}
|
|
}
|
|
|
|
class Key
|
|
{
|
|
private bool hit, hitQueue;
|
|
private bool held, heldQueue;
|
|
|
|
#if CLIENT
|
|
private InputType inputType;
|
|
|
|
public Key(InputType inputType)
|
|
{
|
|
this.inputType = inputType;
|
|
}
|
|
|
|
private InputType inputType;
|
|
|
|
public Key(InputType inputType)
|
|
{
|
|
this.inputType = inputType;
|
|
}
|
|
#if CLIENT
|
|
private KeyOrMouse binding
|
|
{
|
|
get { return GameMain.Config.KeyBind(inputType); }
|
|
}
|
|
|
|
public KeyOrMouse State
|
|
{
|
|
get { return binding; }
|
|
}
|
|
#endif
|
|
|
|
public void SetState()
|
|
{
|
|
hit = binding.IsHit();
|
|
if (hit) hitQueue = true;
|
|
|
|
held = binding.IsDown();
|
|
if (held) heldQueue = true;
|
|
}
|
|
#endif
|
|
|
|
public void SetState()
|
|
{
|
|
hit = binding.IsHit();
|
|
if (hit) hitQueue = true;
|
|
|
|
held = binding.IsDown();
|
|
if (held) heldQueue = true;
|
|
}
|
|
#endif
|
|
|
|
public void SetState()
|
|
{
|
|
hit = binding.IsHit();
|
|
if (hit) hitQueue = true;
|
|
|
|
held = binding.IsDown();
|
|
if (held) heldQueue = true;
|
|
}
|
|
#endif
|
|
|
|
public bool Hit
|
|
{
|
|
get
|
|
{
|
|
return hit;
|
|
}
|
|
set
|
|
{
|
|
hit = value;
|
|
}
|
|
}
|
|
|
|
public bool Held
|
|
{
|
|
get
|
|
{
|
|
return held;
|
|
}
|
|
set
|
|
{
|
|
held = value;
|
|
}
|
|
}
|
|
|
|
|
|
public void SetState(bool hit, bool held)
|
|
{
|
|
if (hit) hitQueue = true;
|
|
if (held) heldQueue = true;
|
|
}
|
|
|
|
public bool DequeueHit()
|
|
{
|
|
bool value = hitQueue;
|
|
hitQueue = false;
|
|
return value;
|
|
}
|
|
|
|
public bool DequeueHeld()
|
|
{
|
|
bool value = heldQueue;
|
|
heldQueue = false;
|
|
return value;
|
|
}
|
|
|
|
public bool GetHeldQueue
|
|
{
|
|
get { return heldQueue; }
|
|
}
|
|
|
|
public bool GetHitQueue
|
|
{
|
|
get { return hitQueue; }
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
hit = false;
|
|
held = false;
|
|
}
|
|
|
|
public void ResetHit()
|
|
{
|
|
hit = false;
|
|
//stateQueue = false;
|
|
}
|
|
|
|
public void ResetHeld()
|
|
{
|
|
held = false;
|
|
//stateQueue = false;
|
|
}
|
|
}
|
|
}
|