コード例 #1
0
ファイル: Compiler.cs プロジェクト: wzzwzz687510/YarnSpinner
        // semi-free form text that gets passed along to the game
        // for things like <<turn fred left>> or <<unlockAchievement FacePlant>>
        public override int VisitAction_statement(YarnSpinnerParser.Action_statementContext context)
        {
            char[] trimming = { '<', '>' };
            string action   = context.GetText().Trim(trimming);

            // TODO: look into replacing this as it seems a bit odd
            switch (action)
            {
            case "stop":
                compiler.Emit(ByteCode.Stop);
                break;

            case "shuffleNextOptions":
                compiler.Emit(ByteCode.PushBool, true);
                compiler.Emit(ByteCode.StoreVariable, VirtualMachine.SpecialVariables.ShuffleOptions);
                compiler.Emit(ByteCode.Pop);
                compiler.flags.DisableShuffleOptionsAfterNextSet = true;
                break;

            default:
                compiler.Emit(ByteCode.RunCommand, action);
                break;
            }

            return(0);
        }
コード例 #2
0
        // semi-free form text that gets passed along to the game
        // for things like <<turn fred left>> or <<unlockAchievement FacePlant>>
        public override int VisitAction_statement(YarnSpinnerParser.Action_statementContext context)
        {
            char[] trimming = { '<', '>' };
            string action   = context.GetText().Trim(trimming);

            // TODO: look into replacing this as it seems a bit odd
            switch (action)
            {
            case "stop":
                // "stop" is a special command that immediately stops
                // execution
                compiler.Emit(OpCode.Stop);
                break;

            default:
                compiler.Emit(OpCode.RunCommand, new Operand(action));
                break;
            }

            return(0);
        }
コード例 #3
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="YarnSpinnerParser.action_statement"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitAction_statement([NotNull] YarnSpinnerParser.Action_statementContext context)
 {
     return(VisitChildren(context));
 }
コード例 #4
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="YarnSpinnerParser.action_statement"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitAction_statement([NotNull] YarnSpinnerParser.Action_statementContext context)
 {
 }