ruby-miyako 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/README +275 -20
  2. data/extern.h +21 -1
  3. data/install_miyako.rb +5 -3
  4. data/lib/Miyako/API/audio.rb +11 -6
  5. data/lib/Miyako/API/basic_data.rb +0 -985
  6. data/lib/Miyako/API/bitmap.rb +19 -22
  7. data/lib/Miyako/API/choices.rb +203 -69
  8. data/lib/Miyako/API/collision.rb +451 -9
  9. data/lib/Miyako/API/color.rb +177 -0
  10. data/lib/Miyako/API/diagram.rb +18 -20
  11. data/lib/Miyako/API/fixedmap.rb +207 -73
  12. data/lib/Miyako/API/font.rb +111 -18
  13. data/lib/Miyako/API/i_yuki.rb +1201 -0
  14. data/lib/Miyako/API/input.rb +65 -0
  15. data/lib/Miyako/API/layout.rb +41 -29
  16. data/lib/Miyako/API/map.rb +202 -157
  17. data/lib/Miyako/API/map_event.rb +86 -19
  18. data/lib/Miyako/API/map_struct.rb +268 -0
  19. data/lib/Miyako/API/modules.rb +136 -37
  20. data/lib/Miyako/API/movie.rb +8 -8
  21. data/lib/Miyako/API/parts.rb +63 -20
  22. data/lib/Miyako/API/plane.rb +4 -4
  23. data/lib/Miyako/API/screen.rb +16 -8
  24. data/lib/Miyako/API/sprite.rb +290 -23
  25. data/lib/Miyako/API/sprite_animation.rb +23 -11
  26. data/lib/Miyako/API/sprite_list.rb +406 -183
  27. data/lib/Miyako/API/story.rb +4 -65
  28. data/lib/Miyako/API/struct_point.rb +157 -0
  29. data/lib/Miyako/API/struct_rect.rb +233 -0
  30. data/lib/Miyako/API/struct_segment.rb +641 -0
  31. data/lib/Miyako/API/struct_size.rb +158 -0
  32. data/lib/Miyako/API/struct_square.rb +253 -0
  33. data/lib/Miyako/API/textbox.rb +49 -35
  34. data/lib/Miyako/API/viewport.rb +5 -5
  35. data/lib/Miyako/API/wait_counter.rb +350 -0
  36. data/lib/Miyako/API/yuki.rb +95 -60
  37. data/lib/Miyako/EXT/raster_scroll.rb +30 -8
  38. data/lib/Miyako/EXT/slides.rb +6 -6
  39. data/lib/Miyako/miyako.rb +25 -11
  40. data/lib/miyako.rb +28 -0
  41. data/lib/miyako_require_only.rb +35 -0
  42. data/miyako_basicdata.c +201 -17
  43. data/miyako_collision.c +315 -6
  44. data/miyako_diagram.c +331 -0
  45. data/miyako_drawing.c +26 -7
  46. data/miyako_font.c +259 -129
  47. data/miyako_input_audio.c +24 -14
  48. data/miyako_layout.c +106 -8
  49. data/miyako_no_katana.c +398 -171
  50. data/miyako_sprite2.c +275 -38
  51. data/miyako_transform.c +113 -107
  52. data/miyako_utility.c +34 -48
  53. data/miyako_yuki.c +241 -0
  54. data/sample/Diagram_sample/diagram_sample_yuki2.rb +30 -30
  55. data/sample/Room3/blue.rb +19 -19
  56. data/sample/Room3/green.rb +9 -9
  57. data/sample/Room3/main.rb +12 -12
  58. data/sample/Room3/red.rb +12 -12
  59. data/sample/Room3/title.rb +15 -10
  60. data/sample/collision_test2.rb +2 -1
  61. data/sample/fixed_map_test/fixed_map_sample.rb +7 -6
  62. data/sample/map_test/main_scene.rb +12 -10
  63. data/sample/map_test/map_manager.rb +14 -13
  64. data/sample/rasterscroll.rb +5 -5
  65. data/sample/takahashi.rb +3 -3
  66. data/sample/textbox_sample.rb +7 -6
  67. data/sample/transform.rb +2 -1
  68. data/uninstall_miyako.rb +4 -1
  69. data/win/miyako_no_katana.so +0 -0
  70. metadata +15 -4
  71. data/lib/Miyako/EXT/miyako_cairo.rb +0 -62
  72. data/sample/cairo_sample.rb +0 -25
