Пример #1
0
        private void HandleNodeViewDuplicationRequested(ChainNodeView nodeView, bool recurse)
        {
            var settings = HaxxisPackage.GetSerializationSettings(TypeNameHandling.All);

            var originalWrapper = new NodeDupeSerializationWrapper(nodeView.ChainNode, ChainView.Instance.GetNodeViewModels(nodeView.ChainNode, recurse));

            var wrapperJson = JsonConvert.SerializeObject(originalWrapper, Formatting.Indented, settings);

            var duplicateWrapper = JsonConvert.DeserializeObject <NodeDupeSerializationWrapper>(wrapperJson, settings);

            // Should this go in Group.AddNode?
            duplicateWrapper.Node.InitializeSchema();

            if (!recurse)
            {
                duplicateWrapper.Node.Router.UntargetAllTargets();
            }

            Group.AddNode(duplicateWrapper.Node, recurse: recurse, isTransfer: false);

            foreach (var vm in duplicateWrapper.ViewModels)
            {
                vm.Position += new Vector3(20.0f, -20.0f, 0.0f);
            }

            ChainView.Instance.SetNodeViewModels(duplicateWrapper.ViewModels);

            BoundsDirty = true;
        }
Пример #2
0
        private void HandleNodeViewDropped(ChainNodeView droppedNodeView)
        {
            if (!ChainView.GroupTransferModeActive)
            {
                return;
            }

            Debug.Log("node view dropped");

            if (NodeViews.Contains(droppedNodeView))
            {
                return;
            }

            droppedNodeView.RequestTransfer(this);
        }
Пример #3
0
        private void RemoveChainNodeView(ChainNodeView view, bool destroy)
        {
            view.BoundsChanged        -= HandleChildViewBoundsChanged;
            view.TransferRequested    -= HandleChildNodeViewTransferRequested;
            view.DuplicationRequested -= HandleNodeViewDuplicationRequested;

            NodeViews.Remove(view);


            if (destroy)
            {
                Destroy(view.gameObject);
            }


            BoundsDirty = true;

            UpdateDeleteButtonState();
        }
Пример #4
0
        private void HandlePreviewNodeViewDrop(ChainNodeView nodeView)
        {
            if (!ChainView.GroupTransferModeActive)
            {
                return;
            }

            if (nodeView == null)
            {
                IndicateDropAcceptance(false);
                return;
            }

            if (NodeViews.Contains(nodeView))
            {
                IndicateDropAcceptance(false);
                return;
            }

            IndicateDropAcceptance(true);
        }
Пример #5
0
        private void AddChainNodeView(ChainNodeView view, bool isTransfer = false)
        {
            if (isTransfer)
            {
                view.transform.SetParent(NodeAttachmentPoint, true);
            }

            NodeViews.Add(view);

            if (!isTransfer)
            {
                view.transform.position = NewNodePosition;
            }


            view.BoundsChanged        += HandleChildViewBoundsChanged;
            view.TransferRequested    += HandleChildNodeViewTransferRequested;
            view.DuplicationRequested += HandleNodeViewDuplicationRequested;

            BoundsDirty = true;

            UpdateDeleteButtonState();
        }
Пример #6
0
            public ChainNodeViewModel(ChainNodeView chainNodeView)
            {
                ChainNode = chainNodeView.ChainNode;

                Position = chainNodeView.RectTransform.localPosition;
            }
 private void AcceptNodeView(ChainNodeView nodeView)
 {
     NodeViewDropped(nodeView);
 }
Пример #8
0
        private void HandleChildNodeViewTransferRequested(ChainNodeView movedView, ChainGroupView destinationView)
        {
            RemoveChainNodeView(movedView, destroy: false);

            destinationView.AddChainNodeView(movedView, isTransfer: true);
        }