Shy07 说
猫君既然你都把名字注上去了,索性另开一帖负责维护吧=W=
于是本帖就诞生了。
本帖接受BUG反馈,不负责回答“这怎么用啊我不会用”这种伸手问题。
由于不是咱自己写的脚本维护起来需要时间,勿催更新……
原帖:
http://rpg.blue/thread-210221-1-1.html
更多截图、功能介绍以及窗口皮肤规格说明请见原帖。
1号补丁(2011-11-26)
- #==============================================================================# Fuki对话框优化版 v6 PATCH 1 @ 2011-11-26#------------------------------------------------------------------------------# 修正:当事件不为自动执行时无法用 $mes_id = 0 指定目标为当前事件。#==============================================================================#==============================================================================# ■ Window_Message#==============================================================================class Window_Message < Window_Selectable #-------------------------------------------------------------------------- # ○ 取得角色 # parameter : 参数 #-------------------------------------------------------------------------- def get_character(parameter) # 参数分歧 case parameter when nil return events == nil when -1 # 玩家 return $game_player when 0 # 该事件 # 清空事件id @event_id = nil # 读取地图事件 events = $game_map.events # 循环 (地图事件) for event in events.values # 如果找到了启动中的事件 if event.starting or event.lock? @event_id = event.id end end return events == nil ? nil : events[@event_id] else # 特定事件 events = $game_map.events return events == nil ? nil : events[parameter] end endend#==============================================================================复制代码
复制代码以上为补丁放置区,主版本号尚未更新之时所作修正均以补丁形式发布。
补丁的放置位置按补丁编号顺序置于Fuki优化版脚本之下。
v6 更新内容:
①修正本事件为对象的错误,现在可以直接用 $mes_id = 0 代表本事件。
②完善注释、设定模块化,版本号定为v6。
③选择项和数值输入的矩形框依然调用数据库中设定的窗口皮肤。
已知BUG:
①默认字号不为20会导致一系列问题。将在下一版本(v7)修正。
脚本:
- #==============================================================================# Fuki对话框优化版 v6# 原版作者:by パラ犬(日)# 汉化修正:by 66RPG.com#------------------------------------------------------------------------------# 2006年01月 汉化修改 by bbschat# 2007年02月 脚本更新 by KKME# 2007年07月 脚本更新 by 绫晓露雪萌# 2010年05月 脚本优化 by Linki Shy# 2011年10月 阴影修正 by 各种压力的猫君# 2011年11月 脚本增强 by 各种压力的猫君#==============================================================================## 【脚本功能】## 1. 此脚本主要是解决了在1.03版XP上的方块问题,以及增加了一些功能## 2. 人名美化使用方法与以前一样## 3. 默认人物头像在左边显示# 如果需要右边显示,在输入的名称之后加"@r"即可# 例: "阿尔西斯@r:"(注意必须小写)## 4. 在对话中更改字体的方法:# \f[X]:更改字号为X## 5. 在对话中显示(技能 物品 武器 防具 人物)图标和名称的方法:# \s[X]: 显示第X号技能图标和名称# \i[X]: 显示第X号物品图标和名称# \w[X]: 显示第X号武器图标和名称# \a[X]: 显示第X号防具图标和名称# \r[X]: 显示第X号人物图标和名称## 6. 在对话中更改文字不透明度的方法:# \o[X]: 把文字不透明度更改为X (取值范围为0~255)# # 7. 在对话中关闭或开启拟声音效的方法:# \q:默认开启时,执行一次关闭,再执行一次则开启## 8. 如果需要自定义字体颜色,# 可以打开"Graphics/Windowskins"目录下的"Window.png"文件查看# 使用方法与VX类似## 9. 追加了不为瞬间显示时确定键快速显示的功能## 10. $mes_id = 0 代表本事件# $mes_id = -1 代表主角# $mes_id = 其他数值 代表事件编号 # $mes_id = nil 代表不使用fuki形式### 【素材要求】## 1. 要求所有半身像朝向一致(默认是正面偏右)##==============================================================================#==============================================================================# ■ Fuki_v6_Setup#------------------------------------------------------------------------------# Fuki对话框优化版 v6 参数设置#==============================================================================module Fuki_v6_Setup #-------------------------------------------------------------------------- # ● 外观 #-------------------------------------------------------------------------- # 窗口透明度 FUKI_OPACITY = 255 # 呼出对话框 MES_OPACITY = 160 # 默认信息窗口 # 角色高度尺寸 CHARACTOR_HEIGHT = 50 # 呼出对话框的相对位置(纵坐标) POP_SHIFT_TOP = 0 # 表示位置为上的时候 POP_SHIFT_UNDER = -4 # 表示位置为下的时候 # 信息的表示速度(数字越小速度越快,0为瞬间表示) # 游戏中可以随时用数字代入 $MES_SPEED 来改变消息表示速度。 MES_SPEED = 1 # 名称修饰符(一对)(此处参考 沉影不器 的VX版对话框加强) NAME_SYMBOL = "【】" # 名称颜色 NAME_COLOR = 7 #-------------------------------------------------------------------------- # ● 功能( true / false ) #-------------------------------------------------------------------------- # 是否显示尾巴 TAIL_SHOW = true # 是否播放打字音效 $play_voice = true # $MES_SPEED不为0时,是否可以用确定键快速显示对话 ENABLE_SKIP = true # 窗口表示时是否根据画面大小自动改变窗口出现的位置 POS_FIX = true #-------------------------------------------------------------------------- # ● 字体 #-------------------------------------------------------------------------- # 预设字体组 FONT_ARRAY = ["黑体", "宋体", "仿宋"] # 默认字号【已知BUG,当默认字号不为20时会导致各种奇怪问题……暂未修正】 MES_FONT_SIZE = 20 # 默认字体颜色 FUKI_COLOR = Color.new(0, 0, 0, 255) #-------------------------------------------------------------------------- # ● 目录 #-------------------------------------------------------------------------- # 呼出对话框用Skin名称(自动在 Graphics\Windowskins 内搜索) FUKI_SKIN_NAME = "Window" # 设定头像图片保存目录 FACE_PIC_DIR = "Graphics/Faces/" #-------------------------------------------------------------------------- # ● 头像对应表 #-------------------------------------------------------------------------- # 如果不想使用角色名字直接作为头像文件名 # 可在这里重新设定角色名字与文件名的对应关系 # # (这功能怎么用我自己也没搞明白……大家无视吧 by 各种压力的猫君) #-------------------------------------------------------------------------- NAME_TABLE = {"玩家"=>"维斯特"} end#============================================================================== "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓""┃ 自定义内容到此结束,以下内容切勿随意修改 ┃""┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"#==============================================================================# ● 初始化全局变量并定义chat方法#==============================================================================$mes_id = nil$mes_name = ""def chat(id = nil,name = "") $mes_id = id $mes_name = name end#==============================================================================# ■ Game_Temp#==============================================================================class Game_Temp #-------------------------------------------------------------------------- # ● 定义实例变量 #-------------------------------------------------------------------------- attr_accessor:namebmp # 记录角色名字和头像文件名对应关系 #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- alias initialize_fuki initialize def initialize initialize_fuki @namebmp = Fuki_v6_Setup::NAME_TABLE endend#==============================================================================# ■ Window_InputNumber#==============================================================================class Window_InputNumber < Window_Base #-------------------------------------------------------------------------- # ● 初始化对像 # digits_max : 位数 #-------------------------------------------------------------------------- def initialize(digits_max) @digits_max = digits_max @number = 0 # 从数字的幅度计算(假定与 0~9 等幅)光标的幅度 dummy_bitmap = Bitmap.new(Fuki_v6_Setup::MES_FONT_SIZE, Fuki_v6_Setup::MES_FONT_SIZE) @cursor_width = dummy_bitmap.text_size("0").width + 8 dummy_bitmap.dispose super(0, 0, @cursor_width * @digits_max + 32, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.size = Fuki_v6_Setup::MES_FONT_SIZE self.contents.font.color = Fuki_v6_Setup::FUKI_COLOR self.z += 9999 self.opacity = 0 @index = 0 refresh update_cursor_rect end #-------------------------------------------------------------------------- # ● 更新光标矩形 #-------------------------------------------------------------------------- def update_cursor_rect self.cursor_rect.set(@index * @cursor_width-4, 0, @cursor_width, Fuki_v6_Setup::MES_FONT_SIZE + 4) end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear s = sprintf("%0*d", @digits_max, @number) for i in 0...@digits_max self.contents.draw_text(i * @cursor_width, 0, 24, Fuki_v6_Setup::MES_FONT_SIZE + 4, s[i,1]) end endend#==============================================================================# ■ Window_Message#==============================================================================class Window_Message < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化状态 #-------------------------------------------------------------------------- def initialize super(80, 304, 480, 160) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.color = text_color(0) self.visible = false self.z = 9998 @fade_in = false @fade_out = false @contents_showing = false @cursor_width = 0 self.active = false self.index = -1 @w = 0 @h = 0 @wait = 0 @dx = 0 @dy = 0 $MES_SPEED = Fuki_v6_Setup::MES_SPEED #------------------------ # ★ 特殊时期中断标志 #------------------------ @no_term_stop = false @save_x = 0 @save_y = 0 @old_text_info = [] @show_right = false @show_name = false @face_width = 0 end #-------------------------------------------------------------------------- # ○ 决定窗口尺寸并生成窗口 #-------------------------------------------------------------------------- def refresh_create unless @no_term_stop @pic_skin.dispose if @pic_skin != nil if $game_temp.message_text.include?(":") if $game_temp.message_text.include?("@r") @show_right = true $game_temp.message_text.sub!(/\@r/, "") end @show_name = true # 添加名称修饰符 unless Fuki_v6_Setup::NAME_SYMBOL.empty? $game_temp.message_text = '\c[' + Fuki_v6_Setup::NAME_COLOR.to_s + ']' + Fuki_v6_Setup::NAME_SYMBOL[0,Fuki_v6_Setup::NAME_SYMBOL.size/2] + $game_temp.message_text $game_temp.message_text.sub!(/\:/, Fuki_v6_Setup::NAME_SYMBOL[Fuki_v6_Setup::NAME_SYMBOL.size/2,Fuki_v6_Setup::NAME_SYMBOL.size/2] + '\c[0]') end end self.contents.clear self.contents.font.color = normal_color # 取得窗口尺寸 get_windowsize w = @w + 40 h = @h * (self.contents.font.size + 4) + 30 h = 64 if h < 64 # 生成呼出窗口 set_fukidasi(self.x, self.y, w, h) draw_msg_face create_backbmp end # 初始化信息表示使用的变量 @dx = @save_x @dx += @face_width unless @show_right @dy = @save_y @cursor_width = 0 @contents_drawing = true # 瞬间表示的情况下 if $MES_SPEED == 0 # 循环信息描绘处理 while $game_temp.message_text != "" draw_massage end draw_opt_text @contents_showing_end = true @contents_drawing = false else # 一个一个描绘文字 refresh_drawtext end end #-------------------------------------------------------------------------- # ○ 一个一个描绘文字 #-------------------------------------------------------------------------- def refresh_drawtext # 当按下确定键的时候直接显示剩余的全部文字 if Input.trigger?(Input::C) and Fuki_v6_Setup::ENABLE_SKIP # 循环信息描绘处理 while $game_temp.message_text != "" draw_massage end draw_opt_text @contents_showing_end = true @contents_drawing = false elsif $game_temp.message_text != "" if @wait > 0 @wait -= 1 elsif @wait == 0 # 描绘处理 draw_massage @wait = $MES_SPEED end else draw_opt_text @contents_showing_end = true @contents_drawing = false end end #-------------------------------------------------------------------------- # ○ 取得窗口尺寸 #-------------------------------------------------------------------------- def get_windowsize get_face_width($mes_name) x = y = 0 @h = @w = 0 @cursor_width = 0 # 有选择项的话,处理字的缩进 if $game_temp.choice_start == 0 x = 16 end # 有等待显示的文字的情况下 if $game_temp.message_text != nil text = $game_temp.message_text.clone # 限制文字处理 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!(/\\\\/) { "\x00" } text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\x01" } text.gsub!(/\\[Gg]/) { "\x02" } text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\x03" + $data_skills[$1.to_i].name } text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\x04" + $data_items[$1.to_i].name } text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\x05" + $data_weapons[$1.to_i].name } text.gsub!(/\\[Aa]\[([0-9]+)\]/) { "\x06" + $data_armors[$1.to_i].name } text.gsub!(/\\[Rr]\[([0-9]+)\]/) { "\x10" + $game_actors[$1.to_i].name } # c 获取 1 个字 (如果不能取得文字就循环) while ((c = text.slice!(/./m)) != nil) if c == "\x00" c = "\" end if c == "\x01" or c == "\x02" next end if c == "\x03" or c == "\x04" or c == "\x05" or c == "\x06" or c == "\x010" c = " " end if c == "\n" # y 累加 1 y += 1 # 取得纵横尺寸 @h = y @w = x > @w ? x : @w if y >= $game_temp.choice_start @w = x + Fuki_v6_Setup::MES_FONT_SIZE > @w ? x + Fuki_v6_Setup::MES_FONT_SIZE : @w end x = 0 x = Fuki_v6_Setup::MES_FONT_SIZE if y >= $game_temp.choice_start # 下面的文字 next end # x 为要描绘文字的宽度加法运算 x += self.contents.text_size(c).width end 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] @h += 1 x = digits_max * self.contents.font.size + 16 @w = x > @w ? x : @w end @w += @face_width @w = 128 if @w < 128 end #-------------------------------------------------------------------------- # ○ 描绘信息处理 #-------------------------------------------------------------------------- def draw_massage # 有等待显示的文字的情况下 if $game_temp.message_text != nil or @old_text_info != nil text = $game_temp.message_text # 限制文字处理 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!(/\\\\/) { "\x00" } text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\x01[#{$1}]" } text.gsub!(/\\[Gg]/) { "\x02" } text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\x03[#{$1}]" } text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\x04[#{$1}]" } text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\x05[#{$1}]" } text.gsub!(/\\[Aa]\[([0-9]+)\]/) { "\x06[#{$1}]" } text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\x07[#{$1}]" } text.gsub!(/\\[Qq]/) { "\x08" } text.gsub!(/\\[Ff]\[([0-9]+)\]/) { "\x09[#{$1}]" } text.gsub!(/\\[Rr]\[([0-9]+)\]/) { "\x10[#{$1}]" } # c 获取 1 个字 c = text.slice!(/./m) # 默认对话框采用默认颜色 self.contents.font.color = normal_color if $mes_id == nil # 选择项的情况 if @dy >= $game_temp.choice_start # 处理字的缩进 @dx = Fuki_v6_Setup::MES_FONT_SIZE @dx += @face_width unless @show_right @dx += Fuki_v6_Setup::MES_FONT_SIZE if @show_name # 描绘文字 self.contents.draw_text(@dx, 24 * @dy, 24, 24, c) # x 为要描绘文字宽度的加法运算 @dx += self.contents.text_size(c).width # 循环 while ((c = text.slice!(/./m)) != "\n") # 描绘文字 self.contents.draw_text(@dx, 24 * @dy, 24, 24, c) # x 为要描绘文字宽度的加法运算 @dx += self.contents.text_size(c).width end if c == "\n" # 更新光标宽度 @cursor_width = [@cursor_width, @dx - @face_width].max # dy 累加 1 @dy += 1 end return end case c when "\x00" c = "\" when "\x01" text.sub!(/\[([0-9]+)\]/, "") color = $1.to_i self.contents.font.color = text_color(color) when "\x02" @contents_showing_end = true @contents_drawing = false terminate_messageX @save_x = @dx @save_y = @dy when "\x03" text.sub!(/\[([0-9]+)\]/, "") last_character draw_icon($data_skills[$1.to_i], 4 + @dx, 24 * @dy) @dx += self.contents.text_size(" ").width when "\x04" text.sub!(/\[([0-9]+)\]/, "") last_character draw_icon($data_items[$1.to_i], 4 + @dx, 24 * @dy) @dx += self.contents.text_size(" ").width when "\x05" text.sub!(/\[([0-9]+)\]/, "") last_character draw_icon($data_weapons[$1.to_i], 4 + @dx, 24 * @dy) @dx += self.contents.text_size(" ").width when "\x06" text.sub!(/\[([0-9]+)\]/, "") last_character draw_icon($data_armors[$1.to_i], 4 + @dx, 24 * @dy) @dx += self.contents.text_size(" ").width when "\x07" text.sub!(/\[([0-9]+)\]/, "") self.contents.font.color.alpha = $1.to_i when "\x08" text.sub!(/\[([0-9]+)\]/, "") $play_voice = !$play_voice when "\x09" text.sub!(/\[([0-9]+)\]/, "") self.contents.font.name = Fuki_v6_Setup::FONT_ARRAY[$1.to_i] when "\x10" text.sub!(/\[([0-9]+)\]/, "") last_character draw_actor_graphic($game_actors[$1.to_i], 4 + @dx, 24 * @dy) @dx += self.contents.text_size(" ").width when "\n" @dy += 1 @dx = 0 @dx += @face_width unless @show_right @dx += Fuki_v6_Setup::MES_FONT_SIZE if @show_name last_character else last_character size_zy = 6 # 设定文字动态增大幅度 if c != nil self.contents.font.size = Fuki_v6_Setup::MES_FONT_SIZE font_size = self.contents.font.size += size_zy @old_text_info.push(@dx , @dy , font_size, self.contents.font.color.clone, c) self.contents.draw_text(4 + @dx, (font_size + 4 - size_zy) * @dy - size_zy / 2, font_size, font_size, c) self.contents.font.size -= size_zy Audio.se_play("Audio/SE/Voice", 90, 100) if $play_voice and c != " " @dx += self.contents.text_size(c).width end end end end #-------------------------------------------------------------------------- # ○ 完成上一个字符的描绘 #-------------------------------------------------------------------------- def last_character size_zy = 6 # 设定文字动态增大幅度 unless @old_text_info == [] self.contents.fill_rect (4 + @old_text_info[0], (@old_text_info[2]+ 4 - size_zy) * @old_text_info[1] - size_zy / 2, @old_text_info[2], @old_text_info[2], Color.new(0,0,0,0)) color = self.contents.font.color.clone self.contents.font.color = @old_text_info[3].clone self.contents.font.size = @old_text_info[2] -= size_zy self.contents.draw_text(4 + @old_text_info[0], (@old_text_info[2] + 4) * @old_text_info[1], @old_text_info[2], @old_text_info[2], @old_text_info[4]) self.contents.font.color = color @old_text_info = [] end end #-------------------------------------------------------------------------- # ○ 选择项和输入数值的情况下 #-------------------------------------------------------------------------- def draw_opt_text # 选择项的情况下 if $game_temp.choice_max > 0 @item_max = $game_temp.choice_max self.active = true 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 + @face_width + Fuki_v6_Setup::MES_FONT_SIZE + 8 @input_number_window.y = self.y + $game_temp.num_input_start * (Fuki_v6_Setup::MES_FONT_SIZE + 2) end end #-------------------------------------------------------------------------- # ○ 生成背景图片 #-------------------------------------------------------------------------- def create_backbmp @pic_skin.dispose if @pic_skin != nil @pic_skin = Sprite.new @pic_skin.opacity = 0 unless @no_term_stop @pic_skin.bitmap = Bitmap.new(self.width + 32, self.height + 32) @pic_skin.x = self.x + 2 @pic_skin.y = self.y + 2 @pic_skin.z = self.z bitmap = RPG::Cache.windowskin(Fuki_v6_Setup::FUKI_SKIN_NAME) rect = Rect.new(0, 0, 32, 32) @pic_skin.bitmap.blt(0, 0, bitmap, rect) rect = Rect.new(96, 0, 32, 32) @pic_skin.bitmap.blt(self.width-32, 0, bitmap, rect) rect = Rect.new(0, 96, 32, 32) @pic_skin.bitmap.blt(0, self.height-32, bitmap, rect) rect = Rect.new(96, 96, 32, 32) @pic_skin.bitmap.blt(self.width-32, self.height-32, bitmap, rect) rect = Rect.new(0, 32, 32, 32) @pic_skin.bitmap.stretch_blt(Rect.new(0, 32, 32, self.height - 64), bitmap, rect) rect = Rect.new(96, 32, 32, 32) @pic_skin.bitmap.stretch_blt(Rect.new(self.width-32,32,32,self.height-64), bitmap, rect) rect = Rect.new(32, 0, 32, 32) @pic_skin.bitmap.stretch_blt(Rect.new(32,0,self.width-64,self.height-32), bitmap, rect) # 如果尾巴在底端的话,更改底边描绘方式以修正阴影 if @message_position == 0 and @tale != nil # 乱七八糟的三个计算变量 above_tale_x = @tale.x - self.x + 14 above_tale_width1 = @tale.x - self.x - 16 - 2 above_tale_width2 = self.width - above_tale_width1 - 32 - 64 # 中部(尾巴上方) rect = Rect.new(32, 96, 32, 16) @pic_skin.bitmap.stretch_blt(Rect.new(above_tale_x , self.height-32, 32, 24), bitmap, rect) # 左半部 rect = Rect.new(32, 96, 32, 32) @pic_skin.bitmap.stretch_blt(Rect.new(32, self.height-32, above_tale_width1, 32), bitmap, rect) # 右半部 @pic_skin.bitmap.stretch_blt(Rect.new(32+above_tale_x, self.height-32, above_tale_width2, 32), bitmap, rect) bitmap.dispose else # 除此之外的情况保留原来的底边描绘方式 rect = Rect.new(32, 96, 32, 32) @pic_skin.bitmap.stretch_blt(Rect.new(32,self.height-32,self.width-64,32), bitmap, rect) bitmap.dispose end end #-------------------------------------------------------------------------- # ○ 设置呼出对话框 #-------------------------------------------------------------------------- def set_fukidasi(x, y, width, height) begin self.pause = false # 不显示暂停标志 pos = get_fuki_pos(width, height) # 取得对话框位置 x = pos[0] y = pos[1] self.windowskin = RPG::Cache.windowskin($game_system.windowskin_name) self.x = x self.y = y self.height = height self.width = width unless @no_term_stop self.contents.dispose self.contents = Bitmap.new(width - 32, height - 32) self.back_opacity = Fuki_v6_Setup::FUKI_OPACITY self.contents.clear self.contents.font.color = Color.new(0, 0, 0, 255) self.contents.font.size = Fuki_v6_Setup::MES_FONT_SIZE end if $game_system.message_frame == 0 tale_pos = get_tale_pos @tale = Sprite.new @tale.bitmap = Bitmap.new(64, 32) if Fuki_v6_Setup::TAIL_SHOW case @message_position when 0 # 上 bitmap = RPG::Cache.windowskin(Fuki_v6_Setup::FUKI_SKIN_NAME) rect = Rect.new(32, 32, 64, 32) @tale.bitmap.blt(0, 0, bitmap, rect) bitmap.dispose @tale.x = tale_pos[0] @tale.x += 8 if @tale.x < 64 if @tale.x > 640 - 64 @tale.mirror = true @tale.x -= 64 end @tale.y = tale_pos[1] @tale.z = self.z + 1 when 1 # 中 @tale.dispose @tale = nil when 2 # 下 bitmap = RPG::Cache.windowskin(Fuki_v6_Setup::FUKI_SKIN_NAME) rect = Rect.new(32, 64, 64, 32) @tale.bitmap.blt(0, 0, bitmap, rect) bitmap.dispose @tale.x = tale_pos[0] @tale.x += 8 if @tale.x < 64 if @tale.x > 640 - 64 @tale.mirror = true @tale.x -= 64 end @tale.y = tale_pos[1] @tale.z = self.z# + 1 end end end rescue del_fukidasi reset_window(width, height) end end #-------------------------------------------------------------------------- # ○ 计算呼出对话框的位置 #-------------------------------------------------------------------------- def get_fuki_pos(width, height) # 取得角色 @character = get_character($mes_id) if @character == nil # 角色不存在的情况下使用默认信息框 del_fukidasi reset_window(width, height) return end # 处理坐标 x = (@character.real_x - $game_map.display_x + 64) * 32 / 128 - (width / 2) # 为尽量显示在画面内而移动横坐标 if x + width > 640 x = 640 - width elsif x < 0 x = 0 end # 决定窗口位置 case $game_system.message_position when 0 # 上 y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - Fuki_v6_Setup::CHARACTOR_HEIGHT + Fuki_v6_Setup::POP_SHIFT_TOP when 1 # 中 x = (640 - width) / 2 y = (480 - height) / 2 when 2 # 下 y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + Fuki_v6_Setup::POP_SHIFT_UNDER end # 纪录文章显示位置 @message_position = $game_system.message_position if Fuki_v6_Setup::POS_FIX case @message_position when 0 # 上 if y = 480 @message_position = 0 y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - Fuki_v6_Setup::CHARACTOR_HEIGHT + Fuki_v6_Setup::POP_SHIFT_TOP end end end return [x, y] end #-------------------------------------------------------------------------- # ○ 计算尾部图标的位置 #-------------------------------------------------------------------------- def get_tale_pos case @message_position when 0 # 上 # 处理坐标 x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 8 y = self.y + self.height - 6 when 1 # 中 x = nil y = nil when 2 # 下 # 处理坐标 x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 8 y = self.y - 18 end return [x, y] end #-------------------------------------------------------------------------- # ○ 设置角色半身像窗口 #-------------------------------------------------------------------------- def draw_msg_face @face_sprite.dispose if @face_sprite != nil # $mes_name为空时不显示 if $mes_name == nil or $mes_name == "" return else # 设定变量 mes_name = $mes_name if $game_temp.namebmp[mes_name] == nil sFile = Fuki_v6_Setup::FACE_PIC_DIR + mes_name else sFile = Fuki_v6_Setup::FACE_PIC_DIR + $game_temp.namebmp[mes_name] end bitmap = Bitmap.new(sFile) @pic_width = bitmap.width @pic_height = bitmap.height @face_sprite = Sprite.new @face_sprite.x = self.x + 26 @face_sprite.x = self.x + self.width - @pic_width - 26 if @show_right @face_sprite.y = self.y + self.height - @pic_height - 6 @face_sprite.bitmap = bitmap @face_sprite.z = self.z + 3 @face_sprite.mirror = @show_right @face_sprite.opacity = 0 end end #-------------------------------------------------------------------------- # ○ 释放呼出对话框 #-------------------------------------------------------------------------- def del_fukidasi self.opacity = 0 self.x = 80 self.width = 480 self.height = 160 self.contents.dispose self.contents = Bitmap.new(width - 32, height - 32) self.pause = true if @tale != nil @tale.dispose @tale = nil end end #-------------------------------------------------------------------------- # ○ 取得角色 # parameter : 参数 #-------------------------------------------------------------------------- def get_character(parameter) # 参数分歧 case parameter when nil return events == nil when -1 # 玩家 return $game_player when 0 # 该事件 events = $game_map.events # 循环 (地图事件) for event in $game_map.events.values # 如果找到了启动中的事件 if event.starting @event_id = event.id end end return events == nil ? nil : events[@event_id] else # 特定事件 events = $game_map.events return events == nil ? nil : events[parameter] end end #-------------------------------------------------------------------------- # ● 设定窗口位置和不透明度 #-------------------------------------------------------------------------- def reset_window(width = nil, height = nil) if $game_temp.in_battle self.y = 16 else case $game_system.message_position when 0 # 上 self.y = 16 when 1 # 中 if height != nil and width != nil self.y = (480 - height) / 2 - 32 self.x = (640 - width) / 2 self.width = width self.height = height self.contents.dispose self.contents = Bitmap.new(width - 32, height - 32) else self.y = 160 end when 2 # 下 self.y = 304 end end self.opacity = 0 self.back_opacity = Fuki_v6_Setup::MES_OPACITY end #-------------------------------------------------------------------------- # ● 刷新画面 #-------------------------------------------------------------------------- def update if $tale_need_dispose del_fukidasi $tale_need_dispose = false end super update_fuki # 呼出模式下跟随事件移动 if @fade_in # 渐变的情况下 self.contents_opacity += 24 @pic_skin.opacity += 20 if @tale != nil @face_sprite.opacity += 24 if @face_sprite != nil and !@face_sprite.disposed? @tale.opacity += 20 end @input_number_window.contents_opacity += 24 if @input_number_window != nil @fade_in = false if self.contents_opacity == 255 return end if @contents_drawing # 显示信息中的情况下 refresh_drawtext return end update_input_number_window # 输入数值的情况下 if @contents_showing_end # 显示信息结束的情况下 if $game_temp.choice_max == 0 and @tale == nil self.pause = true else self.pause = false end update_choose return end if @fade_out == false and $game_temp.message_text != nil # 在渐变以外的状态下 @contents_showing = true $game_temp.message_window_showing = true reset_window refresh_create if @no_term_stop self.visible = true else @tale.opacity = 0 if @tale != nil Graphics.frame_reset self.visible = true self.contents_opacity = 0 @input_number_window.contents_opacity = 0 if @input_number_window != nil @fade_in = true end return end unless @no_term_stop # 没有可以显示的信息、但是窗口为可见的情况下 if self.visible @fade_out = true self.opacity -= 48 @face_sprite.opacity -= 48 if @face_sprite != nil and !@face_sprite.disposed? @pic_skin.opacity -= 48 if @pic_skin != nil and !@pic_skin.disposed? @tale.opacity -= 48 if @tale != nil and [email protected]? if (@face_sprite == nil) or @face_sprite.disposed? or (@face_sprite.opacity == 0) self.visible = false @face_sprite.dispose if @face_sprite != nil @pic_skin.dispose @fade_out = false $game_temp.message_window_showing = false end return end else $game_temp.message_window_showing = false end end #-------------------------------------------------------------------------- # ● 释放 #-------------------------------------------------------------------------- def dispose terminate_message $game_temp.message_window_showing = false @input_number_window.dispose if @input_number_window != nil super end #-------------------------------------------------------------------------- # ● 信息结束处理 #-------------------------------------------------------------------------- def terminate_message self.active = false self.pause = false self.index = -1 self.contents.clear # 清除显示中标志 @contents_showing = false @contents_showing_end = false $mes_name = "" # 呼叫信息调用 $game_temp.message_proc.call if $game_temp.message_proc != nil # 清除文章、选择项、输入数值的相关变量 $game_temp.message_text = nil $game_temp.message_proc = nil $game_temp.choice_start = 99 $game_temp.choice_max = 0 $game_temp.choice_cancel_type = 0 $game_temp.choice_proc = nil $game_temp.num_input_start = 99 $game_temp.num_input_variable_id = 0 $game_temp.num_input_digits_max = 0 # 释放金钱窗口 if @gold_window != nil @gold_window.dispose @gold_window = nil end @no_term_stop = false @save_x = 0 @save_y = 0 @show_right = false @show_name = false @face_width = 0 $tale_need_dispose = true if @tale != nil end #-------------------------------------------------------------------------- # ● ★信息结束处理★ #-------------------------------------------------------------------------- def terminate_messageX self.active = false self.pause = false self.index = -1 # 清除显示中标志 @contents_showing = false @contents_showing_end = false # 呼叫信息调用 $game_temp.message_proc.call if $game_temp.message_proc != nil # 清除文章、选择项、输入数值的相关变量 $game_temp.message_text = nil $game_temp.message_proc = nil @no_term_stop = true @show_right = false @show_name = false @face_width = 0 end #-------------------------------------------------------------------------- # ● 刷新光标矩形 #-------------------------------------------------------------------------- def update_cursor_rect if @index >= 0 n = $game_temp.choice_start + @index self.cursor_rect.set(Fuki_v6_Setup::MES_FONT_SIZE / 2, n * (Fuki_v6_Setup::MES_FONT_SIZE + 4), @cursor_width, Fuki_v6_Setup::MES_FONT_SIZE + 4) self.cursor_rect.x += @face_width unless @show_right self.cursor_rect.x += Fuki_v6_Setup::MES_FONT_SIZE / 2 if @show_name else self.cursor_rect.empty end end #-------------------------------------------------------------------------- # ● 获取文字颜色色 # n : 文字颜色编号 (0~31) #-------------------------------------------------------------------------- def text_color(n) return normal_color if n > 31 x = (n % 8) * 16 y = 128 + (n / 8) * 16 return RPG::Cache.windowskin(Fuki_v6_Setup::FUKI_SKIN_NAME).get_pixel(x, y) end #-------------------------------------------------------------------------- # ● 取得普通文字色 #-------------------------------------------------------------------------- def normal_color nil_color = Color.new(0,0,0,255) return Fuki_v6_Setup::FUKI_COLOR if Fuki_v6_Setup::FUKI_COLOR != nil_color return nil_color end #-------------------------------------------------------------------------- # ● 获取头像宽度 #-------------------------------------------------------------------------- def get_face_width(face_name) return if $mes_name == "" filename = Fuki_v6_Setup::FACE_PIC_DIR + face_name bitmap = Bitmap.new(filename) @face_width = bitmap.width + Fuki_v6_Setup::MES_FONT_SIZE bitmap.dispose end #-------------------------------------------------------------------------- # ● 描绘物品 # item : 物品 #-------------------------------------------------------------------------- def draw_icon(item, x, y) return if item == nil bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x + 4, y, bitmap, Rect.new(0, 0, 24, 24)) color = self.contents.font.color.clone self.contents.font.color = text_color(1) self.contents.draw_text(x + 28, y, self.contents.text_size(item.name).width + 5, 24, item.name) self.contents.font.color = color @dx += self.contents.text_size(item.name).width end #-------------------------------------------------------------------------- # ● 图形的描绘 # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 #-------------------------------------------------------------------------- def draw_actor_graphic(actor, x, y) bitmap = RPG::Cache.character(actor.character_name, actor.character_hue) cw = bitmap.width / 4 ch = bitmap.height / 4 src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x, y - 4, bitmap, src_rect) color = self.contents.font.color.clone self.contents.font.color = text_color(1) self.contents.draw_text(x + 32, y, self.contents.text_size(actor.name).width + 5, 24, actor.name) self.contents.font.color = color @dx += self.contents.text_size(actor.name).width end #-------------------------------------------------------------------------- # ● 刷新呼出对话框 #-------------------------------------------------------------------------- def update_fuki if @tale != nil pos = get_fuki_pos(self.width, self.height) self.x = pos[0] self.y = pos[1] tale_pos = get_tale_pos @tale.mirror = false @tale.x = tale_pos[0] @tale.x += 8 if @tale.x < 64 if @tale.x > 640 - 64 @tale.mirror = true @tale.x -= 64 end @tale.y = tale_pos[1] @pic_skin.x = self.x + 2 @pic_skin.y = self.y + 2 if @face_sprite != nil and !@face_sprite.disposed? @face_sprite.x = self.x + 26 @face_sprite.x = self.x + self.width - @pic_width - 26 if @show_right @face_sprite.y = self.y + self.height - @pic_height - 6 end end end #-------------------------------------------------------------------------- # ● 刷新数字输入框 #-------------------------------------------------------------------------- def update_input_number_window 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 # 释放输入数值窗口 @input_number_window.dispose @input_number_window = nil $game_map.need_refresh = true terminate_message end return end end #-------------------------------------------------------------------------- # ● 刷新选择输入 #-------------------------------------------------------------------------- def update_choose 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::C) 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 endend复制代码
复制代码配套的Window.png(放入Graphics\Windowskins)
范例:
补丁列表:(补丁见帖子顶部)
- 2011-11-26 v6 PATCH 1 修正:当事件不为自动执行时无法用 $mes_id = 0 指定目标为当前事件。复制代码
复制代码 本帖来自P1论坛作者各种压力的猫君,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:
https://rpg.blue/forum.php?mod=viewthread&tid=214724 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。