Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public static List<TreeViewItemData<ActionOrBindingData>> GetActionsAsTreeViewDa
var nextBinding = actionBindings[++i];
while (nextBinding.isPartOfComposite)
{
var name = GetHumanReadableCompositeName(nextBinding);
var name = GetHumanReadableCompositeName(nextBinding, state.selectedControlScheme, state.selectedControlSchemeIndex);

compositeItems.Add(new TreeViewItemData<ActionOrBindingData>(id++,
new ActionOrBindingData(false, name, actionMapIndex, false, GetControlLayout(nextBinding.path), nextBinding.indexOfBinding)));
Expand All @@ -341,7 +341,7 @@ public static List<TreeViewItemData<ActionOrBindingData>> GetActionsAsTreeViewDa
else
{
bindingItems.Add(new TreeViewItemData<ActionOrBindingData>(id++,
new ActionOrBindingData(false, GetHumanReadableBindingName(serializedInputBinding), actionMapIndex,
new ActionOrBindingData(false, GetHumanReadableBindingName(serializedInputBinding, state.selectedControlSchemeIndex, state.selectedControlScheme), actionMapIndex,
false, GetControlLayout(serializedInputBinding.path), serializedInputBinding.indexOfBinding)));
}
}
Expand All @@ -351,18 +351,28 @@ public static List<TreeViewItemData<ActionOrBindingData>> GetActionsAsTreeViewDa
return actionItems;
}

private static string GetHumanReadableBindingName(SerializedInputBinding serializedInputBinding)
private static string GetHumanReadableBindingName(SerializedInputBinding serializedInputBinding, int currentControlSchemeIndex, InputControlScheme? currentControlScheme)
{
var name = InputControlPath.ToHumanReadableString(serializedInputBinding.path);
if (String.IsNullOrEmpty(name))
name = "<No Binding>";
if (!IsBindingPartOfCurrentControlScheme(serializedInputBinding, currentControlScheme, currentControlSchemeIndex))
name += " {GLOBAL}";
return name;
}

internal static string GetHumanReadableCompositeName(SerializedInputBinding binding)
private static bool IsBindingPartOfCurrentControlScheme(SerializedInputBinding serializedInputBinding, InputControlScheme? currentControlScheme, int currentControlSchemeIndex)
{
if (currentControlScheme.HasValue && currentControlSchemeIndex >= 0)
return serializedInputBinding.controlSchemes.Contains(currentControlScheme.Value.name);

return true;
}

internal static string GetHumanReadableCompositeName(SerializedInputBinding binding, InputControlScheme? currentControlScheme, int currentControlSchemeIndex)
{
return $"{ObjectNames.NicifyVariableName(binding.name)}: " +
$"{GetHumanReadableBindingName(binding)}";
$"{GetHumanReadableBindingName(binding, currentControlSchemeIndex, currentControlScheme)}";
}

private static string GetControlLayout(string path)
Expand Down