Sha256: 8be2b4c078e5abaa8722746366c389c83445d7293b20a0403e74a1948f80add1

Contents?: true

Size: 610 Bytes

Versions: 1

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

module Gamefic
  module Scene
    # A scene that presents a list of choices and processes the player's input.
    # If the input is not a valid choice, the scene gets recued.
    #
    class MultipleChoice < Default
      use_props_class Props::MultipleChoice

      def start actor, props
        super
        actor.output[:options] = props.options
      end

      def finish actor, props
        super
        return if props.index

        actor.tell format(props.invalid_message, input: props.input)
        actor.recue
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gamefic-3.0.0 lib/gamefic/scene/multiple_choice.rb