Sha256: ac49f951a5fc750509f0ef99ff2be7596694d2c74d27a607d6889059670c0463

Contents?: true

Size: 610 Bytes

Versions: 2

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
        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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gamefic-3.2.0 lib/gamefic/scene/multiple_choice.rb
gamefic-3.1.0 lib/gamefic/scene/multiple_choice.rb