- 注册时间
- 2010-1-3
- 最后登录
- 2010-11-20
④见习
腿神姐真的很温柔&
- 积分
- 408
|
发表于 2010-1-19 00:47:43
|
显示全部楼层
- class Window_Message
- def initialize
- super(380, 16, 160, 448)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.visible = false
- self.z = 9998
- @fade_in = false
- @fade_out = false
- @contents_showing = false
- @cursor_width = 0
- self.active = false
- self.index = -1
- end
- def refresh
- self.contents.clear
- self.contents.font.color = normal_color
- x = y = 0
- @cursor_width = 0
- if $game_temp.choice_start == 0
- x = 8
- end
- if $game_temp.message_text != nil
- text = $game_temp.message_text
- begin
- last_text = text.clone
- text.gsub!(/\\\\[Vv]\\[([0-9]+)\\]/) { $game_variables[$1.to_i] }
- end until text == last_text
- text.gsub!(/\\\\[Nn]\\[([0-9]+)\\]/) do
- $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
- end
- text.gsub!(/\\\\\\\\/) { "\\000" }
- text.gsub!(/\\\\[Cc]\\[([0-9]+)\\]/) { "\\001[#{$1}]" }
- text.gsub!(/\\\\[Gg]/) { "\\002" }
- while ((c = text.slice!(/./m)) != nil)
- if c == "\\000"
- c = "\\\\"
- end
- if c == "\\001"
- text.sub!(/\\[([0-9]+)\\]/, "")
- color = $1.to_i
- if color >= 0 and color <= 7
- self.contents.font.color = text_color(color)
- end
- next
- end
- if c == "\\002"
- if @gold_window == nil
- @gold_window = Window_Gold.new
- @gold_window.x = 560 - @gold_window.width
- if $game_temp.in_battle
- @gold_window.y = 192
- else
- @gold_window.y = self.y >= 128 ? 32 : 384
- end
- @gold_window.opacity = self.opacity
- @gold_window.back_opacity = self.back_opacity
- end
- next
- end
- if c == "\\n"
- if y >= $game_temp.choice_start
- @cursor_width = [@cursor_width, x].max
- end
- x += 1
- y = 0
- if y >= $game_temp.choice_start
- x = 8
- end
- next
- end
- self.contents.draw_text(-32 * x + 100, 4 + y, 40, 32, c)
- y += self.contents.text_size(c).height
- end
- end
- if $game_temp.choice_max > 0
- @item_max = $game_temp.choice_max
- self.active = true
- self.index = 0
- end
- if $game_temp.num_input_variable_id > 0
- digits_max = $game_temp.num_input_digits_max
- number = $game_variables[$game_temp.num_input_variable_id]
- @input_number_window = Window_InputNumber.new(digits_max)
- @input_number_window.number = number
- @input_number_window.x = self.x + 8
- @input_number_window.y = self.y + $game_temp.num_input_start * 32
- end
- end
- def reset_window
- if $game_temp.in_battle
- self.x = 464
- else
- case $game_system.message_position
- when 0
- self.x = 16
- when 1
- self.x = 240
- when 2
- self.x = 464
- end
- end
- if $game_system.message_frame == 0
- self.opacity = 255
- else
- self.opacity = 0
- end
- self.back_opacity = 160
- end
- end
复制代码 效果很不错哟~~如果需要从左到右,搜索-32 * x + 100,改为x*32 + 4即可。这个是从右到左的~~~ |
|