cyross-ruby-miyako 2.0.5.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. data/README +1092 -929
  2. data/Rakefile +7 -7
  3. data/defines.h +144 -144
  4. data/extern.h +29 -29
  5. data/install_miyako.rb +87 -87
  6. data/lib/Miyako/API/audio.rb +572 -198
  7. data/lib/Miyako/API/basic_data.rb +825 -573
  8. data/lib/Miyako/API/bitmap.rb +534 -507
  9. data/lib/Miyako/API/choices.rb +481 -475
  10. data/lib/Miyako/API/collision.rb +486 -460
  11. data/lib/Miyako/API/diagram.rb +586 -561
  12. data/lib/Miyako/API/drawing.rb +151 -151
  13. data/lib/Miyako/API/exceptions.rb +105 -0
  14. data/lib/Miyako/API/fixedmap.rb +462 -428
  15. data/lib/Miyako/API/font.rb +430 -403
  16. data/lib/Miyako/API/input.rb +456 -447
  17. data/lib/Miyako/API/layout.rb +636 -433
  18. data/lib/Miyako/API/map.rb +583 -529
  19. data/lib/Miyako/API/map_event.rb +222 -198
  20. data/lib/Miyako/API/modules.rb +357 -109
  21. data/lib/Miyako/API/movie.rb +166 -154
  22. data/lib/Miyako/API/parts.rb +276 -189
  23. data/lib/Miyako/API/plane.rb +205 -166
  24. data/lib/Miyako/API/screen.rb +341 -325
  25. data/lib/Miyako/API/shape.rb +443 -443
  26. data/lib/Miyako/API/sprite.rb +771 -752
  27. data/lib/Miyako/API/sprite_animation.rb +490 -481
  28. data/lib/Miyako/API/sprite_list.rb +1135 -0
  29. data/lib/Miyako/API/spriteunit.rb +168 -147
  30. data/lib/Miyako/API/story.rb +350 -300
  31. data/lib/Miyako/API/textbox.rb +770 -725
  32. data/lib/Miyako/API/utility.rb +419 -388
  33. data/lib/Miyako/API/viewport.rb +189 -139
  34. data/lib/Miyako/API/yuki.rb +1226 -996
  35. data/lib/Miyako/EXT/miyako_cairo.rb +62 -62
  36. data/lib/Miyako/EXT/raster_scroll.rb +138 -138
  37. data/lib/Miyako/EXT/slides.rb +157 -157
  38. data/lib/Miyako/miyako.rb +201 -171
  39. data/lib/Miyako/miyako_require_only.rb +35 -0
  40. data/miyako_basicdata.c +590 -590
  41. data/miyako_bitmap.c +1225 -1225
  42. data/miyako_collision.c +403 -403
  43. data/miyako_drawing.c +187 -187
  44. data/miyako_font.c +334 -334
  45. data/miyako_hsv.c +830 -830
  46. data/miyako_input_audio.c +254 -0
  47. data/miyako_layout.c +191 -191
  48. data/miyako_no_katana.c +1078 -1074
  49. data/miyako_sprite2.c +431 -0
  50. data/miyako_transform.c +438 -438
  51. data/miyako_utility.c +288 -288
  52. data/sample/Animation1/m1ku.rb +68 -68
  53. data/sample/Animation2/lex.rb +96 -96
  54. data/sample/Diagram_sample/diagram_sample_yuki2.rb +328 -386
  55. data/sample/Room3/blue.rb +297 -297
  56. data/sample/Room3/ending.rb +180 -180
  57. data/sample/Room3/green.rb +220 -220
  58. data/sample/Room3/main.rb +119 -119
  59. data/sample/Room3/main_component.rb +59 -59
  60. data/sample/Room3/red.rb +227 -227
  61. data/sample/Room3/room3.rb +25 -27
  62. data/sample/Room3/title.rb +184 -184
  63. data/sample/ball_action_sample.rb +204 -204
  64. data/sample/blit_rop.rb +70 -70
  65. data/sample/cairo_sample.rb +25 -25
  66. data/sample/circle_collision_test.rb +66 -66
  67. data/sample/collision_test.rb +33 -33
  68. data/sample/collision_test2.rb +108 -108
  69. data/sample/fixed_map_test/fixed_map_sample.rb +140 -140
  70. data/sample/fixed_map_test/readme.txt +72 -72
  71. data/sample/map_test/chara.rb +58 -58
  72. data/sample/map_test/main_parts.rb +69 -69
  73. data/sample/map_test/main_scene.rb +153 -153
  74. data/sample/map_test/map_manager.rb +75 -75
  75. data/sample/map_test/map_test.rb +23 -23
  76. data/sample/map_test/oasis.rb +71 -71
  77. data/sample/map_test/readme.txt +89 -89
  78. data/sample/map_test/route.rb +157 -157
  79. data/sample/map_test/town.rb +74 -74
  80. data/sample/polygon_test.rb +35 -35
  81. data/sample/rasterscroll.rb +24 -24
  82. data/sample/takahashi.rb +42 -42
  83. data/sample/textbox_sample.rb +189 -189
  84. data/sample/transform.rb +54 -54
  85. data/sample/utility_test.rb +73 -73
  86. data/sample/utility_test2.rb +61 -61
  87. data/sample/utility_test3.rb +64 -64
  88. data/sample/utility_test4.rb +73 -73
  89. data/uninstall_miyako.rb +19 -19
  90. data/win/miyako_no_katana.so +0 -0
  91. metadata +7 -2
