#==============================================================================
# ■ Window_MapName
#------------------------------------------------------------------------------
# 顯示地圖名稱的窗口。
#==============================================================================
class Window_MapName < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(380, 20, 220, 60)
self.contents = Bitmap.new(width - 32, height - 32)
@times = [10,10,34,16]
@window = [244,144,255]
update
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def update
if $game_switches[1]
newid = $game_map.map_id
name = $data_map[newid].name
time = @times[1] + @times[2] + @times[3]
if newid != @id
@id = newid
@show_time = @times[0] + @times[1] + @times[2] + @times[3]
elsif @show_time < 1
self.opacity = 0
self.back_opacity = 0
self.contents_opacity = 0
return
end
self.contents.clear
self.contents.font.color = Color.new(255, 255, 255, 255)
self.contents.draw_text(4, 0 , width - 40, 32, name, 1)
if @show_time > (@times[2] + @times[3])
if @show_time < time
self.opacity=((@window[0]/@times[1])*(time - @show_time)).to_i
self.back_opacity=((@window[1]/@times[1])*(time - @show_time)).to_i
self.contents_opacity=((@window[2]/@times[1])*(time-@show_time)).to_i
else
self.opacity = 0
self.back_opacity = 0
self.contents_opacity = 0
end
else
if @show_time < (@times[3] / 16 * 14)
self.opacity = ((@window[0] / @times[3]) * @show_time).to_i
else
self.opacity = @window[0]
end
if @show_time < (@times[3] / 16 * 9)
self.back_opacity = ((@window[1] / @times[3]) * @show_time).to_i
else
self.back_opacity = @window[1]
end
if @show_time < @times[3]
self.contents_opacity = ((@window[2] / @times[3])* @show_time).to_i
else
self.contents_opacity = @window[2]
end
end
@show_time -= 1
else
self.opacity = 0
self.back_opacity = 0
self.contents_opacity = 0
end
end
end