public override void OnInit(long funcID, string[] param)
 {
     base.OnInit(funcID, param);
     this.m_node = param[0];
     if (param.Length > 1)
     {
         this.m_nodeStatus = (NodeStatus)int.Parse(param[1]);
     }
 }
예제 #2
0
파일: Selector.cs 프로젝트: siquel/BeatEmUp
        /// <summary>
        /// Hakee uuden childin jos niitä on vielä jäljellä, muulloin asettaa
        /// staten onnistuneiden nodejen määrän perusteella ja resetoi managerin.
        /// </summary>
        /// <param name="status"></param>
        private void TryToGetNextChild(ref NodeStatus status)
        {
            if (!nodeManager.NextChild())
            {
                status = successfullNodes > 0 ? NodeStatus.Success : NodeStatus.Failed;

                nodeManager.Reset();
            }
        }
		public void SetStatus (NodeStatus status, Color color) {
			this.status = status;

			ColorBlock colorBlock = btn.colors;
			colorBlock.normalColor = color;
			colorBlock.highlightedColor = color;

			btn.colors = colorBlock;
		}
예제 #4
0
        public void CurrentNodeOpen(string nodeName)
        {
            CurrentNodeStatus = NodeStatus.Open;

            XSDTreeNode node = null;

            CurrentNode?.Elements.TryGetValue(nodeName, out node);
            CurrentNode = node ?? CurrentNode;
        }
예제 #5
0
        public void CurrentNodeEnd(string nodeName)
        {
            CurrentNodeStatus = NodeStatus.Inside;

            XSDTreeNode node = null;

            CurrentNode?.Elements.TryGetValue(nodeName, out node);
            CurrentNode = node ?? GetFromComplex(CurrentNode, nodeName) ?? CurrentNode;
        }
예제 #6
0
    public DirectionType dir; // 用于跳点搜索 跳点速度方向(父给的方向 + 自身带的方向)

    public void Clear()
    {
        parent = null;
        g      = 0;
        h      = 0;
        f      = 0;
        status = NodeStatus.Untest;
        dir    = DirectionType.None;
    }
예제 #7
0
 public async Task Heartbeat(AddNodeStatusDto input)
 {
     var request    = Context.GetHttpContext().Request;
     var nodeId     = request.Query["nodeId"];
     var nodeStatus = new NodeStatus {
         Cpu = input.Cpu, CreationTime = DateTime.Now, FreeMemory = input.FreeMemory, NodeId = Guid.Parse(nodeId), ProcessCount = input.ProcessCount
     };
     await _nodeStatusService.AddNodeStatusAsync(nodeStatus);
 }
예제 #8
0
파일: Node.cs 프로젝트: UmeiGon/battoleBlo
 public bool Close()
 {
     if (nodeStatus != NodeStatus.Open)
     {
         return(false);
     }
     nodeStatus = NodeStatus.Closed;
     return(true);
 }
예제 #9
0
        private void Heartbeart()
        {
            var response = SendHeartbeartRequest();

            // 请求成功则请求次数清零
            _retryTimes = 0;

            if (response == null || string.IsNullOrWhiteSpace(response.Content))
            {
                Log.Logger.Information($"Receive empty block.");
                return;
            }
            var block = JsonConvert.DeserializeObject <BlockOutput>(response.Content);

            if (string.IsNullOrWhiteSpace(block.Id) || string.IsNullOrWhiteSpace(block.Identity))
            {
                Log.Logger.Warning($"Receive unvalid block.");
                return;
            }
            switch (block.Command)
            {
            case Command.None:
            {
                Log.Logger.Warning($"Receive unvalid block {block.Id}.");
                break;
            }

            case Command.Pause:
            {
                _status = NodeStatus.Stop;
                break;
            }

            case Command.Continue:
            {
                _status = NodeStatus.Running;
                break;
            }

            case Command.Exit:
            {
                _status = NodeStatus.Exiting;
                break;
            }

            case Command.Download:
            {
                Log.Logger.Information($"Receive block {block.Id}, identity {block.Identity}.");
                _threadPool.QueueUserWork(() =>
                    {
                        HandleBlock(block);
                    });
                break;
            }
            }
        }
예제 #10
0
파일: ClusterNode.cs 프로젝트: farooqam/ng5
        public void SetStatus()
        {
            if (!Metrics.Any())
            {
                Status = NodeStatus.NoThresholdsSet;
                return;
            }

            Status = (NodeStatus)Metrics.Select(m => m.Status).Max();
        }
