Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
        private void HandleNodeViewDropped(ChainNodeView droppedNodeView)
        {
            if (!ChainView.GroupTransferModeActive)
            {
                return;
            }

            Debug.Log("node view dropped");

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

            droppedNodeView.RequestTransfer(this);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 6
0
            public ChainNodeViewModel(ChainNodeView chainNodeView)
            {
                ChainNode = chainNodeView.ChainNode;

                Position = chainNodeView.RectTransform.localPosition;
            }
 private void AcceptNodeView(ChainNodeView nodeView)
 {
     NodeViewDropped(nodeView);
 }
Ejemplo n.º 8
0
        private void HandleChildNodeViewTransferRequested(ChainNodeView movedView, ChainGroupView destinationView)
        {
            RemoveChainNodeView(movedView, destroy: false);

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