# 开放金钱窗口
if @gold_window != nil
@gold_window.dispose
@gold_window = nil
end
# 其他
@lbl_count = 0
@temp_skip = false
$game_system.close_on_display = false
$game_system.close_on_time = nil
@name_box.visible = false
# Text
@text = nil
$game_system.scrolling_text = nil
# 多重窗口
if !$game_system.multiple_windows.include?(self)
for i in 0..$game_system.multiple_windows.size
w = $game_system.multiple_windows
next if w.nil?
w.terminate_message
w.dispose
end
$game_system.multiple_windows = []
end
# ShowImamgs =v-!
self.contents.dispose
self.contents = Bitmap.new(width - 32, height - 32)
self.oy = 0
@scroll_up = nil
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
@scroll_up = nil
x = y = 0
@cursor_width = 0
# 到选择项的下一行字
x = 8 if $game_temp.choice_start == 0
# 有等待显示的文字的情况下
if $game_temp.message_text != nil
@text = $game_temp.message_text if @text.nil?
@saved_text = @text
#调整改变窗口大小
modify_window
#开始文本处理~
begin
last_text = @text.clone
@text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
end until @text == last_text
@text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end
#跳动
@text.gsub!(/\\[Pp][Ss]\[([0-9]+)\]/) do
bool = $1.to_i
$game_system.player_skip = (bool == 0 ? false : true)
""
end
# 为了方便、将 "\\\\" 变换为 "\000"
@text.gsub!(/\\\\/) { "\000" }
# "\\C" 变为 "\001" 、"\\G" 变为 "\002"
@text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
@text.gsub!(/\\[Gg]/) { "\002" }
# lbl
@text.gsub!(/\\[Ll][Bb][Ll]\[([0-9]+)\]/) { "\003[#{$1}]" }
# lse =w= 音效!
@text.gsub!(/\\[Ss][Ee]\[(.*?)\]/) { "\004[#{$1}]" }
# ls
@text.gsub!(/\\[Ll][Ss]\[([0-9]+)\]/) { "\005[#{$1}]" }
# 图标
@text.gsub!(/\\[Ii][Cc]\[(.*?)\]/) { "\015[#{$1}]" }
# 物品图标
@text.gsub!(/\\[Ww][Pp]\[([0-9]+)\]/) {
item = $data_items[$1.to_i]
"\016[#{$1}]"+item.name }
# 武器图标
@text.gsub!(/\\[Ww][Qq]\[([0-9]+)\]/) {
item = $data_weapons[$1.to_i]
"\017[#{$1}]" + item.name
}
# 防具图标
@text.gsub!(/\\[Dd][Ff]\[([0-9]+)\]/) {
item = $data_armors[$1.to_i]
"\018[#{$1}]" + item.name
}
# 技能图标
@text.gsub!(/\\[Ss][Kk]\[([0-9]+)\]/) {
item = $data_skills[$1.to_i]
"\019[#{$1}]"+ item.name
}
# 字体
@text.gsub!(/\\[Ff][Tt]\[(.*?)\]/) { "\013[#{$1}]" }
# b - 粗体
@text.gsub!(/\\[Bb]/) { "\006" }
# i - 斜体字
@text.gsub!(/\\[Ii]/) { "\007" }
# st - 特殊字符
@text.gsub!(/\\[Tt][Ss]/) { "\010" }
# u - 文字下划线
@text.gsub!(/\\[Uu]/) { "\011" }
# sh - 文字影子
@text.gsub!(/\\[Yy][Zz]/) { "\014" }
# 等待?帧数 \CT[帧数]
@text.gsub!(/\\[Cc][Tt]\[([0-9]+)\]/) do
$game_system.close_on_time = $1.to_i
""
end
# 停止等待
@text.gsub!(/\\[Cc][Ll]/) do
$game_system.close_on_display = true
""
end
#= =b这个暂时丢掉不用。以后更新在、、
# @text.gsub!(/\\[Pp][Ee]/) { "#{$game_player.social.personality}" }
if $game_system.face_graphic != ""
bitmap = RPG::Cache.picture($game_system.face_graphic)
if $game_system.face_justify == 0
self.contents.blt(0, y + 4, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
else
self.contents.blt(self.width-bitmap.width-32, y + 4, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
end
@face_width = bitmap.width
x = 0
x += @face_width if $game_system.face_justify == 0
else
@face_width = 0
end
# 显示Battle
if $game_system.battler_graphic != ""
bitmap = RPG::Cache.battler($game_system.battler_graphic,0)
if $game_system.battler_justify == 0
self.contents.blt(0, y + 4, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
else
self.contents.blt(self.width-bitmap.width-32, y + 4, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
end
@battler_width = bitmap.width
x = 0
x += @battler_width if $game_system.battler_justify == 0
else
@battler_width = 0
end
#循环获取文本。
while ((c = @text.slice!(/./m)) != nil)#54就可用了
# 卷动情况全解!!!!!独家啊
if !$game_system.scrolling_text.nil?
if !@scroll_up.nil?
if @scroll_up == y
scroll_frames = $game_system.scroll_speed
# 等待。。。。等啊等啊
while scroll_frames > 0
scroll_frames -= 1
end
@scroll_up = y+1
auto_s += 1
@temp_skip = false
if !$game_system.auto_scroll and auto_s == 4
auto_s = 0
#循环
loop do
#刷新游戏画面
Graphics.update
# Player Skip
Input.update
#按下C停止跳动
if Input.trigger?(Input::C)
break
end
end
end
#向上卷动
self.oy+=32
end
else
auto_s = 0
self.oy -= 32*3
@scroll_up = 1
end
end
# \lbl 的情况下卷动
if c == "\003"
@text.sub!(/\[([0-9]+)\]/, "")
bool = $1.to_i
$game_system.letterBYletter = (bool == 0 ? false : true)
next
end
# \ls 的情况下
if c == "\005"
@text.sub!(/\[([0-9]+)\]/, "")
bool = $1.to_i
$game_system.letter_speed = bool
next
end
# \lse 的情况下
if c == "\004"
@text.sub!(/\[(.*?)\]/, "")
$game_system.letter_se = $1.to_s
next
end
if $game_system.letterBYletter and !@temp_skip
@lbl_count = $game_system.letter_speed
# 循环
while @lbl_count > 0
# 刷新画面
Graphics.update
if $game_system.player_skip
Input.update
if Input.trigger?(Input::C)
@temp_skip = true
end
end
#更新计数
@lbl_count -= 1
end
if $game_system.letter_se != ""
Audio.se_play("Audio/SE/" + $game_system.letter_se, 100, 100)
end
end
# \\ 的情况下
if c == "\000"
# 还原为本来的文字
c = "\\"
end
# \C[n] 的情况下
if c == "\001"
# 更改文字色
@text.sub!(/\[([0-9]+)\]/, "")
color = $1.to_i
if color >= 0 and color = $game_temp.choice_start
@cursor_width = [@cursor_width, x].max
end
# y 加 1
y += 1
x = 0
x += @face_width if $game_system.face_justify == 0
x += @battler_width if $game_system.battler_justify == 0
# 刷新选择项及光标的高
if y >= $game_temp.choice_start
index = y-$game_temp.choice_start
cursor_width = self.width / 2 - 32
x = index % 2 * (cursor_width + 32) + 8
end
# 下面的文字
next
end
# 图标的情况下
if c == "\015"
@text.sub!(/\[(.*?)\]/, "")
bitmap = RPG::Cache.icon($1.to_s)
self.contents.blt(x, 32*y + 4, bitmap, Rect.new(0, 0, 24, 24))
# x 为要描绘文字的加法运算
x += 24
next
end
# 物品图标的情况下
if c == "\016"
@text.sub!(/\[([0-9]+)\]/, "")
name = $data_items[$1.to_i]
next if name.nil?
bitmap = RPG::Cache.icon(name.icon_name)
self.contents.blt(x, 32*y + 4, bitmap, Rect.new(0, 0, 24, 24))
# x 为要描绘文字的加法运算
x += 24
next
end
# 武器图标的情况下
if c == "\017"
@text.sub!(/\[([0-9]+)\]/, "")
name = $data_weapons[$1.to_i]
next if name.nil?
bitmap = RPG::Cache.icon(name.icon_name)
self.contents.blt(x, 32*y + 4, bitmap, Rect.new(0, 0, 24, 24))
# x 为要描绘文字的加法运算
x += 24
next
end
# 防具图标情况下
if c == "\018"
@text.sub!(/\[([0-9]+)\]/, "")
name = $data_armors[$1.to_i]
next if name.nil?
bitmap = RPG::Cache.icon(name.icon_name)
self.contents.blt(x, 32*y + 4, bitmap, Rect.new(0, 0, 24, 24))
# x 为要描绘文字的加法运算
x += 24
next
end
# 技能图标的情况下
if c == "\019"
@text.sub!(/\[([0-9]+)\]/, "")
index = $1.to_i
# name = $data_skills[$1.to_i]
item = $data_skills[index]
next if name.nil?
icon = RPG::Cache.icon(item.icon_name)
bitmap = RPG::Cache.icon(name.icon_name)
self.contents.blt(x, 32*y + 4, bitmap, Rect.new(0, 0, 24, 24))
#self.contents.blt(@x + 2, (@y * line) + 4, icon, Rect.new(0, 0, 24, 24))
# x 为要描绘文字的加法运算
x += 24
next
end
# 描绘文字
self.contents.draw_text(4 + x, 32 * y, 40, 32, c) if y < $game_temp.choice_start
index = y - $game_temp.choice_start
self.contents.draw_text(4 + x, (index/2*32)+((y-index)*32), 40, 32, c) if y >= $game_temp.choice_start
# x 为要描绘文字的加法运算
x += self.contents.text_size(c).width
end
end
self.oy += 32 if !$game_system.scrolling_text.nil?
# 选择项的情况
if $game_temp.choice_max > 0
@item_max = $game_temp.choice_max
self.active = true
@column_max = 2 if $game_temp.choice_max > 1
self.index = 0
end
# 输入数值的情况
if $game_temp.num_input_variable_id > 0
digits_max = $game_temp.num_input_digits_max
number = $game_variables[$game_temp.num_input_variable_id]
@input_number_window = Window_InputNumber.new(digits_max)
@input_number_window.number = number
@input_number_window.x = self.x + 8
@input_number_window.y = self.y + $game_temp.num_input_start * 32
end
if $game_system.close_on_display
if $game_temp.choice_max > 0
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(self.index)
end
terminate_message
end
if $game_system.close_on_time != nil
loop do
Graphics.update
$game_system.close_on_time -= 1
break if $game_system.close_on_time 0
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(self.index)
end
terminate_message
end
end
#--------------------------------------------------------------------------
# ● 改变窗口
#--------------------------------------------------------------------------
# 有关控制信息窗口的都在这里
#--------------------------------------------------------------------------
def modify_window
# 改变窗口的宽度
@text.gsub!(/\\[Mm][Ww]\[([0-9]+)\]/) do
$game_system.message_width = self.width = $1.to_i
""
end
# 改变窗口的高度\MH
@text.gsub!(/\\[Mm][Hh]\[([0-9]+)\]/) do
$game_system.message_height = self.height = $1.to_i
""
end
# 窗口的大小根据文本长度改变\Mt 模态窗口
@text.gsub!(/\\[Mm][Tt]\[([0-9]+)\]/) do
bool = $1.to_i
$game_system.window_to_text = (bool == 0 ? false : true)
""
end
if $game_system.window_to_text
size = 0
for string in (@text.clone).split("\n")
next if string.nil?
w = contents.text_size(string).width+32
size = w+32 if size+32 < w
end
self.width = size
self.width = size*2 if $game_temp.choice_start == 0
self.height = (@text.clone).split("\n").size * 32 + 32
self.height = self.height/2 + 32 if $game_temp.choice_start == 0
self.contents.dispose
if $game_system.scrolling_text.nil?
self.contents = Bitmap.new(width - 32, height - 32)
else
h = ($game_temp.message_text.clone).split("\n").size * 32 + 32
self.contents.dispose
self.contents = Bitmap.new(width - 32, h+32)
end
else
self.width = $game_system.message_width
self.height = $game_system.message_height
if $game_system.scrolling_text.nil?
self.contents = Bitmap.new(width - 32, height - 32)
else
h = ($game_temp.message_text.clone).split("\n").size * 32 + 32
self.contents.dispose
self.contents = Bitmap.new(width - 32, h+32)
end
end
# X 位置
@text.gsub!(/\\[Ww][Xx]\[([0-9]+)\]/) do
$game_system.window_x = self.x = $1.to_i
""
end
# Y 位置
@text.gsub!(/\\[Ww][Yy]\[([0-9]+)\]/) do
$game_system.window_y = self.y = $1.to_i
""
end
# 消息框的位置。0=角色
@text.gsub!(/\\[Ww][Zz]\[([0-9]+)\]/) do
id = $1.to_i
if id == 0
self.x = $game_player.screen_x - self.width/2
self.y = $game_player.screen_y
self.y = $game_player.screen_y - (64+self.height) if $game_system.window_to_text
else
self.x = $game_map.events[id].screen_x - self.width/2
self.y = $game_map.events[id].screen_y
self.y = $game_map.events[id].screen_y - (64+self.height) if $game_system.window_to_text
end
""
end
# 正常窗口
correct_window
# 显示名字盒子\Nm[name]
@text.gsub!(/\\[Nn][Mm]\[(.*?)\]/) do
name = $1.to_s
@name_box.text = name
@name_box.visible = true
@name_box.y = self.y-@name_box.height
@name_box.x = self.x
@name_box.y = self.height if @name_box.y < 0
""
end
# 显示图片
@text.gsub!(/\\[Ff]\[(.*?)\]/) do
name = $1.to_s
$game_system.face_graphic = name
@face_width = 0 if name == ""
""
end
# 设置头像位置左边
@text.gsub!(/\\[Ff][Ll]/) do
$game_system.face_justify = 0
""
end
# 设置头像位置右边
@text.gsub!(/\\[Ff][Rr]/) do
$game_system.face_justify = 1
""
end
# 显示战斗图片
@text.gsub!(/\\[Bb][Tt]\[(.*?)\]/) do
name = $1.to_s
$game_system.battler_graphic = name
@battler_width = 0 if name == ""
""
end
# 设置战斗图位置左边
@text.gsub!(/\\[Bb][Ll]/) do
$game_system.battler_justify = 0
""
end
# 设置战斗图位置右边
@text.gsub!(/\\[Bb][Rr]/) do
$game_system.battler_justify = 1
""
end
end
#--------------------------------------------------------------------------
# ● 正常窗口
#--------------------------------------------------------------------------
def correct_window
if self.x > 640-self.width
self.x = 640-self.width
elsif self.x < 0
self.x = 0
end
if self.y > 480-self.height
self.y = 480-self.height
elsif self.y = self.contents.height
break
end
end
end
#--------------------------------------------------------------------------
# ● 搞定卷动
#--------------------------------------------------------------------------
def scroll_done
return true if self.oy >= self.contents.height - 32*4
return false
end
#--------------------------------------------------------------------------
# ● 显示多个窗口(本脚本的特点啊!)
#--------------------------------------------------------------------------
def show_m_window
@contents_showing = true
reset_window
self.visible = true if $game_system.letterBYletter or !$game_system.scrolling_text.nil?
refresh
Graphics.frame_reset
self.visible = true
if @input_number_window != nil
@input_number_window.contents_opacity = 0 if !$game_system.letterBYletter and $game_system.scrolling_text.nil?
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 = =b又到了刷新的时候了。刷一刷天天都干净!-_-!!
#--------------------------------------------------------------------------
def update
super
#在存在的时候。名字框刷新。
@name_box.update if @name_box.visible
@name_box.opacity = $game_system.nameBox_opacity if !$game_system.nameBox_to_window_opacity and @name_box.opacity != $game_system.nameBox_opacity
@name_box.opacity = self.opacity if $game_system.nameBox_to_window_opacity and @name_box.opacity != self.opacity
# 渐变的情况下
if @fade_in and !$game_system.letterBYletter and $game_system.scrolling_text.nil?
self.contents_opacity += 24
if @input_number_window != nil
@input_number_window.contents_opacity += 24
end
if self.contents_opacity == 255
@fade_in = false
end
return
elsif ($game_system.letterBYletter or !$game_system.scrolling_text.nil?) and @fade_in
return @fade_in = false
end
# 输入数值的情况下
if @input_number_window != nil
@input_number_window.update
#确定
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_variables[$game_temp.num_input_variable_id] = @input_number_window.number
$game_map.need_refresh = true
# 释放输入数值窗口
@input_number_window.dispose
@input_number_window = nil
terminate_message
end
return
end
# 显示信息中的情况下
if @contents_showing
# 如果不是在显示选择项中就显示暂停标志
if $game_temp.choice_max == 0
self.pause = true
end
# 确定
if Input.trigger?(Input::B)
if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
$game_system.se_play($data_system.cancel_se)
$game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
terminate_message
end
end
# 确定
if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) or
Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT)
if $game_temp.choice_max 0
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(self.index)
end
terminate_message
end
return
end
# 在渐变以外的状态下有等待显示的信息与选择项的场合
if @fade_out == false and $game_temp.message_text != nil
@contents_showing = true
$game_temp.message_window_showing = true
reset_window
self.visible = true if $game_system.letterBYletter or !$game_system.scrolling_text.nil?
refresh
Graphics.frame_reset
self.visible = true
self.contents_opacity = 0 if !$game_system.letterBYletter and $game_system.scrolling_text.nil?
if @input_number_window != nil
@input_number_window.contents_opacity = 0 if !$game_system.letterBYletter and $game_system.scrolling_text.nil?
end
# 显示多窗口
if !$game_system.multiple_windows.include?(self)
for w in $game_system.multiple_windows
next if w.nil?
w.show_m_window
end
end
return @fade_in = true
end
# 没有可以显示的信息、但是窗口为可见的情况下
if self.visible
@fade_out = true
self.opacity -= 48
if self.opacity == 0
self.visible = false
@fade_out = false
$game_temp.message_window_showing = false
end
return
end
end
#--------------------------------------------------------------------------
# ● 更新光标矩形
#-------------------------------------------------------------------------- def update_cursor_rect
def update_cursor_rect
# 光标位置不满 0 的情况下
return self.cursor_rect.empty if @index < 0
# 获取当前的行
row = @index / @column_max
# 当前行被显示开头行前面的情况下
if row < self.top_row
# 从当前行向开头行滚动
self.top_row = row
end
# 当前行被显示末尾行之后的情况下
if row > self.top_row + (self.page_row_max - 1)
# 从当前行向末尾滚动
self.top_row = row - (self.page_row_max - 1)
end
# 计算光标的宽度
cursor_width = self.width / @column_max - 32
# 计算光标坐标
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
# 更新光标矩形
self.cursor_rect.set(x, y+($game_temp.choice_start*32), cursor_width, 32)
end
end
#==============================================================================
#● 名字框家族= =b之一
#-------------------------------------------------------------------------------
# 这个算老大吧。
#===============================================================================
class Window_NameBoxMd < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 32)
self.visible = false
@text = ""
@dummy_window = Window_NameBoxModel.new(self)
end
#--------------------------------------------------------------------------
# ● 文本
#--------------------------------------------------------------------------
def text=(t)
return if @text == t
# 编辑文本
@dummy_window.text = @text = t
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
super
@dummy_window.dispose if !@dummy_window.nil?
end
# X
def y=(v)
super(v)
@dummy_window.y = v-16 if !@dummy_window.nil?
end
# Y
def x=(v)
super(v)
@dummy_window.x = v if !@dummy_window.nil?
end
#--------------------------------------------------------------------------
# ● 显示端口
#--------------------------------------------------------------------------
def visible=(v)
super(v)
@dummy_window.visible = v if !@dummy_window.nil?
end
end
#==============================================================================
# ● 名字框家族= =b之一
#------------------------------------------------------------------------------
# 这个就是传说中又上角那个小框框~显示名字那个地方
#===============================================================================
class Window_NameBoxModel < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize(parent)
super(0, 0, 160, 64)
self.visible = false
self.opacity = 0
@name_box = parent
self.contents = Bitmap.new(width - 32, height - 32)
@text = ""
end
#--------------------------------------------------------------------------
# ● 文本
#--------------------------------------------------------------------------
def text=(t)
return if @text == t
@text = t
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
# 变化大小~
self.width = cx = contents.text_size(@text).width + 32
@name_box.width = self.width
self.contents.dispose if !self.contents.disposed?
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.draw_text(0, 0, cx-32, 32, @text)
end
end
=begin
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
=end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 处理地图画面的类。
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 循环
loop do
# 按照地图、实例、主角的顺序刷新
# (本更新顺序不会在满足事件的执行条件下成为给予角色瞬间移动
# 的机会的重要因素)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# 系统 (计时器)、画面刷新
$game_system.update
$game_screen.update
# 如果主角在场所移动中就中断循环
unless $game_temp.player_transferring
break
end
# 执行场所移动
transfer_player
# 处理过渡中的情况下、中断循环
if $game_temp.transition_processing
break
end
end
# 刷新活动块
@spriteset.update
# 刷新信息窗口
@message_window.update
# 游戏结束的情况下
if $game_temp.gameover
# 切换的游戏结束画面
$scene = Scene_Gameover.new
return
end
# 返回标题画面的情况下
if $game_temp.to_title
# 切换到标题画面
$scene = Scene_Title.new
return
end
# 处理过渡中的情况下
if $game_temp.transition_processing
# 清除过渡处理中标志
$game_temp.transition_processing = false
# 执行过渡
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# 显示信息窗口中的情况下。
if $game_temp.message_window_showing and !$game_system.hover_message
return
end
# 遇敌计数为 0 且、且遇敌列表不为空的情况下
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# 不是在事件执行中或者禁止遇敌中
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# 确定队伍
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# 队伍有效的话
if $data_troops[troop_id] != nil
# 设置调用战斗标志
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 不是在事件执行中或菜单禁止中
unless ($game_system.map_interpreter.running? and !$game_system.hover_message) or
$game_system.menu_disabled
# 设置菜单调用标志以及 SE 演奏
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
# 调试模式为 ON 并且按下 F9 键的情况下
if $DEBUG and Input.press?(Input::F9)
# 设置调用调试标志
$game_temp.debug_calling = true
end
# 不在主角移动中的情况下
unless $game_player.moving?
# 执行各种画面的调用
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
end
#==============================================================================
# ■ Game_Player
#------------------------------------------------------------------------------
# 处理主角的类。事件启动的判定、以及地图的滚动等功能。
# 本类的实例请参考 $game_player。
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 画面更新
#--------------------------------------------------------------------------
def update
# 本地变量记录移动信息
last_moving = moving?
# 移动中、事件执行中、强制移动路线中、
# 信息窗口一个也不显示的时候
unless moving? or ($game_system.map_interpreter.running? and !$game_system.hover_message) or
@move_route_forcing or ($game_temp.message_window_showing and !$game_system.hover_message)
# 如果方向键被按下、主角就朝那个方向移动
#= =b我个人比较喜欢8方向行走所有改了这里如果你喜欢改下面注释就好了
case Input.dir8 #表示8方向
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
when 1
move_lower_left
when 3
move_lower_right
when 7
move_upper_left
when 9
move_upper_right
end
#case Input.dir4 #表示4方向
# when 2
# move_down
# when 4
# move_left
# when 6
# move_right
# when 8
# move_up
# end
end
# 本地变量记忆坐标
last_real_x = @real_x
last_real_y = @real_y
super
# 角色向下移动、画面上的位置在中央下方的情况下
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# 画面向下卷动
$game_map.scroll_down(@real_y - last_real_y)
end
# 角色向左移动、画面上的位置在中央左方的情况下
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# 画面向左卷动
$game_map.scroll_left(last_real_x - @real_x)
end
# 角色向右移动、画面上的位置在中央右方的情况下
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# 画面向右卷动
$game_map.scroll_right(@real_x - last_real_x)
end
# 角色向上移动、画面上的位置在中央上方的情况下
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# 画面向上卷动
$game_map.scroll_up(last_real_y - @real_y)
end
# 不在移动中的情况下
unless moving?
# 上次主角移动中的情况
if last_moving
# 与同位置的事件接触就判定为事件启动
result = check_event_trigger_here([1,2])
# 没有可以启动的事件的情况下
if result == false
# 调试模式为 ON 并且按下 CTRL 键的情况下除外
unless $DEBUG and Input.press?(Input::CTRL)
# 遇敌计数下降
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 判定为同位置以及正面的事件启动
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end