예제 #11
0
 public void Dispose()
 {
     _status = NodeStatus.Exiting;
     Log.Logger.Information("Waiting service exit...");
     while (_status != NodeStatus.Exited)
     {
         Thread.Sleep(100);
     }
     Log.Logger.Information("Exited.");
 }
예제 #12
0
        private Repeater CreateRepeater(NodeStatus returns, bool yieldable)
        {
            int          i    = 3;
            Mock <INode> node = TestHelper.Mock <INode>(returns);

            return(new Repeater(node.Object, () =>
            {
                return i-- >= 0;
            }, yieldable));
        }
예제 #13
0
    public virtual NodeStatus Behave(Context context, GameObject peep)
    {
        NodeStatus ret = OnBehave(context, peep);

        if (startFlag == true)
        {
            startFlag = false;
        }
        return(ret);
    }
예제 #14
0
 /// <summary>
 /// ノード起動時処理
 /// </summary>
 public virtual void OnStart()
 {
     if (_status != NodeStatus.WAITING)
     {
         Debug.LogError("Status is not waiting : " + name);
         return;
     }
     _status = NodeStatus.RUNNING;
     Debug.Log("OnStart : " + name + ", status : " + _status);
 }
예제 #15
0
        public void Tick_ReturnsStatus(NodeStatus status)
        {
            var blackboard = this.GetBlackboard();
            var result     = new ActionNode <TestBlackboard>((TestBlackboard bb) =>
            {
                return(status);
            });

            Assert.AreEqual(status, result.Tick(blackboard));
        }
예제 #16
0
    public override NodeStatus Tick()
    {
        NodeStatus status = child.Tick();

        if (status == NodeStatus.FAILURE)
        {
            return(NodeStatus.SUCCESS);
        }
        return(status);
    }
예제 #17
0
    public override NodeStatus Behave(Context context, GameObject go)
    {
        NodeStatus ns = GetChild().Behave(context, go);

        if (ns != NodeStatus.RUNNING)
        {
            return(NodeStatus.SUCCESS);
        }
        return(NodeStatus.RUNNING);
    }
예제 #18
0
    public override NodeStatus Tick()
    {
        NodeStatus ns = child.Tick();

        if (ns == NodeStatus.RUNNING)
        {
            return(ns);
        }
        return((NodeStatus)(((int)ns + 1) % 2)); // success<>fail,
    }
예제 #19
0
 public void Finish(NodeStatus status)
 {
     if (path.Peek().GetType() == typeof(ActionNode))
     {
         actionTaken = false;
     }
     Debug.Log("popping " + path.Peek().Name + " as " + status);
     path.Pop();
     lastStatus = status;
 }
예제 #20
0
 public bool Open(Node parent_node, int can_step_height)
 {
     if (nodeStatus != NodeStatus.None || !CanStepHeight(parent_node, can_step_height))
     {
         return(false);
     }
     parent     = parent_node;
     nodeStatus = NodeStatus.Open;
     return(true);
 }
