コード例 #1
0
        public override NodeRunResult Run(ref ProgramCounter pc, ref ProgramData pd)
        {
            var i = 0;

            foreach (var n in Children)
            {
                if (n is OptionNode)
                {
                    var o = n as OptionNode;
                    if (o.RemoveOnSelect && pd.HasRemovedOption(o.Id))
                    {
                    }
                    else
                    {
                        i++;
                        Console.WriteLine(o.Text);
                    }
                }
            }
            // If there are no options return nextnode
            if (i == 0)
            {
                return(NodeRunResult.NextCommand);
            }

            {
                return(OnAwaiting(ref pc));
            }
        }
コード例 #2
0
        public override NodeRunResult Run(ref ProgramCounter pc, ref ProgramData pd)
        {
            var i = 0;

            if (ReturnOnSelect)
            {
                // We selected an option which results in a return
            }
            else
            {
                foreach (var n in Children)
                {
                    if (n is OptionNode)
                    {
                        var o = n as OptionNode;


                        // TODO this could be shifted into the compiler at somestage.
                        if (this.RemoveOnSelect == true)
                        {
                            o.RemoveOnSelect = true;
                        }

                        if (o.RemoveOnSelect && pd.HasRemovedOption(o.Id))
                        {
                        }
                        else
                        {
                            i++;
                            Console.WriteLine(o.Text);
                        }
                    }
                }
            }
            // If there are no options return nextnode
            if (i == 0)
            {
                return(NodeRunResult.NextCommand);
            }

            {
                return(OnAwaiting(ref pc));
            }
        }