gamefic 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ac7da649347939f4c5baadc676151b8a8c73714552c48a290de75bd072bb801
4
- data.tar.gz: 6d83150ed62df24a4056e3e54ff5b499bc5f7a69ebe8d5cfaddb261f64573af4
3
+ metadata.gz: ad70329086d7b1e9dd06a8459c5b1ee95952ab5453f63afd4e7a87df6ba90e69
4
+ data.tar.gz: 443a8642312dd1da33612a78ce1598723a9336b46e55b840636c2f41804eb8c5
5
5
  SHA512:
6
- metadata.gz: e068317caa9fbfb1f8a73bde4725f5df3f3bcad95ba87d44c8f973759cdc991e0fbbcea874fd451eacbd6ffd2ea2ade9144e61f2d358f31fec6a7f1e97ca3a10
7
- data.tar.gz: 1ab813a5cb14307bc844c42424c9503bae6f73a48d12979a5369812619e5a2e80dfab2ac6181401045511286743fc20f35968bd46e5071cf24f296e3c1c20e36
6
+ metadata.gz: 6c207722b0d00906579e9a221d0f8fad831a8f35694ac2252569d427d2846e113beda49c3e160083013284e6f5c85354f9959b49fceb4383100c451de61dc882
7
+ data.tar.gz: 899b4605d74e236a6904d80a6218c6c607c78594357124bb2b36ea12557bee1c485e76bde2eb8ed1f29359f7d6a6f32ca1d7c2294b0d56f9d1109ad195f7c890
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 2.1.0 - June 21, 2021
2
+ - Remove redundant MultipleChoice prompt
3
+ - Deprecate Scene::Custom
4
+
1
5
  # 2.0.3 - December 14, 2020
2
6
  - Remove unused Index class
3
7
  - Active#conclude accepts data argument
@@ -1,6 +1,8 @@
1
1
  module Gamefic
2
- # The Base Scene is not intended for instantiation. Other Scene classes
3
- # should inherit from it.
2
+ # An abstract class for building different types of scenes. It can be
3
+ # extended either through concrete subclasses or by creating anonymous
4
+ # subclasses through a scene helper method like
5
+ # `Gamefic::World::Scenes#custom`.
4
6
  #
5
7
  class Scene::Base
6
8
  include Gamefic::Serialize
@@ -1,7 +1,7 @@
1
1
  module Gamefic
2
2
  # A Conclusion ends the Plot (or the character's participation in it).
3
3
  #
4
- class Scene::Conclusion < Scene::Custom
4
+ class Scene::Conclusion < Scene::Base
5
5
  def type
6
6
  @type ||= 'Conclusion'
7
7
  end
@@ -6,7 +6,7 @@ module Gamefic
6
6
  # The finish block's input parameter receives a MultipleChoice::Input object
7
7
  # instead of a String.
8
8
  #
9
- class Scene::MultipleChoice < Scene::Custom
9
+ class Scene::MultipleChoice < Scene::Base
10
10
  # The zero-based index of the selected option.
11
11
  #
12
12
  # @return [Integer]
@@ -33,7 +33,6 @@ module Gamefic
33
33
  get_choice
34
34
  if selection.nil?
35
35
  actor.tell invalid_message
36
- tell_options
37
36
  else
38
37
  super
39
38
  end
@@ -77,14 +76,5 @@ module Gamefic
77
76
  }
78
77
  end
79
78
  end
80
-
81
- def tell_options
82
- list = '<ol class="multiple_choice">'
83
- options.each { |o|
84
- list += "<li><a href=\"#\" rel=\"gamefic\" data-command=\"#{o}\">#{o}</a></li>"
85
- }
86
- list += "</ol>"
87
- actor.tell list
88
- end
89
79
  end
90
80
  end
@@ -1,7 +1,7 @@
1
1
  module Gamefic
2
2
  # Pause for user input.
3
3
  #
4
- class Scene::Pause < Scene::Custom
4
+ class Scene::Pause < Scene::Base
5
5
  def post_initialize
6
6
  self.type = 'Pause'
7
7
  self.prompt = 'Press enter to continue...'