예제 #21
0
        internal void InternalUpdateClusterManifestTest(string v1clusterConfigPath, string v2clusterConfigPath, string targetClusterManifestPath)
        {
            MockupJsonModel jsonConfig = Utility.GetJsonConfigFromFile(Path.Combine(Constant.TestDirectory, v1clusterConfigPath));

            var userConfig      = jsonConfig.GetUserConfig();
            var clusterTopology = jsonConfig.GetClusterTopology();
            var adminConfig     = new MockupAdminConfig();
            var logger          = new MockupTraceLogger();

            List <NodeStatus> nodesStatus = new List <NodeStatus>();

            foreach (NodeDescription node in clusterTopology.Nodes.Values)
            {
                NodeStatus nodeStatus = new NodeStatus()
                {
                    NodeName               = node.NodeName,
                    InstanceId             = 0,
                    NodeDeactivationIntent = WrpNodeDeactivationIntent.Invalid,
                    NodeState              = NodeState.Enabled,
                    NodeType               = node.NodeTypeRef
                };

                nodesStatus.Add(nodeStatus);
            }

            MockupCluster clusterResource = new MockupCluster(adminConfig, userConfig, clusterTopology, logger);
            MockupClusterManifestBuilder v1mockupClusterManifestBuilder = new MockupClusterManifestBuilder(
                clusterTopology,
                clusterResource.SeedNodeSelector,
                userConfig,
                adminConfig,
                new ClusterNodeConfig(nodesStatus, 2),
                new MockupManifestVersionGenerator(),
                clusterResource.FabricSettingsActivator,
                clusterResource.ClusterManifestGeneratorSettings,
                new MockupTraceLogger());

            MockupJsonModel v2JsonConfig = Utility.GetJsonConfigFromFile(Path.Combine(Constant.TestDirectory, v2clusterConfigPath));
            var             v2generatedClusterManifest = v1mockupClusterManifestBuilder.UpdateClusterManifest(v1mockupClusterManifestBuilder.GenerateClusterManifest(), new MockupAdminConfig().GetFabricSettingsMetadata());

            XmlSerializer xmlSerializer = new XmlSerializer(typeof(ClusterManifestType));

            StringWriter generatedClusterManifestWriter = new StringWriter();

            xmlSerializer.Serialize(generatedClusterManifestWriter, v2generatedClusterManifest);
            string generatedClusterManifestString = generatedClusterManifestWriter.ToString();

            var          targetClusterManifest       = System.Fabric.Interop.Utility.ReadXml <ClusterManifestType>(Path.Combine(Constant.TestDirectory, targetClusterManifestPath), SchemaLocation.GetWindowsFabricSchemaLocation());
            StringWriter targetClusterManifestWriter = new StringWriter();

            xmlSerializer.Serialize(targetClusterManifestWriter, targetClusterManifest);
            string targetClusterManifestString = targetClusterManifestWriter.ToString();

            Assert.AreEqual(Utility.RemoveRandomGuid(generatedClusterManifestString), Utility.RemoveRandomGuid(targetClusterManifestString));
        }
예제 #22
0
        public void Update()
        {
            using (var iter = nodeGroups.Values.GetEnumerator())
            {
                while (iter.MoveNext())
                {
                    var nodeGroup = iter.Current;
                    var keys      = Pool <uint> .List.New();

                    var startNodes = nodeGroup.StartNodes;
                    using (var siter = startNodes.GetEnumerator())
                    {
                        while (siter.MoveNext())
                        {
                            keys.Add(siter.Current.Key);
                        }
                    }

                    //List<uint> keys = new List<uint>(startNodes.Keys);
                    for (int i = 0; i < keys.Count; i++)
                    {
                        StartNode startNode = startNodes[keys[i]];
                        // 先递归重置一下trigger所有孩子的状态(为了控制编辑器结点由高亮状态还原)
                        if (Application.isEditor)
                        {
                            startNode.SetChildrenStatus(NodeStatus.NONE);
                        }

                        NodeStatus result = startNode.Update();
                        if (startNode.NodeMode == StartNodeMode.ONCE)
                        {
                            if (result == NodeStatus.SUCCESS)
                            {
                                nodeGroup.RemoveStartNode(startNode);
                            }
                            else
                            {
                                startNode.Active = false;
                            }
                        }
                        else
                        {
                            startNode.Active = false;
                        }
                    }

                    Pool <uint> .List.Free(keys);
                }
            }

            //foreach (var nodeGroup in nodeGroups.Values)
            //{

            //}
        }
예제 #23
0
            /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
            /// <exception cref="System.IO.IOException"/>
            public virtual NodeHeartbeatResponse NodeHeartbeat(NodeHeartbeatRequest request)
            {
                NodeStatus nodeStatus = request.GetNodeStatus();

                Log.Info("Got heartbeat number " + heartBeatID);
                nodeStatus.SetResponseId(heartBeatID++);
                NodeHeartbeatResponse nhResponse = YarnServerBuilderUtils.NewNodeHeartbeatResponse
                                                       (heartBeatID, null, null, null, null, null, 1000L);

                return(nhResponse);
            }
예제 #24
0
파일: Blob.cs 프로젝트: siquel/BeatEmUp
        private void ShouldChase(ref NodeStatus status)
        {
            if (elapsed < TARGET_SWAP_TIME && !resting)
            {
                status = NodeStatus.Success;

                return;
            }

            status = NodeStatus.Failed;
        }
