Project1
标题:
【不是创意的创意】显示地图名和坐标——通用单脚本版
[打印本页]
作者:
精灵使者
时间:
2014-12-18 14:10
标题:
【不是创意的创意】显示地图名和坐标——通用单脚本版
本帖最后由 精灵使者 于 2017-10-8 02:06 编辑
与以前的独立的脚本不同,此脚本可以在XP,VX和VA环境下使用。
设置的时候,请参考设置部分。
打开相应的开关脚本即可工作。
#==========================================================================
# 本脚本来自[url=http://www.66rpg.com]www.66rpg.com[/url],用于任何游戏请保留此信息。别以为加密就可以del哦
#==========================================================================
#==========================================================================
#显示地图名和坐标 ver 20160205
#
#更新by精灵使者
#
#更新内容:设定改为XP,VX,VA通用脚本。
#具体使用方法去看设置部分,启动窗口开关脚本开始工作。
#如果使用分隔符,可以自己修改分隔符。
#地图名只显示分隔符前的内容。
#分隔符前面如果没有地图名的话,小地图会暂时关闭。
#==========================================================================
#--------------------------------------------------------------------------
# ● 顶层变量
#--------------------------------------------------------------------------
OS = self ? (RUBY_VERSION == '1.9.2' ? :va : :vx) : :xp
#==============================================================================
# ■ 设定部分
#==============================================================================
module FAY
EDITION = OS # 版本
WINDOW_XY = 1 # XY坐标窗口开关
MAPNAME_COLOR =
Color.new(255, 255, 255) # 地图名颜色,如果是其他颜色请指定
XYNAME_COLOR =
Color.new(192, 224, 255) # XY名字的颜色,如果是其他颜色请指定
XYNUMBER_COLOR =
Color.new(255, 255, 255) # XY数字的颜色,如果是其他颜色请指定
XY_OPACITY = 0 # XY窗口的透明度,默认完全透明
XY_B_OPACITY = 0 # XY窗口背景的透明度,默认完全透明
XY_C_OPACITY = 255 # XY窗口内容的透明度,默认完全不透明
XYBACK_PNG = "" # XY背景图片文件名(注:背景图片会遮挡小地图)
XYBACK_OPATITY = 192 # XY背景透明度(建议透明,否则会完全盖住)
XY_SPLIT_WORDS = /☆/ # 反斜杠内分隔符,地图名内分隔符不要超过2个
XY_WORD_X = "X:" # 表示X坐标的用语
XY_WORD_Y = "Y:" # 表示Y坐标的用语
SCREEN_WIDTH = EDITION == :xp ? 640 : 544 # 屏幕宽
SCREEN_HEIGHT = EDITION == :xp ? 480 : 416 # 屏幕高
WINDOW_X = SCREEN_WIDTH - 250 # X坐标
WINDOW_Y = SCREEN_HEIGHT - 101 # Y坐标
end
#==============================================================================
# ■ Game_Temp
#------------------------------------------------------------------------------
# 在没有存档的情况下,处理临时数据的类。这个类的实例请参考
# $game_temp 。
#==============================================================================
class Game_Temp
attr_accessor :map_visible # 地图的表示状态
attr_accessor :xy_visible # XY地图的表示状态
attr_accessor :back_visible # 背景图表示状态
end
#==============================================================================
# ■ Window_XY
#------------------------------------------------------------------------------
# 显示坐标的窗口。
#==============================================================================
class Window_xy < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(0, 0, 280, 96)
case FAY::EDITION
when :xp
@mapnames = load_data("Data/MapInfos.rxdata")
when :vx
@mapnames = load_data("Data/MapInfos.rvdata")
when :va
@mapnames = load_data("Data/MapInfos.rvdata2")
end
@x = $game_player.x
@y = $game_player.y
@id = $game_map.map_id
map_name = @mapnames[@id].name.split(FAY::XY_SPLIT_WORDS , 2)[0]
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = FAY::XY_B_OPACITY
self.opacity = FAY::XY_OPACITY
self.contents.font.bold = true
self.contents_opacity = FAY::XY_C_OPACITY
self.visible = map_name == "" ? false : $game_switches[FAY::WINDOW_XY]
refresh if self.visible
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if $game_switches[FAY::WINDOW_XY]
self.contents.clear
@x = $game_player.x
@y = $game_player.y
@id = $game_map.map_id
map_name = @mapnames[@id].name.split(FAY::XY_SPLIT_WORDS , 2)[0]
self.contents.font.color = FAY::MAPNAME_COLOR
self.contents.draw_text(0, 0, 175, 32, map_name,1)
self.contents.font.color = FAY::XYNAME_COLOR
self.contents.draw_text(0, 32, 175, 32, FAY::XY_WORD_X)
self.contents.font.color = FAY::XYNUMBER_COLOR
self.contents.draw_text(0, 32, 80, 32, @x.to_s,2)
self.contents.font.color = FAY::XYNAME_COLOR
self.contents.draw_text(95, 32, 175, 32, FAY::XY_WORD_Y)
self.contents.font.color = FAY::XYNUMBER_COLOR
self.contents.draw_text(0, 32, 175, 32, @y.to_s,2)
end
end
#--------------------------------------------------------------------------
# ● 判断文字刷新。节约内存用
#--------------------------------------------------------------------------
def judge
return true if @x != $game_player.x
return true if @y != $game_player.y
return true if @id != $game_map.map_id
return false
end
end
class Scene_Map
alias xy_66rpg_main main unless $@
def main
case FAY::EDITION
when :xp
@mapnames = load_data("Data/MapInfos.rxdata")
when :vx
@mapnames = load_data("Data/MapInfos.rvdata")
when :va
@mapnames = load_data("Data/MapInfos.rvdata2")
end
@id = $game_map.map_id
map_name = @mapnames[@id].name.split(FAY::XY_SPLIT_WORDS , 2)[0]
@xy_window = Window_xy.new
@xy_window.x = FAY::WINDOW_X
@xy_window.y = FAY::WINDOW_Y
@xy_window.z = 1500
@xy_window.opacity = FAY::XY_OPACITY
@xy_window.visible = map_name == "" ? false : $game_switches[FAY::WINDOW_XY]
@back = Sprite.new
unless FAY::XYBACK_PNG.empty?
@back.bitmap = Bitmap.new("Graphics/Pictures/"+FAY::XYBACK_PNG)
@back.x = FAY::SCREEN_WIDTH - 16 - @back.bitmap.width
@back.y = FAY::SCREEN_HEIGHT - 16 - @back.bitmap.height
@back.z = 1250
end
@back.visible =map_name == "" ? false : $game_switches[FAY::WINDOW_XY]
@back.opacity = FAY::XYBACK_OPATITY
xy_66rpg_main
@xy_window.dispose
@back.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
alias xy_66rpg_update update unless $@
def update
xy_66rpg_update
@id = $game_map.map_id
map_name = @mapnames[@id].name.split(FAY::XY_SPLIT_WORDS, 2 )[0]
@xy_window.visible = map_name == "" ? false : $game_switches[FAY::WINDOW_XY]
@xy_window.refresh if (@xy_window.judge and @xy_window.visible)
@back.visible = map_name == "" ? false : $game_switches[FAY::WINDOW_XY]
end
end
#==========================================================================
# 本脚本来自[url=http://www.66rpg.com]www.66rpg.com[/url],用于任何游戏请保留此信息。别以为加密就可以del哦
#==========================================================================
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1