本文整理汇总了C#中InputManager.Select方法的典型用法代码示例。如果您正苦于以下问题:C# InputManager.Select方法的具体用法?C# InputManager.Select怎么用?C# InputManager.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputManager
的用法示例。
在下文中一共展示了InputManager.Select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompileController
public override string CompileController(int playerIndex, IPlatformInfo platformInfo, IControllerDefinition controllerDefinition, IControllerTemplate controllerTemplate, IGamepadAbstraction gamepadAbstraction, IInputTemplate inputTemplate, IGameInfo gameInfo)
{
var controllerMappings = gamepadAbstraction.ProfileType == ControllerProfileType.KEYBOARD_PROFILE ?
controllerTemplate.KeyboardControllerMappings : controllerTemplate.GamepadControllerMappings;
string deviceName = gamepadAbstraction.DeviceName;
IList<IInputDevice> devices = new InputManager().GetGamepads();
if (deviceName == null) deviceName = String.Empty;
int realWiimoteAmount = devices.Count(device => device.DI_ProductName.Contains("RVL-CNT"));
if(controllerDefinition.ControllerID == "WII_COMBINED_CONTROLLER")
{
//All wiimotes have the same attachment
int wiimote_extension = this.ConfigurationFlagStore.GetValue(gameInfo, "wiimote_extension", ConfigurationFlagTypes.SELECT_FLAG);
controllerMappings["default"].KeyMappings["EXTENSION"] = this.ConfigurationFlags["wiimote_extension"].SelectValues[wiimote_extension].Value;
if (playerIndex <= realWiimoteAmount)
{
controllerMappings["default"].KeyMappings["SOURCE"] = "2"; //Real Wiimotes take precedence
}
else
{
controllerMappings["default"].KeyMappings["SOURCE"] = "1"; //Emulated Wiimote
}
}
if (deviceName.Equals(InputDeviceNames.KeyboardDevice, StringComparison.InvariantCultureIgnoreCase))
{
controllerMappings["default"].KeyMappings["DEVICE"] = "DInput/0/Keyboard Mouse";
return this.CompileController(playerIndex, platformInfo, controllerDefinition, controllerTemplate,
gamepadAbstraction, inputTemplate, controllerMappings, gameInfo);
}
string xinputDevice = "XInput/{0}/Gamepad";
string dintpuDevice = "DInput/{0}/{1}";
if (deviceName.Equals(InputDeviceNames.XInputDevice1, StringComparison.InvariantCultureIgnoreCase))
{
controllerMappings["default"].KeyMappings["DEVICE"] =
String.Format(xinputDevice, 0);
}
else if (deviceName.Equals(InputDeviceNames.XInputDevice2, StringComparison.InvariantCultureIgnoreCase))
{
controllerMappings["default"].KeyMappings["DEVICE"] =
String.Format(xinputDevice, 1);
}
else if (deviceName.Equals(InputDeviceNames.XInputDevice3, StringComparison.InvariantCultureIgnoreCase))
{
controllerMappings["default"].KeyMappings["DEVICE"] =
String.Format(xinputDevice, 2);
}
else if (deviceName.Equals(InputDeviceNames.XInputDevice4, StringComparison.InvariantCultureIgnoreCase))
{
controllerMappings["default"].KeyMappings["DEVICE"] =
String.Format(xinputDevice, 3);
}
else if (devices.Select(device => device.DI_ProductName).Contains(deviceName))
{
var device = devices.First(d => d.DI_ProductName == deviceName);
controllerMappings["default"].KeyMappings["DEVICE"] =
String.Format(dintpuDevice, device.DI_ProductName, device.DeviceIndex);
}
return this.CompileController(playerIndex, platformInfo, controllerDefinition, controllerTemplate, gamepadAbstraction, inputTemplate, controllerMappings, gameInfo);
}