예제 #25
0
        public override NodeStatus Tick(BehaviorBlackboard data)
        {
            List <NodeOutput> nodes = this.Outputs;

            NodeStatus[] childstatus = new NodeStatus[nodes.Count];
            int          count       = 0;
            bool         running     = false;
            bool         fail        = false;

            for (int i = 0; i < nodes.Count; i++)
            {
                if (nodes[i].connections.Count == 0)
                {
                    continue;
                }

                count++;
                childstatus[i] = ((BaseBehaviorNode)(nodes[i].connections[0].body)).Tick(data);
            }

            if (count == 0)
            {
                Debug.LogError("Behavor Tree Designer\nNo output node is connected on node: " + this.name);
                return(NodeStatus.ERROR);
            }

            foreach (NodeStatus status in childstatus)
            {
                if (status == NodeStatus.ERROR)
                {
                    return(NodeStatus.ERROR);
                }
                if (status == NodeStatus.RUNNING)
                {
                    running = true;
                }
                if (status == NodeStatus.FAILURE)
                {
                    fail = true;
                }
            }
            if (running)
            {
                return(NodeStatus.RUNNING);
            }
            else if (fail)
            {
                return(NodeStatus.FAILURE);
            }
            else
            {
                return(NodeStatus.RUNNING);
            }
        }
예제 #26
0
    public override NodeStatus Evaluate()
    {
        if (m_conditionNode != null)
        {
            NodeStatus status = m_conditionNode.EvaluateCondition(m_nodeStatus);
            if (status == NodeStatus.STATUS_FAILURE)
            {
                SetFailuer();
                return(m_nodeStatus);
            }
        }

        BaseBTNode runningNode = computeRunningNode(m_nodes);

        if (runningNode != null)
        {
            m_isRunningNode = true;
        }

        //子ノードの処理を順番に実行
        foreach (BaseBTNode node in m_nodes)
        {
            if (m_isRunningNode)
            {
                if (node != runningNode)
                {
                    continue;
                }
                else
                {
                    m_isRunningNode = false;
                }
            }
            switch (node.Evaluate())
            {
            case NodeStatus.STATUS_SUCCESS:
                continue;

            case NodeStatus.STATUS_FAILURE:
                m_nodeStatus = NodeStatus.STATUS_FAILURE;
                return(m_nodeStatus);

            case NodeStatus.STATUS_RUNNING:
                m_nodeStatus = NodeStatus.STATUS_RUNNING;
                return(m_nodeStatus);

            default:
                m_nodeStatus = NodeStatus.STATUS_SUCCESS;
                return(m_nodeStatus);
            }
        }
        m_nodeStatus = NodeStatus.STATUS_SUCCESS;
        return(m_nodeStatus);
    }
예제 #27
0
    public override NodeStatus OnBehave(Context context, GameObject peep)
    {
        NodeStatus childStatus = GetChild().Behave(context, peep);

        if (childStatus == NodeStatus.SUCCESS)
        {
            Reset();
            return(NodeStatus.RUNNING);
        }
        return(NodeStatus.RUNNING);
    }
예제 #28
0
        }//end get ticket

        public async Task <Response> Echo()
        {
            Response echoResponse = new Response();

            echoResponse.fullRequest = this.FullUrl + "echo";
            DateTime before = DateTime.Now;

            FailsEcho = true;
            //RAIDA_Status.failsEcho[raidaID] = true;
            try
            {
                echoResponse.fullResponse = await Utils.GetHtmlFromURL(echoResponse.fullRequest);

                Debug.WriteLine("Echo From Node - " + NodeNumber + ". " + echoResponse.fullResponse);
                echoresult = JsonConvert.DeserializeObject <NodeEchoResponse>(echoResponse.fullResponse);

                //Debug.WriteLine("Echo URL - "+ FullUrl);
                if (echoResponse.fullResponse.Contains("ready"))
                {
                    echoResponse.success = true;
                    echoResponse.outcome = "ready";
                    this.RAIDANodeStatus = NodeStatus.Ready;
                    FailsEcho            = false;
                    //RAIDA_Status.failsEcho[raidaID] = false;
                }
                else
                {
                    this.RAIDANodeStatus = NodeStatus.NotReady;
                    echoResponse.success = false;
                    echoResponse.outcome = "error";
                    FailsEcho            = true;
                    //RAIDA_Status.failsEcho[raidaID] = true;
                }
            }
            catch (Exception ex)
            {
                echoResponse.outcome = "error";
                echoResponse.success = false;
                this.RAIDANodeStatus = NodeStatus.NotReady;
                FailsEcho            = true;
                //RAIDA_Status.failsEcho[raidaID] = true;
                if (ex.InnerException != null)
                {
                    echoResponse.fullResponse = ex.InnerException.Message;
                }
                Debug.WriteLine("Error---" + ex.Message);
            }
            DateTime after = DateTime.Now; TimeSpan ts = after.Subtract(before);

            echoResponse.milliseconds = Convert.ToInt32(ts.Milliseconds);
            EchoTime = Convert.ToInt32(ts.Milliseconds);
            //Debug.WriteLine("Echo Complete-Node No.-" + NodeNumber + ".Status-" + RAIDANodeStatus);
            return(echoResponse);
        }//end detect