data/miyako_yuki.c ADDED
@@ -0,0 +1,241 @@
1
+ /*
2
+ --
3
+ Miyako v2.1 Extend Library "Miyako no Katana"
4
+ Copyright (C) 2009 Cyross Makoto
5
+
6
+ This library is free software; you can redistribute it and/or
7
+ modify it under the terms of the GNU Lesser General Public
8
+ License as published by the Free Software Foundation; either
9
+ version 2.1 of the License, or (at your option) any later version.
10
+
11
+ This library is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ Lesser General Public License for more details.
15
+
16
+ You should have received a copy of the GNU Lesser General Public
17
+ License along with this library; if not, write to the Free Software
18
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ ++
20
+ */
21
+
22
+ /*
23
+ =拡張ライブラリmiyako_no_katana
24
+ Authors:: サイロス誠
25
+ Version:: 2.1
26
+ Copyright:: 2007-2009 Cyross Makoto
27
+ License:: LGPL2.1
28
+ */
29
+ #include "defines.h"
30
+ #include "extern.h"
31
+
32
+ static VALUE mSDL = Qnil;
33
+ static VALUE mMiyako = Qnil;
34
+ static VALUE cYuki = Qnil;
35
+ static VALUE cIYuki = Qnil;
36
+ static VALUE nZero = Qnil;
37
+ static VALUE nOne = Qnil;
38
+ static volatile ID id_kakko = Qnil;
39
+ static volatile ID id_start = Qnil;
40
+ static volatile ID id_stop = Qnil;
41
+ static volatile ID id_reset = Qnil;
42
+ static volatile ID id_update_animation = Qnil;
43
+ static volatile ID id_move = Qnil;
44
+ static volatile ID id_move_to = Qnil;
45
+ static volatile ID id_render = Qnil;
46
+ static volatile ID id_render_to = Qnil;
47
+ static volatile ID id_sprite_only = Qnil;
48
+ static volatile ID id_executing = Qnil;
49
+ static volatile ID id_update = Qnil;
50
+ static volatile ID id_update_input = Qnil;
51
+ static volatile ID id_update_inner = Qnil;
52
+ static volatile ID id_update_input_inner = Qnil;
53
+ static volatile ID id_update_animation_inner = Qnil;
54
+ static volatile ID id_render_inner = Qnil;
55
+ static volatile ID id_render_to_inner = Qnil;
56
+ static volatile int zero = 0;
57
+ static volatile int one = 1;
58
+ static const char *str_visible = "@visible";
59
+ static const char *str_visibles = "@visibles";
60
+ static const char *str_o_yuki = "@over_yuki";
61
+ static const char *str_executing = "@executing";
62
+
63
+ /*
64
+ :nodoc:
65
+ */
66
+ static VALUE yuki_is_exec(VALUE self)
67
+ {
68
+ return rb_iv_get(self, str_executing);
69
+ }
70
+
71
+ /*
72
+ :nodoc:
73
+ */
74
+ static VALUE yuki_ua(VALUE self)
75
+ {
76
+ _miyako_sprite_list_update_animation(rb_iv_get(self, str_visibles));
77
+ VALUE over_yuki = rb_iv_get(self, str_o_yuki);
78
+ if(over_yuki == Qnil) return self;
79
+ if(yuki_is_exec(self) == Qtrue){
80
+ yuki_ua(over_yuki);
81
+ }
82
+ return self;
83
+ }
84
+
85
+ /*
86
+ :nodoc:
87
+ */
88
+ static VALUE yuki_render(VALUE self)
89
+ {
90
+ if(rb_iv_get(self, str_visible) == Qtrue){
91
+ _miyako_sprite_list_render(rb_iv_get(self, str_visibles));
92
+ }
93
+ VALUE over_yuki = rb_iv_get(self, str_o_yuki);
94
+ if(over_yuki == Qnil) return self;
95
+ if(yuki_is_exec(self) == Qtrue){
96
+ yuki_render(over_yuki);
97
+ }
98
+ return self;
99
+ }
100
+
101
+ /*
102
+ :nodoc:
103
+ */
104
+ static VALUE yuki_render_to(VALUE self, VALUE dst)
105
+ {
106
+ if(rb_iv_get(self, str_visible) == Qtrue){
107
+ _miyako_sprite_list_render_to(rb_iv_get(self, str_visibles), dst);
108
+ }
109
+ VALUE over_yuki = rb_iv_get(self, str_o_yuki);
110
+ if(over_yuki == Qnil) return self;
111
+ if(yuki_is_exec(self) == Qtrue){
112
+ yuki_render_to(over_yuki, dst);
113
+ }
114
+ return self;
115
+ }
116
+
117
+ /*
118
+ :nodoc:
119
+ */
120
+ static VALUE iyuki_pre_process(VALUE self)
121
+ {
122
+ _miyako_audio_update();
123
+ _miyako_input_update();
124
+ rb_funcall(self, id_update_input, 0);
125
+ rb_funcall(self, id_update, 0);
126
+ rb_funcall(self, id_update_animation, 0);
127
+ _miyako_screen_clear();
128
+ return self;
129
+ }
130
+
131
+ /*
132
+ :nodoc:
133
+ */
134
+ static VALUE iyuki_post_process(VALUE self)
135
+ {
136
+ rb_funcall(self, id_render, 0);
137
+ _miyako_screen_render();
138
+ return self;
139
+ }
140
+
141
+ /*
142
+ :nodoc:
143
+ */
144
+ static VALUE iyuki_update(VALUE self)
145
+ {
146
+ rb_funcall(self, id_update_inner, 1, self);
147
+ rb_iv_set(self, "@pause_release", Qfalse);
148
+ rb_iv_set(self, "@select_ok", Qfalse);
149
+ rb_iv_set(self, "@select_cansel", Qfalse);
150
+ VALUE amt = rb_iv_get(self, "@select_amount");
151
+ *(RARRAY_PTR(amt)+0) = nZero;
152
+ *(RARRAY_PTR(amt)+1) = nZero;
153
+ return self;
154
+ }
155
+
156
+ /*
157
+ :nodoc:
158
+ */
159
+ static VALUE iyuki_update_input(VALUE self)
160
+ {
161
+ rb_funcall(self, id_update_input_inner, 1, self);
162
+ return self;
163
+ }
164
+
165
+ /*
166
+ :nodoc:
167
+ */
168
+ static VALUE iyuki_ua(VALUE self)
169
+ {
170
+ rb_funcall(self, id_update_animation_inner, 1, self);
171
+ _miyako_sprite_list_update_animation(rb_iv_get(self, str_visibles));
172
+ return self;
173
+ }
174
+
175
+ /*
176
+ :nodoc:
177
+ */
178
+ static VALUE iyuki_render(VALUE self)
179
+ {
180
+ if(rb_iv_get(self, str_visible) == Qtrue){
181
+ _miyako_sprite_list_render(rb_iv_get(self, str_visibles));
182
+ }
183
+ rb_funcall(self, id_render_inner, 1, self);
184
+ return self;
185
+ }
186
+
187
+ /*
188
+ :nodoc:
189
+ */
190
+ static VALUE iyuki_render_to(VALUE self, VALUE dst)
191
+ {
192
+ if(rb_iv_get(self, str_visible) == Qtrue){
193
+ _miyako_sprite_list_render_to(rb_iv_get(self, str_visibles), dst);
194
+ }
195
+ rb_funcall(self, id_render_to_inner, 2, self, dst);
196
+ return self;
197
+ }
198
+
199
+ void Init_miyako_yuki()
200
+ {
201
+ mSDL = rb_define_module("SDL");
202
+ mMiyako = rb_define_module("Miyako");
203
+ cYuki = rb_define_class_under(mMiyako, "Yuki", rb_cObject);
204
+ cIYuki = rb_define_class_under(mMiyako, "InitiativeYuki", rb_cObject);
205
+
206
+ id_kakko = rb_intern("[]");
207
+ id_start = rb_intern("start");
208
+ id_stop = rb_intern("stop");
209
+ id_reset = rb_intern("reset");
210
+ id_update_animation = rb_intern("update_animation");
211
+ id_move = rb_intern("move!");
212
+ id_move_to = rb_intern("move_to!");
213
+ id_render = rb_intern("render");
214
+ id_render_to = rb_intern("render_to");
215
+ id_sprite_only = rb_intern("sprite_only");
216
+ id_executing = rb_intern("executing?");
217
+ id_update = rb_intern("update");
218
+ id_update_input = rb_intern("update_input");
219
+ id_update_inner = rb_intern("update_inner");
220
+ id_update_input_inner = rb_intern("input_inner");
221
+ id_update_animation_inner = rb_intern("update_animation_inner");
222
+ id_render_inner = rb_intern("render_inner");
223
+ id_render_to_inner = rb_intern("render_to_inner");
224
+
225
+ zero = 0;
226
+ nZero = INT2NUM(zero);
227
+ one = 1;
228
+ nOne = INT2NUM(one);
229
+
230
+ rb_define_method(cYuki, "executing?", yuki_is_exec, 0);
231
+ rb_define_method(cYuki, "update_animation", yuki_ua, 0);
232
+ rb_define_method(cYuki, "render", yuki_render, 0);
233
+ rb_define_method(cYuki, "render_to", yuki_render_to, 1);
234
+ rb_define_method(cIYuki, "pre_process", iyuki_pre_process, 0);
235
+ rb_define_method(cIYuki, "post_process", iyuki_post_process, 0);
236
+ rb_define_method(cIYuki, "update", iyuki_update, 0);
237
+ rb_define_method(cIYuki, "update_input", iyuki_update_input, 0);
238
+ rb_define_method(cIYuki, "update_animation", iyuki_ua, 0);
239
+ rb_define_method(cIYuki, "render", iyuki_render, 0);
240
+ rb_define_method(cIYuki, "render_to", iyuki_render_to, 1);
241
+ }
@@ -3,19 +3,19 @@
3
3
  # Diagram sample for Miyako v2.0
