diff options
Diffstat (limited to 'Client/Assembly-CSharp/KeyboardJoystick.cs')
-rw-r--r-- | Client/Assembly-CSharp/KeyboardJoystick.cs | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/KeyboardJoystick.cs b/Client/Assembly-CSharp/KeyboardJoystick.cs new file mode 100644 index 0000000..848eff3 --- /dev/null +++ b/Client/Assembly-CSharp/KeyboardJoystick.cs @@ -0,0 +1,79 @@ +using System; +using UnityEngine; + +public class KeyboardJoystick : MonoBehaviour, IVirtualJoystick +{ + public Vector2 Delta + { + get + { + return this.del; + } + } + + private Vector2 del; + + private void Update() + { + if (!PlayerControl.LocalPlayer) + { + return; + } + this.del.x = (this.del.y = 0f); + if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D)) + { + this.del.x = this.del.x + 1f; + } + if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A)) + { + this.del.x = this.del.x - 1f; + } + if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W)) + { + this.del.y = this.del.y + 1f; + } + if (Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S)) + { + this.del.y = this.del.y - 1f; + } + if (Input.GetKeyDown(KeyCode.R)) + { + DestroyableSingleton<HudManager>.Instance.ReportButton.DoClick(); + } + if (Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.E)) + { + DestroyableSingleton<HudManager>.Instance.UseButton.DoClick(); + } + if (Input.GetKeyDown(KeyCode.Tab)) + { + DestroyableSingleton<HudManager>.Instance.ShowMap(delegate(MapBehaviour m) + { + m.ShowNormalMap(); + }); + } + if (PlayerControl.LocalPlayer.Data.IsImpostor && Input.GetKeyDown(KeyCode.Q)) + { + DestroyableSingleton<HudManager>.Instance.KillButton.PerformKill(); + } + if (Input.GetKeyDown(KeyCode.Escape)) + { + if (Minigame.Instance) + { + Minigame.Instance.Close(); + } + else if (DestroyableSingleton<HudManager>.InstanceExists && MapBehaviour.Instance && MapBehaviour.Instance.IsOpen) + { + MapBehaviour.Instance.Close(); + } + else + { + CustomPlayerMenu customPlayerMenu = UnityEngine.Object.FindObjectOfType<CustomPlayerMenu>(); + if (customPlayerMenu) + { + customPlayerMenu.Close(true); + } + } + } + this.del.Normalize(); + } +} |