Exemplo n.º 1
0
            public ChainGroupViewModel(ChainGroupView groupView, List <ChainNodeView.ChainNodeViewModel> nodeViewModels)
            {
                Group = groupView.Group;

                NodeViewModels = nodeViewModels;

                GroupViewModels = new List <ChainGroupViewModel>();
            }
Exemplo n.º 2
0
        private void RequestTransfer(ChainGroupView destinationView)
        {
            // Model
            Group.RequestTransfer(destinationView.Group);

            // View
            TransferRequested(this, destinationView);
        }
Exemplo n.º 3
0
            public ChainGroupViewModel(ChainGroupView groupView)
            {
                Group = groupView.Group;

                Position = groupView.IsRootGroupView ? Vector3.zero : groupView.ChildAttachmentPoint.localPosition;


                RelativePath = groupView.RelativePath;


                GroupViewModels = groupView.GroupViews.Select(gv => gv.ViewModel).ToList();

                NodeViewModels = groupView.NodeViews.Select(nv => nv.ViewModel).ToList();
            }
Exemplo n.º 4
0
        private void HandleGroupViewDropped(ChainGroupView droppedGroupView)
        {
            if (!ChainView.GroupTransferModeActive)
            {
                return;
            }

            Debug.Log("group view dropped");

            if (GroupViews.Contains(droppedGroupView))
            {
                return;
            }

            droppedGroupView.RequestTransfer(this);
        }
Exemplo n.º 5
0
        private void AddChainGroupView(ChainGroupView view, bool isTransfer = false)
        {
            GroupViews.Add(view);

            view.transform.SetParent(GroupAttachmentPoint, isTransfer);

            if (!isTransfer)
            {
                view.transform.localPosition = Vector2.zero;
                view.SetVisiblePosition(NewNodePosition, local: false);
            }

            view.BoundsChanged     += HandleChildViewBoundsChanged;
            view.TransferRequested += HandleChildGroupViewTransferRequested;

            BoundsDirty = true;

            UpdateDeleteButtonState();
        }
Exemplo n.º 6
0
        private void HandlePreviewGroupViewDrop(ChainGroupView groupView)
        {
            if (!ChainView.GroupTransferModeActive)
            {
                return;
            }

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

            if (GroupViews.Contains(groupView))
            {
                IndicateDropAcceptance(false);
                return;
            }

            IndicateDropAcceptance(true);
        }
Exemplo n.º 7
0
        private void RemoveChainGroupView(ChainGroupView view, bool destroy)
        {
            view.BoundsChanged     -= HandleChildViewBoundsChanged;
            view.TransferRequested -= HandleChildGroupViewTransferRequested;

            GroupViews.Remove(view);



            UpdateWorkspaceSize();

            EnsureWorkspaceIsVisible();

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

            BoundsDirty = true;

            UpdateDeleteButtonState();
        }
Exemplo n.º 8
0
        public void RequestTransfer(ChainGroupView destinationGroupView)
        {
            ChainNode.RequestTransfer(destinationGroupView.Group);

            TransferRequested(this, destinationGroupView);
        }
 private void AcceptGroupView(ChainGroupView groupView)
 {
     GroupViewDropped(groupView);
 }
Exemplo n.º 10
0
        private void HandleChildNodeViewTransferRequested(ChainNodeView movedView, ChainGroupView destinationView)
        {
            RemoveChainNodeView(movedView, destroy: false);

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