4
4
  # 2009.1.16 Cyross Makoto
5
5
 
6
- require 'Miyako/miyako'
6
+ require 'miyako'
7
7
 
8
8
  include Miyako
9
9
 
10
10
  # 移動が遅いスクロール
11
11
  class MoveSlower
12
12
  include Diagram::NodeBase
13
-
13
+
14
14
  def initialize(spr)
15
15
  @spr = spr
16
16
  @finish = false # 終了フラグ
17
17
  end
18
-
18
+
19
19
  def start
20
20
  @spr.move_to!(640, @spr.y) # 画面を出たところまで移動
21
21
  end
@@ -29,7 +29,7 @@ class MoveSlower
29
29
  def render
30
30
  @spr.render
31
31
  end
32
-
32
+
33
33
  def finish?
34
34
  return @finish
35
35
  end
@@ -38,12 +38,12 @@ end
38
38
  # 移動が速いスクロール
39
39
  class MoveFaster
40
40
  include Diagram::NodeBase
41
-
41
+
42
42
  def initialize(spr)
43
43
  @spr = spr
44
44
  @finish = false # 終了フラグ
45
45
  end
46
-
46
+
47
47
  def start
48
48
  @spr.move_to!(640, @spr.y) # 画面を出たところまで移動
49
49
  end
