#______________________________________________________________________________
# * 此脚本归66RPG - Idiot Script Association(ISA)所有,谢绝任何形式转载。
#______________________________________________________________________________
#==============================================================================
# ■ 头顶的东西 - Put On The Thing
#------------------------------------------------------------------------------
# 遵守协议:66RPG - Idiot Script Association(ISA)
# 初始脚本:忧雪の伤
# 更新优化:无
# 当前版本:1.0.0.0
#------------------------------------------------------------------------------
# 更新日记:忧雪の伤(2011.3.19)
# - 初始化对象
#------------------------------------------------------------------------------
# 功能介绍:创建一个可以跟随移动,指定文件,显示在Player头上的Icon。
# 使用方法:插入接入包的下端处。
# 存在问题:无
#==============================================================================
#--------------------------------------------------------------------------
# ● 资料记录
#--------------------------------------------------------------------------
module ISA
Use["头顶的东西"] = [true, "1.0.0.0"]
System["头顶的东西"] = {}
end
#--------------------------------------------------------------------------
# ● 设定部分
#--------------------------------------------------------------------------
module ISA
# 窗口的坐标修正设定
System["头顶的东西"]["坐标修正设定"] = [30, 82]
end
#==============================================================================
# ■ Game_Temp
#------------------------------------------------------------------------------
# 在没有存档的情况下,处理临时数据的类。这个类的实例请参考
# $game_temp 。
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :map_put_on # 地图头顶存在图标
attr_accessor :map_put_name # 地图头顶存在图标文件名
end
#==============================================================================
# ■ Window_Put_On
#------------------------------------------------------------------------------
# 显示图标的窗口。
#==============================================================================
class Window_Put_On < Window_Base
include ISA
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize(name)
super(0, 0, 64, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.x = $game_player.screen_x - System["头顶的东西"]["坐标修正设定"][0]
self.y = $game_player.screen_y - System["头顶的东西"]["坐标修正设定"][1]
self.z = 0
@name = name
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
bitmap = RPG::Cache.icon(@name)
self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 24, 24))
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
self.x = $game_player.screen_x - System["头顶的东西"]["坐标修正设定"][0]
self.y = $game_player.screen_y - System["头顶的东西"]["坐标修正设定"][1]
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 处理地图画面的类。
#==============================================================================
class Scene_Map
include ISA
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
alias :put_on_the_thing_main :main unless method_defined? :put_on_the_thing_main
def main
@put_on_window = Window_Put_On.new($game_temp.map_put_name) if $game_temp.map_put_on
put_on_the_thing_main
@put_on_window.dispose if @put_on_window != nil
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
alias :put_on_the_thing_update :update unless method_defined? :put_on_the_thing_update
def update
@put_on_window.update if @put_on_window != nil
put_on_the_thing_update
end
#--------------------------------------------------------------------------
# ● 设置图标
#--------------------------------------------------------------------------
def set_icon(name)
@put_on_window = Window_Put_On.new(name)
@put_on_window.visible = true
$game_temp.map_put_on = true
$game_temp.map_put_name = name
end
#--------------------------------------------------------------------------
# ● 图标关闭
#--------------------------------------------------------------------------
def set_icon_no
$game_temp.map_put_on = false
if @put_on_window != nil
@put_on_window.visible = false
end
return true
end
end