void AddButtonAxisSource(object data) { ControlBinding binding = (ControlBinding)data; var source = new ButtonAxisSource(new InputControlDescriptor(), new InputControlDescriptor()); binding.buttonAxisSources.Add(source); m_SelectedSource = null; m_SelectedButtonAxisSource = source; }
void DrawButtonAxisSourceSummary(Rect rect, ButtonAxisSource source) { if ((Type)(source.negative.deviceType) == (Type)(source.positive.deviceType)) { EditorGUI.LabelField(rect, string.Format("{0} {1} & {2}", InputDeviceUtility.GetDeviceName(source.negative), InputDeviceUtility.GetDeviceControlName(source.negative), InputDeviceUtility.GetDeviceControlName(source.positive) ) ); } else { EditorGUI.LabelField(rect, string.Format("{0} & {1}", GetSourceString(source.negative), GetSourceString(source.positive))); } }
void DrawSourceSummary(InputControlDescriptor source) { Rect rect = EditorGUILayout.GetControlRect(); if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition)) { m_SelectedButtonAxisSource = null; m_SelectedSource = source; Repaint(); } if (m_SelectedSource == source) { GUI.DrawTexture(rect, EditorGUIUtility.whiteTexture); } DrawSourceSummary(rect, "Source", source); EditorGUILayout.Space(); }
void DrawButtonAxisSourceSummary(ButtonAxisSource source) { Rect rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing); if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition)) { m_SelectedSource = null; m_SelectedButtonAxisSource = source; Repaint(); } if (m_SelectedButtonAxisSource == source) { GUI.DrawTexture(rect, EditorGUIUtility.whiteTexture); } rect.height = EditorGUIUtility.singleLineHeight; DrawSourceSummary(rect, "Source (negative)", source.negative); rect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; DrawSourceSummary(rect, "Source (positive)", source.positive); EditorGUILayout.Space(); }
void DrawButtonAxisSourceSummary(Rect rect, ButtonAxisSource source) { ControlScheme scheme = m_ActionMapEditCopy.controlSchemes[selectedScheme]; var negativeDeviceSlot = scheme.GetDeviceSlot(source.negative.deviceKey); var positiveDeviceSlot = scheme.GetDeviceSlot(source.positive.deviceKey); if ((Type)(negativeDeviceSlot.type) == (Type)(positiveDeviceSlot.type)) { EditorGUI.LabelField(rect, string.Format("{0} {1} {2} & {3}", InputDeviceUtility.GetDeviceNameWithTag(negativeDeviceSlot), GetDeviceInstanceString(scheme, negativeDeviceSlot), InputDeviceUtility.GetDeviceControlName(negativeDeviceSlot, source.negative), InputDeviceUtility.GetDeviceControlName(positiveDeviceSlot, source.positive) ) ); } else { EditorGUI.LabelField(rect, string.Format("{0} & {1}", GetSourceString(source.negative), GetSourceString(source.positive))); } }
void DisplayButtonAxisSource(ButtonAxisSource source, bool positive) { DisplaySource(positive ? source.positive : source.negative); }