@@ -57,7 +57,7 @@ class MoveFaster
57
57
  def render
58
58
  @spr.render
59
59
  end
60
-
60
+
61
61
  def finish?
62
62
  return @finish
63
63
  end
@@ -69,19 +69,19 @@ class WaitTrigger
69
69
  def initialize(wait=0.1)
70
70
  @timer = WaitCounter.new(wait)
71
71
  end
72
-
72
+
73
73
  def pre_process
74
74
  @timer.start
75
75
  end
76
-
76
+
77
77
  def update?
78
78
  @timer.finish?
79
79
  end
80
-
80
+
81
81
  def post_update
82
82
  @timer.start
83
83
  end
84
-
84
+
85
85
  def post_process
86
86
  @timer.stop
87
87
  end
@@ -90,7 +90,7 @@ end
90
90
  # 移動アニメーションノード
91
91
  class Moving
92
92
  include Diagram::NodeBase
93
-
93
+
94
94
  def initialize(parts, wait)
95
95
  @parts = parts
96
96
  @pr = {}
@@ -98,7 +98,7 @@ class Moving
98
98
  dia.add :scroll, MoveFaster.new(@parts[:c1]), WaitTrigger.new(wait)
99
99
  dia.add_arrow(:scroll, nil)
100
100
  }