@@ -4,7 +4,7 @@ module Gamefic
4
4
  # block. After the scene is finished, the :active scene will be cued if no
5
5
  # other scene has been prepared or cued.
6
6
  #
7
- class Scene::YesOrNo < Scene::Custom
7
+ class Scene::YesOrNo < Scene::Base
8
8
  attr_writer :invalid_message
9
9
 
10
10
  def post_initialize
@@ -1,3 +1,3 @@
1
1
  module Gamefic
2
- VERSION = '2.0.3'
2
+ VERSION = '2.1.0'
3
3
  end
@@ -95,10 +95,10 @@ module Gamefic
95
95
  #
96
96
  # @param prompt [String]
97
97
  # @yieldparam [Gamefic::Actor]
98
- # @yieldparam [Gamefic::Scene::Custom]
99
- # @return [Class<Gamefic::Scene::Custom>]
98
+ # @yieldparam [Gamefic::Scene::Base]
99
+ # @return [Class<Gamefic::Scene::Base>]
100
100
  def question prompt = 'What is your answer?', &block
101
- s = Scene::Custom.subclass do |actor, scene|
101
+ s = Scene::Base.subclass do |actor, scene|
102
102
  scene.prompt = prompt
103
103
  scene.on_finish &block
104
104
  end
@@ -150,23 +150,23 @@ module Gamefic
150
150
  # Custom scenes should always specify the next scene to be cued or
151
151
  # prepared. If not, the scene will get repeated on the next turn.
152
152
  #
153
- # This method creates a Scene::Custom by default. You can customize other
153
+ # This method creates a Scene::Base by default. You can customize other
154
154
  # scene types by specifying the class to create.
155
155
  #
156
156
  # @example Ask the user for a name
157
- # @scene = custom do |scene|
158
- # data.prompt = "What's your name?"
159
- # scene.on_finish do |actor, data|
160
- # actor.name = data.input
157
+ # @scene = custom do |actor, scene|
158
+ # scene.prompt = "What's your name?"
159
+ # scene.on_finish do
160
+ # actor.name = scene.input
161
161
  # actor.tell "Hello, #{actor.name}!"
162
- # actor.cue :active
162
+ # actor.cue default_scene
163
163
  # end
164
164
  # end
165
165
  #
166
166
  # @param cls [Class] The class of scene to be instantiated.
167
167
  # @yieldparam [Gamefic::Actor]
168
- # @return [Class<Gamefic::Scene::Custom>]
169
- def custom cls = Scene::Custom, &block
168
+ # @return [Class<Gamefic::Scene::Base>]
169
+ def custom cls = Scene::Base, &block
170
170
  s = cls.subclass &block
171
171
  scene_classes.push s
172
172
  s
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamefic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2021-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -113,7 +113,6 @@ files:
113
113
  - lib/gamefic/scene/activity.rb
114
114
  - lib/gamefic/scene/base.rb
115
115
  - lib/gamefic/scene/conclusion.rb
116
- - lib/gamefic/scene/custom.rb
117
116
  - lib/gamefic/scene/multiple_choice.rb
118
117
  - lib/gamefic/scene/multiple_scene.rb
119
118
  - lib/gamefic/scene/pause.rb
@@ -134,7 +133,7 @@ homepage: http://gamefic.com
134
133
  licenses:
135
134
  - MIT
136
135
  metadata: {}
137
- post_install_message:
136
+ post_install_message:
138
137
  rdoc_options: []
139
138
  require_paths:
140
139
  - lib
@@ -149,8 +148,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
148
  - !ruby/object:Gem::Version
150
149
  version: '0'
151
150
  requirements: []
152
- rubygems_version: 3.1.2
153
- signing_key:
151
+ rubygems_version: 3.1.6
152
+ signing_key:
154
153
  specification_version: 4
155
154
  summary: Gamefic
156
155
  test_files: []
@@ -1,7 +0,0 @@
1
- module Gamefic
2
- # A Custom Scene allows for complete configuration of its behavior upon
3
- # instantiation. It is suitable for direct instantiation or subclassing.
4
- #
5
- class Scene::Custom < Scene::Base
6
- end
7
- end