예제 #29
0
 public override void OnChildComplete(Behavior sender, NodeStatus status)
 {
     // we value success first.
     if (status == NodeStatus.SUCCESS)
     {
         // if our success policy is one, then any successful child will make us propagate the success code and abort everyone else.
         if (successPolicy == Policy.One)
         {
             AbortChildren();
             Exit(status);
         }
         // if we need everyone to succeed, then we have to go on processing.
         else if (successPolicy == Policy.All)
         {
             // this child may fail previously, but as long as we don't exit, we should remove it from the failed set and add it to the success set.
             failed.Remove(sender);
             succeeded.Add(sender);
             // if every child succeeded, we abort and exit with success.
             if (succeeded.Count == Children.Count)
             {
                 AbortChildren();
                 Exit(status);
             }
             // if not, we ask it to keep running again.
             else
             {
                 sender.Enter();
             }
         }
     }
     // the failure part is essentially the same.
     else if (status == NodeStatus.FAILURE)
     {
         if (failurePolicy == Policy.One)
         {
             AbortChildren();
             Exit(status);
         }
         else if (failurePolicy == Policy.All)
         {
             succeeded.Remove(sender);
             failed.Add(sender);
             if (failed.Count == Children.Count)
             {
                 AbortChildren();
                 Exit(status);
             }
             else
             {
                 sender.Enter();
             }
         }
     }
 }
예제 #30
0
 public void SetNodeStatus(string node, NodeStatus status)
 {
     if (m_nodeStatus.ContainsKey(node))
     {
         m_nodeStatus[node] = status;
     }
     else
     {
         m_nodeStatus.Add(node, status);
     }
 }
예제 #31
0
    public override NodeStatus OnBehave(BehaviourState state)
    {
        NodeStatus ret = child.Behave(state);

        if (ret == NodeStatus.RUNNING)
        {
            return(NodeStatus.RUNNING);
        }

        return(NodeStatus.SUCCESS);
    }
        /// <summary>
        /// Visits all the nodes in a render node graph. Used when the maximum node identifier is known
        /// </summary>
        /// <param name="startNodes">Initial nodes</param>
        /// <param name="visitor">Visitor object</param>
        /// <param name="maxNodeId">Maximum node identifier value in the graph</param>
        /// <remarks>
        /// A node is only visited once all its input nodes have been visited first.
        /// </remarks>
        public static void Walk( IEnumerable<IRenderNode> startNodes, IRenderNodeVisitor visitor, int maxNodeId )
        {
            if ( startNodes == null )
            {
                throw new ArgumentNullException( "startNodes" );
            }
            if ( visitor == null )
            {
                throw new ArgumentNullException( "visitor" );
            }
            visitor.StartVisiting( );

            NodeStatus[] nodeStatuses = new NodeStatus[ 32 ];
            Queue<IRenderNode> nodeQueue = new Queue<IRenderNode>( );
            Enqueue( nodeQueue, startNodes, ref nodeStatuses );

            try
            {
                while ( nodeQueue.Count > 0 )
                {
                    IRenderNode node = nodeQueue.Dequeue( );
                    if ( nodeStatuses[ node.Id ] == NodeStatus.Visited )
                    {
                        //	Guards against cyclic graphs
                        continue;
                    }

                    //	Check that the current node can be visited
                    if ( !CheckNodeStatus( nodeQueue, node, ref nodeStatuses ) )
                    {
                        //	It can't (an input node has not been visited yet)
                        nodeQueue.Enqueue( node );
                        continue;
                    }

                    //	Enqueue all output nodes of the current node
                    Enqueue( nodeQueue, node.OutputNodes, ref nodeStatuses );

                    //	Visit the current node
                    visitor.Visit( node );
                    nodeStatuses[ node.Id ] = NodeStatus.Visited;
                }
            }
            finally
            {
                visitor.FinishVisiting( );
            }
        }
