ruby-miyako-mswin32 2.1.4 → 2.1.6

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.
@@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
21
  =end
22
22
 
23
23
  module Miyako
24
- @@modes = [:text, :txt_calc, :takahashi, :tk_calc]
25
-
24
+ @@modes = [:text, :txt_calc, :takahashi, :tk_calc]
25
+
26
26
  #==テキストや図形を描画するクラス
27
27
  #図形は、長方形・丸み付き長方形・円・楕円が描画可能
28
28
  #文字列は、通常の文字列と高橋メソッド形式文字列が描画可能
@@ -36,7 +36,7 @@ module Miyako
36
36
  @edge = parameter[:edge] ||= nil
37
37
  @align = parameter[:align] ||= :left
38
38
  @valign = parameter[:valign] ||= :middle
39
- @lines = parameter[:lines] ||= 2
39
+ @lines = parameter[:lines] ||= 2
40
40
  @vertexes = parameter[:vertexes] ||= []
41
41
  end
42
42
 
@@ -55,8 +55,8 @@ module Miyako
55
55
  end
56
56
 
57
57
  #===テキストを高橋メソッド形式で描画した画像を作成
58
- #指定した大きさの矩形・行数で文字を描画する。
59
- #指定した行数で描画を基準に文字サイズを算出する。
58
+ #指定した大きさの矩形・行数で文字を描画する。
59
+ #指定した行数で描画を基準に文字サイズを算出する。
60
60
  #但し、文字列が長すぎる時は、その文字数を基準に文字サイズを算出する。
61
61
  #ブロックに渡した行数が指定数より多くなると文字列がはみ出るため、注意すること。
62
62
  #_param_:: 設定パラメータ。ハッシュ形式。
@@ -123,13 +123,13 @@ module Miyako
123
123
 
124
124
  def create_text(param, text_block) #:nodoc:
125
125
  init_parameter(param)
126
- text_block = lambda{ @text } if @text
126
+ text_block = Proc.new{ @text } if @text
127
127
  org_size = @font.size
128
128
  org_color = @font.color
129
129
  @margins = []
130
130
  @heights = []
131
131
  area_size = calc(text_block)
132
- @sprite = Sprite.new({size: area_size, type: :ac})
132
+ @sprite = Sprite.new(:size => area_size, :type => :ac)
133
133
  Drawing.fill(@sprite, [0, 0, 0])
134
134
  Bitmap.ck_to_ac!(@sprite, [0, 0, 0])
135
135
  case @align
@@ -140,7 +140,7 @@ module Miyako
140
140
  when :right
141
141
  @margins = @margins.map{|v| area_size.w - v }
142
142
  end
143
- @lines = @margins.length
143
+ @lines = @margins.length
144
144
  vmargin = 0
145
145
  case @valign
146
146
  when :top
@@ -162,9 +162,9 @@ module Miyako
162
162
  org_size = @font.size
163
163
  org_color = @font.color
164
164
  olines = @lines
165
- # calc font size
165
+ # calc font size
166
166
  @font.size = @size[1] / @lines
167
- # calc font size incldue line_height
167
+ # calc font size incldue line_height
168
168
  @font.size = @font.size * @font.size / @font.line_height
169
169
  set_font_size_inner(text_block)
170
170
  # over lines?
@@ -195,7 +195,7 @@ module Miyako
195
195
  when :bottom
196
196
  vmargin = @size[1] - @heights.inject(:+)
197
197
  end
198
- @sprite = Sprite.new({size: @size, type: :ac})
198
+ @sprite = Sprite.new(:size => @size, :type => :ac)
199
199
  Drawing.fill(@sprite, [0, 0, 0])
200
200
  Bitmap.ck_to_ac!(@sprite, [0, 0, 0])
201
201
  @locate = Point.new(@margins.shift, vmargin)
@@ -204,7 +204,7 @@ module Miyako
204
204
  @font.color = org_color
205
205
  return @sprite
206
206
  end
207
-
207
+
208
208
  def set_font_size_inner(text_block) #:nodoc:
