Project1
标题:
大地图显示不同区域的名称
[打印本页]
作者:
A瞪谁谁怀孕
时间:
2019-7-28 20:26
标题:
大地图显示不同区域的名称
又来麻烦各位大神了、在一个大地图上可以显示不同区域的名称吗?
例如:在同一个地图上显示澳大利亚,然后在同一地图的某个区域显示中国?
作者:
Nil2018
时间:
2019-7-28 21:27
#==============================================================================
# ** 区域名称
# Author: Hime
# Version: 1.1
# Date: May 5, 2012
#------------------------------------------------------------------------------
# ** Change log
# 1.1
# -created a custom region window
# -now shows the party leader by default
# 1.0 May 5, 2012
# -initial release
#------------------------------------------------------------------------------
# 本脚本会自动追踪玩家所处的区域(通过区域id),当玩家进入新区域时显示一个信息
# 提示
#
# 使用方法,使用地图备注:
# <region names>
# 1: 区域名称
# 2: 区域名称
# 10: 区域名称
# </region names>
#
# 请将“区域名称”替换为其他文字
#------------------------------------------------------------------------------
# 本脚本和yanfly的“区域战斗背景”兼容,在下面设定。
#==============================================================================
$imported = {} if $imported.nil?
module Tsuki
module Region_Names
#进入新区域时显示的信息前半部分
Entrance_Message = "已进入: "
#你是否使用了 yanfly 闲谈窗口?
Use_Gab = false
end
end
module Tsuki
module Regex
module Map
Region_Names_On = /<(?:REGION_NAMES|region names)>/i
Region_Names_Off = /<\/(?:REGION_NAMES|region names)>/i
Region_Names_ID = /(\d+):[ ](.*)/i
end
end
end
class RPG::Map
attr_accessor :region_names
def load_notetags_region_names
@region_names = {}
@region_battlebacks_on = false
self.note.split(/[\r\n]+/).each do |line|
case line
when Tsuki::Regex::Map::Region_Names_On
@region_names_on = true
when Tsuki::Regex::Map::Region_Names_Off
@region_names_on = false
when Tsuki::Regex::Map::Region_Names_ID
next unless @region_names_on
rid = $1.to_i
@region_names[rid] = "" if @region_names[rid].nil?
@region_names[rid] = $2.to_s
end
end
end
end
class Game_Map
alias tsuki_regionNames_setup setup
def setup(map_id)
tsuki_regionNames_setup(map_id)
@map.load_notetags_region_names
end
def region_names
return @map.region_names
end
def region_name
name = region_names[$game_player.region_id]
return name if name else ""
end
end
class Game_Player < Game_Character
#attr_reader :last_region
alias tsuki_regionNames_initialize initialize
def initialize
tsuki_regionNames_initialize
@last_region = 0
@region_changed = false
end
alias tsuki_regionNames_update update
def update
tsuki_regionNames_update
@region_changed = @last_region != region_id && region_id != 0
@last_region = region_id if region_id != 0
end
def region_changed?
@region_changed
end
end
class Scene_Map < Scene_Base
alias tsuki_regionName_update_scene update_scene
def update_scene
tsuki_regionName_update_scene
update_region_change unless scene_changing?
end
def update_region_change
if $game_player.region_changed?
message = Tsuki::Region_Names::Entrance_Message + $game_map.region_name
if $imported["YEA-GabWindow"] && Tsuki::Region_Names::Use_Gab
Game_Interpreter.new.gab(message, 0)
else
@region_name_window.open(message)
end
end
end
alias tsuki_regionName_create_all_windows create_all_windows
def create_all_windows
tsuki_regionName_create_all_windows
create_region_location_window
end
#--------------------------------------------------------------------------
# * Create Region Name Window
#--------------------------------------------------------------------------
def create_region_location_window
@region_name_window = Window_RegionName.new
end
end
#==============================================================================
# ** Window_RegionName
#------------------------------------------------------------------------------
# This window displays the region name on the map.
#==============================================================================
class Window_RegionName < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(300, 0, window_width, fitting_height(1))
self.opacity = 0
self.contents_opacity = 0
@show_count = 0
refresh
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 240
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if @show_count > 0 && $game_map.name_display
update_fadein
@show_count -= 1
else
update_fadeout
end
end
#--------------------------------------------------------------------------
# * Update Fadein
#--------------------------------------------------------------------------
def update_fadein
self.contents_opacity += 16
end
#--------------------------------------------------------------------------
# * Update Fadeout
#--------------------------------------------------------------------------
def update_fadeout
self.contents_opacity -= 16
end
#--------------------------------------------------------------------------
# * Open Window
#--------------------------------------------------------------------------
def open(name)
refresh(name)
@show_count = 150
self.contents_opacity = 0
self
end
#--------------------------------------------------------------------------
# * Close Window
#--------------------------------------------------------------------------
def close
@show_count = 0
self
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(name="")
contents.clear
unless name.empty? || @show_count == 150
draw_background(contents.rect)
draw_text(contents.rect, name, 1)
end
end
#--------------------------------------------------------------------------
# * Draw Background
#--------------------------------------------------------------------------
def draw_background(rect)
temp_rect = rect.clone
temp_rect.width /= 2
contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
temp_rect.x = temp_rect.width
contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
end
#--------------------------------------------------------------------------
# * Get Background Color 1
#--------------------------------------------------------------------------
def back_color1
Color.new(0, 0, 0, 192)
end
#--------------------------------------------------------------------------
# * Get Background Color 2
#--------------------------------------------------------------------------
def back_color2
Color.new(0, 0, 0, 0)
end
end
复制代码
作者:
A瞪谁谁怀孕
时间:
2019-7-28 21:55
Nil2018 发表于 2019-7-28 21:27
感谢!!!!!!!!!!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1