示例#1
0
        public StateHelper()
        {
            Settings         = new BL.DummySettings();
            ApiHandler       = new BL.ApiHandler(Settings);
            NodeStore        = new BL.NodeStore();
            WebSocketHandler = new BL.WebSocketHelper(Settings.WebSocketUri);

            var nodeType = typeof(INode);
            var types    = this.GetType().Assembly.GetExportedTypes();

            foreach (var t in types)
            {
                if (nodeType.IsAssignableFrom(t))
                {
                    var attr = t.GetCustomAttributes(typeof(NodeFeatureAttribute), true).OfType <NodeFeatureAttribute>().FirstOrDefault();
                    if (attr != null)
                    {
                        NodeTypes.Add(attr.Features, t);
                    }
                }
                if (nodeType.IsAssignableFrom(t))
                {
                    var attr = t.GetCustomAttributes(typeof(NodeViewAttribute), true).OfType <NodeViewAttribute>().FirstOrDefault();
                    if (attr != null)
                    {
                        NodeViews.Add(attr.NodeType, t);
                    }
                }
            }
        }
示例#2
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();
        }