209
209
  @max_height = @font.line_height
210
210
  @margins = []
@@ -242,7 +242,7 @@ module Miyako
242
242
  end
243
243
  @img_size.w = [@locate.x, @img_size.w].max
244
244
  end
245
-
245
+
246
246
  #===Shape.textメソッドのブロック内で使用する、文字描画指示メソッド
247
247
  #(例)Shape.text(){ text "abc" }
248
248
  #(例)Shape.takahashi(:size=>[200,200]){ text "名前重要" }
@@ -255,7 +255,7 @@ module Miyako
255
255
  @locate.x += @font.text_size(txt)[0]
256
256
  return self
257
257
  end
258
-
258
+
259
259
  #===Shape.text/takahashiメソッドのブロック内で使用する、文字色指示メソッド
260
260
  #ブロック内で指定した範囲でのみ色が変更される
261
261
  #(例)Shape.text(){ text "abc"; cr; color(:red){"def"} }
@@ -278,7 +278,7 @@ module Miyako
278
278
  }
279
279
  return self
280
280
  end
281
-
281
+
282
282
  def size_inner(margin, &block) #:nodoc:
283
283
  @locate.y += margin
284
284
  text instance_eval(&block)
@@ -294,7 +294,7 @@ module Miyako
294
294
  @font.bold{ text instance_eval(&block) }
295
295
  return self
296
296
  end
297
-
297
+
298
298
  #===Shape.textメソッドのブロック内で使用する、斜体指示メソッド
299
299
  #ブロック内で指定した範囲でのみ斜体文字になる
300
300
  #(使用すると文字の端が切れてしまう場合あり!)
@@ -304,7 +304,7 @@ module Miyako
304
304
  @font.italic{ text instance_eval(&block) }
305
305
  return self
306
306
  end
307
-
307
+
308
308
  #===Shape.textメソッドのブロック内で使用する、下線指示メソッド
309
309
  #ブロック内で指定した範囲でのみ文字に下線が付く
310
310
  #(例)Shape.text(){ text "abc"; cr; bold{"def"} }
@@ -331,10 +331,10 @@ module Miyako
331
331
  @locate.y += @max_height
332
332
  return self
333
333
  end
334
-
334
+
335
335
  def box(param) #:nodoc:
336
336
  init_parameter(param)
337
- s = Sprite.new(size: [w, h], type: :alpha_channel)
337
+ s = Sprite.new(:size => [w, h], :type => :alpha_channel)
338
338
  w = @size[0]
339
339
  h = @size[1]
340
340
  Drawing.fill(s, [0, 0, 0])
@@ -363,7 +363,7 @@ module Miyako
363
363
  init_parameter(param)
364
364
  w = @size[0]
365
365
  h = @size[1]
366
- s = Sprite.new(size: @size, type: :ac)
366
+ s = Sprite.new(:size => @size, :type => :ac)
367
367
  Drawing.fill(s, [0, 0, 0])
368
368
  Bitmap.ck_to_ac!(s, [0, 0, 0])
369
369
  if @edge
@@ -377,7 +377,7 @@ module Miyako
377
377
 
378
378
  def circle(param) #:nodoc:
379
379
  init_parameter(param)
380
- s = Sprite.new(size: [@ray*2+1, @ray*2+1], type: :alpha_channel)
380
+ s = Sprite.new(:size => [@ray*2+1, @ray*2+1], :type => :alpha_channel)
381
381
  Drawing.fill(s, [0, 0, 0])
382
382
  Bitmap.ck_to_ac!(s, [0, 0, 0])
383
383
  if @edge
@@ -396,7 +396,7 @@ module Miyako
396
396
  w2 = w * 2 + 1
397
397
  h = @size[1]
398
398
  h2 = h * 2 + 1
399
- s = Sprite.new(size: [w2, h2], type: :alpha_channel)
399
+ s = Sprite.new(:size => [w2, h2], :type => :alpha_channel)
400
400
  Drawing.fill(s, [0, 0, 0])
