def winheight
Graphics.height - M5Read::HEIGHT
end
def update
super
if $game_message.scroll_mode
update_message_up if Input.press?(:UP)
update_message_down if Input.press?(:DOWN)
15.times {update_message_up} if Input.press?(:LEFT)
15.times {update_message_down} if Input.press?(:RIGHT)
terminate_message if (Input.repeat?(:B) or Input.repeat?(:C))
start_message if !@text && $game_message.has_text? && !Input.press?(:B)
end
end
def start_message
@text = $game_message.all_text
self.oy = -M5Read::SPACE
refresh
show
end
def refresh
reset_font_settings
update_all_text_height
create_contents
draw_text_ex(4, 0, @text)
end
def update_all_text_height
@all_text_height = 1
convert_escape_characters(@text).each_line do |line|
@all_text_height += calc_line_height(line, false)
end
reset_font_settings
end
def contents_height
@all_text_height ? @all_text_height : super
end
def update_message_down
if contents.height < winheight-standard_padding*2-M5Read::SPACE
return
end
self.oy = [self.oy + scroll_speed,
contents.height - winheight + standard_padding * 2 + M5Read::SPACE ].min
end
def update_message_up
if contents.height < winheight-standard_padding*2-M5Read::SPACE
return
end
self.oy = [self.oy - scroll_speed,-M5Read::SPACE ].max
end
def scroll_speed
M5Read::SPEED
end
def terminate_message
@text = nil
$game_message.clear
hide
end
end
#==============================================================================
# 脚本结束
#==============================================================================[/pre]