data/sample/Room3/main.rb CHANGED
@@ -1,120 +1,120 @@
1
- # -*- encoding: utf-8 -*-
2
- class MainScene
3
- include Story::Scene
4
- include MainComponent
5
-
6
- def init
7
- @yuki = Yuki.new(message_box[:box], command_box[:box]){|box, cbox|
8
- select_textbox(box)
9
- select_commandbox(cbox)
10
- }
11
- @yuki.select_plot(plot)
12
- @doors = Sprite.new(:file=>"image/three_doors.png", :type=>:as)
13
- @doors.center.bottom
14
-
15
- var[:sekkaku] = true if var[:sekkaku] == nil
16
- var[:aikotoba] = false if var[:aikotoba] == nil
17
-
18
- @yuki.vars[:var] = var
19
- @yuki.vars[:tell_aikotoba] = tell_aikotoba
20
- @yuki.vars[:ending] = Ending
21
- @yuki.vars[:red] = Red
22
- @yuki.vars[:blue] = Blue
23
- @yuki.vars[:green] = Green
24
- @yuki.vars[:now] = @now
25
- @yuki.vars[:command]= get_command
26
- end
27
-
28
- def setup
29
- @yuki.setup
30
- message_box.start
31
- command_box.start
32
- @yuki.start_plot(plot)
33
- end
34
-
35
- def update
36
- return nil if Input.quit_or_escape?
37
- message_box.update_animation
38
- command_box.update_animation
39
- @yuki.update
40
- r = @yuki.executing? ? @now : @yuki.result
41
- @yuki.start_plot(plot) if (@yuki.executing? == false && r == @now)
42
- return r
43
- end
44
-
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)]
51
- end
52
-
53
- def plot
54
- yuki_plot{
55
- ret = vars[:now]
56
- text "目の前には緑、赤、青の3つの扉がある。"
57
- cr
58
- text "どうする?"
59
- cr
60
- command vars[:command]
61
- ret = select_result if is_scene?(select_result)
62
- ret = call_plot(select_result) if is_scenario?(select_result)
63
- clear
64
- vars[:var][:sekkaku] = false
65
- ret
66
- }
67
- end
68
-
69
- def main_command
70
- end
71
-
72
- def red_sekkaku
73
- yuki_plot{
74
- text "せっかくだから、赤の扉に入ってみよう"
75
- pause.clear
76
- vars[:red]
77
- }
78
- end
79
-
80
- def tell_aikotoba
81
- yuki_plot{
82
- text "「こんなゲーム、"
83
- wait 0.5
84
- text "まじになっちゃって "
85
- wait 0.5
86
- text "どうするの!」"
87
- pause.clear
88
- vars[:ending]
89
- }
90
- end
91
-
92
- def render
93
- @doors.render
94
- message_box.render
95
- command_box.render if @yuki.selecting?
96
- end
97
-
98
- def final
99
- message_box.stop
100
- command_box.stop
101
- end
102
- end
103
-
104
- class Blue
105
- include Story::Scene
106
-
107
- def update
108
- return nil if Input.quit_or_escape?
109
- return @now
110
- end
111
- end
112
-
113
- class Green
114
- include Story::Scene
115
-
116
- def update
117
- return nil if Input.quit_or_escape?
118
- return @now
119
- end
1
+ # -*- encoding: utf-8 -*-
2
+ class MainScene
3
+ include Story::Scene
4
+ include MainComponent
5
+
6
+ def init
7
+ @yuki = Yuki.new(message_box[:box], command_box[:box]){|box, cbox|
8
+ select_textbox(box)
9
+ select_commandbox(cbox)
10
+ }
11
+ @yuki.select_plot(plot)
12
+ @doors = Sprite.new(:file=>"image/three_doors.png", :type=>:as)
13
+ @doors.center!.bottom!
14
+
15
+ var[:sekkaku] = true if var[:sekkaku] == nil
16
+ var[:aikotoba] = false if var[:aikotoba] == nil
17
+
18
+ @yuki.vars[:var] = var
19
+ @yuki.vars[:tell_aikotoba] = tell_aikotoba
20
+ @yuki.vars[:ending] = Ending
21
+ @yuki.vars[:red] = Red
22
+ @yuki.vars[:blue] = Blue
23
+ @yuki.vars[:green] = Green
24
+ @yuki.vars[:now] = @now
25
+ @yuki.vars[:command]= get_command
26
+ end
27
+
28
+ def setup
29
+ @yuki.setup
30
+ message_box.start
31
+ command_box.start
32
+ @yuki.start_plot(plot)
33
+ end
34
+
35
+ def update
36
+ return nil if Input.quit_or_escape?
37
+ message_box.update_animation
38
+ command_box.update_animation
39
+ @yuki.update
40
+ r = @yuki.executing? ? @now : @yuki.result
41
+ @yuki.start_plot(plot) if (@yuki.executing? == false && r == @now)
42
+ return r
43
+ end
44
+
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)]
51
+ end
52
+
53
+ def plot
54
+ yuki_plot{
55
+ ret = vars[:now]
56
+ text "目の前には緑、赤、青の3つの扉がある。"
57
+ cr
58
+ text "どうする?"
59
+ cr
60
+ command vars[:command]
61
+ ret = select_result if is_scene?(select_result)
62
+ ret = call_plot(select_result) if is_scenario?(select_result)
63
+ clear
64
+ vars[:var][:sekkaku] = false
65
+ ret
66
+ }
67
+ end
68
+
69
+ def main_command
70
+ end
71
+
72
+ def red_sekkaku
73
+ yuki_plot{
74
+ text "せっかくだから、赤の扉に入ってみよう"
75
+ pause.clear
76
+ vars[:red]
77
+ }
78
+ end
79
+
80
+ def tell_aikotoba
81
+ yuki_plot{
82
+ text "「こんなゲーム、"
83
+ wait 0.5
84
+ text "まじになっちゃって "
85
+ wait 0.5
86
+ text "どうするの!」"
87
+ pause.clear
88
+ vars[:ending]
89
+ }
90
+ end
91
+
92
+ def render
93
+ @doors.render
94
+ message_box.render
95
+ command_box.render if @yuki.selecting?
96
+ end
97
+
98
+ def final
99
+ message_box.stop
100
+ command_box.stop
101
+ end
102
+ end
103
+
104
+ class Blue
105
+ include Story::Scene
106
+
107
+ def update
108
+ return nil if Input.quit_or_escape?
109
+ return @now
110
+ end
111
+ end
112
+
113
+ class Green
114
+ include Story::Scene
115
+
116
+ def update
117
+ return nil if Input.quit_or_escape?
118
+ return @now
119
+ end
120
120
  end