예제 #33
0
        public bool Connect(string endpoint)
        {
            if (Status == NodeStatus.Alive)
                return true;

            try
            {
                string pipeName = "net.pipe://localhost/" + endpoint;

                pipeName = "net.tcp://" + endpoint + "/ServiceNode";

                NetTcpBinding binding = new NetTcpBinding();

                binding.ReceiveTimeout = TimeSpan.MaxValue;
                binding.ReliableSession.InactivityTimeout = TimeSpan.MaxValue;
                binding.ReliableSession.Enabled = true;

                if (channelFactory == null)
                {
                    channelFactory = new ChannelFactory<IClusterNode>(
                        binding, ///new NetNamedPipeBinding(),
                        new EndpointAddress(pipeName));
                }

                channel = channelFactory.CreateChannel();

                ((IClientChannel)channel).Open(TimeSpan.FromMilliseconds(150));
                ((IClientChannel)channel).Faulted += new EventHandler(ClientChannel_Falted);
                ((IClientChannel)channel).Closed += new EventHandler(ClientChannel_Closed);

                Status = NodeStatus.Alive;
            }
            catch (Exception)
            {
                Status = NodeStatus.Error;
                return false;
            }

            return true;
        }
		/// <summary>
		/// Constructs a <see cref="StatusSpecification"/> specification matching the given <paramref name="status"/>.
		/// </summary>
		/// <param name="status">The <see cref="NodeStatus"/>.</param>
		/// <returns>Returns the created specification.</returns>
		public static StatusSpecification Is(NodeStatus status)
		{
			return new StatusSpecification(status);
		}
		/// <summary>
		/// Constructs this specification.
		/// </summary>
		/// <param name="status">The <see cref="NodeStatus"/> a <see cref="Node"/> should have in order to match this specification.</param>
		private StatusSpecification(NodeStatus status)
		{
			Status = status;
		}
예제 #36
0
            public void Update(GameTime gameTime, Vector2 postion, List<BodyNode> list, BigSnake snake)
            {
                if (RightGlass.CurrentStatus == GlassStatus.Bad
                    && LeftGlass.CurrentStatus == GlassStatus.Bad
                    && this.NodeStatus == NodeStatus.Good)
                {
                    this.NodeStatus = NodeStatus.Judge;
                }

                this.RightGlass.Update(gameTime);
                this.LeftGlass.Update(gameTime);
                switch (this.NodeStatus)
                {
                    case NodeStatus.Good:

                        if (list.IndexOf(this) == 0)
                        {
                            this.Speed = postion - this.Postion;
                        }
                        else
                        {
                            this.Speed = list[list.IndexOf(this) - 1].Postion - this.Postion;
                        }

                        this.Speed.Length = this.Speed.Length / 3 + 320;

                        if (list.IndexOf(this) == 0)
                        {
                            if ((this.Postion - postion).Length() > 120)
                            {
                                this.Postion = AIBase.SenceManager.MoveTest(this.Postion, this.Speed,
                                                                            (float)gameTime.ElapsedGameTime.TotalSeconds);
                            }
                            this.Rotation = Speed.Radian + MathHelper.PiOver2;

                        }
                        else
                        {
                            if ((this.Postion - list[list.IndexOf(this) - 1].Postion).Length() >120)
                            {
                                this.Postion = AIBase.SenceManager.MoveTest(this.Postion, this.Speed,
                                                                            (float)gameTime.ElapsedGameTime.TotalSeconds);
                            }
                            this.Rotation = Speed.Radian + MathHelper.PiOver2;
                        }
                        break;

                    case NodeStatus.Judge:
                        if (!this.Next)
                        {
                            this.NodeStatus = NodeStatus.Bad;
                            if (list.IndexOf(this) != 0)
                            {
                                list[list.IndexOf(this) - 1].Next = false;
                            }
                            else
                            {
                                snake.CurrentSnakeStatus = SnakeStatus.Notail;
                            }
                        }
                        else
                        {
                            this.NodeStatus = NodeStatus.Freeze;
                        }
                        break;

                    case NodeStatus.Bad:
                        if (this.Color.A != 0)
                        {
                            this.Color.A -= 15;
                        }
                        else
                        {
                            this.Color.A = 0;

                        }
                        break;

                    case NodeStatus.Freeze:
                        this.Color = Color.Gray;

                        if (list.IndexOf(this) == 0)
                        {
                            this.Speed = postion - this.Postion;
                        }
                        else
                        {
                            this.Speed = list[list.IndexOf(this) - 1].Postion - this.Postion;
                        }
                        this.Speed.Length = this.Speed.Length/2 + 320;

                        if (list.IndexOf(this) == 0)
                        {
                            if ((this.Postion - postion).Length() > 120)
                            {
                                this.Postion = AIBase.SenceManager.MoveTest(this.Postion, this.Speed,
                                                                            (float)gameTime.ElapsedGameTime.TotalSeconds);
                            }
                            this.Rotation = Speed.Radian + MathHelper.PiOver2;

                        }
                        else
                        {
                            if ((this.Postion - list[list.IndexOf(this) - 1].Postion).Length() > 120)
                            {
                                this.Postion = AIBase.SenceManager.MoveTest(this.Postion, this.Speed,
                                                                            (float)gameTime.ElapsedGameTime.TotalSeconds);
                            }
                            this.Rotation = Speed.Radian + MathHelper.PiOver2;
                        }

                        this.Rotation = Speed.Radian + MathHelper.PiOver2;

                        if (!this.Next)
                        {
                            this.NodeStatus = NodeStatus.Bad;
                            if (list.IndexOf(this) != 0)
                            {
                                list[list.IndexOf(this) - 1].Next = false;
                            }
                            else
                            {
                                snake.CurrentSnakeStatus = SnakeStatus.Notail;
                            }
                        }
                        break;
                }
            }
