protected virtual void Start() { _validAxesMapping.Clear(); for (int i = 0; i < _virtualAxes.Count; i++) { List <InputMap> maps = new List <InputMap>(); foreach (BaseInputManager iManager in GetInputManagers()) { AxisMapping axisMapping = iManager.GetAxisMapping(i); if (axisMapping._axisCode != BaseInputManager.NULL_MAPPING) { maps.Add(new InputMap(iManager, axisMapping._axisCode, InputMap.Type.Axis)); } if (axisMapping._positiveButton._keyCode != BaseInputManager.NULL_MAPPING) { maps.Add(new InputMap(iManager, axisMapping._positiveButton._keyCode, InputMap.Type.Button, 1)); } if (axisMapping._positiveButton._altKeyCode != BaseInputManager.NULL_MAPPING) { maps.Add(new InputMap(iManager, axisMapping._positiveButton._altKeyCode, InputMap.Type.Button, 1)); } if (axisMapping._negativeButton._keyCode != BaseInputManager.NULL_MAPPING) { maps.Add(new InputMap(iManager, axisMapping._negativeButton._keyCode, InputMap.Type.Button, -1)); } if (axisMapping._negativeButton._altKeyCode != BaseInputManager.NULL_MAPPING) { maps.Add(new InputMap(iManager, axisMapping._negativeButton._altKeyCode, InputMap.Type.Button, -1)); } } _validAxesMapping.Add(maps); } _validButtonsMapping.Clear(); for (int i = 0; i < _virtualButtons.Count; i++) { List <InputMap> maps = new List <InputMap>(); foreach (BaseInputManager iManager in GetInputManagers()) { ButtonMapping bMapping = iManager.GetButtonMapping(i); if (bMapping._keyCode != BaseInputManager.NULL_MAPPING) { maps.Add(new InputMap(iManager, bMapping._keyCode, InputMap.Type.Button)); } if (bMapping._altKeyCode != BaseInputManager.NULL_MAPPING) { maps.Add(new InputMap(iManager, bMapping._altKeyCode, InputMap.Type.Button)); } } _validButtonsMapping.Add(maps); } }
protected virtual void ConfigureDefaultAxis(string virtualAxisName, string axisName) { AxisMapping aMapping = GetAxisMapping(_inputManager.ToAxisID(virtualAxisName)); if (aMapping != null) { if (aMapping._axisCode == NULL_MAPPING) { aMapping._axisCode = axisName; } } }
protected virtual void ConfigureDefaultAxis(string virtualAxisName, string kPositive, string kNegative) { AxisMapping aMapping = GetAxisMapping(_inputManager.ToAxisID(virtualAxisName)); if (aMapping == null) { return; } if (aMapping._positiveButton._keyCode == NULL_MAPPING) { aMapping._positiveButton._keyCode = kPositive; } if (aMapping._negativeButton._keyCode == NULL_MAPPING) { aMapping._negativeButton._keyCode = kNegative; } }
protected virtual void DrawAxisMapping(int axisID) { AxisMapping mapping = _baseInputManager.GetAxisMapping(axisID); EditorGUI.indentLevel++; bool showInInspector = EditorGUILayout.Foldout(mapping._showInInspector, _inputManager.GetVirtualAxis(axisID)); if (showInInspector) { EditorGUI.indentLevel++; int index = EditorGUILayout.Popup(AXIS, GetSelectedIndex(_axisCodes, mapping._axisCode), _axisCodes); mapping._axisCode = _axisCodes[index]; ButtonMapping positiveButton = mapping._positiveButton; index = EditorGUILayout.Popup(POSITIVE_KEY, GetSelectedIndex(_buttonCodes, positiveButton._keyCode), _buttonCodes); positiveButton._keyCode = _buttonCodes[index]; index = EditorGUILayout.Popup(ALT_POSITIVE_KEY, GetSelectedIndex(_buttonCodes, positiveButton._altKeyCode), _buttonCodes); positiveButton._altKeyCode = _buttonCodes[index]; ButtonMapping negativeButton = mapping._negativeButton; index = EditorGUILayout.Popup(NEGATIVE_KEY, GetSelectedIndex(_buttonCodes, negativeButton._keyCode), _buttonCodes); negativeButton._keyCode = _buttonCodes[index]; index = EditorGUILayout.Popup(ALT_NEGATIVE_KEY, GetSelectedIndex(_buttonCodes, negativeButton._altKeyCode), _buttonCodes); negativeButton._altKeyCode = _buttonCodes[index]; EditorGUI.indentLevel--; } EditorGUI.indentLevel--; mapping._showInInspector = showInInspector; //mapping.ApplyModifiedProperties(); }