| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 3 |
| 经验 | |
| 最后登录 | 2023-5-14 |
| 在线时间 | 68 小时 |
- 梦石
- 0
- 星屑
- 292
- 在线时间
- 68 小时
- 注册时间
- 2022-11-22
- 回帖
- 9
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 jinae2022 于 2023-1-13 23:20 编辑
首先我用了这个对话加强的脚本,对比fuki的气泡对话框,功能上比较强一些,但是我更喜欢fuki的那种气泡样式,更贴合游戏。有偿求人帮我把fuki的气泡对话框移植到我用的这个对话加强脚本里。
[fold=以下是我现在用的对话脚本]- #==============================================================================
- # 本脚本来自https://rpg.blue,使用和转载请保留此信息
- #------------------------------------------------------------------------------
- # 原版:趙雲
- # 重制:RyanBern 2015.08.24
- #------------------------------------------------------------------------------
- #==============================================================================
- # 设置区域(其他参数的调节请看这里)
- #==============================================================================
- module RB
- end
- module RB::Mes_Config
- # 打开 XX 号开关后,关闭打字效果
- No_Typing = 31
- # 打开 XX 号开关后,按下[空格键]可以瞬间显示全部文字
- Write_Skip = 32
- # 打开 XX 号开关后,屏蔽加强对话框(使用默认对话框)
- Mes_Disabled = 33
- # 主角名字字符缩写
- Regex_Player_Name = /pn(\d+)/
- # 主角姓名框底色(RGBA)
- Name_Bar_Color = Color.new(36, 64, 127, 80)
- # 字体大小
- Size = 18
- # 对话框窗口皮肤(不写为和系统皮肤相同)
- Mes_Windowskin = ""
- # 最大行数(初值为 4,尽量不要修改,如果考虑合并选择项和连行,可以设置为 6 以上)
- # 此最大行数仅在 \p 指令下有效,如果不使用 \p 指令那么对话框还是 4 行的高度
- Max_Lines = 8
- # 画面宽度和高度(width / height)
- # 此设置一般不需要更改,当使用分辨率扩张脚本时,将如下的值改成你游戏的分辨率即可。
- Graphics_Width = 640
- Graphics_Height = 480
- # 打开 XX 号开关后,对话自动结束(不用按下 C 键)
- Auto_Terminate = 34
- # 打开 XX 号开关后,按下 CTRL 可以高速跳过对话
- Text_Skip_Fast = 35
- # 打开 XX 号开关后,自动调节对话框使其不会挡住说话者
- Auto_Adjust_Mes_Pos = 36
- # 对话自动结束延迟(单位:帧)
- Auto_Terminate_Frame = 10
- # 打开 XX 号开关后,对话框不会有淡入淡出效果
- No_Fade = 37
- # 头像组:横向单元数
- Face_Group_W = 4
- # 头像组:纵向单元数
- Face_Group_H = 2
- # 默认姓名文字颜色(和系统默认编号一致)
- Name_Color_Default = 6
- # 快捷指令,定义后,可以直接在文本框中输入快捷指令
- # 定义方式为 快捷指令 => 完整指令 ,使用方式为 \sc[快捷指令]
- # 注意,指令中通常包含反斜线'\',因此需要使用单引号的字符串,
- # 或者用"\"进行转义。下面是一个例子:
- # 这样定义后,输入\sc[pn1]就等效为 \name[pn1]\r[L1]\p[-1]
- Shortcuts = {
- #'pn1' => '\name[pn1]\r[L1]\p[-1]'
- }
- # 高级快捷指令定义,类似于宏展开,需要借助正则表达式(高级用户使用)
- Shortcuts_Regexp = {
- /\\pn1/ => '\name[pn1]\r[L1]\p[-1]',
- /\\[Rr]ed\[(.*?)\]/m => '\c[2]\1\c[0]',
- /\\[Cc]ol\[(\d+)\]\{(.*?)\}/m => '\c[\1]\2\c[0]',
- }
- end
- #==============================================================================
- # RPG::Cache
- #------------------------------------------------------------------------------
- # RPG::Cache 追加定义
- #==============================================================================
- module RPG::Cache
- def self.face(filename)
- self.load_bitmap("Graphics/Faces/", filename)
- end
- end
-
- #==============================================================================
- # ■ Game_System
- #------------------------------------------------------------------------------
- # 处理系统附属数据的类。也可执行诸如 BGM 管理之类的功能。本类的实例请参考
- # $game_system 。
- #==============================================================================
-
- class Game_System
- attr_accessor :soundname_on_speak
- alias carol3_ini initialize
- def initialize
- carol3_ini
- @soundname_on_speak = nil
- end
- end
- #==============================================================================
- # ■ Window_Message
- #------------------------------------------------------------------------------
- # 修改的对话框类。
- #==============================================================================
- class Window_Message_RB < Window_Selectable
- include RB::Mes_Config
- # 定义经过变换后不可见的字符,描绘结束后直接描绘下一个字符,不进入下一帧
- Invisible_Chars = [
- "\001", "\003", "\n", "\023", "\024", "\025", "\076"]
- #--------------------------------------------------------------------------
- # ● 初始化状态
- #--------------------------------------------------------------------------
- def initialize
- super(80, 304, 480, 160)
- self.contents = Bitmap.new(1, 1)
- self.visible = false
- self.z = 9998
- @fade_in = false
- @fade_out = false
- @contents_showing = false
- @write_skip = false
- @text_skip = false
- @cursor_width = 0
- @face_h = 0
- self.active = false
- self.index = -1
- if $game_system.soundname_on_speak == nil then
- $game_system.soundname_on_speak = ""
- end
- self.windowskin = RPG::Cache.windowskin(Mes_Windowskin) if Mes_Windowskin != ""
- @opacity_text_buf = Bitmap.new(32, 32)
- @all_opa = 0;
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- terminate_message
- $game_temp.message_window_showing = false
- if @input_number_window != nil
- @input_number_window.dispose
- end
- super
- end
- #--------------------------------------------------------------------------
- # ● 处理信息结束
- #--------------------------------------------------------------------------
- def terminate_message
- self.active = false
- self.pause = false
- self.index = -1
- self.contents.clear
- # 清除显示中标志
- @contents_showing = false
- # 呼叫信息调用
- if $game_temp.message_proc != nil
- $game_temp.message_proc.call
- end
- # 清除文章、选择项、输入数值的相关变量
- $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
- # 清除头像(由于是 RPG::Cache 所以无需释放)
- @face_bitmap = nil
- @face_group_bitmap = nil
- @face_ok = false
- # 清除跳过标志
- @write_skip = false
- @text_skip = false
- # 释放金钱窗口
- if @gold_window != nil
- @gold_window.dispose
- @gold_window = nil
- end
- # 释放姓名窗口
- if @name_window_text != nil
- @name_window_text.dispose
- @name_window_text = nil
- end
- # 释放右侧立绘
- if @right_picture != nil
- @right_picture.dispose
- @right_picture = nil
- end
- # 释放左侧立绘
- if @left_picture != nil
- @left_picture.dispose
- @left_picture = nil
- end
- # 释放姓名蓝条
- if @bar != nil
- @bar.bitmap.dispose
- @bar.dispose
- @bar = nil
- end
- # 释放气泡图标
- if @k_tale != nil
- @k_tale.dispose
- @k_tale = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- # 初期化
- @x = @y = @max_x = @max_y = @indent = @lines = 0
- @face_indent = 0
- @opacity = 255
- @cursor_width = 0
- @write_speed = 0
- @write_wait = 0
- @mid_stop = false
- @popchar = -2
- @auto_terminate = -1
- if $game_temp.choice_start == 0
- @x = 8
- end
- if $game_temp.message_text != nil
- @now_text = $game_temp.message_text
- # \` 预处理
- @now_text.gsub!(/\\`/){ "\077" }
- # `foo` 预处理
- @protected = @now_text.scan(/`(.+?)`/m).flatten
- @now_text.gsub!(/`(.+?)`/m){ "\076" }
- # Shortcuts 预处理
- @now_text.gsub!(/\\sc\[(.*?)\]/) { Shortcuts[$1] || "" }
- # Shortcuts_Regexp 预处理
- Shortcuts_Regexp.each_pair do |regex, str|
- @now_text.gsub!(regex, str)
- end
- # 头像设置
- if (/\\[Ff]\[(.+?)\]/.match(@now_text)) != nil
- @face_bitmap = RPG::Cache.face($1)
- @x = @face_indent = [128, @face_bitmap.width + 4].min
- @now_text.gsub!(/\\[Ff]\[(.+?)\]/) { "" }
- end
- # 头像组设置
- if (/\\[Gg]f\[(.+?)\s*,\s*(\d+)\]/).match(@now_text) != nil
- @face_group_bitmap = RPG::Cache.face($1)
- idx = $2.to_i
- ix, iy = idx % Face_Group_W, idx / Face_Group_W
- w, h = @face_group_bitmap.width / Face_Group_W, @face_group_bitmap.height / Face_Group_H
- @face_bitmap = Bitmap.new(w, h)
- @face_bitmap.blt(0, 0, @face_group_bitmap, Rect.new(ix * w, iy * h, w, h))
- @x = @face_indent = [128, @face_bitmap.width + 4].min
- @now_text.gsub!(/\\[Gg]f\[(.+?)\s*,\s*(\d+)\]/) { "" }
- end
- #——左半身像设置
- if (/\\[Ll]\[(.+?)\]/.match(@now_text)) != nil then
- @face = $1
- if @left_picture != nil
- @left_picture.dispose
- end
- @left_picture = Sprite.new
- @left_picture.bitmap = RPG::Cache.face(@face)
- @left_picture.mirror = true
- @x = @face_indent = @left_picture.bitmap.width
- @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
- end
- #——右半身像设置
- if (/\\[Rr]\[(.+?)\]/.match(@now_text)) != nil then
- @face = $1
- if @right_picture != nil
- @right_picture.dispose
- end
- @right_picture = Sprite.new
- @right_picture.bitmap = RPG::Cache.face(@face)
- @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
- end
- # 显示人物姓名
- name_window_set = false
- if (/\\[Nn]m\[(.+?)\]/.match(@now_text)) != nil
- name_window_set = true
- name_text = $1
- if Regex_Player_Name =~ name_text
- name_text = $game_actors[$1.to_i].name
- end
- @now_text.sub!(/\\[Nn]m\[(.*?)\]/) { "" }
- end
- # 人物姓名颜色
- name_color = text_color(Name_Color_Default)
- if (/\\[Nn]c\[(\d+)\]/.match(@now_text)) != nil
- name_color = text_color($1.to_i)
- @now_text.sub!(/\\[Nn]c\[(\d+)\]/) { "" }
- end
- # 文字位置的判定
- if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text)) != nil then
- @popchar = $1.to_i
- @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
- end
- # 自动结束判定
- @auto_terminate = Auto_Terminate_Frame if $game_switches[Auto_Terminate]
- if (/\\[Tt]\[(\d+)\]/).match(@now_text)
- @auto_terminate = $1.to_i
- @now_text.gsub!(/\\[Tt]\[(\d+)\]/) { "" }
- end
- # 开始替换文字(\v)
- begin
- last_text = @now_text.clone
- @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
- end until @now_text == last_text
- # 替换控制码
- @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
- $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
- end
- @now_text.gsub!(/\\\\/) { "\000" }
- @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
- @now_text.gsub!(/\\[Gg]/) { "\002" }
- @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
- @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
- @now_text.gsub!(/\\[.]/) { "\005" }
- @now_text.gsub!(/\\[|]/) { "\006" }
- @now_text.gsub!(/\\[Ii]c\[(.*?)\]/) { "\030[#{$1}] "}
- @now_text.gsub!(/\\[>]/) { "\016" }
- @now_text.gsub!(/\\[<]/) { "\017" }
- @now_text.gsub!(/\\[!]/) { "\020" }
- @now_text.gsub!(/\\[~]/) { "\021" }
- @now_text.gsub!(/\\[Ii]/) { "\023" }
- @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
- @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
- @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
- # 根据 \p 的不同设置对话框大小
- if @popchar >= 0 # \p 的情况下自动调节
- @text_save = @now_text.clone
- process_real_text
- @max_x = name_window_set ? contents.text_size(name_text).width : 0
- @max_y = Max_Lines
- for i in 0...Max_Lines
- line = @text_save.split(/\n/)[Max_Lines-i-1]
- @max_y -= 1 if line == nil && @max_y <= Max_Lines - i
- next if line == nil
- contents.font.size = Size
- cx = contents.text_size(line).width
- @max_x = cx if cx > @max_x
- end
- if @right_picture != nil && !@right_picture.disposed?
- self.width = @max_x + 48 + @face_indent + @right_picture.bitmap.width
- else
- self.width = @max_x + 48 + @face_indent
- end
- @face_h = @face_bitmap == nil ? 0 : [120, @face_bitmap.height].min
- if $game_temp.num_input_variable_id > 0
- self.height = [(@max_y - 1) * line_height + 96, @face_h + 32].max
- else
- self.height = [(@max_y - 1) * line_height + 64, @face_h + 32].max
- end
- # 生成气泡图标
- @k_tale = Sprite.new
- elsif @popchar == -1
- line_count = @now_text.split(/\n/).size
- line_count = [Max_Lines , [line_count, 4].max].min
- self.width = Graphics_Width
- self.height = [64 + line_height * (line_count - 1), @face_h + 32].max
- @max_x = self.width - 32 - @face_indent
- else
- self.width = Graphics_Width * 0.6
- self.height = 64 + line_height * 3
- @max_x = self.width - 32 - @face_indent
- end
- # 如果设置了姓名框
- if name_window_set
- off_x = 0
- off_y = -40
- space = 2
- x = self.x + off_x - space / 2
- y = self.y + off_y - space / 2
- w = self.contents.text_size(name_text).width + 26 + space
- h = 40 + space
- x = self.x + off_x + 4
- y = self.y + off_y
- @name_window_text = Air_Text.new(self.x + @face_indent+4+8, self.y+16, name_text, name_color)
- @name_window_text.z = self.z + 2
- @bar = Sprite.new
- @bar.bitmap = Bitmap.new(self.width, 24)
- face_cut = @face_bitmap == nil ? 0 : @face_indent + 2
- @bar.x = self.x + 8 + face_cut
- @bar.y = self.y + 16
- @bar.z = self.z + 2
- @bar.bitmap.fill_rect(0,0,self.width-16-face_cut,24, Name_Bar_Color)
- end
- # 一切设置完毕后,创建 contents
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.color = normal_color
- self.contents.font.size = Size
- end
- # 如果选择项被设置
- 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.visible = false
- end
- # 设置背景不透明度
- self.back_opacity = 200
- # 更新窗口位置
- update_window_pos
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- super
- # 使用默认窗口外观的情况下,如果窗口的外关被变更了、再设置
- if $game_system.windowskin_name != @windowskin_name && Mes_Windowskin == ""
- @windowskin_name = $game_system.windowskin_name
- self.windowskin = RPG::Cache.windowskin(@windowskin_name)
- end
- # 地图中实时更新位置
- if @k_tale != nil && @k_tale.visible && !$game_temp.in_battle
- update_window_pos
- end
- # [空格键]跳过描绘
- if $game_switches[Write_Skip] && Input.trigger?(Input::C)
- @write_skip = true
- end
- # CTRL 高速跳过对话
- if $game_switches[Text_Skip_Fast] && Input.trigger?(Input::CTRL)
- # 选择项或数字输入时无法高速跳过
- if $game_temp.choice_max > 0 || @input_number_window != nil
- @write_skip = true
- else
- @text_skip = true
- end
- end
- # 描绘头像
- if @face_bitmap != nil && !@face_ok
- face_real_w = [120, @face_bitmap.width].min
- face_real_h = [120, @face_bitmap.height].min
- self.contents.stretch_blt(Rect.new(0, 0, face_real_w, face_real_h), @face_bitmap, Rect.new(0, 0, @face_bitmap.width, @face_bitmap.height))
- @face_ok = true
- end
- # 淡入中的情况下
- if @fade_in
- self.all_opa += 64
- if self.all_opa >= 255
- @fade_in = false
- end
- return
- end
- @now_text = nil if @now_text == ""
- # 逐个描绘文字
- if @now_text != nil && @mid_stop == false && !@text_skip
- @write_wait = 0 if @write_skip
- if @write_wait > 0
- @write_wait -= 1
- return
- end
- tmp_text_skip = false
- while true
- @max_x = @x if @max_x < @x
- @max_y = @y if @max_y < @y
- # 处理字符
- if (c = @now_text.slice!(/./m)) != nil
- is_c_invisible = Invisible_Chars.include?(c)
- # \\的情况下
- if c == "\000"
- c = "\"
- end
- # \c的情况下
- if c == "\001"
- @now_text.sub!(/\[([0-9]+)\]/, "")
- color = $1.to_i
- if color >= 0 and color <= 7
- self.contents.font.color = text_color(color)
- end
- c = ""
- end
- # \g的情况下
- if c == "\002"
- if @gold_window == nil && @popchar <= 0
- @gold_window = Window_Gold.new
- @gold_window.x = 560 - @gold_window.width
- if $game_temp.in_battle
- @gold_window.y = 192
- else
- @gold_window.y = self.y >= 128 ? 32 : 384
- end
- @gold_window.opacity = self.opacity
- @gold_window.back_opacity = self.back_opacity
- end
- c = ""
- end
- # \s的情况下
- if c == "\003"
- @now_text.sub!(/\[([0-9]+)\]/, "")
- speed = $1.to_i
- if speed >= 0 and speed <= 19
- @write_speed = speed
- end
- c = ""
- end
- # \a的情况下
- if c == "\004"
- @now_text.sub!(/\[(.*?)\]/, "")
- se_filename = "Audio/SE/#{$1}"
- if FileTest.exist?(se_filename)
- Audio.se_play(se_filename)
- end
- c = ""
- end
- # \.的情况下
- if c == "\005"
- @write_wait += 5
- c = ""
- end
- # \|的情况下
- if c == "\006"
- @write_wait += 20
- c = ""
- end
- # \>的情况下
- if c == "\016"
- tmp_text_skip = true
- c = ""
- end
- # \<的情况下
- if c == "\017"
- tmp_text_skip = false
- c = ""
- end
- # \!的情况下
- if c == "\020"
- # 当有其他跳过绘制功能的输入时,\! 无效
- @mid_stop = true if !@write_skip
- c = ""
- end
- # \~的情况下
- if c == "\021"
- terminate_message
- return
- end
- # \i的情况下
- if c == "\023"
- @indent = @x
- c = ""
- end
- # \o的情况下
- if c == "\024"
- @now_text.sub!(/\[([0-9]+)\]/, "")
- @opacity = $1.to_i
- c = ""
- end
- # \h的情况下
- if c == "\025"
- @now_text.sub!(/\[([0-9]+)\]/, "")
- self.contents.font.size = [[$1.to_i, 6].max, 32].min
- c = ""
- end
- # \b的情况下
- if c == "\026"
- @now_text.sub!(/\[([0-9]+)\]/, "")
- @x += $1.to_i
- c = ""
- end
- # 图标的情况
- if c == "\030"
- @now_text.sub!(/\[(.*?)\]/, "")
- self.contents.blt(@x , @y * line_height + (line_height - 24) / 2, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
- if $game_system.soundname_on_speak != ""
- Audio.se_play($game_system.soundname_on_speak)
- end
- @x += 24
- c = ""
- end
- # 另起一行的情况下
- if c == "\n"
- if @lines >= $game_temp.choice_start
- @cursor_width = [@cursor_width, @max_x - @face_indent].max
- end
- @lines += 1
- @y += 1
- @x = 0 + @indent + @face_indent
- if @lines >= $game_temp.choice_start
- @x = 8 + @indent + @face_indent
- end
- c = ""
- end
- # \` 的情况下
- if c == "\077"
- c = "`"
- end
- # `foo` 的情况下
- if c == "\076"
- @now_text = @protected.shift + @now_text
- c = ""
- end
- if c != ""
- # 文字描画
- @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size) / 2, c, @opacity)
- if $game_system.soundname_on_speak != "" then
- Audio.se_play($game_system.soundname_on_speak)
- end
- end
- else
- break
- end
- # 当 c 包含实际内容时才进行下一次绘制
- # 否则会绘制一个空字符,产生若干卡顿
- if !$game_switches[No_Typing] && !@write_skip && !is_c_invisible && !tmp_text_skip
- break
- end
- end
- @write_wait += @write_speed
- return
- end
- # 数值输入的处理
- if @input_number_window != nil
- @input_number_window.visible = true
- @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 @text_skip
- @now_text = nil
- terminate_message
- return
- end
- # 文章显示中的情况下
- if @contents_showing
- if $game_temp.choice_max == 0
- self.pause = true
- end
- # auto terminate
- if $game_temp.choice_max == 0 && @auto_terminate > 0
- @auto_terminate -= 1
- if @auto_terminate == 0
- terminate_message
- end
- return
- end
- # 取消
- if Input.trigger?(Input::B)
- if $game_temp.choice_max > 0 && $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 @mid_stop
- @mid_stop = false
- return
- else
- 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
- end
- return
- end
- if self.visible
- if $game_switches[No_Fade]
- $game_temp.message_window_showing = false
- self.visible = false
- else # 4 帧淡出
- @fade_out = true
- self.opacity -= 64
- if self.opacity == 0
- self.visible = false
- @fade_out = false
- $game_temp.message_window_showing = false
- end
- end
- return
- end
- if @fade_out == false and $game_temp.message_text != nil
- @contents_showing = true
- $game_temp.message_window_showing = true
- refresh
- Graphics.frame_reset
- self.visible = true
- if $game_switches[No_Fade]
- self.all_opa = 255
- else
- self.all_opa = 0
- @fade_in = true
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 预览实际描绘内容(计算窗口宽用)
- #--------------------------------------------------------------------------
- # 实际对 @text_save 进行操作
- # 此方法用于去除某些控制码引起窗口过长的影响
- #--------------------------------------------------------------------------
- def process_real_text
- return if @text_save.nil?
- regex = /[\001-\006\016\017\020\021\024](\[.*?\]){0,1}/
- regex30 = /\030\[.*?\]/
- @text_save.gsub!(regex, "")
- @text_save.gsub!(regex30, " ")
- end
- #--------------------------------------------------------------------------
- # ● 获得角色(\p功能)
- #--------------------------------------------------------------------------
- def get_character(parameter)
- case parameter
- when 0
- return $game_player
- else
- events = $game_map.events
- return events == nil ? nil : events[parameter]
- end
- end
- #--------------------------------------------------------------------------
- # ● 获得战斗者(\p功能,此功能仅在战斗中有效)
- #--------------------------------------------------------------------------
- # parameter : 1-999 表示主角 ID,1001-1008 表示索引为1-8的各个敌人
- #--------------------------------------------------------------------------
- def get_battler(parameter)
- if parameter < 1000
- return $game_actors[parameter]
- else
- return $game_troop.enemies[parameter - 1001]
- end
- end
- #--------------------------------------------------------------------------
- # ● 计算 y 偏移量(\p功能,这是考虑到不同战斗图/行走图的高度不同)
- #--------------------------------------------------------------------------
- # character : 角色/战斗者
- #--------------------------------------------------------------------------
- def process_y_shift(character)
- rate = character.is_a?(Game_Battler) ? 1 : 4
- bmp = character.is_a?(Game_Battler) ?
- RPG::Cache.battler(character.battler_name, character.battler_hue) :
- RPG::Cache.character(character.character_name, character.character_hue)
- return bmp.height / rate + 16
- end
- #--------------------------------------------------------------------------
- # ● 更新窗口位置(所有组件)
- #--------------------------------------------------------------------------
- def update_window_pos
- # 如果使用了 \p 设置位置
- if @popchar >= 0
- character = $game_temp.in_battle ? get_battler(@popchar) : get_character(@popchar)
- final_pos = $game_system.message_position
- if character != nil
- x = [[character.screen_x - self.width / 2, 4].max, Graphics_Width - 4 - self.width].min
- # adjust final_pos automatically when it is enabled
- # ignore the case when pos == 1
- if $game_switches[Auto_Adjust_Mes_Pos] && final_pos != 1
- # try default mes_pos first
- temp_y = final_pos == 2 ? [character.screen_y + 16, 4].max :
- character.screen_y - process_y_shift(character) - self.height
-
- # set pos == 0 if temp_y exceeds the boundary of the screen
- final_pos = 0 if temp_y > Graphics_Height - 4 - self.height && final_pos == 2
- final_pos = 2 if temp_y < 4 && final_pos == 0
- end
- if final_pos == 2
- y = [[character.screen_y + 16, 4].max, Graphics_Height - 4 - self.height].min
- elsif final_pos == 0
- y = [[character.screen_y - process_y_shift(character) - self.height, 4].max, Graphics_Height - 4 - self.height].min
- else
- x = (Graphics_Width - self.width) / 2
- y = (Graphics_Height - self.height) / 2
- end
- self.x = x
- self.y = y
- # 设置气泡图标
- if @k_tale != nil
- @k_tale.x = character.is_a?(Game_Character) ?
- ( character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16 :
- character.screen_x
- k_tale_filename = Mes_Windowskin == "" ? $game_system.windowskin_name : Mes_Windowskin
- suffix = final_pos == 2 ? "-under" : "-top"
- # reload @k_tale's bitmap
- @k_tale.bitmap = RPG::Cache.windowskin(k_tale_filename + suffix)
- if final_pos == 2
- @k_tale.y = self.y - 16
- elsif final_pos == 0
- @k_tale.y = self.y + self.height - 16
- else
- @k_tale.visible = false
- end
- @k_tale.z = 9999
- end
- end
- elsif @popchar == -1
- self.x = 0
- self.y = Graphics_Height - self.height
- else # 无 \p 的情况下
- self.x = (Graphics_Width - self.width) / 2
- # 处于战斗中时
- if $game_temp.in_battle
- self.y = 16
- else
- # 显示文章位置的分支
- case $game_system.message_position
- when 0 # 上
- self.y = 16
- when 1 # 中
- self.y = (Graphics_Height - self.height) / 2
- when 2 # 下
- self.y = (Graphics_Height - self.height - 16)
- end
- end
- end # of @popchar >= 0
- # 设置左侧立绘
- if @left_picture != nil and !@left_picture.disposed?
- @left_picture.x = self.x + 8
- @left_picture.y = self.y - @left_picture.bitmap.height + self.height - 8
- @left_picture.z = self.z + 4
- end
- # 设置右侧立绘
- if @right_picture != nil and !@right_picture.disposed?
- @right_picture.x = self.x + self.width - @right_picture.bitmap.width - 8
- @right_picture.y = self.y - @right_picture.bitmap.height + self.height - 8
- @right_picture.z = self.z + 4
- end
- # 设置姓名空气文字坐标
- if @name_window_text != nil
- @name_window_text.x = self.x + @face_indent - 4
- @name_window_text.y = self.y
- end
- # 设置姓名蓝条坐标
- if @bar != nil
- face_cut = @face_bitmap == nil ? 0 : @face_indent + 2
- @bar.x = self.x + 8 + face_cut
- @bar.y = self.y + 16
- end
- # 设置数字处理
- if @input_number_window != nil
- @input_number_window.x = self.x + @face_indent
- @input_number_window.y = self.y + 8 + $game_temp.num_input_start * line_height
- end
- end
- #--------------------------------------------------------------------------
- # ● line_height
- #--------------------------------------------------------------------------
- # 返回值 : 行高
- #--------------------------------------------------------------------------
- def line_height
- return [[Size * 15 / 10, 18].max, 32].min
- end
- #--------------------------------------------------------------------------
- # ● 文字描画
- #--------------------------------------------------------------------------
- # target :描绘的目标 bitmap 对象
- # x :x 坐标
- # y :y 坐标
- # str :描绘的文字
- # opacity:不透明度(0~255)
- # 返回值 :文字宽度(@x 的增加值)。
- #--------------------------------------------------------------------------
-
-
- def opacity_draw_text(target, x, y, str,opacity)
- height = target.font.size
- width = target.text_size(str).width
- opacity = [[opacity, 0].max, 255].min
- if opacity == 255
- target.draw_text(x, y, width, height, str)
- return width
- else
- if @opacity_text_buf.width < width or @opacity_text_buf.height < height
- @opacity_text_buf.dispose
- @opacity_text_buf = Bitmap.new(width, height)
- else
- @opacity_text_buf.clear
- end
- @opacity_text_buf.font.size = target.font.size
- @opacity_text_buf.draw_text(0, 0, width, height, str)
- target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
- return width
- end
- end
- #--------------------------------------------------------------------------
- # ● \V 变换
- #--------------------------------------------------------------------------
- # option : 选项,'i'物品,'w'武器,'a'防具,'s'技能
- # index : 数据库的索引
- #--------------------------------------------------------------------------
- def convart_value(option, index)
- option == nil ? option = "" : nil
- option.downcase!
- case option
- when "i"
- unless $data_items[index].name == nil
- r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
- end
- when "w"
- unless $data_weapons[index].name == nil
- r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
- end
- when "a"
- unless $data_armors[index].name == nil
- r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
- end
- when "s"
- unless $data_skills[index].name == nil
- r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
- end
- else
- r = $game_variables[index]
- end
- r == nil ? r = "" : nil
- return r
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- terminate_message
- unless @opacity_text_buf.disposed?
- @opacity_text_buf.dispose
- end
- $game_temp.message_window_showing = false
- if @input_number_window != nil
- @input_number_window.dispose
- end
- super
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @index >= 0
- n = $game_temp.choice_start + @index
- self.cursor_rect.set(4 + @indent + @face_indent, n * line_height, @cursor_width, line_height)
- else
- self.cursor_rect.empty
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置不透明度(所有组件)
- #--------------------------------------------------------------------------
- def all_opa=(opa)
- opa = [255, [opa, 0].max].min
- @all_opa = opa
- if $game_system.message_frame == 0
- self.opacity = opa
- @k_tale.opacity = opa if @k_tale
- else
- self.opacity = 0
- @k_tale.opacity = 0 if @k_tale
- end
- self.contents_opacity = opa
- @gold_window.opacity = opa if @gold_window
- @name_window_text.contents_opacity = opa if @name_window_text
- @right_picture.opacity = opa if @right_picture
- @left_picture.opacity = opa if @left_picture
- @bar.opacity = opa if @bar
- end
- #--------------------------------------------------------------------------
- # ● 获取不透明度(所有组件)
- #--------------------------------------------------------------------------
- def all_opa
- @all_opa
- end
- end
- #==============================================================================
- # ■ Air_Text
- #------------------------------------------------------------------------------
- # 空气文字,借助窗口显示文字,但是不显示窗口载体。
- #==============================================================================
- class Air_Text < Window_Base
- #--------------------------------------------------------------------------
- # ● 对象初始化
- #--------------------------------------------------------------------------
- def initialize(x, y, designate_text, color)
- super(x-16, y-16, 32 + designate_text.size * 12, 56)
- self.opacity = 0
- self.back_opacity = 0
- self.contents = Bitmap.new(self.width - 32, self.height - 32)
- self.contents.font.size = 20
- self.contents.font.color = color
- w = self.contents.width
- h = self.contents.height
- self.contents.draw_text(0, 0, w, h, designate_text)
- end
-
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- self.contents.clear
- super
- end
- end
-
- class Interpreter
- include RB::Mes_Config
- #--------------------------------------------------------------------------
- # ● 显示文章
- #--------------------------------------------------------------------------
- def command_101
- # 另外的文章已经设置过 message_text 的情况下
- if $game_temp.message_text != nil
- # 结束
- return false
- end
- # 设置信息结束后待机和返回调用标志
- @message_waiting = true
- $game_temp.message_proc = Proc.new { @message_waiting = false }
- # message_text 设置为 1 行
- # check whether \+ exists
- append = /\\\+$/ =~ @list[@index].parameters[0]
- line = @list[@index].parameters[0].sub(/\\\+$/, "")
- $game_temp.message_text = line + "\n"
- line_count = 1
- # 循环
- loop do
- # 下一个事件指令为文章两行以上的情况
- if @list[@index+1].code == 401 || @list[@index+1].code == 101 && append
- append = /\\\+$/ =~ @list[@index+1].parameters[0]
- line = @list[@index+1].parameters[0].sub(/\\\+$/, "")
- # message_text 添加到第 2 行以下
- $game_temp.message_text += line + "\n"
- line_count += 1
- # 事件指令不在文章两行以下的情况
- else
- # 下一个事件指令为显示选择项的情况下
- if @list[@index+1].code == 102
- # 如果选择项能收纳在画面里
- if @list[@index+1].parameters[0].size <= Max_Lines - line_count
- # 推进索引
- @index += 1
- # 设置选择项
- $game_temp.choice_start = line_count
- setup_choices(@list[@index].parameters)
- end
- # 下一个事件指令为处理输入数值的情况下
- elsif @list[@index+1].code == 103
- # 如果数值输入窗口能收纳在画面里
- if line_count < Max_Lines
- # 推进索引
- @index += 1
- # 设置输入数值
- $game_temp.num_input_start = line_count
- $game_temp.num_input_variable_id = @list[@index].parameters[0]
- $game_temp.num_input_digits_max = @list[@index].parameters[1]
- end
- end
- # 继续
- return true
- end
- # 推进索引
- @index += 1
- end
- end
- end
-
- class Scene_Map
- include RB::Mes_Config
- alias rb_update_20160408 update
- def update
- if @rb_mes_disabled != $game_switches[Mes_Disabled]
- @rb_mes_disabled = $game_switches[Mes_Disabled]
- @message_window.dispose if @message_window != nil
- @message_window = @rb_mes_disabled ? Window_Message.new : Window_Message_RB.new
- end
- rb_update_20160408
- end
- end
-
- class Scene_Battle
- include RB::Mes_Config
- alias rb_update_20160408 update
- def update
- if @rb_mes_disabled != $game_switches[Mes_Disabled]
- @rb_mes_disabled = $game_switches[Mes_Disabled]
- @message_window.dispose if @message_window != nil
- @message_window = @rb_mes_disabled ? Window_Message.new : Window_Message_RB.new
- end
- rb_update_20160408
- end
- end
-
-
- #==============================================================================
- # 本脚本来自https://rpg.blue,使用和转载请保留此信息
- #==============================================================================
复制代码
[/fold]
[fold=以下是fuki的气泡对话框脚本]- #==============================================================================
- # ■ 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
- end
- end
- #==============================================================================
- # ■ 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
- end
- end
- #==============================================================================
- # ■ 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 <= 0
- @message_position = 2
- y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + Fuki_v6_Setup::POP_SHIFT_UNDER
- end
- when 2 # 下
- if y + height >= 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 !@tale.disposed?
- 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
- end
- end
复制代码 [/fold]

这是fuki的范例工程
Fuki对话框优化版 v6.zip
(270.79 KB, 下载次数: 2)
|
-
这里fuki
-
这是对话加强
|