当前位置: 首页>>代码示例>>C#>>正文


C# Nodes类代码示例

本文整理汇总了C#中Nodes的典型用法代码示例。如果您正苦于以下问题:C# Nodes类的具体用法?C# Nodes怎么用?C# Nodes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Nodes类属于命名空间,在下文中一共展示了Nodes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowObject

        public static void ShowObject(Nodes.Node.ObjectPair obj)
        {
            BehaviorTreeList behaviorTreeList = BehaviorManager.Instance as BehaviorTreeList;
            if (behaviorTreeList == null)
                return;

            Nodes.Node node = null;
            Attachments.Attachment attach = null;
            if (obj.Obj is Nodes.Node)
            {
                node = (Nodes.Node)obj.Obj;
            }
            else if (obj.Obj is Attachments.Attachment)
            {
                attach = (Attachments.Attachment)obj.Obj;
                node = attach.Node;
            }

            if (node != null)
            {
                behaviorTreeList.ShowNode(node, obj.Root);
                if (BehaviorTreeViewDock.LastFocused != null)
                {
                    BehaviorTreeView behaviorTreeView = BehaviorTreeViewDock.LastFocused.BehaviorTreeView;
                    if (behaviorTreeView != null)
                    {
                        behaviorTreeView.SelectedNodePending = node;
                        behaviorTreeView.SelectedAttachmentPending = attach;

                        behaviorTreeView.Refresh();
                    }
                }
            }
        }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:34,代码来源:FindDock.cs

示例2: operation

        public string type = ""; // type of undo operation (delete, create, edit, move, changeLineColor, changeLineWidth, changeNodeColor)

        #endregion Fields

        #region Constructors

        /*************************************************************************************************************************/
        // CONSTRUCTORS
        public UndoOperation(
            string type, 
            Nodes nodes = null, 
            Lines lines = null, 
            int group = 0, 
            Position position = null, 
            int layer = 0
        )
        {
            this.type = type;
            this.group = group;
            this.position.set(position);
            this.layer = layer;

            if (nodes != null)
            {
                foreach (Node node in nodes)
                {
                    this.nodes.Add(new Node(node));
                }
            }

            if (lines != null)
            {
                foreach (Line line in lines)
                {
                    this.lines.Add(new Line(line));
                }
            }
        }
开发者ID:pekand,项目名称:infinite-diagram,代码行数:38,代码来源:UndoOperations.cs

示例3: hitJoint

        public static string hitJoint(Nodes.Node n, Rectangle rect, int x, int y, bool inputsOnly) {
            //assume using a padded rect
            //missed the balls.
            if (x > rect.Left + ballSize && x < rect.Right - ballSize)
                return null;

            rect.Y += nodeTitleFont.Height;
            if (n.getExtra() != null) {
                rect.Y += nodeExtraFont.Height;
            }

            if (y < rect.Y)
                return null;

            Point pos;
            foreach (var kvp in n.getProperties()) {
                if ((kvp.Value.isInput && inputsOnly) || (kvp.Value.isOutput && !inputsOnly)) {
                    pos = getJointPos(n, kvp.Key, inputsOnly);
                    pos.X -= x; pos.Y -= y;

                    //intentionally dividing by 2 instead of 4 to expand the 'okay' selection radius.
                    if (pos.X * pos.X + pos.Y * pos.Y < ballSize * ballSize / 2) {
                        return kvp.Key;
                    }
                }
            }

            return null;
        }
开发者ID:JoePelz,项目名称:NodeShop,代码行数:29,代码来源:NodeArtist.cs

示例4: SetPar

        public void SetPar(ParInfo par, Nodes.Node rootNode, bool isNewPar)
        {
            Debug.Check(par != null && rootNode != null);

            _isNewPar = isNewPar;
            _initialized = false;

            this.Text = isNewPar ? Resources.NewPar : Resources.EditPar;

            _par = par;
            _parTemp = par.Clone();
            _rootNode = rootNode;

            setParTypes();

            if (par != null) {
                _isArray = Plugin.IsArrayType(par.Type);
                Type type = _isArray ? par.Type.GetGenericArguments()[0] : par.Type;

                nameTextBox.Text = par.Name;
                arrayCheckBox.Checked = _isArray;
                typeComboBox.Text = Plugin.GetMemberValueTypeName(type);
                descTextBox.Text = par.BasicDescription;

                setValue(type);
            }

            enableOkButton();

            _initialized = true;
        }
