void DrawActionMapInput(ActionMapInput map) { EditorGUI.BeginDisabledGroup(!map.active); GUIContent mapContent = new GUIContent(map.actionMap.name); GUILayout.BeginVertical(mapContent, Styles.mapStyle); { LabelField("Block Subsequent", map.blockSubsequent.ToString()); string schemeString = "-"; if (map.active && map.controlScheme != null) { schemeString = map.controlScheme.name; } LabelField("Current Control Scheme", schemeString); string devicesString = ""; if (map.active) { devicesString = string.Join(", ", map.GetCurrentlyUsedDevices().Select(e => e.ToString()).ToArray()); } if (string.IsNullOrEmpty(devicesString)) { devicesString = "-"; } LabelField("Currently Used Devices", devicesString); } EditorGUILayout.EndVertical(); EditorGUI.EndDisabledGroup(); }
public static ActionMapInput Create(ActionMap actionMap) { ActionMapInput map = (ActionMapInput)Activator.CreateInstance(actionMap.customActionMapType, new object[] { actionMap }); return(map); }
void Awake() { if (autoAssignGlobal) { handle = PlayerHandleManager.GetNewPlayerHandle(); handle.global = true; foreach (ActionMapSlot actionMapSlot in actionMaps) { ActionMapInput actionMapInput = ActionMapInput.Create(actionMapSlot.actionMap); actionMapInput.TryInitializeWithDevices(handle.GetApplicableDevices()); actionMapInput.active = actionMapSlot.active; actionMapInput.blockSubsequent = actionMapSlot.blockSubsequent; handle.maps.Add(actionMapInput); } } }
bool ProcessEventInMap(ActionMapInput map, InputEvent inputEvent) { if (map.ProcessEvent(inputEvent)) { return(true); } if (map.CurrentlyUsesDevice(inputEvent.device)) { return(false); } if (!map.TryInitializeWithDevices(GetApplicableDevices())) { return(false); } // When changing control scheme, we do not want to init control scheme to device states // like we normally want, so do a hard reset here, before processing the new event. map.Reset(false); return(map.ProcessEvent(inputEvent)); }