101
-
101
+
102
102
  @pr[:slow] = Diagram::Processor.new{|dia|
103
103
  dia.add :scroll, MoveSlower.new(@parts[:c2]), WaitTrigger.new(wait)
104
104
  dia.add_arrow(:scroll, nil)
@@ -115,13 +115,13 @@ class Moving
115
115
  @finished = @pr.keys.inject(true){|r, k|
116
116
  @pr[k].update
117
117
  r &= @pr[k].finish?
118
- } # アニメーション処理が終了するまで繰り返し
118
+ } # アニメーション処理が終了するまで繰り返し
119
119
  end
120
120
 
121
121
  def stop
122
122
  @pr.keys.each{|k| @pr[k].stop }
123
123
  end
124
-
124
+
125
125
  def render
126
126
  @parts[:bk].render
127
127
  # 通常なら。@pr[:fast].render,@pr[:slow].renderが筋だが、
@@ -129,7 +129,7 @@ class Moving
129
129
  @parts[:c1].render
130
130
  @parts[:c2].render
131
131
  end
132
-
132
+
133
133
  def finish?
134
134
  return @finished
135
135
  end
@@ -138,7 +138,7 @@ end
138
138
  # Yukiプロット開始
139
139
  class StartPlot
140
140
  include Diagram::NodeBase
141
-
141
+
142
142
  def initialize(manager, parts, imgs)
143
143
  @manager = manager
144
144
  @parts = parts
@@ -157,13 +157,13 @@ class StartPlot
157
157
 
158
158
  def stop
159
159
  end
160
-
160
+
161
161
  def render
162
162
  @imgs[:bk].render
163
163
  @imgs[:c1].render
164
164
  @imgs[:c2].render
165
165
  end
166
-
166
+
167
167
  def finish?
168
168
  return @finished
169
169
  end
@@ -172,7 +172,7 @@ end
172
172
  # Yukiプロット実行
173
173
  class Plotting
174
174
  include Diagram::NodeBase
175
-
175
+
176
176
  def initialize(manager, parts, imgs, set_wait)
177
177
  @manager = manager
178
178
  @parts = parts
@@ -202,10 +202,10 @@ class Plotting
202
202
  @manager.render
203
203
  @parts.render
204
204
  end
205
-
205
+
206
206
  def stop
207
207
  end
208
-
208
+
209
209
  def finish?
210
210
  return @finished
211
211
  end
@@ -240,13 +240,13 @@ class MainScene
240
240
 
241
241
  @yuki = Yuki.new
242
242
  @yuki.update_text = self.method(:update_text)
243
-
243
+
244
244
  @imgs = {}
245
245
  @imgs[:c1] = Sprite.new(:file=>"chr01.png", :type=>:ac).bottom!
246
246
  @imgs[:c2] = Sprite.new(:file=>"chr02.png", :type=>:ac).bottom!
247
247
  @imgs[:bk] = Sprite.new(:file=>"back.png", :type=>:as).centering!
248
248
 
249
-
249
+
250
250
  @pr = Diagram::Processor.new{|dia|
251
251
  dia.add :move, Moving.new(@imgs, 0.01)
252
252
  dia.add :start, StartPlot.new(@yuki, @parts, @imgs)
@@ -268,7 +268,7 @@ class MainScene
268
268
  select_first_page nil # nil, :page1, :page2が選択可能
269
269
  }
270
270
  end
271
-
271
+
272
272
  def update
273
273
  return nil if Input.quit_or_escape?
274
274
  @pr.update_input
@@ -276,11 +276,11 @@ class MainScene
276
276
  return nil if @pr.finish?
277
277
  return @now
278
278
  end
279
-
279
+
280
280
  def render
281
281
  @pr.render
282
282
  end
283
-
283
+
284
284
  def plot
285
285
  yuki_plot{
286
286
  text_method :string do
@@ -307,7 +307,7 @@ class MainScene
307
307
  end
308
308
  }
309
309
  end
310
-
310
+
311
311
  def update_text(yuki, ch)
312
312
  yuki.wait @wait # 1文字ずつ表示させる
