public static bool GetButtonUp(Button button, Index controlIndex) { code = GetKeycode(button, controlIndex); if (controlIndex == Index.Keyboard1 || controlIndex == Index.Keyboard2) { KeyboardSetting setting1 = KeyboardSetting.GetKetboard(controlIndex.ToString()); return(Input.GetKeyUp(setting1.GetKey(button.ToString()))); } else if (controlIndex != Index.Any) { return(Input.GetKeyUp(code)); } else { KeyboardSetting setting1 = KeyboardSetting.GetKetboard(Index.Keyboard1.ToString()); KeyboardSetting setting2 = KeyboardSetting.GetKetboard(Index.Keyboard2.ToString()); return(Input.GetKeyUp(code) || Input.GetKeyUp(setting1.GetKey(button.ToString())) || Input.GetKeyUp(setting2.GetKey(button.ToString()))); } }
private static void FillKeyboard(ref GamepadState state, Index controlIndex) { KeyboardSetting setting = KeyboardSetting.GetKetboard(controlIndex.ToString()); state.A = Input.GetKey(setting.A); state.B = Input.GetKey(setting.B); state.Y = Input.GetKey(setting.Y); state.X = Input.GetKey(setting.X); state.AUp = Input.GetKeyUp(setting.A); state.BUp = Input.GetKeyUp(setting.B); state.YUp = Input.GetKeyUp(setting.Y); state.XUp = Input.GetKeyUp(setting.X); state.ADown = Input.GetKeyDown(setting.A); state.BDown = Input.GetKeyDown(setting.B); state.YDown = Input.GetKeyDown(setting.Y); state.XDown = Input.GetKeyDown(setting.X); state.RightShoulder = Input.GetKey(setting.RightShoulder); state.LeftShoulder = Input.GetKey(setting.LeftShoulder); state.RightStick = Input.GetKey(setting.RightStick); state.LeftStick = Input.GetKey(setting.LeftStick); state.RightShoulderUp = Input.GetKeyUp(setting.RightShoulder); state.LeftShoulderUp = Input.GetKeyUp(setting.LeftShoulder); state.RightShoulderDown = Input.GetKeyDown(setting.RightShoulder); state.LeftShoulderDwon = Input.GetKeyDown(setting.LeftShoulder); state.RightShoulder = Input.GetKey(setting.RightShoulder); state.LeftShoulder = Input.GetKey(setting.LeftShoulder); state.Start = Input.GetKey(setting.Start); state.Back = Input.GetKey(setting.Back); state.rightStickAxis = Vector2.zero; state.Left = Input.GetKey(setting.Left); state.Right = Input.GetKey(setting.Right); state.Up = Input.GetKey(setting.Up); state.Down = Input.GetKey(setting.Down); move = Vector2.zero; if (state.Left) { move.x += -1.0f; } if (state.Right) { move.x += 1.0f; } if (state.Down) { move.y += -1.0f; } if (state.Up) { move.y += 1.0f; } state.LeftStickAxis = move; dPad = Vector2.zero; if (Input.GetKey(setting.DpadUp)) { dPad.y += 1.0f; } if (Input.GetKey(setting.DpadDown)) { dPad.y += -1.0f; } if (Input.GetKey(setting.DpadRight)) { dPad.x += 1.0f; } if (Input.GetKey(setting.DpadLeft)) { dPad.x += -1.0f; } state.dPadAxis = dPad; state.LeftTrigger = Input.GetKey(setting.LeftTrigger) ? 1.0f : 0.0f; state.RightTrigger = Input.GetKey(setting.RightTrigger) ? 1.0f : 0.0f; state.AnyKeyPressedDownAXYB = state.XDown || state.ADown || state.YDown || state.BDown; }