예제 #37
0
 private void ClientChannel_Falted(object sender, EventArgs e)
 {
     Status = NodeStatus.Error;
 }
예제 #38
0
 private void ClientChannel_Closed(object sender, EventArgs e)
 {
     Status = NodeStatus.Dead;
 }
예제 #39
0
 private void fillNode(int nodeIndex, NodeStatus status)
 {
     if (status == NodeStatus.Selected)
         nodesByIndex[nodeIndex].Fill = nodeSelectedFill;
     if (status == NodeStatus.Deselected)
         nodesByIndex[nodeIndex].Fill = nodeNormalFill;
 }
예제 #40
0
 void node_NewSingleNodeStatus(NodeStatus status)
 {
     Console.WriteLine(status.StatusByte.ToString());
 }
예제 #41
0
 public BodyNode(Vector2 postion)
 {
     this.Postion = postion;
     RightGlass = new RightGlass(postion);
     LeftGlass = new LeftGlass(postion);
     this.NodeStatus = NodeStatus.Good;
     Next = true;
     this.Color = Color.AliceBlue;
     this.Rotation = MathHelper.PiOver2;
     this.Speed = new Vector2(0);
 }
예제 #42
0
            internal StatusEnt(svn_wc_status_t status, string localpath)
            {
                LocalFilePath = localpath;
                TextStatus = (NodeStatus)status.svn_wc_status_kind__text;
                PropsStatus = (NodeStatus)status.svn_wc_status_kind__props;
                Locked = status.locked != 0;
                Copied = status.copied != 0;
                Switched = status.switched != 0;
                RemoteTextStatus = (NodeStatus)status.svn_wc_status_kind__text__repo;
                RemotePropsStatus = (NodeStatus)status.svn_wc_status_kind__props__repo;

                if (status.to__svn_wc_entry_t == IntPtr.Zero)
                    return;

                svn_wc_entry_t ent = (svn_wc_entry_t)Marshal.PtrToStructure(status.to__svn_wc_entry_t, typeof(svn_wc_entry_t));
                Name = ent.name;
                Revision = ent.revision;
                  			Url = ent.url;
                  			Repository = ent.repos;
                  			RepositoryUuid = ent.repos_uuid;
                  			IsDirectory = (ent.node_kind == (int)NodeKind.Dir);
                  			Schedule = (NodeSchedule)ent.schedule;
                  			Copied = ent.copied != 0;
                  			Deleted = ent.deleted != 0;
                  			Absent = ent.absent != 0;
                  			Incomplete = ent.incomplete != 0;
                  			CopiedFrom = ent.copied_from;
                  			CopiedFromRevision = ent.copied_rev;
                  			ConflictOld = ent.conflict_old;
                  			ConflictNew = ent.conflict_new;
                  			ConflictWorking = ent.conflict_working;
                  			PropertyRejectFile = ent.property_reject_file;
                  			TextTime = Epoch.AddTicks(ent.text_time*10);
                  			PropTime = Epoch.AddTicks(ent.prop_time*10);
                  			Checksum = ent.checksum;
                  			LastCommitRevision = ent.last_commit_rev;
                  			LastCommitDate = Epoch.AddTicks(ent.last_commit_date*10);
                  			LastCommitAuthor = ent.last_commit_author;
            }
 /// <summary>
 /// Sets a node status value
 /// </summary>
 private static void SetNodeStatus( IRenderNode node, NodeStatus status, ref NodeStatus[] nodeStatuses )
 {
     GrowNodeStatusArrayToIncludeNode( node, ref nodeStatuses );
     nodeStatuses[ node.Id ] = status;
 }
 /// <summary>
 /// Grows a array of node status values to ensure that it includes an entry for the specified node
 /// </summary>
 private static void GrowNodeStatusArrayToIncludeNode( IRenderNode node, ref NodeStatus[] nodeStatuses )
 {
     if ( node.Id >= nodeStatuses.Length )
     {
         Array.Resize( ref nodeStatuses, ( node.Id + 1 ) * 2 );
     }
 }
 /// <summary>
 /// Enqueues a range of nodes onto the render queue. Updates each node's status to NodeStatus.Pending
 /// </summary>
 private static void Enqueue( Queue<IRenderNode> nodeQueue, IEnumerable<IRenderNode> nodes, ref NodeStatus[] nodeStatuses )
 {
     foreach ( IRenderNode node in nodes )
     {
         Enqueue( nodeQueue, node, ref nodeStatuses );
     }
 }
 /// <summary>
 /// Enqueues a single node onto the render queue. Updates the node's status to NodeStatus.Pending
 /// </summary>
 private static void Enqueue( Queue< IRenderNode > nodeQueue, IRenderNode node, ref NodeStatus[] nodeStatuses )
 {
     nodeQueue.Enqueue( node );
     SetNodeStatus( node, NodeStatus.Pending, ref nodeStatuses );
 }
