if @popchar >= 0
@text_save = @now_text.clone
@max_x = 0
@max_y = 4
for i in 0..3
line = @now_text.split(/\n/)[3-i]
@max_y -= 1 if line == nil and @max_y <= 4-i
next if line == nil
cx = contents.text_size(line).width
@max_x = cx if cx > @max_x
end
self.width = @max_x + 48 + @face_indent
self.height = (@max_y - 1) * 32 + 64
else
@max_x = self.width - 32 - @face_indent
end
reset_window
if name_window_set
off_x = 0
off_y = -40
space = 2
w = self.contents.text_size(name_text).width + 26 + space
x = @alignment ? self.x + off_x - space / 2 : self.x + off_x - space / 2 + self.width - w
y = self.y + off_y - space / 2
h = 40 + space
@name_window_frame = Window_Frame.new(x, y, w, h)
@name_window_frame.z = self.z + 1
x = @alignment ? self.x + off_x - space / 2 + 4 : self.x + off_x - space / 2 + 4 + self.width - w
y = self.y + off_y - space / 2
@name_window_text = Air_Text.new(x+4, y+6, name_text)
@name_window_text.z = self.z + 2
end
end
reset_window
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 update
super
if @autoclosetime == 0
@autoclosetime = -1
terminate_message
end
if @autoclosetime >= 1
@autoclosetime -= 1
end
if @fade_in
self.contents_opacity += 24
if @input_number_window != nil
@input_number_window.contents_opacity += 24
end
if self.contents_opacity == 255
@fade_in = false
end
return
end
@now_text = nil if @now_text == ""
if @now_text != nil and @mid_stop == false
if @write_wait > 0
@write_wait -= 1
return
end
text_not_skip = $game_system.typing
while true
@max_x = @x if @max_x < @x
@max_y = @y if @max_y < @y
if (c = @now_text.slice!(/./m)) != nil
if c == "\000"
c = "\\"
end
if c == "\001"
@now_text.sub!(/\[([0-9]+)\]/, "")
color = $1.to_i
if color >= 0 and color <= 7
self.contents.font.color = text_color(color)
end
c = ""
end
if c == "\002"
if @gold_window == nil and @popchar <= 0
@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
c = ""
end
if c == "\004"
if @playtime_window == nil and @popchar <=0
@playtime_window = Window_PlayTime.new
@playtime_window.x = 80
if $game_temp.in_battle
@playtime_window.y = 192
else
@playtime_window.y = self.y >= 128 ? 32 : 384
end
@playtime_window.opacity = self.opacity
@playtime_window.back_opacity = self.back_opacity
end
end
if c == "\016"
text_not_skip = false
c = ""
end
if c == "\017"
text_not_skip = true
c = ""
end
if c == "\020"
@mid_stop = true
c = ""
end
if c == "\023"
@indent = @x
c = ""
end
if c == "\024"
@now_text.sub!(/\[([0-9]+)\]/, "")
@opacity = $1.to_i
c = ""
end
if c == "\025"
@now_text.sub!(/\[([0-9]+)\]/, "")
self.contents.font.size = [[$1.to_i, 6].max, 32].min
c = ""
end
if c == "\026"
@now_text.sub!(/\[([0-9]+)\]/, "")
@x += $1.to_i
c = ""
end
if c == "\027"
@now_text.sub!(/\[([0-9]+)\]/, "")
@x += $1.to_i * self.contents.font.size / 2
next
end
if c == "\030"
@now_text.sub!(/\[(.*?)\]/, "")
self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
@x += 24
c = ""
end
if c == "\050"
@now_text.sub!(/\[([0-9]+)\]/, "")
@autoclosetime = $1.to_i
next
end
# Start
# ◎
# \MSの場合
if c == "\052"
@now_text.sub!(/\[([0-9]+)\]/, "")
bcolor = $1.to_i
@bflag = true
end
# \MEの場合
if c == "\053"
@bflag = false
bcolor = 0
end
# ◎
# End
# Start
# ◎
if @bflag == true
if bcolor >= 0 and bcolor <= 7
bsize = self.contents.text_size(c).width
self.contents.fill_rect(4 + @x, 32 * @y, bsize, 32, text_color(bcolor))
end
end
# ◎
# End
if c == "\n"
if @lines >= $game_temp.choice_start
@cursor_width = [@cursor_width, @max_x - @face_indent].max
end
@lines += 1
@y += 1
@x = 0 + @indent + @face_indent
if @lines >= $game_temp.choice_start
@x = 8 + @indent + @face_indent
end
c = ""
end
if c != ""
# 文字描画
@x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
end
if Input.press?(Input::B) and $game_switches[93] == false
text_not_skip = false
end
else
text_not_skip = true
break
end
# 終了判定
if text_not_skip
break
end
end
@write_wait += @write_speed
return
end
if @input_number_window != nil
@input_number_window.update
# 決定
if Input.trigger?(Input::C) and $game_switches[93] == false
# self.contents.font.color = text_color(color)
self.contents.draw_text(0, 0, w, h, designate_text)
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
self.contents.clear
super
end
end作者: 谈陈鸿杰 时间: 2009-12-29 17:09
用柳柳大人的脚本。
# ----------------------------
class Window_Message < Window_Selectable
#\a[n] : n针自动关闭
#\b: 路标
#\c[n] 8种颜色,\d or \c[0]还原
#\d: 还原字体大小颜色高度成默认
#\f[n] : 使用第n种字体
#\g : 显示金钱
#\h[n] : 改变字高度, \d or \h[32] 还原
#\i[n] : Shows the icon and item name of the item with ID n
#\j[n] : Puts n pixels of whitespace at the current position within the message. Useful if you want precise spacing rather than relying on the font's space length.
#\k[n] : Shows the icon and skill name of the skill with ID n.
#\w[n] : Shows the icon and weapon name of the weapon with ID n.
#\m[n] : Shows the icon and armor name of the armor with ID n.
#\n[n] : Shows the name of the hero with ID n.
#\o[n] : The alpha of the window text is n for this message.
#\r: Right-justifies the text on this line. Must be the first thing in the line.