Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 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);
         }
     }
 }
Esempio n. 4
0
        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);
                }
            }
        }
Esempio n. 5
0
 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);
 }
Esempio n. 8
0
 void SetProperty(ActionTreeViewItem treeViewItem)
 {
     m_BindingPropertyView = treeViewItem.GetPropertiesView(OnChange, new TreeViewState());
 }