@@ -1,59 +1,59 @@
1
- # -*- encoding: utf-8 -*-
2
- # 共通部品クラス
3
- # メッセージテキストボックス、コマンドボックスを定義
4
- module MainComponent
5
- def self.create_textbox(size, font, color)
6
- # ポーズカーソル作成
7
- wc = Sprite.new(:file=>"image/wait_cursor.png", :type=>:ac)
8
- wc.oh = wc.w
9
- wc = SpriteAnimation.new(:sprite => wc, :wait => 0.2, :pattern_list => [0, 1, 2, 3, 2, 1])
10
-
11
- # 選択カーソル作成
12
- sc = Sprite.new(:file=>"image/cursor.png", :type=>:ac)
13
- sc.oh = sc.w
14
- sc = SpriteAnimation.new(:sprite => sc, :wait => 0.2, :pattern_list => [0, 1, 2, 3, 2, 1])
15
-
16
- tb = TextBox.new(:size=>size, :font=>font, :wait_cursor=>wc, :select_cursor=>sc)
17
- tb.set_wait_cursor_position{|wc,tbox| wc.right.bottom } # ウェイトカーソルとボックスの右下に
18
-
19
- bg = Sprite.new(:size=>tb.size.map{|n| n + 4}, :type=>:ac)
20
- bg.fill(color)
21
-
22
- box = Parts.new(bg.size)
23
- box[:bg] = bg
24
- box[:bg].centering
25
- box[:box] = tb
26
- box[:box].centering
27
-
28
- return box
29
- end
30
-
31
- # 共通変数
32
- @@vars = { }
33
-
34
- def var
35
- return @@vars
36
- end
37
-
38
- # フォント作成
39
- font = Font.sans_serif
40
- font.size = 24
41
- font.use_shadow = true
42
-
43
- # メッセージボックス作成
44
- @@message_box = self.create_textbox(Size.new(24, 4), font, [0, 0, 255, 128])
45
- @@message_box.center.bottom{|body| (0.1).ratio(body) }
46
-
47
- @@command_box = self.create_textbox(Size.new( 8, 4), font, [0, 255, 0, 128])
48
- @@command_box.right{|body| (0.05).ratio(body) }.top{|body| (0.05).ratio(body) }
49
-
50
- # メッセージボックスを動かさないこと前提
51
- def message_box
52
- return @@message_box
53
- end
54
-
55
- # メッセージボックスを動かさないこと前提
56
- def command_box
57
- return @@command_box
58
- end
59
- end
1
+ # -*- encoding: utf-8 -*-
2
+ # 共通部品クラス
3
+ # メッセージテキストボックス、コマンドボックスを定義
4
+ module MainComponent
5
+ def self.create_textbox(size, font, color)
6
+ # ポーズカーソル作成
7
+ wc = Sprite.new(:file=>"image/wait_cursor.png", :type=>:ac)
8
+ wc.oh = wc.w
9
+ wc = SpriteAnimation.new(:sprite => wc, :wait => 0.2, :pattern_list => [0, 1, 2, 3, 2, 1])
10
+
11
+ # 選択カーソル作成
12
+ sc = Sprite.new(:file=>"image/cursor.png", :type=>:ac)
13
+ sc.oh = sc.w
14
+ sc = SpriteAnimation.new(:sprite => sc, :wait => 0.2, :pattern_list => [0, 1, 2, 3, 2, 1])
15
+
16
+ tb = TextBox.new(:size=>size, :font=>font, :wait_cursor=>wc, :select_cursor=>sc)
17
+ tb.set_wait_cursor_position{|wc,tbox| wc.right!.bottom! } # ウェイトカーソルとボックスの右下に
18
+
19
+ bg = Sprite.new(:size=>tb.size.map{|n| n + 4}, :type=>:ac)
20
+ bg.fill(color)
21
+
22
+ box = Parts.new(bg.size)
23
+ box[:bg] = bg
24
+ box[:bg].centering!
25
+ box[:box] = tb
26
+ box[:box].centering!
27
+
28
+ return box
29
+ end
30
+
31
+ # 共通変数
32
+ @@vars = { }
33
+
34
+ def var
35
+ return @@vars
36
+ end
37
+
38
+ # フォント作成
39
+ font = Font.sans_serif
40
+ font.size = 24
41
+ font.use_shadow = true
42
+
43
+ # メッセージボックス作成
44
+ @@message_box = self.create_textbox(Size.new(24, 4), font, [0, 0, 255, 128])
45
+ @@message_box.center!.bottom!{|body| (0.1).ratio(body) }
46
+
47
+ @@command_box = self.create_textbox(Size.new( 8, 4), font, [0, 255, 0, 128])
48
+ @@command_box.right!{|body| (0.05).ratio(body) }.top!{|body| (0.05).ratio(body) }
49
+
50
+ # メッセージボックスを動かさないこと前提
51
+ def message_box
52
+ return @@message_box
53
+ end
54
+
55
+ # メッセージボックスを動かさないこと前提
56
+ def command_box
57
+ return @@command_box
58
+ end
59
+ end
data/sample/Room3/red.rb CHANGED
@@ -1,227 +1,227 @@
1
- # -*- encoding: utf-8 -*-
2
- class Red
3
- include Story::Scene
4
- include MainComponent
5
-
6
- def init
7
- @yuki = Yuki.new(message_box[:box], command_box[:box]) do |box, cbox|
8
- select_textbox(box)
9
- select_commandbox(cbox)
10
- end
11
- def @yuki.text_wait(txt, w = 0.3)
12
- text txt
13
- wait w
14
- end
15
-
16
- @akamatsu = Sprite.new(:file => "image/akamatsu.png", :type => :ck)
17
- @akamatsu.center.bottom
18
- @yuki.regist_parts(:akamatsu, @akamatsu)
19
-
20
- @room = Sprite.new(:file=>"image/room_red.png", :type=>:as)
21
- @room.center.bottom
22
-
23
- var[:akamatsu_aisatsu] = false if var[:akamatsu_aisatsu] == nil
24
- var[:release_akamatsu_book] = false if var[:release_akamatsu_book] == nil
25
- var[:search_bookmark] = false if var[:search_bookmark] == nil
26
- var[:get_bookmark] = false if var[:get_bookmark] == nil
27
-
28
- @yuki.vars[:var] = var
29
- @yuki.vars[:command] = get_command
30
- @yuki.vars[:main_loop] = main_loop
31
- end
32
-
33
- def setup
34
- @yuki.setup
35
- message_box.start
36
- command_box.start
37
- @yuki.start_plot(plot)
38
- end
39
-
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)]
47
- end
48
-
49
- def update
50
- return nil if Input.quit_or_escape?
51
- message_box.update_animation
52
- command_box.update_animation
53
- @yuki.update
54
- r = @yuki.executing? ? @now : @yuki.result
55
- if @yuki.is_scenario?(r)
56
- @yuki.start_plot(r)
57
- r = @now
58
- end
59
- return r
60
- end
61
-
62
- def render
63
- @room.render
64
- @yuki.render
65
- message_box.render
66
- command_box.render if @yuki.selecting?
67
- end
68
-
69
- def plot
70
- yuki_plot do
71
- text "赤の扉から中に入った。"
72
- pause.clear
73
- show :akamatsu
74
- text "目の前には"
75
- color(:red){vars[:var][:akamatsu_aisatsu] ? "赤松さん" : "男の人"}
76
- text "が居る。"
77
- cr
78
- vars[:main_loop]
79
- end
80
- end
81
-
82
- def main_loop
83
- yuki_plot do
84
- loop do
85
- text "どうする?"
86
- command vars[:command]
87
- break select_result if is_scene?(select_result)
88
- call_plot(select_result) if is_scenario?(select_result)
89
- end
90
- end
91
- end
92
-
93
- def red2
94
- yuki_plot do
95
- clear
96
- text_wait "「はっ、"
97
- text_wait "私の、"
98
- text_wait "名前は、"
99
- text_wait "赤松と、"
100
- text_wait "申します!"
101
- cr
102
- text_wait " よろしく、"
103
- text "お願いします!」"
104
- pause.clear
105
- vars[:var][:akamatsu_aisatsu] = true
106
- end
107
- end
108
-
109
- def look
110
- yuki_plot do
111
- clear
112
- text "部屋を見回すと、勉強家らしく、"
113
- cr
114
- text "机と数々の本が本棚にしまってある。"
115
- pause.clear
116
- end
117
- end
118
-
119
- def talk
120
- yuki_plot do
121
- clear
122
- text_wait "「はっ、"
123
- text_wait "私は、"
124
- text_wait "某大学の、"
125
- text_wait "はっ、"
126
- text "8年生です!"
127
- pause.cr
128
- text_wait " 今年こそ、"
129
- text_wait "無事、"
130
- text_wait "卒業、"
131
- text_wait "できるよう!"
132
- cr
133
- text_wait " 精進する、"
134
- text_wait "所存で、"
135
- text_wait "ございます!」"
136
- pause.clear
137
- end
138
- end
139
-
140
- def send1
141
- yuki_plot do
142
- clear
143
- text "あなたは、青山君から受け取っていた本を返した。"
144
- pause.clear
145
- text_wait "「あっ、"
146
- text_wait "青山くんから、"
147
- text "本を受け取って頂いたのですね!"
148
- pause.cr
149
- text_wait " あ、"
150
- text_wait "ありがとうございます!"
151
- pause.clear
152
- text_wait " あ、"
153
- text_wait "あのひと、"
154
- text "ちょっとビビるでしょ?"
155
- pause.cr
156
- text_wait " ・・・おっとと、"
157
- text_wait "聞こえてちゃ、"
158
- text "困るな。」"
159
- pause.clear
160
- text " それでは・・・・・。"
161
- pause.clear
162
- text " ・・・・・。"
163
- pause.clear
164
- text_wait " おや、"
165
- text_wait "栞が、"
166
- text_wait "入って、"
167
- text "ないですね。"
168
- pause.cr
169
- text_wait " あれは、"
170
- text_wait "僕の、"
171
- text_wait "大事な、"
172
- text "宝物なんです!"
173
- pause.cr
174
- text_wait " 青山君の、"
175
- text_wait "部屋に、"
176
- text_wait "戻って、"
177
- cr
178
- text_wait " 栞を、"
179
- text_wait "探して、"
180
- text_wait "きてください!」"
181
- pause.clear
182
- vars[:var][:search_bookmark]=true
183
- end
184
- end
185
-
186
- def send2
187
- yuki_plot do
188
- clear
189
- text_wait "「あっ、"
190
- text_wait "これは、"
191
- text "無くなっていた栞!"
192
- pause.cr
193
- text_wait " ありがとうございます!"
194
- cr
195
- text_wait " あの、"
196
- text_wait "お礼といっては、"
197
- text "何ですが、"
198
- pause.cr
199
- text_wait " 合言葉を、"
200
- text_wait "教えて、"
201
- text "差し上げます!」"
202
- pause.clear
203
- text_wait "「『こんなゲーム", 0.5
204
- text_wait " まじになっちゃって", 0.5
205
- cr
206
- text_wait "  どうするの』", 0.5
207
- cr
208
- text_wait " これが、"
209
- text_wait "合い言葉です!"
210
- cr
211
- text_wait " それでは、"
212
- text "お元気で!」"
213
- pause.clear
214
- vars[:var][:aikotoba]=true
215
- end
216
- end
217
-
218
- def final
219
- message_box.stop
220
- command_box.stop
221
- end
222
-
223
- def dispose
224
- @akamatsu.dispose
225
- @room.dispose
226
- end
227
- end
1
+ # -*- encoding: utf-8 -*-
2
+ class Red
3
+ include Story::Scene
4
+ include MainComponent
5
+
6
+ def init
7
+ @yuki = Yuki.new(message_box[:box], command_box[:box]) do |box, cbox|
8
+ select_textbox(box)
9
+ select_commandbox(cbox)
10
+ end
11
+ def @yuki.text_wait(txt, w = 0.3)
12
+ text txt
13
+ wait w
14
+ end
15
+
16
+ @akamatsu = Sprite.new(:file => "image/akamatsu.png", :type => :ck)
17
+ @akamatsu.center!.bottom!
18
+ @yuki.regist_parts(:akamatsu, @akamatsu)
19
+
20
+ @room = Sprite.new(:file=>"image/room_red.png", :type=>:as)
21
+ @room.center!.bottom!
22
+
23
+ var[:akamatsu_aisatsu] = false if var[:akamatsu_aisatsu] == nil
24
+ var[:release_akamatsu_book] = false if var[:release_akamatsu_book] == nil
25
+ var[:search_bookmark] = false if var[:search_bookmark] == nil
26
+ var[:get_bookmark] = false if var[:get_bookmark] == nil
27
+
28
+ @yuki.vars[:var] = var
29
+ @yuki.vars[:command] = get_command
30
+ @yuki.vars[:main_loop] = main_loop
31
+ end
32
+
33
+ def setup
34
+ @yuki.setup
35
+ message_box.start
36
+ command_box.start
37
+ @yuki.start_plot(plot)
38
+ end
39
+
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)]
47
+ end
48
+
49
+ def update
50
+ return nil if Input.quit_or_escape?
51
+ message_box.update_animation
52
+ command_box.update_animation
53
+ @yuki.update
54
+ r = @yuki.executing? ? @now : @yuki.result
55
+ if @yuki.is_scenario?(r)
56
+ @yuki.start_plot(r)
57
+ r = @now
58
+ end
59
+ return r
60
+ end
61
+
62
+ def render
63
+ @room.render
64
+ @yuki.render
65
+ message_box.render
66
+ command_box.render if @yuki.selecting?
67
+ end
68
+
69
+ def plot
70
+ yuki_plot do
71
+ text "赤の扉から中に入った。"
72
+ pause.clear
73
+ show :akamatsu
74
+ text "目の前には"
75
+ color(:red){vars[:var][:akamatsu_aisatsu] ? "赤松さん" : "男の人"}
76
+ text "が居る。"
77
+ cr
78
+ vars[:main_loop]
79
+ end
80
+ end
81
+
82
+ def main_loop
83
+ yuki_plot do
84
+ loop do
85
+ text "どうする?"
86
+ command vars[:command]
87
+ break select_result if is_scene?(select_result)
88
+ call_plot(select_result) if is_scenario?(select_result)
89
+ end
90
+ end
91
+ end
92
+
93
+ def red2
94
+ yuki_plot do
95
+ clear
96
+ text_wait "「はっ、"
97
+ text_wait "私の、"
98
+ text_wait "名前は、"
99
+ text_wait "赤松と、"
100
+ text_wait "申します!"
101
+ cr
102
+ text_wait " よろしく、"
103
+ text "お願いします!」"
104
+ pause.clear
105
+ vars[:var][:akamatsu_aisatsu] = true
106
+ end
107
+ end
108
+
109
+ def look
110
+ yuki_plot do
111
+ clear
112
+ text "部屋を見回すと、勉強家らしく、"
113
+ cr
114
+ text "机と数々の本が本棚にしまってある。"
115
+ pause.clear
116
+ end
117
+ end
118
+
119
+ def talk
120
+ yuki_plot do
121
+ clear
122
+ text_wait "「はっ、"
123
+ text_wait "私は、"
124
+ text_wait "某大学の、"
125
+ text_wait "はっ、"
126
+ text "8年生です!"
127
+ pause.cr
128
+ text_wait " 今年こそ、"
129
+ text_wait "無事、"
130
+ text_wait "卒業、"
131
+ text_wait "できるよう!"
132
+ cr
133
+ text_wait " 精進する、"
134
+ text_wait "所存で、"
135
+ text_wait "ございます!」"
136
+ pause.clear
137
+ end
138
+ end
139
+
140
+ def send1
141
+ yuki_plot do
142
+ clear
143
+ text "あなたは、青山君から受け取っていた本を返した。"
144
+ pause.clear
145
+ text_wait "「あっ、"
146
+ text_wait "青山くんから、"
147
+ text "本を受け取って頂いたのですね!"
148
+ pause.cr
149
+ text_wait " あ、"
150
+ text_wait "ありがとうございます!"
151
+ pause.clear
152
+ text_wait " あ、"
153
+ text_wait "あのひと、"
154
+ text "ちょっとビビるでしょ?"
155
+ pause.cr
156
+ text_wait " ・・・おっとと、"
157
+ text_wait "聞こえてちゃ、"
158
+ text "困るな。」"
159
+ pause.clear
160
+ text " それでは・・・・・。"
161
+ pause.clear
162
+ text " ・・・・・。"
163
+ pause.clear
164
+ text_wait " おや、"
165
+ text_wait "栞が、"
166
+ text_wait "入って、"
167
+ text "ないですね。"
168
+ pause.cr
169
+ text_wait " あれは、"
170
+ text_wait "僕の、"
171
+ text_wait "大事な、"
172
+ text "宝物なんです!"
173
+ pause.cr
174
+ text_wait " 青山君の、"
175
+ text_wait "部屋に、"
176
+ text_wait "戻って、"
177
+ cr
178
+ text_wait " 栞を、"
179
+ text_wait "探して、"
180
+ text_wait "きてください!」"
181
+ pause.clear
182
+ vars[:var][:search_bookmark]=true
183
+ end
184
+ end
185
+
186
+ def send2
187
+ yuki_plot do
188
+ clear
189
+ text_wait "「あっ、"
190
+ text_wait "これは、"
191
+ text "無くなっていた栞!"
192
+ pause.cr
193
+ text_wait " ありがとうございます!"
194
+ cr
195
+ text_wait " あの、"
196
+ text_wait "お礼といっては、"
197
+ text "何ですが、"
198
+ pause.cr
199
+ text_wait " 合言葉を、"
200
+ text_wait "教えて、"
201
+ text "差し上げます!」"
202
+ pause.clear
203
+ text_wait "「『こんなゲーム", 0.5
204
+ text_wait " まじになっちゃって", 0.5
205
+ cr
206
+ text_wait "  どうするの』", 0.5
207
+ cr
208
+ text_wait " これが、"
209
+ text_wait "合い言葉です!"
210
+ cr
211
+ text_wait " それでは、"
212
+ text "お元気で!」"
213
+ pause.clear
214
+ vars[:var][:aikotoba]=true
215
+ end
216
+ end
217
+
218
+ def final
219
+ message_box.stop
220
+ command_box.stop
221
+ end
222
+
223
+ def dispose
224
+ @akamatsu.dispose
225
+ @room.dispose
226
+ end
227
+ end