|
10 | 10 | using UnityEngine.InputSystem.Layouts; |
11 | 11 | using UnityEngine.InputSystem.Utilities; |
12 | 12 |
|
| 13 | +#if UNITY_6000_2_OR_NEWER |
| 14 | +using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>; |
| 15 | +using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>; |
| 16 | +using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>; |
| 17 | +#endif |
| 18 | + |
13 | 19 | // The action tree view illustrates one of the weaknesses of Unity's editing model. While operating directly |
14 | 20 | // on serialized data does have a number of advantages (the built-in undo system being one of them), making the |
15 | 21 | // persistence model equivalent to the edit model doesn't work well. Serialized data will be laid out for persistence, |
@@ -90,15 +96,15 @@ public static TreeViewItem BuildWithJustActionsAndBindingsFromMap(SerializedProp |
90 | 96 | public static TreeViewItem BuildWithJustActionMapsFromAsset(SerializedObject assetObject) |
91 | 97 | { |
92 | 98 | Debug.Assert(assetObject != null, "Asset object cannot be null"); |
93 | | - var root = new ActionMapListItem {id = 0, depth = -1}; |
| 99 | + var root = new ActionMapListItem { id = 0, depth = -1 }; |
94 | 100 | ActionMapTreeItem.AddActionMapsFromAssetTo(root, assetObject); |
95 | 101 | return root; |
96 | 102 | } |
97 | 103 |
|
98 | 104 | public static TreeViewItem BuildFullTree(SerializedObject assetObject) |
99 | 105 | { |
100 | 106 | Debug.Assert(assetObject != null, "Asset object cannot be null"); |
101 | | - var root = new TreeViewItem {id = 0, depth = -1}; |
| 107 | + var root = new TreeViewItem { id = 0, depth = -1 }; |
102 | 108 | ActionMapTreeItem.AddActionMapsFromAssetTo(root, assetObject); |
103 | 109 | if (root.hasChildren) |
104 | 110 | foreach (var child in root.children) |
@@ -368,7 +374,7 @@ public IEnumerable<TItem> GetSelectedItemsOrParentsOfType<TItem>() |
368 | 374 | public void SelectFirstToplevelItem() |
369 | 375 | { |
370 | 376 | if (rootItem.children.Any()) |
371 | | - SetSelection(new[] {rootItem.children[0].id}, TreeViewSelectionOptions.FireSelectionChanged); |
| 377 | + SetSelection(new[] { rootItem.children[0].id }, TreeViewSelectionOptions.FireSelectionChanged); |
372 | 378 | } |
373 | 379 |
|
374 | 380 | protected override void SelectionChanged(IList<int> selectedIds) |
@@ -739,7 +745,7 @@ public void PasteItems(string copyBufferString, IEnumerable<InsertLocation> loca |
739 | 745 | // Split buffer into transmissions and then into transmission blocks. Each transmission is an item subtree |
740 | 746 | // meant to be pasted as a whole and each transmission block is a single chunk of serialized data. |
741 | 747 | foreach (var transmission in copyBufferString.Substring(k_CopyPasteMarker.Length) |
742 | | - .Split(new[] {k_EndOfTransmission}, StringSplitOptions.RemoveEmptyEntries)) |
| 748 | + .Split(new[] { k_EndOfTransmission }, StringSplitOptions.RemoveEmptyEntries)) |
743 | 749 | { |
744 | 750 | foreach (var location in locations) |
745 | 751 | PasteBlocks(transmission, location, assignNewIDs, newItemPropertyPaths); |
@@ -768,7 +774,7 @@ private void PasteBlocks(string transmission, InsertLocation location, bool assi |
768 | 774 | { |
769 | 775 | Debug.Assert(location.item != null, "Should have drop target"); |
770 | 776 |
|
771 | | - var blocks = transmission.Split(new[] {k_EndOfTransmissionBlock}, |
| 777 | + var blocks = transmission.Split(new[] { k_EndOfTransmissionBlock }, |
772 | 778 | StringSplitOptions.RemoveEmptyEntries); |
773 | 779 | if (blocks.Length < 1) |
774 | 780 | return; |
@@ -1630,17 +1636,17 @@ private bool CheckChildrenFor(Match match, ActionTreeItemBase item) |
1630 | 1636 |
|
1631 | 1637 | public static FilterCriterion ByName(string name) |
1632 | 1638 | { |
1633 | | - return new FilterCriterion {text = name, type = Type.ByName}; |
| 1639 | + return new FilterCriterion { text = name, type = Type.ByName }; |
1634 | 1640 | } |
1635 | 1641 |
|
1636 | 1642 | public static FilterCriterion ByBindingGroup(string group) |
1637 | 1643 | { |
1638 | | - return new FilterCriterion {text = group, type = Type.ByBindingGroup}; |
| 1644 | + return new FilterCriterion { text = group, type = Type.ByBindingGroup }; |
1639 | 1645 | } |
1640 | 1646 |
|
1641 | 1647 | public static FilterCriterion ByDeviceLayout(string layout) |
1642 | 1648 | { |
1643 | | - return new FilterCriterion {text = layout, type = Type.ByDeviceLayout}; |
| 1649 | + return new FilterCriterion { text = layout, type = Type.ByDeviceLayout }; |
1644 | 1650 | } |
1645 | 1651 |
|
1646 | 1652 | public static List<FilterCriterion> FromString(string criteria) |
|
0 commit comments