예제 #47
0
 internal SubNode(SPort _port, byte node_id)
 {
     port = _port;
     this.node_id = node_id;
     errlist = "";
     
     //to initial reg_table items from xml table
     curr_conf = new Dictionary<string, Nullable<UInt32>>();
     last_conf = new Dictionary<string, Nullable<UInt32>>();
   
     ICollection<string> names = reg_type_tbl.Keys;
     foreach (string name in names)
     {
         last_conf[name] = null;
         curr_conf[name] = null;
     }
     status = NodeStatus.ST_IDLE;
         
 }
예제 #48
0
 static public void SetStatus(byte addr,NodeStatus status)
 {
     lock (agent_access)
     {
         if (agent[addr] is SubNode)
         {
             agent[addr].status = status;
             agent[addr].errlist = "";
         }
     }
     return;
 }
예제 #49
0
 /// <summary>
 /// Class Constructor.</summary>
 public RemoteClusterNode()
 {
     Status = NodeStatus.Starting;
 }
예제 #50
0
 public static Gdk.Pixbuf LoadIconForStatus(NodeStatus status)
 {
     if (status == NodeStatus.Unchanged)
         return overlay_normal;
     if (status == NodeStatus.Modified)
         return overlay_modified;
     if (status == NodeStatus.Conflicted)
         return overlay_conflicted;
     if (status == NodeStatus.ScheduledAdd)
         return overlay_added;
     return null;
 }
예제 #51
0
        public void SetStatus(byte addr, NodeStatus ns)
        {
            if (ns == NodeStatus.ST_DISABLED)
            {
                this[addr].status = NodeStatus.ST_DISABLED;
                this[addr].errlist = "";    
            }
            if (ns == NodeStatus.ST_IDLE)
            {
                this[addr].status = NodeStatus.ST_IDLE;
                this[addr].errlist = "";    
            }

        }
        /// <summary>
        /// Checks that a node can be visited. Ensures all inputs to the node are in the node queue
        /// </summary>
        private static bool CheckNodeStatus( Queue<IRenderNode> nodeQueue, IRenderNode node, ref NodeStatus[] nodeStatuses )
        {
            bool canVisit = true;
            foreach ( IRenderNode inputNode in node.InputNodes )
            {
                GrowNodeStatusArrayToIncludeNode( inputNode, ref nodeStatuses );
                if ( nodeStatuses[ inputNode.Id ] == NodeStatus.NotInQueue )
                {
                    //	Input node is not in the queue - add it
                    Enqueue( nodeQueue, inputNode, ref nodeStatuses );
                    canVisit = false;
                }
                else if ( nodeStatuses[ inputNode.Id ] == NodeStatus.Pending )
                {
                    canVisit = false;
                }
            }

            return canVisit;
        }
예제 #53
0
        private bool WaitState(Node<string> node, NodeStatus status, int waitTime)
        {
            int step = 10;
            for (int delay = 0; delay < waitTime; delay += step)
            {
                if (node.Status == status)
                {
                    return true;
                }

                Thread.Sleep(step);
            }

            return node.Status == status;
        }