# ————————————————————————————————————
# 本脚本来自[url]http://www.66rpg.com/[/url],转载自[url]http://www.phylomortis.com/[/url],转载请保留此信息
# ————————————————————————————————————
#==============================================================================
# ■ Window_MapName
#------------------------------------------------------------------------------
# 显示地图名字的窗口。
#==============================================================================
class Window_MapName < Window_Base
#--------------------------------------------------------------------------
# ● 类常量定义
#--------------------------------------------------------------------------
# 窗口位置设定
NAME_X = 210 # 矩形左上顶点X坐标
NAME_Y = 180 # 矩形左上顶点Y坐标
NAME_W = 220 # 矩形宽
NAME_H = 80 # 矩形高
# 显示时间设置
SHOW_TIME_0 = 10 # 地图名出现前等待的帧数
SHOW_TIME_1 = 10 # 地图名从不可见变成可见的帧数
SHOW_TIME_2 = 34 # 地图名完全可见的帧数
SHOW_TIME_3 = 16 # 地图名从可见变成不可见的帧数
# 完全可见时的透明度设置
OPACITY_1 = 0 # 边框
OPACITY_2 = 0 # 背景
OPACITY_3 = 255 # 文字
# 地图名字的颜色
TEXT_COLOR = Color.new(255, 255, 255, 255)
#--------------------------------------------------------------------------
# ● 初始化状态
#--------------------------------------------------------------------------
def initialize
super(NAME_X , NAME_Y, NAME_W, NAME_H)
# 初始化窗口透明度
self.opacity = 0
self.back_opacity = 0
self.contents_opacity = 0
self.contents = Bitmap.new(width - 32, height - 32)
# 剩余帧数初始化
@show_time = 0
end
#--------------------------------------------------------------------------
# ● 输出文字
#--------------------------------------------------------------------------
def setname
# 获取地图ID
newid = $game_map.map_id
time = SHOW_TIME_1 + SHOW_TIME_2 + SHOW_TIME_3
# 如果现在的地图的ID不是刚才显示的地图ID则开始显示
if newid != @id
@id = newid
@show_time = SHOW_TIME_0 + SHOW_TIME_1 + SHOW_TIME_2 + SHOW_TIME_3
# 剩余帧数为0是时,全部窗口透明
elsif @show_time < 1
self.opacity = 0
self.back_opacity = 0
self.contents_opacity = 0
return
end
self.contents.clear
self.contents.font.color = TEXT_COLOR
# 描绘地图名
self.contents.font.size = 22
self.contents.draw_text(4, 0 , width - 40, 32, $data_mapinfos[@id].name.split(/#/)[0], 1)
self.contents.font.size = 15
self.contents.draw_text(4, 0 , width - 40, 62, "------------------------", 1)
self.contents.draw_text(4, 0 , width - 40, 81, $data_mapinfos[@id].name.split(/#/)[1], 1)
# 根本帧数设定窗口透明度
if @show_time > (SHOW_TIME_2 + SHOW_TIME_3)
self.opacity = @show_time < time ? (((OPACITY_1 / SHOW_TIME_1) * (time - @show_time)).to_i) : 0
self.back_opacity = @show_time < time ? (((OPACITY_2 / SHOW_TIME_1 )* (time - @show_time)).to_i) : 0
self.contents_opacity = @show_time < time ? (((OPACITY_3 / SHOW_TIME_1) * (time - @show_time)).to_i) : 0
else
self.opacity = @show_time < (SHOW_TIME_3 / 16 * 14) ? ((OPACITY_1 / SHOW_TIME_3) * @show_time).to_i : OPACITY_1
self.back_opacity = @show_time < (SHOW_TIME_3 / 16 * 9) ? ((OPACITY_2 / SHOW_TIME_3) * @show_time).to_i : OPACITY_2
self.contents_opacity = @show_time < SHOW_TIME_3 ? ((OPACITY_3 / SHOW_TIME_3)* @show_time).to_i : OPACITY_3
end
@show_time -= 1
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 处理地图画面的类。(追加定义)
#==============================================================================
class Scene_Map
alias smn_main main
def main
@mapname = Window_MapName.new
smn_main
@mapname.dispose
end
alias smn_update update
def update
@mapname.setname
smn_update
end
end
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# 处理标题画面的类。(追加定义)
#==============================================================================
class Scene_Title
alias smn_main main
def main
# 读取地图信息文件
$data_mapinfos = load_data("Data/MapInfos.rxdata")
smn_main
end
end