ruby-miyako 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. data/README +1115 -0
  2. data/Rakefile +7 -0
  3. data/defines.h +144 -0
  4. data/extconf.rb +44 -0
  5. data/extern.h +29 -0
  6. data/img/cursor.png +0 -0
  7. data/img/cursors.png +0 -0
  8. data/img/dice.png +0 -0
  9. data/img/wait_cursor.png +0 -0
  10. data/img/win_base.png +0 -0
  11. data/img/window.png +0 -0
  12. data/install_miyako.rb +87 -0
  13. data/lib/Miyako/API/audio.rb +584 -0
  14. data/lib/Miyako/API/basic_data.rb +1026 -0
  15. data/lib/Miyako/API/bitmap.rb +534 -0
  16. data/lib/Miyako/API/choices.rb +481 -0
  17. data/lib/Miyako/API/collision.rb +638 -0
  18. data/lib/Miyako/API/diagram.rb +586 -0
  19. data/lib/Miyako/API/drawing.rb +151 -0
  20. data/lib/Miyako/API/exceptions.rb +105 -0
  21. data/lib/Miyako/API/fixedmap.rb +462 -0
  22. data/lib/Miyako/API/font.rb +430 -0
  23. data/lib/Miyako/API/input.rb +456 -0
  24. data/lib/Miyako/API/layout.rb +644 -0
  25. data/lib/Miyako/API/map.rb +583 -0
  26. data/lib/Miyako/API/map_event.rb +222 -0
  27. data/lib/Miyako/API/modules.rb +357 -0
  28. data/lib/Miyako/API/movie.rb +166 -0
  29. data/lib/Miyako/API/parts.rb +188 -0
  30. data/lib/Miyako/API/plane.rb +205 -0
  31. data/lib/Miyako/API/screen.rb +341 -0
  32. data/lib/Miyako/API/shape.rb +443 -0
  33. data/lib/Miyako/API/sprite.rb +773 -0
  34. data/lib/Miyako/API/sprite_animation.rb +494 -0
  35. data/lib/Miyako/API/sprite_list.rb +1135 -0
  36. data/lib/Miyako/API/spriteunit.rb +168 -0
  37. data/lib/Miyako/API/story.rb +350 -0
  38. data/lib/Miyako/API/textbox.rb +773 -0
  39. data/lib/Miyako/API/utility.rb +419 -0
  40. data/lib/Miyako/API/viewport.rb +190 -0
  41. data/lib/Miyako/API/yuki.rb +1180 -0
  42. data/lib/Miyako/EXT/miyako_cairo.rb +62 -0
  43. data/lib/Miyako/EXT/raster_scroll.rb +138 -0
  44. data/lib/Miyako/EXT/slides.rb +157 -0
  45. data/lib/Miyako/miyako.rb +201 -0
  46. data/lib/Miyako/miyako_require_only.rb +35 -0
  47. data/logo/EGSR_logo.png +0 -0
  48. data/logo/EGSR_logo_bg.png +0 -0
  49. data/logo/EGSR_logo_fg.png +0 -0
  50. data/logo/EGSR_title_banner.png +0 -0
  51. data/logo/EGSR_title_logo.png +0 -0
  52. data/logo/miyako.png +0 -0
  53. data/logo/miyako_banner.png +0 -0
  54. data/logo/space.png +0 -0
  55. data/miyako_basicdata.c +484 -0
  56. data/miyako_bitmap.c +1225 -0
  57. data/miyako_collision.c +403 -0
  58. data/miyako_drawing.c +187 -0
  59. data/miyako_font.c +334 -0
  60. data/miyako_hsv.c +830 -0
  61. data/miyako_input_audio.c +254 -0
  62. data/miyako_layout.c +191 -0
  63. data/miyako_no_katana.c +1086 -0
  64. data/miyako_sprite2.c +431 -0
  65. data/miyako_transform.c +438 -0
  66. data/miyako_utility.c +288 -0
  67. data/sample/Animation1/m1ku.rb +68 -0
  68. data/sample/Animation1/m1ku_arm_0.png +0 -0
  69. data/sample/Animation1/m1ku_arm_1.png +0 -0
  70. data/sample/Animation1/m1ku_arm_2.png +0 -0
  71. data/sample/Animation1/m1ku_arm_3.png +0 -0
  72. data/sample/Animation1/m1ku_back.jpg +0 -0
  73. data/sample/Animation1/m1ku_body.png +0 -0
  74. data/sample/Animation1/m1ku_eye_0.png +0 -0
  75. data/sample/Animation1/m1ku_eye_1.png +0 -0
  76. data/sample/Animation1/m1ku_eye_2.png +0 -0
  77. data/sample/Animation1/m1ku_eye_3.png +0 -0
  78. data/sample/Animation1/m1ku_hair_front.png +0 -0
  79. data/sample/Animation1/m1ku_hair_rear.png +0 -0
  80. data/sample/Animation1/readme.txt +72 -0
  81. data/sample/Animation2/lex.rb +96 -0
  82. data/sample/Animation2/lex_back.png +0 -0
  83. data/sample/Animation2/lex_body.png +0 -0
  84. data/sample/Animation2/lex_roadroller.png +0 -0
  85. data/sample/Animation2/lex_wheel_0.png +0 -0
  86. data/sample/Animation2/lex_wheel_1.png +0 -0
  87. data/sample/Animation2/lex_wheel_2.png +0 -0
  88. data/sample/Animation2/readme.txt +72 -0
  89. data/sample/Animation2/song_title.png +0 -0
  90. data/sample/Diagram_sample/back.png +0 -0
  91. data/sample/Diagram_sample/chr01.png +0 -0
  92. data/sample/Diagram_sample/chr02.png +0 -0
  93. data/sample/Diagram_sample/cursor.png +0 -0
  94. data/sample/Diagram_sample/diagram_sample_yuki2.rb +329 -0
  95. data/sample/Diagram_sample/readme.txt +90 -0
  96. data/sample/Diagram_sample/wait_cursor.png +0 -0
  97. data/sample/Room3/blue.rb +297 -0
  98. data/sample/Room3/ending.rb +180 -0
  99. data/sample/Room3/green.rb +220 -0
  100. data/sample/Room3/image/akamatsu.png +0 -0
  101. data/sample/Room3/image/aoyama.png +0 -0
  102. data/sample/Room3/image/congra.png +0 -0
  103. data/sample/Room3/image/congratulation.png +0 -0
  104. data/sample/Room3/image/congratulation_bg.png +0 -0
  105. data/sample/Room3/image/cursor.png +0 -0
  106. data/sample/Room3/image/midori.png +0 -0
  107. data/sample/Room3/image/mittsu_no_oheya.png +0 -0
  108. data/sample/Room3/image/mittsu_no_oheya_logo.png +0 -0
  109. data/sample/Room3/image/room_blue.png +0 -0
  110. data/sample/Room3/image/room_green.png +0 -0
  111. data/sample/Room3/image/room_red.png +0 -0
  112. data/sample/Room3/image/start.png +0 -0
  113. data/sample/Room3/image/three_doors.png +0 -0
  114. data/sample/Room3/image/wait_cursor.png +0 -0
  115. data/sample/Room3/main.rb +120 -0
  116. data/sample/Room3/main_component.rb +59 -0
  117. data/sample/Room3/readme.txt +76 -0
  118. data/sample/Room3/red.rb +227 -0
  119. data/sample/Room3/room3.rb +25 -0
  120. data/sample/Room3/title.rb +184 -0
  121. data/sample/ball_action_sample.rb +204 -0
  122. data/sample/blit_rop.rb +70 -0
  123. data/sample/cairo_sample.rb +25 -0
  124. data/sample/circle_collision_test.rb +66 -0
  125. data/sample/collision_test.rb +33 -0
  126. data/sample/collision_test2.rb +108 -0
  127. data/sample/fixed_map_test/cursor.png +0 -0
  128. data/sample/fixed_map_test/fixed_map_sample.rb +140 -0
  129. data/sample/fixed_map_test/map.csv +19 -0
  130. data/sample/fixed_map_test/map_01.png +0 -0
  131. data/sample/fixed_map_test/mapchip.csv +23 -0
  132. data/sample/fixed_map_test/monster.png +0 -0
  133. data/sample/fixed_map_test/readme.txt +72 -0
  134. data/sample/map_test/chara.rb +58 -0
  135. data/sample/map_test/chr1.png +0 -0
  136. data/sample/map_test/cursor.png +0 -0
  137. data/sample/map_test/main_parts.rb +69 -0
  138. data/sample/map_test/main_scene.rb +153 -0
  139. data/sample/map_test/map.png +0 -0
  140. data/sample/map_test/map2.png +0 -0
  141. data/sample/map_test/map_layer.csv +127 -0
  142. data/sample/map_test/map_manager.rb +75 -0
  143. data/sample/map_test/map_test.rb +23 -0
  144. data/sample/map_test/mapchip.csv +21 -0
  145. data/sample/map_test/oasis.rb +71 -0
  146. data/sample/map_test/readme.txt +89 -0
  147. data/sample/map_test/route.rb +157 -0
  148. data/sample/map_test/sea.png +0 -0
  149. data/sample/map_test/town.rb +74 -0
  150. data/sample/map_test/wait_cursor.png +0 -0
  151. data/sample/map_test/window.png +0 -0
  152. data/sample/polygon_test.rb +35 -0
  153. data/sample/rasterscroll.rb +25 -0
  154. data/sample/takahashi.rb +42 -0
  155. data/sample/text.png +0 -0
  156. data/sample/textbox_sample.rb +192 -0
  157. data/sample/transform.rb +54 -0
  158. data/sample/utility_test.rb +73 -0
  159. data/sample/utility_test2.rb +61 -0
  160. data/sample/utility_test3.rb +64 -0
  161. data/sample/utility_test4.rb +73 -0
  162. data/uninstall_miyako.rb +19 -0
  163. data/win/miyako_no_katana.so +0 -0
  164. metadata +216 -0