401
401
  Bitmap.ck_to_ac!(s, [0, 0, 0])
402
402
  if @edge
@@ -410,16 +410,16 @@ module Miyako
410
410
 
411
411
  def polygon(param) #:nodoc:
412
412
  init_parameter(param)
413
-
413
+
414
414
  min_x, max_x = @vertexes.map{|v| v[0]}.minmax
415
415
  min_y, max_y = @vertexes.map{|v| v[1]}.minmax
416
-
416
+
417
417
  w = max_x - min_x
418
418
  h = max_y - min_y
419
-
419
+
420
420
  @vertexes = @vertexes.map{|v| [v[0]-min_x, v[1]-min_y]}
421
-
422
- s = Sprite.new(size: [w, h], type: :alpha_channel)
421
+
422
+ s = Sprite.new(:size => [w, h], :type => :alpha_channel)
423
423
  Drawing.fill(s, [0, 0, 0])
424
424
  Bitmap.ck_to_ac!(s, [0, 0, 0])
425
425
  Drawing.polygon(s, @vertexes, Color.to_rgb(@color), true)
@@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
20
  ++
21
21
  =end
22
22
 
23
- require 'Forwardable'
24
-
25
23
  # スプライト関連クラス群
26
24
  module Miyako
27
25
  #==スプライト管理クラス
@@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
21
  ++
22
22
  =end
23
23
 
24
- require 'singleton'
25
-
26
24
  module Miyako
27
25
  #==シーン実行クラス
28
26
  #用意したシーンインスタンスを実行
@@ -30,7 +30,7 @@ module Miyako
30
30
  extend Forwardable
31
31
 
32
32
  attr_accessor :textarea, :visible
33
- attr_accessor :select_type, :waiting, :selecting
33
+ attr_accessor :waiting, :selecting
34
34
  attr_accessor :font, :margin
35
35
  attr_reader :wait_cursor, :select_cursor, :choices
36
36
  attr_reader :locate, :size, :max_height
@@ -89,7 +89,6 @@ module Miyako
89
89
  @pre_attach = false
90
90
 
91
91
  @waiting = false
92
- @select_type = :left
93
92
  @selecting = false
94
93
 
95
94
  @textarea.snap(self)
@@ -98,10 +97,10 @@ module Miyako
98
97
  @fiber = nil
99
98
 
100
99
  if @wait_cursor
101
- @wait_cursor.snap(self)
102
- @default_wait_cursor_position.call(@wait_cursor, self)
103
- end
104
- @select_cursor.snap(self) if @select_cursor
100
+ @wait_cursor.snap(self)
101
+ @default_wait_cursor_position.call(@wait_cursor, self)
102
+ end
103
+ @select_cursor.snap(self) if @select_cursor
105
104
 
