// ------------------- public AxisDescription(UnityInputManagerUtils.InputAxis inputAxis) { this.name = inputAxis.name; this.inputAxis = inputAxis; this.inputAxes = new List <UnityInputManagerUtils.InputAxis>(4); this.inputAxes.Add(inputAxis); if (inputAxis.type == UnityInputManagerUtils.AxisType.JoystickAxis) { this.targetAxisType = InputRig.AxisType.SignedAnalog; } else if (inputAxis.type == UnityInputManagerUtils.AxisType.MouseMovement) { this.targetAxisType = (((inputAxis.axis == UnityInputManagerUtils.SCROLL_PRIMARY_AXIS_ID) || (inputAxis.axis == UnityInputManagerUtils.SCROLL_SECONDARY_AXIS_ID)) ? InputRig.AxisType.ScrollWheel : InputRig.AxisType.Delta); } else { if ((inputAxis.negativeButton.Length > 0) || (inputAxis.altNegativeButton.Length > 0)) { this.targetAxisType = InputRig.AxisType.SignedAnalog; } else { this.targetAxisType = InputRig.AxisType.Digital; } } }
// ------------------ public void DrawElementGUI() { EditorGUILayout.BeginHorizontal(CFEditorStyles.Inst.transpBevelBG); this.enabled = EditorGUILayout.ToggleLeft(new GUIContent(this.name, "Transfer this axis to Input Rig."), this.enabled, GUILayout.ExpandWidth(true)); this.targetAxisType = (InputRig.AxisType)CFGUI.EnumPopup(new GUIContent("Add as:", "Select target axis type."), this.targetAxisType, 50, GUILayout.Width(180)); EditorGUILayout.EndHorizontal(); }
// ----------------- public AxisCreationParams(InputRig rig, string name, InputRig.AxisType axisType) { this.rig = rig; this.name = name; this.axisType = axisType; }
// ---------------------- static public void AddMenuItem(GenericMenu menu, string axisName, string menuPath, InputRig.AxisType axisType, InputRig rig, System.Action callback) { AxisCreationMenuItem o = new AxisCreationMenuItem(); string itemName = ""; o.axisName = axisName; o.axisType = axisType; o.callback = callback; o.rig = rig; itemName = "Create \"" + axisName + "\" " + axisType.ToString() + " axis!"; menu.AddItem(new GUIContent(menuPath + itemName), false, o.Execute); }