Class: Gamefic::Scene::YesOrNo

Inherits:
Custom show all
Defined in:
lib/gamefic/scene/yes_or_no.rb

Overview

Prompt the user to answer “yes” or “no”. The scene will accept variations like “YES” or “n” and normalize the answer to “yes” or “no” in the finish block. After the scene is finished, the :active scene will be cued if no other scene has been prepared or cued.

Instance Method Summary collapse

Methods inherited from Custom

#initialize, #on_finish, #on_start, #prompt_for, #start

Methods inherited from Base

#prompt_for, #start, #type

Constructor Details

This class inherits a constructor from Gamefic::Scene::Custom

Instance Method Details

#data_classObject



9
10
11
# File 'lib/gamefic/scene/yes_or_no.rb', line 9

def data_class
  SceneData::YesOrNo
end

#finish(actor, input) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/gamefic/scene/yes_or_no.rb', line 13

def finish actor, input
  data = finish_data_for(actor, input)
  if data.yes? or data.no?
    this_scene = actor.scene
    do_finish_block actor, data
    #actor.cue :active if (actor.scene == this_scene and actor.next_scene.nil?)
  else
    actor.tell data.invalid_message
  end
end