开发者ID:wuzhen,项目名称:behaviac,代码行数:31,代码来源:ParSettingsDialog.cs

示例5: ResolveSpecific

        protected override Tags.Base ResolveSpecific(Nodes.Base node)
        {
            if (node is Nodes.Mapping)
                return new Tags.Mapping();
            if (node is Nodes.Sequence)
                return new Tags.Sequence();

            var scalarNode = (Nodes.Scalar)node;

            var value = scalarNode.Content;

            switch (value)
            {
                case "null":
                    return new Tags.Null();
                case "true":
                case "false":
                    return new Tags.Boolean();
            }

            if (intExpression.IsMatch(value))
                return new Tags.Integer();
            if (floatExpression.IsMatch(value))
                return new Tags.FloatingPoint();

            return null;
        }
开发者ID:IngisKahn,项目名称:Nyaml,代码行数:27,代码来源:Json.cs

示例6: Exporter

 /// <summary>
 /// Creates a new exporter.
 /// </summary>
 /// <param name="node">The behaviour hich will be exported.</param>
 /// <param name="outputFolder">The folder we want to export the behaviour to.</param>
 /// <param name="filename">The relative filename we want to export to. You have to add your file extension.</param>
 public Exporter(Nodes.BehaviorNode node, string outputFolder, string filename, List<string> includedFilenames = null)
 {
     _node = node;
     _outputFolder = outputFolder;
     _filename = filename;
     _includedFilenames = includedFilenames;
 }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:13,代码来源:Exporter.cs

示例7: RenderChildren

        public override void RenderChildren(IParrotWriter writer, Nodes.Statement statement, IRendererFactory rendererFactory, IDictionary<string, object> documentHost, object model, string defaultTag = null)
        {
            if (string.IsNullOrEmpty(defaultTag))
            {
                defaultTag = DefaultChildTag;
            }

            //get model from parameter
            //required - do not remove
            if (statement.Parameters != null && statement.Parameters.Count == 1)
            {
                var localModel = GetLocalModel(documentHost, statement, model);

                if (localModel is IEnumerable)
                {
                    //create locals object to handle local values to the method
                    Locals locals = new Locals(documentHost);

                    IList<object> items = ToList(model as IEnumerable);
                    for (int i = 0; i < items.Count; i++)
                    {
                        var localItem = items[i];
                        locals.Push(IteratorItem(i, items));

                        base.RenderChildren(writer, statement.Children, rendererFactory, documentHost, defaultTag, localItem);

                        locals.Pop();
                    }
                }
            }
            else
            {
                base.RenderChildren(writer, statement.Children, rendererFactory, documentHost, defaultTag, model);
            }
        }
开发者ID:ParrotFx,项目名称:Parrot,代码行数:35,代码来源:ListRenderer.cs

示例8: ArrayAssignment

        private static Nodes.Assignment ArrayAssignment(Lexer.Lexem currLexem, Nodes.Node.Coords coords)
        {
            Nodes.Expression index = Expr();
            if (Lexer.LookAhead().LexType != Lexer.LexType.CloseSquadBracket)
                ErrorList.Add(new Error(ParserException.NeedCloseSquadBracket, Lexer.LookBack().EndCoords));
            else
                Lexer.NextLexem();

            if (Lexer.LookAhead().LexType == Lexer.LexType.EqualSign)
            {
                Lexer.NextLexem();
                Nodes.Expression value = Expr();
                /*if (Lexer.LookAhead().LexType != Lexer.LexType.Semicolon)
                    ErrorList.Add(new Error(ParserException.NeedSemicolon, Lexer.LookBack().EndCoords));
                else
                    Lexer.NextLexem();*/
                Nodes.Assignment result = new Nodes.Assignment(new Nodes.ElementOfArray(currLexem.VarName, index), value, coords);
                result.Head = result;
                result.Tail = result;
                return result;
            }
            else
            {
                while (Lexer.LookBack().LexType != Lexer.LexType.Variable)
                    Lexer.RollBack();
                Lexer.RollBack();
                return null;
            }
        }
开发者ID:shurik111333,项目名称:spbu,代码行数:29,代码来源:Parser.cs