@@ -0,0 +1,329 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #! /usr/bin/ruby
3
+ # Diagram sample for Miyako v2.0
4
+ # 2009.1.16 Cyross Makoto
5
+
6
+ require 'Miyako/miyako'
7
+
8
+ include Miyako
9
+
10
+ # 移動が遅いスクロール
11
+ class MoveSlower
12
+ include Diagram::NodeBase
13
+
14
+ def initialize(spr)
15
+ @spr = spr
16
+ @finish = false # 終了フラグ
17
+ end
18
+
19
+ def start
20
+ @spr.move_to!(640, @spr.y) # 画面を出たところまで移動
21
+ end
22
+
23
+ def update
24
+ @finish = (@spr.x <= 320) # 所定の位置までスクロールさせたら終了
25
+ return if @finish
26
+ @spr.move!(-2,0)
27
+ end
28
+
29
+ def render
30
+ @spr.render
31
+ end
32
+
33
+ def finish?
34
+ return @finish
35
+ end
36
+ end
37
+
38
+ # 移動が速いスクロール
39
+ class MoveFaster
40
+ include Diagram::NodeBase
41
+
42
+ def initialize(spr)
43
+ @spr = spr
44
+ @finish = false # 終了フラグ
45
+ end
46
+
47
+ def start
48
+ @spr.move_to!(640, @spr.y) # 画面を出たところまで移動
49
+ end
50
+
51
+ def update
52
+ @finish = (@spr.x <= 40) # 所定の位置までスクロールさせたら終了
53
+ return if @finish
54
+ @spr.move!(-4,0)
55
+ end
56
+
57
+ def render
58
+ @spr.render
59
+ end
60
+
61
+ def finish?
62
+ return @finish
63
+ end
64
+ end
65
+
66
+ class WaitTrigger
67
+ include Diagram::TriggerBase
68
+
69
+ def initialize(wait=0.1)
70
+ @timer = WaitCounter.new(wait)
71
+ end
72
+
73
+ def pre_process
74
+ @timer.start
75
+ end
76
+
77
+ def update?
78
+ @timer.finish?
79
+ end
80
+
81
+ def post_update
82
+ @timer.start
83
+ end
84
+
85
+ def post_process
86
+ @timer.stop
87
+ end
88
+ end
89
+
90
+ # 移動アニメーションノード
91
+ class Moving
92
+ include Diagram::NodeBase
93
+
94
+ def initialize(parts, wait)
95
+ @parts = parts
96
+ @pr = {}
97
+ @pr[:fast] = Diagram::Processor.new{|dia|
98
+ dia.add :scroll, MoveFaster.new(@parts[:c1]), WaitTrigger.new(wait)
99
+ dia.add_arrow(:scroll, nil)
100
+ }
101
+
102
+ @pr[:slow] = Diagram::Processor.new{|dia|
103
+ dia.add :scroll, MoveSlower.new(@parts[:c2]), WaitTrigger.new(wait)
104
+ dia.add_arrow(:scroll, nil)
105
+ }
106
+
107
+ @finished = false
108
+ end
109
+
110
+ def start
111
+ @pr.keys.each{|k| @pr[k].start }
112
+ end
113
+
114
+ def update
115
+ @finished = @pr.keys.inject(true){|r, k|
116
+ @pr[k].update
117
+ r &= @pr[k].finish?
118
+ } # アニメーション処理が終了するまで繰り返し
119
+ end
120
+
121
+ def stop
122
+ @pr.keys.each{|k| @pr[k].stop }
123
+ end
124
+
125
+ def render
126
+ @parts[:bk].render
127
+ # 通常なら。@pr[:fast].render,@pr[:slow].renderが筋だが、
128
+ # @pr[:fast]が終了すると、renderを呼んでも描画されないため、元の画像を表示する
129
+ @parts[:c1].render
130
+ @parts[:c2].render
131
+ end
132
+
133
+ def finish?
134
+ return @finished
135
+ end
136
+ end
137
+
138
+ # Yukiプロット開始
139
+ class StartPlot
140
+ include Diagram::NodeBase
141
+
142
+ def initialize(manager, parts, imgs)
143
+ @manager = manager
144
+ @parts = parts
145
+ @imgs = imgs
146
+ @finished = false
147
+ end
148
+
149
+ def start
150
+ end
151
+
152
+ def update
153
+ @manager.start_plot
154
+ @parts.start
155
+ @finished = true
156
+ end
157
+
158
+ def stop
159
+ end
160
+
161
+ def render
162
+ @imgs[:bk].render
163
+ @imgs[:c1].render
164
+ @imgs[:c2].render
165
+ end
166
+
167
+ def finish?
168
+ return @finished
169
+ end
170
+ end
171
+
172
+ # Yukiプロット実行
173
+ class Plotting
174
+ include Diagram::NodeBase
175
+
176
+ def initialize(manager, parts, imgs, set_wait)
177
+ @manager = manager
178
+ @parts = parts
179
+ @imgs = imgs
180
+ @set = set_wait
181
+ @finished = false
182
+ end
183
+
184
+ def start
185
+ end
186
+
187
+ def update
188
+ @manager.update
189
+ @parts.update
190
+ @parts.update_animation
191
+ @finished = !(@manager.executing?)
192
+ end
193
+
194
+ def update_input
195
+ @set.call(0.0) if (Input.pushed_any?(:btn1) || Input.click?(:left)) # 1ボタンを押すor左クリックしたら、表示途中のメッセージをすべて表示
196
+ end
197
+
198
+ def render
199
+ @imgs[:bk].render
200
+ @imgs[:c1].render
201
+ @imgs[:c2].render
202
+ @manager.render
203
+ @parts.render
204
+ end
205
+
206
+ def stop
207
+ end
208
+
209
+ def finish?
210
+ return @finished
211
+ end
212
+ end
213
+
214
+ class MainScene
215
+ include Story::Scene
216
+
217
+ TEXTBOX_MARGIN = 16
218
+ TEXTBOX_BOTTOM = 24
219
+
220
+ def init
221
+ ws = Sprite.new(:file=>"wait_cursor.png", :type=>:ac)
222
+ ws.oh = ws.ow
223
+ ws = SpriteAnimation.new(:sprite=>ws, :wait=>0.2, :pattern_list=>[0,1,2,3,2,1])
224
+ @ws = ws
225
+ cs = Sprite.new(:file=>"cursor.png", :type=>:ac)
226
+ cs.oh = cs.ow
227
+ cs = SpriteAnimation.new(:sprite=>cs, :wait=>0.2, :pattern_list=>[0,1,2,3,2,1])
228
+ font = Font.sans_serif
229
+ font.color = Color[:white]
230
+ font.size = 24
231
+ @box = TextBox.new(:size=>[20,5], :wait_cursor => ws, :select_cursor => cs, :font => font)
232
+ @box_bg = Sprite.new(:size => @box.size.to_a.map{|v| v + TEXTBOX_MARGIN}, :type => :ac)
233
+ @box_bg.fill([0,0,255,128])
234
+ @parts = Parts.new(@box.size)
235
+ @parts[:box_bg] = @box_bg
236
+ @parts[:box] = @box
237
+ @parts[:box_bg].centering!
238
+ @parts[:box].centering!
239
+ @parts.center!.bottom!{ TEXTBOX_BOTTOM }
240
+
241
+ @yuki = Yuki.new
242
+ @yuki.update_text = self.method(:update_text)
243
+
244
+ @imgs = {}
245
+ @imgs[:c1] = Sprite.new(:file=>"chr01.png", :type=>:ac).bottom!
246
+ @imgs[:c2] = Sprite.new(:file=>"chr02.png", :type=>:ac).bottom!
247
+ @imgs[:bk] = Sprite.new(:file=>"back.png", :type=>:as).centering!
248
+
249
+
250
+ @pr = Diagram::Processor.new{|dia|
251
+ dia.add :move, Moving.new(@imgs, 0.01)
252
+ dia.add :start, StartPlot.new(@yuki, @parts, @imgs)
253
+ dia.add :plot, Plotting.new(@yuki, @parts, @imgs, lambda{|w| set_wait(w) })
254
+ dia.add_arrow(:move, :start){|from| from.finish? }
255
+ dia.add_arrow(:start, :plot){|from| from.finish? }
256
+ dia.add_arrow(:plot, nil){|from| from.finish? }
257
+ }
258
+
259
+ @base_wait = 0.1 # ウェイト基本値
260
+ @wait = @base_wait # ウェイト
261
+ end
262
+
263
+ def setup
264
+ @pr.start
265
+ @yuki.setup(@box, plot){|box, pl|
266
+ select_textbox box
267
+ select_plot pl
268
+ select_first_page nil # nil, :page1, :page2が選択可能
269
+ }
270
+ end
271
+
272
+ def update
273
+ return nil if Input.quit_or_escape?
274
+ @pr.update_input
275
+ @pr.update
276
+ return nil if @pr.finish?
277
+ return @now
278
+ end
279
+
280
+ def render
281
+ @pr.render
282
+ end
283
+
284
+ def plot
285
+ yuki_plot{
286
+ text_method :string do
287
+ page :page1 do
288
+ text "「ねえ、あんたの担当のセリフ、ちゃんと覚えてるわよねぇ?"
289
+ cr
290
+ pause
291
+ text " まさか、忘れてたなんて言わないわよねぇ?」"
292
+ end
293
+ clear
294
+ page :page2 do
295
+ color :red do
296
+ size 32 do
297
+ size(24){ "「そんなこと" }
298
+ text "ない"
299
+ size(24){ "よぉ~" }
300
+ end
301
+ cr
302
+ pause
303
+ text " ちゃんと覚えてるよぉ~」"
304
+ cr
305
+ end
306
+ end
307
+ end
308
+ }
309
+ end
310
+
311
+ def update_text(yuki, ch)
312
+ yuki.wait @wait # 1文字ずつ表示させる
313
+ end
314
+
315
+ def set_wait(wait)
316
+ @wait = wait
317
+ end
318
+
319
+ def reset_wait
320
+ @wait = @base_wait
321
+ end
322
+
323
+ def final
324
+ @pr.stop
325
+ end
326
+ end
327
+
328
+ ds = Story.new
329
+ ds.run(MainScene)
@@ -0,0 +1,90 @@
1
+ *******************************************************************************
2
+ �y ��Җ� �z�@�T�C���X��
3
+ �y �\�t�g�� �z�@Miyako v2.0�T���v��(�J�ڐ}�`��)
4
+ �y �o�[�W���� �z�@2.0
5
+ �y �쐬�� �z�@2009/04/13
6
+ �y ��� �z�@�t���[�E�F�A
7
+ �y �J������ �z�@Ruby 1.9.1-p0
8
+ �y �����^�C�� �z�@Miyako v2.0
9
+ �y �Ή��@�� �z�@Windows 2000/XP/Vista�ALinux
10
+ �y �Ĕz�z �z�@�C��BSD���C�Z���X�ɂ��
11
+ �y �]�� �z�@�C��BSD���C�Z���X�ɂ��
12
+ �y�z�[���y�[�W�z�@http://www.twin.ne.jp/~cyross/Miyako/
13
+ �y �A���� �z�@cyross@po.twin.ne.jp
14
+ *******************************************************************************
15
+
16
+ �E�T�v
17
+
18
+ �@���̃v���O�����́AMiyako 2.0�ȍ~�ɑΉ�����AMiyako�T���v���v���O�����ł��B
19
+ �@�L�����N�^�̑��d�X�N���[�����s���܂�(���ꂾ���ł����E�E�E)
20
+
21
+ �EMiyako�ɂ‚���
22
+
23
+ �@Miyako�Ɋւ��ẮA�ȉ���URL���Q�l�ɂ��Ă��������B
24
+ http://www.twin.ne.jp/~cyross/Miyako/
25
+
26
+ �@Miyako(Ruby�ARuby/SDL�܂�)�̃C���X�g�[���Ɋւ��܂��ẮA
27
+ ��LURL��H���ē�����A�[�J�C�u���ꂽMiyako���C�u������
28
+ �W�J����ƁAreadme.txt�������܂��̂ŁA����������Q�Ɖ������B
29
+
30
+ �@�{�T���v���ł́AMiyako��Windows��œ��삷�邱�Ƃ�O��ɂ��Ă��܂��B
31
+ �i�C���X�g�[������Ruby���s�‹���ActiveRuby�ł��邱�Ƃ��O���
32
+ �@���Ă��܂��j
33
+
34
+ �E�N�����@
35
+
36
+ �@�G�N�X�v���[���[���J���A�{�T���v���̃t�H���_���ŁA�udiagram_sample.rb�v��
37
+ �_�u���N���b�N���܂��B
38
+ �@�������́A�R�}���h���C����œ������ꍇ�́A�{�T���v���̃f�B���N�g����
39
+ �ړ����āA�ȉ��̃R�}���h����͂��܂��B
40
+
41
+ �@ruby diagram_sample.rb
42
+
43
+ �E�Ɛӎ���
44
+
45
+ �@�{�T���v���͖��ۏ؂ł��B�����{�T���v�����g�p���邱�Ƃɂ��s��E�g���u��
46
+ ���N�������Ƃ��Ă��A�����Ȃ�g���u���ɑ΂���ӔC�𕉂�Ȃ����Ƃ��������������B
47
+
48
+ �@�{�T���v���́A�C��BSD���C�Z���X�Ɋ�Â����]�ځE�Ĕz�z�����‚��܂��B
49
+
50
+ �@�܂��A�{�T���v���ł́A�w�i�摜�ɁA�w�i�摜�f�ޏW�u�}�E�ʌi�v�̋����摜���g�p���Ă��܂��B
51
+ �@http://naox.cool.ne.jp/bonkai1/
52
+
53
+ �E�X�V����
54
+
55
+ �@(1.1)
56
+ �@�E�����S�̂���‚̑J�ڐ}�`���ɂ܂Ƃ߂�(����q�̑J�ڐ}���ł���T���v��)
57
+ �@�EYuki�ɂ�郁�b�Z�[�W�\����lj�
58
+
59
+ �@(1.2)
60
+ �@�E�J�ڐ}�`���N���X���̏C��
61
+
62
+ �@(1.2.1)
63
+ �@�ERC3�Œlj�����Yuki::Yuki2�N���X�Ή���diagram_sample_yuki2.rb��lj�
64
+
65
+ �@(2.0)
66
+ �@�EMiyako2.0�ɑΉ�
67
+
68
+ �EBSD���C�Z���X��
69
+
70
+ Copyright (c) 2008, Cyross Makoto
71
+
72
+ All rights reserved.
73
+
74
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
75
+
76
+ �ERedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
77
+ �ERedistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
78
+ �ENeither the name of the Cyross Makoto nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
79
+
80
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
81
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
82
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
83
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
84
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
85
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
86
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
87
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
88
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
89
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
90
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,297 @@
1
+ # -*- encoding: utf-8 -*-
2
+ class Blue
3
+ include Story::Scene
4
+ include MainComponent
5
+
6
+ def init
7
+ @yuki = Yuki.new
8
+ @yuki.select_textbox(message_box[:box])
9
+ @yuki.select_commandbox(command_box[:box])
10
+ @aoyama = Sprite.new(:file => "image/aoyama.png", :type => :ck)
11
+ @aoyama.center!.bottom!
12
+ @yuki.regist_parts(:aoyama, @aoyama)
13
+
14
+ @room = Sprite.new(:file => "image/room_blue.png", :type => :as)
15
+ @room.center!.bottom!
16
+
17
+ var[:aoyama_aisatsu] = false if var[:aoyama_aisatsu] == nil
18
+ var[:release_aoyama_book] = false if var[:release_aoyama_book] == nil
19
+ var[:search_bookmark] = false if var[:search_bookmark] == nil
20
+ var[:look_video_base] = false if var[:look_video_base] == nil
21
+ var[:get_bookmark] = false if var[:get_bookmark] == nil
22
+ var[:release_akamatsu_book] = false if var[:release_akamatsu_book] == nil
23
+
24
+ @yuki.vars[:var] = var
25
+ @yuki.vars[:main_command] = main_command
26
+ @yuki.vars[:search_command] = search_command
27
+ @yuki.vars[:command] = get_command
28
+ @yuki.vars[:search] = get_search
29
+ @yuki.vars[:video2] = video2
30
+ end
31
+
32
+ def setup
33
+ @yuki.setup
34
+ message_box.start
35
+ command_box.start
36
+ @yuki.start_plot(plot)
37
+ end
38
+
39
+ def update
40
+ return nil if Input.quit_or_escape?
41
+ message_box.update_animation
42
+ command_box.update_animation
43
+ @yuki.update
44
+ r = @yuki.executing? ? @now : @yuki.result
45
+ if @yuki.is_scenario?(r)
46
+ @yuki.start_plot(r)
47
+ r = @now
48
+ end
49
+ return r
50
+ end
51
+
52
+ def render
53
+ @room.render
54
+ @yuki.render
55
+ message_box.render
56
+ command_box.render if @yuki.selecting?
57
+ end
58
+
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)]
66
+ end
67
+
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")]
77
+ end
78
+
79
+ def plot
80
+ yuki_plot do
81
+ text "青の扉から中に入った。"
82
+ pause.clear
83
+ show :aoyama
84
+ text "目の前には"
85
+ color(:cyan){vars[:var][:aoyama_aisatsu]==true ? "青山くん" : "男の子"}
86
+ text "が居る。"
87
+ cr
88
+ vars[:main_command]
89
+ end
90
+ end
91
+
92
+ def main_command
93
+ yuki_plot do
94
+ loop do
95
+ show :aoyama
96
+ text "どうする?"
97
+ command vars[:command]
98
+ clear
99
+ break select_result if is_scene?(select_result)
100
+ call_plot(select_result) if is_scenario?(select_result)
101
+ end
102
+ end
103
+ end
104
+
105
+ def blue2
106
+ yuki_plot do
107
+ text "「オレの名前は"
108
+ color(:cyan){"青山"}
109
+ text "。よろしくな」"
110
+ pause.clear
111
+ vars[:var][:aoyama_aisatsu]=true
112
+ end
113
+ end
114
+
115
+ def look_blue
116
+ yuki_plot do
117
+ text "部屋の中は整然としている。"
118
+ pause.cr
119
+ text "中にはテレビとソファーがあり、"
120
+ cr
121
+ text "ゆったりとくつろげるようになっている。"
122
+ pause.clear
123
+ end
124
+ end
125
+
126
+ def talk
127
+ yuki_plot do
128
+ text "「まぁ、オレはこうやってのんびりするのが"
129
+ cr
130
+ text " 好きなんだな。"
131
+ pause.cr
132
+ text " とはいえども、いわゆるニートってやつじゃない。"
133
+ pause.clear
134
+ text " ここには無いが、パソコン使って"
135
+ cr
136
+ text " 株の取引やってるわけさ。」"
137
+ pause.clear
138
+ end
139
+ end
140
+
141
+ def send1
142
+ yuki_plot do
143
+ text "あなたは、みどりさんから受け取っていた本を返した。"
144
+ pause.clear
145
+ text "「おお、サンキュ。"
146
+ pause.cr
147
+ text " みどりから受け取ったのか。"
148
+ pause.cr
149
+ text " じゃああんたも、"
150
+ color(:red){"ブチギレみどり"}
151
+ text "を見たってわけか。」"
152
+ pause.clear
153
+ text "そのとき、どこからともなく声が聞こえた。"
154
+ wait 0.5
155
+ cr
156
+ color(:red){
157
+ text "『なあぁぁぁんですってぇぇぇぇ"
158
+ wait 0.5
159
+ cr
160
+ text "私のどこがブチ切れてるってぇぇぇ!?』"
161
+ }
162
+ pause.cr
163
+ text "「・・・ほらね。」"
164
+ pause.clear
165
+ text "「じゃあ、ついでにオレからも、"
166
+ pause.cr
167
+ text " 隣りの赤松さんところへ行って、"
168
+ pause.cr
169
+ text " この本を返してきてくれないかなぁ?"
170
+ pause.cr
171
+ text " 頼むよ。」"
172
+ pause.clear
173
+ text " 赤松さんの本を受け取った。"
174
+ pause.clear
175
+ vars[:var][:release_akamatsu_book] = true
176
+ end
177
+ end
178
+
179
+ def search
180
+ yuki_plot do
181
+ text "「どうぞ」"
182
+ cr
183
+ hide :aoyama
184
+ call_plot(vars[:search_command])
185
+ end
186
+ end
187
+
188
+ def search_command
189
+ yuki_plot do
190
+ loop do
191
+ text "どこを?"
192
+ command vars[:search], "ret"
193
+ clear
194
+ break if select_result.kind_of?(String) && select_result == "ret"
195
+ call_plot(select_result) if is_scenario?(select_result)
196
+ end
197
+ end
198
+ end
199
+
200
+ def wall
201
+ yuki_plot do
202
+ text "壁を調べてみた。"
203
+ pause.cr
204
+ text "何もないようだ。"
205
+ pause.clear
206
+ end
207
+ end
208
+
209
+ def tv
210
+ yuki_plot do
211
+ text "テレビを調べてみた。"
212
+ pause.cr
213
+ text "テレビを点けてみた。"
214
+ pause.cr
215
+ text "・・・つまらんなぁ、この番組。"
216
+ pause.clear
217
+ end
218
+ end
219
+
220
+ def tv_base
221
+ yuki_plot do
222
+ text "テレビ台を調べてみた。"
223
+ pause.cr
224
+ text "中にはビデオデッキとテレビゲーム機があるようだ。"
225
+ pause.clear
226
+ vars[:var][:look_video_base] = true
227
+ end
228
+ end
229
+
230
+ def video
231
+ yuki_plot do
232
+ text "ビデオデッキを調べてみた。"
233
+ pause.cr
234
+ text "いわゆるHDDビデオデッキだ。"
235
+ pause.clear
236
+ call_plot(vars[:video2]) if vars[:var][:get_bookmark]==false
237
+ end
238
+ end
239
+
240
+ def video2
241
+ yuki_plot do
242
+ text "・・・"
243
+ wait 0.3
244
+ text "ン!? 何か挟まってる。"
245
+ pause.cr
246
+ text "引っ張り出してみると、"
247
+ color(:red){"真っ赤な栞"}
248
+ text "だ。"
249
+ pause.cr
250
+ color(:red){"栞"}
251
+ text "を見つけ出した!"
252
+ pause.cr
253
+ text "「良かったなぁ、見つかって。」"
254
+ pause.clear
255
+ vars[:var][:get_bookmark] = true
256
+ end
257
+ end
258
+
259
+ def tv_game
260
+ yuki_plot do
261
+ text "テレビゲーム機を調べてみた。"
262
+ pause.cr
263
+ text "・・・このゲーム機、対応ゲーム出てる?"
264
+ pause.clear
265
+ end
266
+ end
267
+
268
+ def sofar
269
+ yuki_plot do
270
+ text "ソファーを調べてみた。"
271
+ pause.cr
272
+ text "ふかふかだ。"
273
+ wait 0.5
274
+ text "ここで寝そべりたい・・・。"
275
+ pause.clear
276
+ end
277
+ end
278
+
279
+ def bed
280
+ yuki_plot do
281
+ text "ベッドを調べてみた。"
282
+ pause.cr
283
+ text "ソファーより固そうだ。"
284
+ pause.clear
285
+ end
286
+ end
287
+
288
+ def final
289
+ message_box.stop
290
+ command_box.stop
291
+ end
292
+
293
+ def dispose
294
+ @aoyama.dispose
295
+ @room.dispose
296
+ end
297
+ end