Sha256: 327dad5c0f3c87b0b4b6c2eb0c5e7b6f6335e922b32fd6f7ad81f2e8f8e7dcd9

Contents?: true

Size: 717 Bytes

Versions: 5

Compression:

Stored size: 717 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
        props.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

      def run_finish_blocks actor, props
        return unless props.index

        super
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gamefic-3.6.0 lib/gamefic/scene/multiple_choice.rb
gamefic-3.5.0 lib/gamefic/scene/multiple_choice.rb
gamefic-3.4.0 lib/gamefic/scene/multiple_choice.rb
gamefic-3.3.0 lib/gamefic/scene/multiple_choice.rb
gamefic-3.2.1 lib/gamefic/scene/multiple_choice.rb