예제 #1
0
        public override bool ParseArgs(IScenarioContent content, ref GotoArgs args, out string error)
        {
            // goto #flag;
            if (content.length != 2)
            {
                error = GetLengthErrorString(2);
                return(false);
            }

            args.flag = content[1];
            error     = null;
            return(true);
        }
예제 #2
0
        private bool DoGoto(GotoArgs arguments, StringBuilder output)
        {
            if (arguments.Line < 1 || arguments.Line > this.lines.Count)
            {
                output.AppendLine("Line out of range");
                return(false);
            }

            // Subtact 1 to adjust for 0-based indexing, and another 1 because the number will be incremented
            //  immediately after processing this directive.
            this.currentLineNum = arguments.Line - 2;
            return(true);
        }
예제 #3
0
        protected override ActionStatus Run(IGameAction gameAction, IScenarioContent content, GotoArgs args, out string error)
        {
            ScenarioAction action;

            if (!ParseAction <ScenarioAction>(gameAction, out action, out error))
            {
                return(ActionStatus.Error);
            }

            return(action.GotoCommand(args.flag, out error));
        }