public static void Show(Rect btnRect, ActionTreeViewItem treeViewLine, Action reload) { var w = CreateInstance <BindingPropertiesPopup>(); w.OnChange = reload; w.SetProperty(treeViewLine); w.ShowPopup(); w.ShowAsDropDown(btnRect, new Vector2(250, 350)); }
private void MoveAction(DragAndDropArgs args, ActionTreeViewItem row) { var action = (ActionTreeItem)row; var dstIndex = args.insertAtIndex; var srcIndex = action.index; if (dstIndex > srcIndex) { dstIndex--; } InputActionSerializationHelpers.MoveAction(actionMapProperty, srcIndex, dstIndex); }
private static void CopyChildrenItems(ActionTreeViewItem parent, StringBuilder result) { foreach (var treeViewItem in parent.children) { var item = (ActionTreeViewItem)treeViewItem; result.Append(item.GetType().Name + "\n"); result.Append(item.SerializeToString()); result.Append(k_InputAssetMarker); if (item.hasChildren) { CopyChildrenItems(item, result); } } }
private void MoveBinding(DragAndDropArgs args, ActionTreeViewItem row) { TreeViewItem item; var compositeChildrenCount = 0; for (var i = 0; i < args.insertAtIndex; i++) { item = args.parentItem.children[i]; if (item.hasChildren) { compositeChildrenCount += item.children.Count; } } args.insertAtIndex += compositeChildrenCount; var action = (ActionTreeItem)args.parentItem; var dstIndex = action.bindingsStartIndex + args.insertAtIndex; var srcIndex = action.bindingsStartIndex + row.index; if (dstIndex > srcIndex) { dstIndex--; } InputActionSerializationHelpers.MoveBinding(actionMapProperty, srcIndex, dstIndex); if (row.hasChildren) { for (var i = 0; i < row.children.Count; i++) { if (dstIndex > srcIndex) { // when moving composite down InputActionSerializationHelpers.MoveBinding(actionMapProperty, srcIndex, dstIndex); continue; } // when moving composite up dstIndex++; srcIndex = action.bindingsStartIndex + (row.children[i] as CompositeTreeItem).index; InputActionSerializationHelpers.MoveBinding(actionMapProperty, srcIndex, dstIndex); } } }
void SetProperty(ActionTreeViewItem treeViewLine) { m_BindingPropertyView = treeViewLine.GetPropertiesView(OnChange, new TreeViewState(), null); }
private void SetProperty(ActionTreeViewItem treeViewLine) { m_BindingPropertyView = new InputBindingPropertiesView(treeViewLine.elementProperty, change => OnChange(), new InputControlPickerState(), null); }
void SetProperty(ActionTreeViewItem treeViewLine) { m_BindingPropertyView = new InputBindingPropertiesView(treeViewLine.elementProperty, OnChange, new TreeViewState(), null); }
void SetProperty(ActionTreeViewItem treeViewItem) { m_BindingPropertyView = treeViewItem.GetPropertiesView(OnChange, new TreeViewState()); }