Class: TyranoDsl::WritingWords::AskQuestion
- Inherits:
-
Object
- Object
- TyranoDsl::WritingWords::AskQuestion
- Includes:
- WritingWordsModule
- Defined in:
- lib/tyrano_dsl/writing_words/ask_question.rb
Instance Method Summary collapse
Methods included from WritingWordsModule
#fetch_scene, #h, #raise_unknown
Instance Method Details
#run(writing_context, world, word_location, parameters) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tyrano_dsl/writing_words/ask_question.rb', line 7 def run(writing_context, world, word_location, parameters) content = [] parameters[:possible_answers].each do |possible_answer| text = possible_answer[:text] scene_name = possible_answer[:scene] label_name = possible_answer[:label] top = possible_answer[:top] left = possible_answer[:left] target_scene = fetch_scene(world, word_location, scene_name) label = label_name ? world.labels[label_name].target_name : '' content << "[glink color=\"black\" storage=\"#{target_scene.target_name}\" target=\"#{label}\" size=\"20\" x=\"#{left}\" y=\"#{top}\" text=\"#{h(text)}\"]\n" end content << "[s]\n" writing_context.append_content( word_location, content.join ) end |