106
105
  @move_list = [
107
106
  [lambda{ },
@@ -148,7 +147,6 @@ module Miyako
148
147
  @choices.left!.top!
149
148
 
150
149
  @waiting = false
151
- @select_type = :left
152
150
  @selecting = false
153
151
 
154
152
  @textarea = @textarea.dup
@@ -156,10 +154,10 @@ module Miyako
156
154
  @textarea.centering!
157
155
 
158
156
  if @wait_cursor
159
- @wait_cursor.snap(self)
160
- @default_wait_cursor_position.call(@wait_cursor, self)
161
- end
162
- @select_cursor.snap(self) if @select_cursor
157
+ @wait_cursor.snap(self)
158
+ @default_wait_cursor_position.call(@wait_cursor, self)
159
+ end
160
+ @select_cursor.snap(self) if @select_cursor
163
161
 
164
162
  @move_list = @move_list.dup
165
163
  end
@@ -163,7 +163,7 @@ module Miyako
163
163
  y_array = ((y1 / size[1])..(y2 / size[1])).to_a.map{|e| e * size[1]}
164
164
  return x_array.product(y_array)
165
165
  end
166
-
166
+
167
167
  #===指定の矩形が格子状のどこに重なっているかを返す
168
168
  # position(Point([x,y])形式)を基準として、矩形rect(Rect([x,y,w,h])形式)が、格子状の並べた矩形
169
169
  # (基準を[0,0]とした、大きさ[size,size]の矩形をタイル状に並べた物)にある場合、
@@ -201,7 +201,7 @@ module Miyako
201
201
  y_array = [min] + get_step_array_f(min, y2.to_f, sz, skip_even)
202
202
  return x_array.uniq.product(y_array.uniq)
203
203
  end
204
-
204
+
205
205
  #===指定の矩形が格子状のどこに重なっているかを返す(実数で指定)
206
206
  #position(Point([x,y])形式)を基準として、矩形rect(Rect([x,y,w,h])形式)が、格子状の並べた矩形
207
207
  #(基準を[0.0,0.0]とした、大きさ[size,size]の矩形をタイル状に並べた物)にある場合、
@@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
22
 
23
23
  #lambdaの別名として、yuki_plotメソッドを追加
24
24
  alias :yuki_plot :lambda
25
+ alias :scenario_plot :lambda
25
26
 
26
27
  #=シナリオ言語Yuki実装モジュール
27
28
  module Miyako
@@ -190,15 +191,22 @@ module Miyako
190
191
 
191
192
  @valign = :middle
192
193
 
193
- @release_checks_default = [lambda{ Input.pushed_any?(:btn1, :spc) }, lambda{ @mouse_enable && Input.click?(:left) } ]
194
+ @release_checks_default = [
195
+ lambda{ Input.pushed_any?(:btn1, :spc) },
196
+ lambda{ @mouse_enable && Input.click?(:left) }
197
+ ]
194
198
  @release_checks = @release_checks_default.dup
195
199
 
196
- @ok_checks_default = [lambda{ Input.pushed_any?(:btn1, :spc) },
197
- lambda{ @mouse_enable && self.commandbox.attach_any_command?(*Input.get_mouse_position) && Input.click?(:left) } ]
200
+ @ok_checks_default = [
201
+ lambda{ Input.pushed_any?(:btn1, :spc) },
202
+ lambda{ @mouse_enable && self.commandbox.attach_any_command?(*Input.get_mouse_position) && Input.click?(:left) }
203
+ ]
198
204
  @ok_checks = @ok_checks_default.dup
199
205
 
200
- @cancel_checks_default = [lambda{ Input.pushed_any?(:btn2, :esc) },
201
- lambda{ @mouse_enable && Input.click?(:right) } ]
206
+ @cancel_checks_default = [
207
+ lambda{ Input.pushed_any?(:btn2, :esc) },
208
+ lambda{ @mouse_enable && Input.click?(:right) }
209
+ ]
202
210
  @cancel_checks = @cancel_checks_default.dup
203
211
 
204
212
  @key_amount_proc = lambda{ Input.pushed_amount }
@@ -226,6 +234,10 @@ module Miyako
226
234
  raise MiyakoCopyError.not_copy("Yuki")
227
235
  end
228
236
 
237
+ def over_engine
238
+ @over_yuki
239
+ end
240
+
229
241
  #===マウスでの制御を可能にする
230
242
  #ゲームパッド・キーボードでのコマンド・ポーズ制御を行えるが、
231
243
  #それに加えて、マウスでもゲームパッド・キーボードでの制御が行える
@@ -258,7 +270,6 @@ module Miyako
258
270
  #なお、visibleの値がfalseの時は描画されない。
259
271
  #返却値:: 自分自身を返す
260
272
  def render
261
- @visibles.render if @visible
262
273
  @over_yuki.render if @over_yuki && @over_yuki.executing?
263
274
  return self
264
275
  end
@@ -268,7 +279,6 @@ module Miyako
268
279
  #なお、visibleの値がfalseの時は描画されない。
269
280
  #返却値:: 自分自身を返す
270
281
  def render_to(dst)
271
- @visibles.render_to(dst) if @visible
272
282
  @over_yuki.render_to(dst) if @over_yuki && @over_yuki.executing?
273
283
  return self
274
284
  end
@@ -278,7 +288,6 @@ module Miyako
278
288
  #返却値:: 描く画像のupdate_spriteメソッドを呼び出した結果を配列で返す
279
289
  def update_animation
280
290
  @over_yuki.update_animation if @over_yuki && @over_yuki.executing?
281
- @visibles.update_animation
282
291
  end
283
292
 
284
293
  #===変数を参照する
@@ -1470,4 +1479,6 @@ module Miyako
1470
1479
  @is_outer_height = nil
1471
1480
  end
1472
1481
  end
1482
+
1483
+ ScenarioEngine = Yuki
1473
1484
  end
data/lib/Miyako/miyako.rb CHANGED
@@ -42,6 +42,9 @@ require 'forwardable'
42
42
  require 'iconv' if RUBY_VERSION < '1.9.0'
43
43
  require 'kconv'
44
44
  require 'rbconfig'
45
+ require 'singleton'
46
+ require 'csv'
47
+ require 'delegate'
45
48
 
46
49
  #画面などの初期設定を自動的に行うかどうかの設定。デフォルトはtrue
47
50
  $miyako_auto_open = true if $miyako_auto_open.nil?
Binary file
data/sample/Room3/blue.rb CHANGED
@@ -5,14 +5,16 @@ class Blue
5
5
 
6
6
  def init
7
7
  @yuki = Yuki.new
8
- @yuki.select_textbox(message_box[:box])
9
- @yuki.select_commandbox(command_box[:box])
8
+ @yuki.select_textbox(message_box[:box], message_box)
9
+ @yuki.select_commandbox(command_box[:box], command_box)
10
10
  @aoyama = Sprite.new(:file => "image/aoyama.png", :type => :ck)
11
+ @aoyama.hide
11
12
  @aoyama.center!.bottom!
12
- @yuki.regist_parts(:aoyama, @aoyama)
13
+ @yuki.visibles[:aoyama] = @aoyama
13
14
 
14
15
  @room = Sprite.new(:file => "image/room_blue.png", :type => :as)
15
16
  @room.center!.bottom!
17
+ @yuki.bgs[:room] = @room
16
18
 
17
19
  var[:aoyama_aisatsu] = false if var[:aoyama_aisatsu] == nil
18
20
  var[:release_aoyama_book] = false if var[:release_aoyama_book] == nil
@@ -31,15 +33,15 @@ class Blue
31
33
 
32
34
  def setup
33
35
  @yuki.setup
34
- message_box.start
35
- command_box.start
36
+ @yuki.textbox_all.start
37
+ @yuki.commandbox_all.start
36
38
  @yuki.start_plot(plot)
37
39
  end
38
40
 
39
41
  def update
40
42
  return nil if Input.quit_or_escape?
41
- message_box.update_animation
42
- command_box.update_animation
43
+ @yuki.textbox_all.update_animation
44
+ @yuki.commandbox_all.update_animation
43
45
  @yuki.update
44
46
  r = @yuki.executing? ? @now : @yuki.result
45
47
  if @yuki.is_scenario?(r)
@@ -50,10 +52,10 @@ class Blue
50
52
  end
51
53
 
52
54
  def render
53
- @room.render
54
- @yuki.render
55
- message_box.render
56
- command_box.render if @yuki.selecting?
55
+ @yuki.bgs.render
56
+ @yuki.visibles.render
57
+ @yuki.textbox_all.render
58
+ @yuki.commandbox_all.render
57
59
  end
58
60
 
59
61
  def get_command
@@ -286,8 +288,8 @@ class Blue
286
288
  end
287
289
 
288
290
  def final
289
- message_box.stop
290
- command_box.stop
291
+ @yuki.textbox_all.stop
292
+ @yuki.commandbox_all.stop
291
293
  end
292
294
 
293
295
  def dispose
@@ -14,7 +14,7 @@ class Ending
14
14
  }
15
15
  end
16
16
 
17
- @yuki.select_textbox(message_box[:box])
17
+ @yuki.select_textbox(message_box[:box], message_box)
18
18
  @bg = Sprite.new(:file => "image/congratulation_bg.png", :type => :as)
19
19
  @bg.oh = @bg.h / 2
20
20
  @anim = SpriteAnimation.new(:sprite=>@bg, :wait=>0.5)
@@ -25,23 +25,23 @@ class Ending
25
25
  @cong_man.center!.bottom!
26
26
  @visible_cong_man = false
27
27
  @timer = WaitCounter.new(3)
28
- @staff_roll = [Shape.text(:font=>message_box[:box].font, :align=>:center){
28
+ @staff_roll = [Shape.text(:font=>@yuki.textbox.font, :align=>:center){
29
29
  text "シナリオ・グラフィック・"
30
30
  cr
31
31
  text "スクリプティング・その他雑用"
32
32
  cr.cr
33
33
  text "サイロス 誠"
34
34
  },
35
- Shape.text(:font=>message_box[:box].font){ text "Powerd By Miyako 2.0" }
35
+ Shape.text(:font=>@yuki.textbox.font){ text "Powerd By Miyako 2.1" }
36
36
  ]
37
37
  @staff_roll.each{|st|
38
- st.snap(message_box)
38
+ st.snap(@yuki.textbox_all)
39
39
  st.centering!
40
40
  }
41
41
  @index = -1
42
42
 
43
- @end_roll = Shape.text(:font=>message_box[:box].font){ text "T H E  E N D" }
44
- @end_roll.snap(message_box)
43
+ @end_roll = Shape.text(:font=>@yuki.textbox.font){ text "T H E  E N D" }
44
+ @end_roll.snap(@yuki.textbox_all)
45
45
  @end_roll.centering!
46
46
  @yuki.regist_parts(:end_roll, @end_roll)
47
47
  @yuki.vars[:staff_roll] = self.method(:staff_roll)
@@ -67,7 +67,7 @@ class Ending
67
67
  @cong_man.render if @visible_cong_man
68
68
  if @exec == self.method(:plot_executing)
69
69
  @yuki.render
70
- message_box.render
70
+ @yuki.textbox_all.render
71
71
  @staff_roll[@index].render if @index >= 0
72
72
  end
73
73
  end
@@ -90,8 +90,7 @@ class Ending
90
90
  end
91
91
 
92
92
  def plot_executing
93
- message_box.update_animation
94
- command_box.update_animation
93
+ @yuki.textbox_all.update_animation
95
94
  @yuki.update
96
95
  r = @yuki.executing? ? @now : @yuki.result
97
96
  if @yuki.is_scenario?(r)
@@ -5,14 +5,16 @@ class Green
5
5
 
6
6
  def init
7
7
  @yuki = Yuki.new
8
- @yuki.select_textbox(message_box[:box])
9
- @yuki.select_commandbox(command_box[:box])
8
+ @yuki.select_textbox(message_box[:box], message_box)
9
+ @yuki.select_commandbox(command_box[:box], command_box)
10
10
  @midori = Sprite.new(:file => "image/midori.png", :type => :ck)
11
+ @midori.hide
11
12
  @midori.center!.bottom!
12
- @yuki.regist_parts(:midori, @midori)
13
+ @yuki.visibles[:midori] = @midori
13
14
 
14
15
  @room = Sprite.new(:file => "image/room_green.png", :type => :as)
15
16
  @room.center!.bottom!
17
+ @yuki.bgs[:room] = @room
16
18
 
17
19
  var[:midori_aisatsu] = false if var[:midori_aisatsu] == nil
18
20
  var[:release_aoyama_book] = false if var[:release_aoyama_book] == nil
@@ -28,15 +30,15 @@ class Green
28
30
 
29
31
  def setup
30
32
  @yuki.setup
31
- message_box.start
32
- command_box.start
33
+ @yuki.textbox_all.start
34
+ @yuki.commandbox_all.start
33
35
  @yuki.start_plot(plot)
34
36
  end
35
37
 
36
38
  def update
37
39
  return nil if Input.quit_or_escape?
38
- message_box.update_animation
39
- command_box.update_animation
40
+ @yuki.textbox_all.update_animation
41
+ @yuki.commandbox_all.update_animation
40
42
  @yuki.update
41
43
  r = @yuki.executing? ? @now : @yuki.result
42
44
  if @yuki.is_scenario?(r)
@@ -47,10 +49,11 @@ class Green
47
49
  end
48
50
 
49
51
  def render
50
- @room.render
51
- @yuki.render
52
- message_box.render
53
- command_box.render if @yuki.selecting?
52
+ @yuki.bgs.render
53
+ @yuki.visibles.render
54
+ @yuki.textbox_all.render
55
+ @yuki.commandbox_all.render
56
+ @yuki.pre_visibles.render
54
57
  end
55
58
 
56
59
  def get_command
@@ -209,8 +212,8 @@ class Green
209
212
  end
210
213
 
211
214
  def final
212
- message_box.stop
213
- command_box.stop
215
+ @yuki.textbox_all.stop
216
+ @yuki.commandbox_all.stop
214
217
  end
215
218
 
216
219
  def dispose
data/sample/Room3/main.rb CHANGED
@@ -4,13 +4,13 @@ class MainScene
4
4
  include MainComponent
5
5
 
6
6
  def init
7
- @yuki = Yuki.new(message_box[:box], command_box[:box]){|box, cbox|
8
- select_textbox(box)
9
- select_commandbox(cbox)
7
+ @yuki = Yuki.new(message_box, command_box){|box, cbox|
8
+ select_textbox(box[:box], box)
9
+ select_commandbox(cbox[:box], cbox)
10
10
  }
11
11
  @yuki.select_plot(plot)
12
- @doors = Sprite.new(:file=>"image/three_doors.png", :type=>:as)
13
- @doors.center!.bottom!
12
+ @yuki.load_bg :doors, "image/three_doors.png"
13
+ @yuki.bgs[:doors].center!.bottom!
14
14
 
15
15
  var[:sekkaku] = true if var[:sekkaku] == nil
16
16
  var[:aikotoba] = false if var[:aikotoba] == nil
@@ -27,15 +27,16 @@ class MainScene
27
27
 
28
28
  def setup
29
29
  @yuki.setup
30
- message_box.start
31
- command_box.start
30
+ @yuki.bg_show
31
+ @yuki.textbox_all.start
32
+ @yuki.commandbox_all.start
32
33
  @yuki.start_plot(plot)
33
34
  end
34
35
 
35
36
  def update
36
37
  return nil if Input.quit_or_escape?
37
- message_box.update_animation
38
- command_box.update_animation
38
+ @yuki.textbox_all.update_animation
39
+ @yuki.commandbox_all.update_animation
39
40
  @yuki.update
40
41
  r = @yuki.executing? ? @now : @yuki.result
41
42
  @yuki.start_plot(plot) if (@yuki.executing? == false && r == @now)
@@ -90,14 +91,14 @@ class MainScene
90
91
  end
91
92
 
92
93
  def render
93
- @doors.render
94
- message_box.render
95
- command_box.render if @yuki.selecting?
94
+ @yuki.bgs.render
95
+ @yuki.textbox_all.render
96
+ @yuki.commandbox_all.render
96
97
  end
97
98
 
98
99
  def final
99
- message_box.stop
100
- command_box.stop
100
+ @yuki.textbox_all.stop
101
+ @yuki.commandbox_all.stop
101
102
  end
102
103
  end
103
104
 
@@ -46,6 +46,7 @@ module MainComponent
46
46
 
47
47
  @@command_box = self.create_textbox(Size.new( 8, 4), font, [0, 255, 0, 128])
48
48
  @@command_box.right!{|body| (0.05).ratio(body) }.top!{|body| (0.05).ratio(body) }
49
+ @@command_box.hide
49
50
 
50
51
  # メッセージボックスを動かさないこと前提
51
52
  def message_box