313
313
  end
@@ -319,11 +319,11 @@ class MainScene
319
319
  def reset_wait
320
320
  @wait = @base_wait
321
321
  end
322
-
322
+
323
323
  def final
324
324
  @pr.stop
325
325
  end
326
326
  end
327
327
 
328
328
  ds = Story.new
329
- ds.run(MainScene)
329
+ ds.run(MainScene)
data/sample/Room3/blue.rb CHANGED
@@ -48,34 +48,34 @@ class Blue
48
48
  end
49
49
  return r
50
50
  end
51
-
51
+
52
52
  def render
53
53
  @room.render
54
54
  @yuki.render
55
55
  message_box.render
56
56
  command_box.render if @yuki.selecting?
57
57
  end
58
-
58
+
59
59
  def get_command
60
- return [Yuki::Command.new("挨拶する", nil, lambda{var[:aoyama_aisatsu]==false}, blue2),
61
- Yuki::Command.new("辺りを見る", nil, lambda{var[:aoyama_aisatsu]==true}, look_blue),
62
- Yuki::Command.new("話す", nil, lambda{var[:aoyama_aisatsu]==true}, talk),
63
- Yuki::Command.new("渡す", nil, lambda{var[:aoyama_aisatsu]==true && var[:release_aoyama_book]==true && var[:release_akamatsu_book]==false}, send1),
64
- Yuki::Command.new("探す", nil, lambda{var[:search_bookmark]==true && var[:get_bookmark]==false}, search),
65
- Yuki::Command.new("戻る", nil, lambda{var[:aoyama_aisatsu]==true}, MainScene)]
60
+ return [Yuki::Command.new("挨拶する", nil, nil, true, lambda{var[:aoyama_aisatsu]==false}, blue2),
61
+ Yuki::Command.new("辺りを見る", nil, nil, true, lambda{var[:aoyama_aisatsu]==true}, look_blue),
62
+ Yuki::Command.new("話す", nil, nil, true, lambda{var[:aoyama_aisatsu]==true}, talk),
63
+ Yuki::Command.new("渡す", nil, nil, true, lambda{var[:aoyama_aisatsu]==true && var[:release_aoyama_book]==true && var[:release_akamatsu_book]==false}, send1),
64
+ Yuki::Command.new("探す", nil, nil, true, lambda{var[:search_bookmark]==true && var[:get_bookmark]==false}, search),
65
+ Yuki::Command.new("戻る", nil, nil, true, lambda{var[:aoyama_aisatsu]==true}, MainScene)]
66
66
  end
67
-
67
+
68
68
  def get_search
69
- return [Yuki::Command.new("壁", nil, nil, wall),
70
- Yuki::Command.new("テレビ", nil, nil, tv),
71
- Yuki::Command.new("テレビ台", nil, nil, tv_base),
72
- Yuki::Command.new("ビデオデッキ", nil, lambda{var[:look_video_base] == true}, video),
73
- Yuki::Command.new("テレビゲーム機", nil, lambda{var[:look_video_base] == true}, tv_game),
74
- Yuki::Command.new("ソファー", nil, nil, sofar),
75
- Yuki::Command.new("ベッド", nil, nil, bed),
76
- Yuki::Command.new("戻る", nil, nil, "ret")]
69
+ return [Yuki::Command.new("壁", nil, nil, true, nil, wall),
70
+ Yuki::Command.new("テレビ", nil, nil, true, nil, tv),
71
+ Yuki::Command.new("テレビ台", nil, nil, true, nil, tv_base),
72
+ Yuki::Command.new("ビデオデッキ", nil, nil, true, lambda{var[:look_video_base] == true}, video),
73
+ Yuki::Command.new("テレビゲーム機", nil, nil, true, lambda{var[:look_video_base] == true}, tv_game),
74
+ Yuki::Command.new("ソファー", nil, nil, true, nil, sofar),
75
+ Yuki::Command.new("ベッド", nil, nil, true, nil, bed),
76
+ Yuki::Command.new("戻る", nil, nil, true, nil, "ret")]
77
77
  end
78
-
78
+
79
79
  def plot
80
80
  yuki_plot do
81
81
  text "青の扉から中に入った。"
@@ -88,7 +88,7 @@ class Blue
88
88
  vars[:main_command]
