/// <summary> /// Input setting for XBox 360's gamepad. /// </summary> public static void SetupXBox360Joystick() { float defalutSenstivity = JCS_InputSettings.DEFAULT_SENSITIVITY; float defaultDead = JCS_InputSettings.DEFAULT_DEAD; float defaultGravity = JCS_InputSettings.DEFAULT_GRAVITY; for (int joystickNum = 0; joystickNum < GAMEPAD_COUNT; ++joystickNum) { foreach (JCS_JoystickButton val in JCS_Util.GetValues <JCS_JoystickButton>()) { if (val == JCS_JoystickButton.NONE) { continue; } // add axis definition. AddAxis(new InputAxis() { name = JCS_InputSettings.GetJoystickButtonIdName(joystickNum, val), positiveButton = JCS_InputSettings.GetPositiveNameByLabel(val), dead = defaultDead, gravity = defaultGravity, sensitivity = defalutSenstivity, type = JCS_InputSettings.GetAxisType(val), invert = JCS_InputSettings.IsInvert(val), axis = (int)JCS_InputSettings.GetAxisChannel(val), joyNum = joystickNum, }); } } }
/// <summary> /// Initialize the packet handlers array list. /// </summary> /// <typeparam name="K"></typeparam> protected void InitPacketHandlersArray <K>() where K : struct, IComparable, IFormattable, IConvertible { if (typeof(K).BaseType != typeof(Enum)) { throw new InvalidCastException(); } int maxRecvOp = 0; foreach (K op in JCS_Util.GetValues <K>()) { int opId = Convert.ToInt32(op); if (opId > maxRecvOp) { maxRecvOp = opId; } } mHandlers = new JCS_PacketHandler[maxRecvOp + 1]; Reset(this.mMode); }