示例9: NodeUserControl

 /// <summary>
 /// Creates an instance of <see cref="NodeUserControl"/> class.
 /// </summary>
 public NodeUserControl()
 {
     InitializeComponent();
     m_dataContext = new Nodes(16);
     m_dataContext.PropertyChanged += new PropertyChangedEventHandler(ViewModel_PropertyChanged);
     this.DataContext = m_dataContext;
 }
开发者ID:avs009,项目名称:gsf,代码行数:10,代码来源:NodeUserControl.xaml.cs

示例10: Assignment

 public Assignment(ElementOfArray array, Nodes.Expression expr, Node.Coords coords)
 {
     Var = null;
     Value = expr;
     Array = array;
     this.Coords = coords;
 }
开发者ID:shurik111333,项目名称:spbu,代码行数:7,代码来源:Assignment.cs

示例11: InspectObject

        public void InspectObject(AgentType agentType, string agentFullname, Nodes.Node node)
        {
            _agentFullname = agentFullname;

            preLayout();

            deleteAllRowControls();

            if (agentType != null)
            {
                IList<PropertyDef> properties = agentType.GetProperties();
                foreach (PropertyDef p in properties)
                {
                    addRowControl(p, null);
                }
            }
            else if (node != null)
            {
                List<ParInfo> allPars = node.Pars;
                foreach (ParInfo par in allPars)
                {
                    addRowControl(null, par);
                }
            }

            postLayout();
        }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:27,代码来源:ParametersPanel.cs

示例12: Leader

        public Leader(IElection election, 
            IHartbeatTimer hartbeat,
            IObservable<AppendEntryResultMessage> reply,
            IObserver<AppendEntryMessage> append,
            IObserver<ClientResultMessage> clientReply,
            IObservable<ClientMessage> client,
            ILogReplication logReplication, 
            Nodes nodes,
            ILoggerFactory loggerFactory,
            RaftOptions options, 
            ServerIdentifier serverIdentifier)
        {
            _isDispose = false;
            _hartbeat = hartbeat;
            _append = append;
            _clientReply = clientReply;
            _client = client;
            _logReplication = logReplication;
            _nodes = nodes;
            _options = options;
            _serverIdentifier = serverIdentifier;
            _election = election;
            _logger = loggerFactory.CreateLogger(nameof(Leader) + " " + serverIdentifier);

            if (_options.UseLogging)
                _logger.LogInformation($"{nameof(ServerStateType.Leader)}");

            // Reinitialized after election
            NextIndex = new ConcurrentDictionary<ServerIdentifier, int>();
            MatchIndex = new ConcurrentDictionary<ServerIdentifier, int>();
            _hartbeat.Leader(SendHartbeat);
            _replyDispose = reply.Subscribe(EntryReplyMessageRecived);
            _clientReplyDispose = client.Subscribe(ClientMessageRecived);
        }
开发者ID:RossMerr,项目名称:Caudex.Rafting,代码行数:34,代码来源:Leader.cs

示例13: ResolveSpecific

        protected override Tags.Base ResolveSpecific(Nodes.Base node)
        {
            if (node is Nodes.Mapping)
                return new Tags.Mapping();
            if (node is Nodes.Sequence)
                return new Tags.Sequence();

            // overkill
            var scalarNode = (Nodes.Scalar)node;

            var value = scalarNode.Content;

            if (nullExpression.IsMatch(value))
                return new Tags.Null();

            if (boolExpression.IsMatch(value))
                return new Tags.Boolean();

            if (intExpression.IsMatch(value))
                return new Tags.Integer();

            if (floatExpression.IsMatch(value))
                return new Tags.FloatingPoint();

            return new Tags.String();
        }
开发者ID:IngisKahn,项目名称:Nyaml,代码行数:26,代码来源:Core.cs

示例14: Attachment

 protected Attachment(Nodes.Node node, string label, string description)
 {
     _node = node;
     _label = label;
     _baselabel = label;
     _description = description;
 }
开发者ID:nusus,项目名称:behaviac,代码行数:7,代码来源:Attachment.cs

示例15: FileManager

        /// <summary>
        /// Creates a new file manager.
        /// </summary>
        /// <param name="filename">The filename we want to load from or save to.</param>
        /// <param name="node">The behaviour we want to save. For loading use null.</param>
        public FileManager(string filename, Nodes.BehaviorNode node)
        {
            Debug.Check( Path.IsPathRooted(filename) );

            _filename = filename;
            _behavior = node;
        }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:12,代码来源:FileManager.cs


注:本文中的Nodes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。