Control settings, more server settings, selecting character face

This commit is contained in:
Regalis
2015-10-28 19:07:17 +02:00
parent 9ed2963cd9
commit 948285f6ab
46 changed files with 789 additions and 325 deletions
+138 -23
View File
@@ -7,62 +7,177 @@ namespace Barotrauma
public enum InputType
{
Select,
ActionHit, ActionHeld,
SecondaryHit, SecondaryHeld,
Left, Right, Up, Down,
Use,
Aim,
Up, Down, Left, Right,
Run, Chat
}
public class KeyOrMouse
{
Keys keyBinding;
int? mouseButton;
public KeyOrMouse(Keys keyBinding)
{
this.keyBinding = keyBinding;
}
public KeyOrMouse(int mouseButton)
{
this.mouseButton = mouseButton;
}
public bool IsDown()
{
if (mouseButton==null)
{
return PlayerInput.KeyDown(keyBinding);
}
else if (mouseButton == 0)
{
return PlayerInput.LeftButtonDown();
}
else if (mouseButton == 1)
{
return PlayerInput.RightButtonDown();
}
return false;
}
public bool IsHit()
{
if (mouseButton == null)
{
return PlayerInput.KeyHit(keyBinding);
}
else if (mouseButton == 0)
{
return PlayerInput.LeftButtonClicked();
}
else if (mouseButton == 1)
{
return PlayerInput.RightButtonClicked();
}
return false;
}
public override string ToString()
{
if (mouseButton==null)
{
return keyBinding.ToString();
}
else if (mouseButton==0)
{
return "Mouse1";
}
else if (mouseButton==1)
{
return "Mouse2";
}
return "None";
}
}
class Key
{
private bool state, stateQueue;
private bool canBeHeld;
private bool hit, hitQueue;
private bool held, heldQueue;
public bool CanBeHeld
{
get { return canBeHeld; }
}
KeyOrMouse binding;
//public bool CanBeHeld
//{
// get { return canBeHeld; }
//}
public Key(bool canBeHeld)
public Key(KeyOrMouse binding)
{
this.canBeHeld = canBeHeld;
this.binding = binding;
}
public bool State
public bool Hit
{
get
{
return state;
return hit;
}
set
{
//if (value == false) return;
state = value;
//if (value) stateQueue = value;
hit = value;
}
}
public void SetState(bool value)
public bool Held
{
get
{
return held;
}
set
{
held = value;
}
}
public KeyOrMouse State
{
get { return binding; }
}
public void SetState()
{
state = value;
if (value) stateQueue = value;
hit = binding.IsHit();
if (hit) hitQueue = true;
held = binding.IsDown();
if (held) heldQueue = true;
}
public bool Dequeue
{
get
{
bool value = stateQueue;
stateQueue = false;
bool value = hitQueue;
hitQueue = false;
return value;
}
}
public void Reset()
public bool DequeueHeld
{
get
{
bool value = heldQueue;
heldQueue = false;
return value;
}
}
public void Reset()
{
hit = false;
held = false;
}
public void ResetHit()
{
if (!canBeHeld) state = false;
hit = false;
//stateQueue = false;
}
public void ResetHeld()
{
held = false;
//stateQueue = false;
}
}
public static class PlayerInput