89
89
  end
90
90
  end
91
-
91
+
92
92
  def main_command
93
93
  yuki_plot do
94
94
  loop do
@@ -19,7 +19,7 @@ class Green
19
19
  var[:midori_talk] = 0 if var[:midori_talk] == nil
20
20
 
21
21
  @talks = Array.new(6){|i| self.method("talk#{i}".to_sym).call}
22
-
22
+
23
23
  @yuki.vars[:var] = var
24
24
  @yuki.vars[:main_command] = main_command
25
25
  @yuki.vars[:command] = get_command
@@ -45,21 +45,21 @@ class Green
45
45
  end
46
46
  return r
47
47
  end
48
-
48
+
49
49
  def render
50
50
  @room.render
51
51
  @yuki.render
52
52
  message_box.render
53
53
  command_box.render if @yuki.selecting?
54
54
  end
55
-
55
+
56
56
  def get_command
57
- return [Yuki::Command.new("挨拶する", nil, lambda{var[:midori_aisatsu]==false}, green2),
58
- Yuki::Command.new("辺りを見る", nil, lambda{var[:midori_aisatsu]==true}, look_green),
59
- Yuki::Command.new("話す", nil, lambda{var[:midori_aisatsu]==true}, talk),
60
- Yuki::Command.new("戻る", nil, lambda{var[:midori_aisatsu]==true}, MainScene)]
57
+ return [Yuki::Command.new("挨拶する", nil, nil, true, lambda{var[:midori_aisatsu]==false}, green2),
58
+ Yuki::Command.new("辺りを見る", nil, nil, true, lambda{var[:midori_aisatsu]==true}, look_green),
59
+ Yuki::Command.new("話す", nil, nil, true, lambda{var[:midori_aisatsu]==true}, talk),
60
+ Yuki::Command.new("戻る", nil, nil, true, lambda{var[:midori_aisatsu]==true}, MainScene)]
61
61
  end
62
-
62
+
63
63
  def plot
64
64
  yuki_plot do
65
65
  text "緑の扉から中に入った。"
@@ -72,7 +72,7 @@ class Green
72
72
  vars[:main_command]
73
73
  end
74
74
  end
75
-
75
+
76
76
  def main_command
77
77
  yuki_plot do
78
78
  loop do
data/sample/Room3/main.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  class MainScene
3
3
  include Story::Scene
4
4
  include MainComponent
5
-
5
+
6
6
  def init
