Class: Gamefic::Scene::MultipleChoice
- Defined in:
- lib/gamefic/scene/multiple_choice.rb
Overview
Provide a list of options and process the selection in the scene’s finish block. After the scene is finished, the :active scene will be cued unless some other scene has already been prepared or cued.
The finish block’s input parameter receives a MultipleChoice::Input object instead of a String.
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from Custom
#initialize, #on_finish, #on_start, #prompt_for
Methods inherited from Base
Constructor Details
This class inherits a constructor from Gamefic::Scene::Custom
Instance Method Details
#data_class ⇒ Object
11 12 13 |
# File 'lib/gamefic/scene/multiple_choice.rb', line 11 def data_class SceneData::MultipleChoice end |
#finish(actor, input) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gamefic/scene/multiple_choice.rb', line 22 def finish actor, input data = finish_data_for(actor, input) get_choice data if data.selection.nil? actor.tell data. actor, data else do_finish_block actor, data end data end |
#start(actor) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/gamefic/scene/multiple_choice.rb', line 15 def start actor data = start_data_for(actor) data..clear do_start_block actor, data actor, data end |