RemappingButtonCategory 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
游戏板重新映射的类型。
public enum class RemappingButtonCategory
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Gaming.Input.GamingInputPreviewContract, 131072)]
enum class RemappingButtonCategory
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Gaming.Input.GamingInputPreviewContract), 131072)]
public enum RemappingButtonCategory
var value = Windows.Gaming.Input.Preview.RemappingButtonCategory.buttonSettings
Public Enum RemappingButtonCategory
- 继承
-
RemappingButtonCategory
- 属性
Windows 要求
设备系列 |
Windows Desktop Extension SDK (在 10.0.23665.0 中引入)
|
API contract |
Windows.Gaming.Input.GamingInputPreviewContract (在 v2.0 中引入)
|
字段
AnalogSettings | 1 | 用于交换模拟控件。 |
ButtonSettings | 0 | 用于重新映射按钮。 |
ShareDoublePress | 9 | 未实现。 |
ShareDoublePressMetaData | 10 | 未实现。 |
ShareDoublePressMetaDataDisplay | 11 | 未实现。 |
ShareLongPress | 6 | 未实现。 |
ShareLongPressMetaData | 7 | 未实现。 |
ShareLongPressMetaDataDisplay | 8 | 未实现。 |
ShareShortPress | 3 | 未实现。 |
ShareShortPressMetaData | 4 | 未实现。 |
ShareShortPressMetaDataDisplay | 5 | 未实现。 |
VibrationSettings | 2 | 用于禁用振动。 |
示例
void RemapButtons(IGameController controller, IGameControllerProvider controllerProvider)
{
LegacyGipGameControllerProvider legacyGipGameControllerProvider =
LegacyGipGameControllerProvider.FromGameControllerProvider(controllerProvider);
// Retrieve all current remappings set for standard controllers
IReadOnlyDictionary<RemappingButtonCategory, object> currentMappings =
legacyGipGameControllerProvider.GetStandardControllerButtonRemapping(
controller.User, false);
// Swap two of the buttons
Dictionary<RemappingButtonCategory, object> remaps =
new Dictionary<RemappingButtonCategory, object>();
// Duplicates are not allowed. Swap two of the buttons
UInt64 currentButtonMappings =
(UInt64)currentMappings[RemappingButtonCategory.ButtonSettings];
// Isolate the buttons we want to remap
UInt64 lastButton = (currentButtonMappings & 0xf000000000000000);
UInt64 secondLastButton = currentButtonMappings & 0x0f00000000000000;
// Swap their positions
UInt64 newMapping = (lastButton >> 4) | (secondLastButton << 4);
// Recombine with the original mappings
UInt64 newButtonMappings = (currentButtonMappings & 0x00ffffffffffffff) | newMapping;
// Add the new button remappings to the mapping dictionary
remaps.Add(RemappingButtonCategory.ButtonSettings, newButtonMappings);
// Update controller mapping
legacyGipGameControllerProvider.SetStandardControllerButtonRemapping(
controller.User, false, newButtonMappings);
}
注解
注意
控制器映射是系统范围的,对于给定用户而言是永久性的。 这只应在用户的方向上完成。