7
7
  @yuki = Yuki.new(message_box[:box], command_box[:box]){|box, cbox|
8
8
  select_textbox(box)
@@ -31,7 +31,7 @@ class MainScene
31
31
  command_box.start
32
32
  @yuki.start_plot(plot)
33
33
  end
34
-
34
+
35
35
  def update
36
36
  return nil if Input.quit_or_escape?
37
37
  message_box.update_animation
@@ -41,15 +41,15 @@ class MainScene
41
41
  @yuki.start_plot(plot) if (@yuki.executing? == false && r == @now)
42
42
  return r
43
43
  end
44
-
44
+
45
45
  def get_command
46
- return [Yuki::Command.new("緑の扉から入る", nil, nil, Green),
47
- Yuki::Command.new("赤の扉から入る", nil, lambda{var[:sekkaku] == true }, red_sekkaku),
48
- Yuki::Command.new("赤の扉から入る", nil, lambda{var[:sekkaku] == false}, Red),
49
- Yuki::Command.new("青の扉から入る", nil, nil, Blue),
50
- Yuki::Command.new("合い言葉を言う", nil, lambda{var[:aikotoba] == true}, tell_aikotoba)]
46
+ return [Yuki::Command.new("緑の扉から入る", nil, nil, true, nil, Green),
47
+ Yuki::Command.new("赤の扉から入る", nil, nil, true, lambda{var[:sekkaku] == true }, red_sekkaku),
48
+ Yuki::Command.new("赤の扉から入る", nil, nil, true, lambda{var[:sekkaku] == false}, Red),
49
+ Yuki::Command.new("青の扉から入る", nil, nil, true, nil, Blue),
50
+ Yuki::Command.new("合い言葉を言う", nil, nil, true, lambda{var[:aikotoba] == true}, tell_aikotoba)]
51
51
  end
52
-
52
+
53
53
  def plot
54
54
  yuki_plot{
55
55
  ret = vars[:now]
@@ -68,7 +68,7 @@ class MainScene
68
68
 
69
69
  def main_command
70
70
  end
71
-
71
+
72
72
  def red_sekkaku
73
73
  yuki_plot{
74
74
  text "せっかくだから、赤の扉に入ってみよう"
@@ -76,7 +76,7 @@ class MainScene
76
76
  vars[:red]
77
77
  }
78
78
  end
79
-
79
+
80
80
  def tell_aikotoba
81
81
  yuki_plot{
82
82
  text "「こんなゲーム、"
@@ -88,7 +88,7 @@ class MainScene
88
88
  vars[:ending]
89
89
  }
90
90
  end
91
-
91
+
92
92
  def render
93
93
  @doors.render
94
94
  message_box.render
data/sample/Room3/red.rb CHANGED
@@ -24,7 +24,7 @@ class Red
24
24
  var[:release_akamatsu_book] = false if var[:release_akamatsu_book] == nil
25
25
  var[:search_bookmark] = false if var[:search_bookmark] == nil
26
26
  var[:get_bookmark] = false if var[:get_bookmark] == nil
27
-
27
+
28
28
  @yuki.vars[:var] = var
29
29
  @yuki.vars[:command] = get_command
30
30
  @yuki.vars[:main_loop] = main_loop
@@ -36,16 +36,16 @@ class Red
36
36
  command_box.start
37
37
  @yuki.start_plot(plot)
38
38
  end
39
-
39
+
40
40
  def get_command
41
- return [Yuki::Command.new("挨拶する", nil, lambda{var[:akamatsu_aisatsu] == false}, red2),
42
- Yuki::Command.new("辺りを見る", nil, lambda{var[:akamatsu_aisatsu]==true }, look),
43
- Yuki::Command.new("話す", nil, lambda{var[:akamatsu_aisatsu]==true }, talk),
44
- Yuki::Command.new("渡す", nil, lambda{var[:akamatsu_aisatsu] && var[:release_akamatsu_book] && var[:search_bookmark]==false}, send1),
45
- Yuki::Command.new("渡す", nil, lambda{var[:search_bookmark] && var[:get_bookmark] && var[:aikotoba]==false}, send2),
46
- Yuki::Command.new("戻る", nil, lambda{var[:akamatsu_aisatsu]==true}, MainScene)]
41
+ return [Yuki::Command.new("挨拶する", nil, nil, true, lambda{var[:akamatsu_aisatsu] == false}, red2),
42
+ Yuki::Command.new("辺りを見る", nil, nil, true, lambda{var[:akamatsu_aisatsu]==true }, look),
43
+ Yuki::Command.new("話す", nil, nil, true, lambda{var[:akamatsu_aisatsu]==true }, talk),
44
+ Yuki::Command.new("渡す", nil, nil, true, lambda{var[:akamatsu_aisatsu] && var[:release_akamatsu_book] && var[:search_bookmark]==false}, send1),
45
+ Yuki::Command.new("渡す", nil, nil, true, lambda{var[:search_bookmark] && var[:get_bookmark] && var[:aikotoba]==false}, send2),
46
+ Yuki::Command.new("戻る", nil, nil, true, lambda{var[:akamatsu_aisatsu]==true}, MainScene)]
47
47
  end
48
-
48
+
49
49
  def update
50
50
  return nil if Input.quit_or_escape?
51
51
  message_box.update_animation
@@ -65,7 +65,7 @@ class Red
65
65
  message_box.render
66
66
  command_box.render if @yuki.selecting?
67
67
  end
68
-
68
+
69
69
  def plot
70
70
  yuki_plot do
71
71
  text "赤の扉から中に入った。"
@@ -78,7 +78,7 @@ class Red
78
78
  vars[:main_loop]
79
79
  end
80
80
  end
81
-
81
+
82
82
  def main_loop
83
83
  yuki_plot do
84
84
  loop do
@@ -219,7 +219,7 @@ class Red
219
219
  message_box.stop
220
220
  command_box.stop
221
221
  end
222
-
222
+
223
223
  def dispose
224
224
  @akamatsu.dispose
225
225
  @room.dispose