设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1964|回复: 2
打印 上一主题 下一主题

[已经解决] fuki对话框的一个问题?

 关闭 [复制链接]

Lv3.寻梦者

梦石
0
星屑
1010
在线时间
226 小时
注册时间
2010-4-16
帖子
87
跳转到指定楼层
1
发表于 2011-7-13 16:02:53 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 as853484572 于 2011-7-13 16:35 编辑


fuki对话框的人物名称显示的是头像的名称
我希望可以把名称改其他的
又不用改文件的名字
比如像半身像对话框一样   在名字后加个   就可以显示这个名字
如果要这样的话该怎么改呢?






我用的脚本是这个:
  1. #==============================================================================
  2. # vx呼出对话框 by 沉影不器
  3. #------------------------------------------------------------------------------
  4. # 呼出对话框原作者: パラ犬(日)
  5. #------------------------------------------------------------------------------
  6. # 『素材准备』
  7. #   ① 按vx默认头像素材的格式,但要求每个头像文件所有8格均为同一人的表
  8. #      情并且所有表情朝向一致(默认是正面偏右), 以角色(对话者)名称来命
  9. #      名每个头像文件,用于对话框中自动生成对话者名称.
  10. #   ② vx窗体较xp更精致,头像不宜太大.
  11. #      小头像不宜超过96*96; 半身像不宜超过140*140
  12. #   ③ 呼出对话框箭头图标的命名规则为:
  13. #      制作上下两个对话框箭头图标, 分别命名为:
  14. #      您设定的对话框皮肤名称后加"_arrow_down"(对应下箭头)
  15. #      或"_arrow_up"(对应上箭头), 并存放在system文件夹内.
  16. #
  17. # 『脚本使用』
  18. #   ① 复制脚本插入到Main之前.
  19. #   ② 请务必看完脚本的设定部分,并根据游戏素材的情况设定好各参数
  20. #      脚本第 47-98 行为默认设定部分
  21. #      脚本第 107-113 行为游戏中可更改的设定部分.
  22. #   ③ 地图上跟角色进行对话的事件名称使用与头像素材一致的名称, 即对话
  23. #      者的名称,以便脚本根据名称找到对应事件.
  24. #   ④ 可在游戏中更改参数的说明:
  25. #      ▼ 以第行的fuki_font_name举例
  26. #         对话之前,在事件脚本中输入$game_temp.fuki_font_name = "宋体"
  27. #         将把对话框使用的字体改为"宋体".
  28. #      ▼ 以第行的face_type举例
  29. #         对话之前,在事件脚本中输入$game_temp.face_type = 1
  30. #         将把头像的水平显示位置改为"头像在右".
  31. #      其它可改参数同上.
  32. #
  33. # 『脚本自动完成部分的补充说明』
  34. #   ① 根据头像的文件名自动填写对话者名称,这将占用一行对话框的位置
  35. #   ② 脚本根据事件名称,在屏幕范围内自动查找对话者,如果对话者在范围内
  36. #      不存在,则使用普通对话框,自动调节对话框大小,自动水平居中显示,垂
  37. #      直方向仍由对话事件本身决定.
  38. #   ③ 默认头像素材为正面偏右,当您指定头像显示在右时,脚本将对头像素材
  39. #      镜像处理,您的头像素材中须注意这点
  40. #------------------------------------------------------------------------------
  41. # 最后一句提示: 善用素材,配合默认设定的修改. 感谢您看完烦琐的说明.
  42. #==============================================================================

  43. #==============================================================================
  44. # ■ 默认设定(部分设定允许在游戏中随时更改,见脚本第 107-113 行)
  45. #==============================================================================
  46. module FUKI
  47.   #--------------------------------------------------------------------------
  48.   # ◎ 坐标微调
  49.   #--------------------------------------------------------------------------
  50.   # 对话框
  51.     MSG_Y_ADJ = 8               # 使用呼出对话框时,角色和对话框的纵向间距
  52.   # 头像
  53.     FACE_X_ADJ = 6              # 头像向对话框内横向缩进(避免遮盖对话框外框)
  54.     FACE_Y_ADJ = 6             # 头像向对话框内纵向缩进(避免遮盖对话框外框)
  55.   # 名称背景条
  56.     NAME_BAR_X = 6              # 名称背景条相对于对话框的起始横坐标
  57.   # 呼出对话框箭头
  58.     ARR0W_UP_X_ADJ = 0          # 上箭头的横向调节
  59.     ARR0W_UP_Y_ADJ = 6          # 上箭头的纵向调节
  60.     ARR0W_DOWN_X_ADJ = 0        # 下箭头的横向调节
  61.     ARR0W_DOWN_Y_ADJ = -6       # 下箭头的纵向调节
  62.   #--------------------------------------------------------------------------
  63.   # ◎ 窗体设定
  64.   #--------------------------------------------------------------------------
  65.     SKIN = "window"             # 设定对话框Skin
  66.     OPACITY = 255               # 窗口透明度
  67.   #--------------------------------------------------------------------------
  68.   # ◎ 文字设定
  69.   #    文字颜色说明: 使用Window_Base中text_color(n)的颜色代码
  70.   #--------------------------------------------------------------------------
  71.   # 字体
  72.     FONT_NAME = "黑体"          # 对话框字体
  73.     FONT_SIZE = 14              # 对话框文字字号
  74.     FONT_SHADOW = true          # 对话框文字阴影
  75.   # 文字颜色
  76.     MSG_COLOR = 0               # 对话框文字颜色
  77.     NAME_COLOR = 16             # 角色名称文字颜色
  78.   #--------------------------------------------------------------------------
  79.   # ◎ 头像设定
  80.   #--------------------------------------------------------------------------
  81.   # 头像始终在对话框内(默认使用半身像, 则为 false)
  82.     IN_CONTENT = true
  83.   # 头像垂直对齐方式(0: 顶端对齐; 1: 居中对齐; 2: 底端对齐)
  84.     V_ALIGN = 0
  85.   # 头像水平显示位置(0: 头像在左; 1: 头像在右)
  86.     H_ALIGN = 0
  87.   #--------------------------------------------------------------------------
  88.   # ◎ 自动显示名称设定
  89.   #--------------------------------------------------------------------------
  90.     NAME_Y_ADJ = 6              # 显示名称时,对话者名称与对话内容之间的距离
  91.     NAME_BAR_COLOR = 0         # 名称背景条颜色
  92.     NAME_BAR_OPACITY = 72       # 名称背景条透明度
  93.   #--------------------------------------------------------------------------
  94.   # ◎ 附带功能设定
  95.   #--------------------------------------------------------------------------
  96.   # 超过指定时间,玩家无输入则自动关闭对话框(单位: 帧)
  97.     AUTO_CLOSE_TIME = 60*60     # 默认为1分钟
  98.   # 默认打字速度修正
  99.     SPEED = 2
  100. end

  101. #==============================================================================
  102. # ■ Game_Temp
  103. #==============================================================================
  104. class Game_Temp
  105.   #--------------------------------------------------------------------------
  106.   # ● 定义实例变量
  107.   #--------------------------------------------------------------------------
  108.   attr_accessor :fuki_font_name   # 呼出对话框字体
  109.   attr_accessor :fuki_font_size   # 呼出对话框字号
  110.   attr_accessor :fuki_msg_color   # 呼出对话框文字颜色
  111.   attr_accessor :fuki_name_color  # 角色名称文字颜色
  112.   attr_accessor :face_type        # 头像水平显示位置
  113.   attr_accessor :auto_close       # 对话框自动关闭时间
  114.   attr_accessor :speed            # 对话框打字速度修正
  115.   #--------------------------------------------------------------------------
  116.   # ● 初始化对象
  117.   #--------------------------------------------------------------------------
  118.   alias ini initialize
  119.   def initialize
  120.     ini
  121.     @fuki_font_name = FUKI::FONT_NAME
  122.     @fuki_font_size = FUKI::FONT_SIZE
  123.     @fuki_msg_color = FUKI::MSG_COLOR
  124.     @fuki_name_color = FUKI::NAME_COLOR
  125.     @face_type = FUKI::H_ALIGN
  126.     @auto_close = FUKI::AUTO_CLOSE_TIME
  127.     @speed = FUKI::SPEED
  128.   end
  129. end

  130. #==============================================================================
  131. # ■ Game_Event
  132. #==============================================================================
  133. class Game_Event
  134.   #--------------------------------------------------------------------------
  135.   # ◎ 返回事件名称
  136.   #--------------------------------------------------------------------------
  137.   def name
  138.     return @event.name
  139.   end
  140. end

  141. #==============================================================================
  142. # ■ Window_NumberInput
  143. #==============================================================================
  144. class Window_NumberInput < Window_Base
  145.   #--------------------------------------------------------------------------
  146.   # ◎ 刷新
  147.   #--------------------------------------------------------------------------
  148.   def refresh
  149.     self.contents.clear
  150.     self.contents.font.name = $game_temp.fuki_font_name
  151.     self.contents.font.size = $game_temp.fuki_font_size
  152.     self.contents.font.shadow = FUKI::FONT_SHADOW
  153.     self.contents.font.color = normal_color
  154.     s = sprintf("%0*d", @digits_max, @number)
  155.     for i in 0...@digits_max
  156.       self.contents.draw_text\
  157.       (24 + i * 16, 0, 16, FUKI::FONT_SIZE + 2, s[i,1], 1)
  158.     end
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ◎ 更新光标
  162.   #--------------------------------------------------------------------------
  163.   def update_cursor
  164.     self.cursor_rect.set(24 + @index * 16, 0, 16, FUKI::FONT_SIZE + 2)
  165.   end
  166. end

  167. #==============================================================================
  168. # ■ Window_Message
  169. #==============================================================================
  170. class Window_Message < Window_Selectable
  171.   #--------------------------------------------------------------------------
  172.   # ◎ 定义实例变量
  173.   #--------------------------------------------------------------------------
  174.   attr_accessor :user_cancel              # 暂时使用默认对话框
  175.   attr_accessor :face_type                # 头像水平显示位置
  176.   #--------------------------------------------------------------------------
  177.   # ◎ 常量
  178.   #--------------------------------------------------------------------------
  179.   MAX_LINE = 5                            # 最大行数
  180.   #--------------------------------------------------------------------------
  181.   # ◎ 初始化对象
  182.   #--------------------------------------------------------------------------
  183.   def initialize
  184.     super(0, 288, 544, 128)
  185.     self.z = 200
  186.     self.active = false
  187.     self.index = -1
  188.     self.openness = 0
  189.     @opening = false                      # 窗口正在打开的标志
  190.     @closing = false                      # 窗口正在关闭的标志
  191.     @text = nil                           # 已经没有可显示的文章
  192.     @contents_x = 0                       # 下一条文字描绘的 X 坐标
  193.     @contents_y = 0                       # 下一条文字描绘的 Y 坐标
  194.     @line_count = 0                       # 现在描绘的行数
  195.     @wait_count = 0                       # 等待计数
  196.     @background = 0                       # 背景类型
  197.     @position = 2                         # 显示位置
  198.     @show_fast = false                    # 快速显示标志
  199.     @line_show_fast = false               # 以行为单位快速显示
  200.     @pause_skip = false                   # 省略等待输入标志
  201.     @update_pos = false                   # 对话框跟随开关关闭
  202.     @show_name  = false                   # 名称显示开关关闭
  203.     @fuki_pause = false                   # 为了方便代替window类的pause
  204.     @user_cancel = false                  # 暂时使用默认对话框的标志
  205.     # 生成对象
  206.     create_gold_window
  207.     create_number_input_window
  208.     create_back_sprite
  209.     create_face_sprite                    # 生成头像
  210.     create_namebar_sprite                 # 生成名称背景条
  211.     create_arrow_sprite                   # 生成对话框箭头
  212.     # 透明度设定
  213.     set_opacity(self)
  214.     set_opacity(@arrow_sprite)
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # ◎ 释放
  218.   #--------------------------------------------------------------------------
  219.   def dispose
  220.     super
  221.     dispose_gold_window
  222.     dispose_number_input_window
  223.     dispose_back_sprite
  224.     dispose_face_sprite                   # 释放头像
  225.     dispose_arrow_sprite                  # 释放对话框箭头
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ◎ 更新画面
  229.   #--------------------------------------------------------------------------
  230.   def update
  231.     super
  232.     update_gold_window
  233.     update_number_input_window
  234.     update_back_sprite
  235.     update_show_fast
  236.     if @update_pos
  237.       reset_msg_pos                         # 重设对话框坐标
  238.       reset_namebar_bitmap                  # 重绘名称背景条
  239.     end
  240.     # 除窗口关闭以外
  241.     unless @opening or @closing
  242.       # 文章内等待中
  243.       if @wait_count > 0
  244.         @wait_count -= 1
  245.       # 等待文章翻页待机中
  246.       elsif @fuki_pause
  247.         input_pause
  248.       # 正在输入选择项
  249.       elsif self.active
  250.         input_choice
  251.       # 正在输入数值
  252.       elsif @number_input_window.visible
  253.         input_number
  254.       # 还有剩余的文章
  255.       elsif @text != nil
  256.         update_message                      # 更新消息
  257.       # 继续的情况
  258.       elsif continue?
  259.         start_message                       # 开始消息
  260.         reset_msg_size                      # 重设对话框尺寸
  261.         reset_contents                      # 重设位图容器
  262.         reset_msg_pos                       # 重设对话框坐标
  263.         reset_namebar_bitmap                # 重绘名称背景条
  264.         $game_message.visible = true
  265.         open                                # 打开窗口
  266.         @face_sprite.visible = true
  267.       # 不继续的情况
  268.       else
  269.         @face_sprite.visible = @closing     # 关闭头像显示
  270.         @arrow_sprite.visible = @closing    # 关闭头像显示
  271.         close                               # 关闭窗口
  272.         $game_message.visible = @closing
  273.       end
  274.     end
  275.     # 显示对话时,计算自动关闭时间
  276.     if $game_message.visible
  277.       if $game_temp.auto_close > 0
  278.         $game_temp.auto_close -= 1
  279.       else
  280.         terminate_message
  281.       end
  282.     end
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ◎ 还原默认设定
  286.   #--------------------------------------------------------------------------
  287.   def default_setting
  288.     @user_cancel = false                           # 暂时使用默认对话框的标志
  289.     $game_temp.face_type = FUKI::H_ALIGN           # 头像水平显示位置
  290.     $game_temp.speed = FUKI::SPEED                 # 对话打字速度修正
  291.     $game_temp.auto_close = FUKI::AUTO_CLOSE_TIME  # 自动关闭时间
  292.     @namebar_sprite.bitmap.clear
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ◎ 头像图像预留宽度
  296.   #--------------------------------------------------------------------------
  297.   def face_width
  298.     name = $game_message.face_name
  299.     return 0 if name == ""
  300.     return Cache.face(name).width/4# + FUKI::FACE_X_ADJ
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # ◎ 头像图像预留高度
  304.   #--------------------------------------------------------------------------
  305.   def face_height
  306.     name = $game_message.face_name
  307.     return 0 if name == ""
  308.     return Cache.face(name).height/2# + FUKI::FACE_Y_ADJ
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ◎ 是否使用呼出对话框
  312.   #--------------------------------------------------------------------------
  313.   def use_fuki?
  314.     # 考虑细分条件
  315.     return false if @user_cancel                 # 暂时使用默认对话框的标志
  316.     return false if get_character_pos == nil     # 找不到说话者坐标时
  317.     return true
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ● 生成所持金窗口
  321.   #--------------------------------------------------------------------------
  322.   def create_gold_window
  323.     @gold_window = Window_Gold.new(384, 0)
  324.     @gold_window.openness = 0
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● 生成数值输入窗口
  328.   #--------------------------------------------------------------------------
  329.   def create_number_input_window
  330.     @number_input_window = Window_NumberInput.new
  331.     @number_input_window.visible = false
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ● 生成背景活动块
  335.   #--------------------------------------------------------------------------
  336.   def create_back_sprite
  337.     @back_sprite = Sprite.new
  338.     @back_sprite.bitmap = Cache.system("MessageBack")
  339.     @back_sprite.visible = (@background == 1)
  340.     @back_sprite.z = 190
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # ◎ 生成头像
  344.   #--------------------------------------------------------------------------
  345.   def create_face_sprite
  346.     @face_sprite = Sprite.new
  347.     @face_sprite.bitmap = Bitmap.new(1,1)
  348.     @face_sprite.z = self.z + 2
  349.     @face_sprite.visible = false
  350.     @old_name = ""                        # 判断头像是否改变
  351.     @old_index = 0                        # 判断头像是否改变
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ◎ 生成对话框箭头
  355.   #--------------------------------------------------------------------------
  356.   def create_arrow_sprite
  357.     @arrow_sprite = Sprite.new
  358.     @arrow_sprite.bitmap = Bitmap.new(1, 1)
  359.     @arrow_sprite.z = self.z + 1
  360.     @arrow_sprite.visible = false
  361.    end
  362.   #--------------------------------------------------------------------------
  363.   # ◎ 生成名称背景条
  364.   #--------------------------------------------------------------------------
  365.   def create_namebar_sprite
  366.     @namebar_sprite = Sprite.new
  367.     @namebar_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  368.     @namebar_sprite.z = self.z + 1
  369.    end
  370.   #--------------------------------------------------------------------------
  371.   # ◎ 释放名称背景条
  372.   #--------------------------------------------------------------------------
  373.   def dispose_namebar_sprite
  374.     @namebar_sprite.dispose
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ◎ 释放对话框箭头
  378.   #--------------------------------------------------------------------------
  379.   def dispose_arrow_sprite
  380.     @arrow_sprite.dispose
  381.   end
  382.   #--------------------------------------------------------------------------
  383.   # ◎ 释放头像
  384.   #--------------------------------------------------------------------------
  385.   def dispose_face_sprite
  386.     @face_sprite.dispose
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # ● 释放所持金窗口
  390.   #--------------------------------------------------------------------------
  391.   def dispose_gold_window
  392.     @gold_window.dispose
  393.   end
  394.   #--------------------------------------------------------------------------
  395.   # ● 释放数值输入窗口
  396.   #--------------------------------------------------------------------------
  397.   def dispose_number_input_window
  398.     @number_input_window.dispose
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ● 释放背景活动块
  402.   #--------------------------------------------------------------------------
  403.   def dispose_back_sprite
  404.     @back_sprite.dispose
  405.   end
  406.   #--------------------------------------------------------------------------
  407.   # ● 更新所持金窗口
  408.   #--------------------------------------------------------------------------
  409.   def update_gold_window
  410.     @gold_window.update
  411.   end
  412.   #--------------------------------------------------------------------------
  413.   # ● 更新数值输入窗口
  414.   #--------------------------------------------------------------------------
  415.   def update_number_input_window
  416.     @number_input_window.update
  417.   end
  418.   #--------------------------------------------------------------------------
  419.   # ● 更新背景活动块
  420.   #--------------------------------------------------------------------------
  421.   def update_back_sprite
  422.     @back_sprite.visible = (@background == 1)
  423.     @back_sprite.y = y - 16
  424.     @back_sprite.opacity = openness
  425.     @back_sprite.update
  426.   end
  427.   #--------------------------------------------------------------------------
  428.   # ● 更新快速显示标志
  429.   #--------------------------------------------------------------------------
  430.   def update_show_fast
  431.     if @fuki_pause or self.openness < 255
  432.       @show_fast = false
  433.     elsif Input.trigger?(Input::C) and @wait_count < 2
  434.       @show_fast = true
  435.     elsif not Input.press?(Input::C)
  436.       @show_fast = false
  437.     end
  438.     if @show_fast and @wait_count > 0
  439.       @wait_count -= 1
  440.     end
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ● 判断下一消息继续显示
  444.   #--------------------------------------------------------------------------
  445.   def continue?
  446.     return true if $game_message.num_input_variable_id > 0
  447.     return false if $game_message.texts.empty?
  448.     if self.openness > 0 and not $game_temp.in_battle
  449.       return false if @background != $game_message.background
  450.       return false if @position != $game_message.position
  451.     end
  452.     return true
  453.   end
  454.   #--------------------------------------------------------------------------
  455.   # ◎ 开始显示消息
  456.   #--------------------------------------------------------------------------
  457.   def start_message
  458.     @show_name = false                              # 重新初始化名称标志
  459.     unless $game_message.face_name.empty?
  460.       # 新增名称并设定文字颜色
  461.       text = "\\C[#{$game_temp.fuki_name_color}]" +
  462.              $game_message.face_name.to_s + ":" +
  463.              "\\C[#{$game_temp.fuki_msg_color}]"
  464.       $game_message.texts.unshift(text)
  465.       @show_name = true                             # 设定名称标志
  466.     end
  467.     @text = ""
  468.     for i in 0...$game_message.texts.size
  469.       @text += "  " if i >= $game_message.choice_start
  470.       @text += $game_message.texts[i].clone + "\x00"
  471.     end
  472.     @item_max = $game_message.choice_max
  473.     convert_special_characters
  474.     new_page
  475.     @update_pos = true                              # 对话框跟随开关关闭
  476.   end
  477.   #--------------------------------------------------------------------------
  478.   # ◎ 更换页面处理
  479.   #--------------------------------------------------------------------------
  480.   def new_page
  481.     contents.clear
  482.     if $game_message.face_name.empty?               # 清除上一次的头像
  483.       @contents_x = 0
  484.       @face_sprite.bitmap.dispose unless @face_sprite.bitmap.disposed?
  485.     else                                            # 初始化头像重绘环境
  486.       name = $game_message.face_name
  487.       index = $game_message.face_index
  488.       if @old_name != name or @old_index != index
  489.         @old_name = name
  490.         @old_index = index
  491.       end
  492.       draw_fuki_face(name, index)                   # 重绘头像
  493.       @contents_x = face_width                      # 根据头像修正横坐标
  494.     end
  495.     @contents_y = 0
  496.     @line_count = 0
  497.     @show_fast = false
  498.     @line_show_fast = false
  499.     @pause_skip = false
  500.     contents.font.color = text_color(0)             # 还原默认文字颜色
  501.   end
  502.   #--------------------------------------------------------------------------
  503.   # ● 换行处理
  504.   #--------------------------------------------------------------------------
  505.   def new_line
  506.     if $game_message.face_name.empty?
  507.       @contents_x = 0
  508.     else
  509.       name = $game_message.face_name
  510.       @contents_x = face_width
  511.     end
  512.     @contents_y += FUKI::FONT_SIZE + 2
  513.     @line_count += 1
  514.     @line_show_fast = false
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # ● 特殊文字变换
  518.   #--------------------------------------------------------------------------
  519.   def convert_special_characters
  520.     @text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
  521.     @text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
  522.     @text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
  523.     @text.gsub!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }
  524.     @text.gsub!(/\\G/)              { "\x02" }
  525.     @text.gsub!(/\\\./)             { "\x03" }
  526.     @text.gsub!(/\\\|/)             { "\x04" }
  527.     @text.gsub!(/\\!/)              { "\x05" }
  528.     @text.gsub!(/\\>/)              { "\x06" }
  529.     @text.gsub!(/\\</)              { "\x07" }
  530.     @text.gsub!(/\\\^/)             { "\x08" }
  531.     @text.gsub!(/\\\\/)             { "\\" }
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # ◎ 重绘名称背景条
  535.   #--------------------------------------------------------------------------
  536.   def reset_namebar_bitmap
  537.     @namebar_sprite.bitmap.clear                # 重绘之前清理名称背景条
  538.     return if $game_message.face_name.empty?    # 无名称时不描绘
  539.     rect = Rect.new(0, 0, 0, 0)
  540.     rect.x = self.x + FUKI::NAME_BAR_X
  541.     rect.y = self.y + 16
  542.     rect.width = self.width - FUKI::NAME_BAR_X * 2
  543.     rect.height = FUKI::FONT_SIZE + 2
  544.     color1 = text_color(FUKI::NAME_BAR_COLOR)
  545.     color2 = text_color(FUKI::NAME_BAR_COLOR)
  546.     color1.alpha = FUKI::NAME_BAR_OPACITY
  547.     color2.alpha = 0
  548.     # 渐变条
  549.     @namebar_sprite.bitmap.gradient_fill_rect(rect, color1, color2)
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # ◎ 设置窗口背景与位置
  553.   #--------------------------------------------------------------------------
  554.   def reset_window
  555.     self.pause = true
  556.     @background = $game_message.background
  557.     @position = $game_message.position
  558.     if @background == 0   # 普通窗口
  559.       set_opacity(self)   # 透明度设定
  560.     else                  # 背景变暗、透明
  561.       self.opacity = 0
  562.     end
  563.     # 窗口水平居中
  564.     self.x = (544 - self.width) / 2
  565.     case @position
  566.     when 0  # 上
  567.       if FUKI::IN_CONTENT
  568.         self.y = 8
  569.       else
  570.         if FUKI::V_ALIGN == 2
  571.           self.y = [face_height, self.height].max - self.height + 8
  572.         else
  573.           self.y = 8
  574.         end
  575.       end
  576.       @gold_window.y = 360
  577.     when 1  # 中
  578.       self.y = (Graphics.height - self.height) / 2
  579.       @gold_window.y = 0
  580.     when 2  # 下
  581.       if FUKI::V_ALIGN == 0 and face_height > 0
  582.         self.y = \
  583.         Graphics.height - [face_height, self.height].max - self.height*2 - 8
  584.       else
  585.         self.y = Graphics.height - self.height - 8
  586.       end
  587.       @gold_window.y = 0
  588.     end
  589.   end
  590.   #--------------------------------------------------------------------------
  591.   # ◎ 预提取文本
  592.   #--------------------------------------------------------------------------
  593.   def get_message
  594.     text = []
  595.     for i in 0...$game_message.texts.size
  596.       text[i] = ""
  597.       text[i] += "  " if i >= $game_message.choice_start
  598.       text[i] += $game_message.texts[i].clone
  599.       text[i].gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
  600.       text[i].gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
  601.       text[i].gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
  602.       text[i].gsub!(/\\C\[([0-9]+)\]/i) { "" }
  603.       text[i].gsub!(/\\G/)              { "" }
  604.       text[i].gsub!(/\\\./)             { "" }
  605.       text[i].gsub!(/\\\|/)             { "" }
  606.       text[i].gsub!(/\\!/)              { "" }
  607.       text[i].gsub!(/\\>/)              { "" }
  608.       text[i].gsub!(/\\</)              { "" }
  609.       text[i].gsub!(/\\\^/)             { "" }
  610.       text[i].gsub!(/\\\\/)             { "\\" }
  611.     end
  612.     return text
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # ◎ 获取窗口尺寸
  616.   #--------------------------------------------------------------------------
  617.   def get_window_size
  618.     contents.font.name = $game_temp.fuki_font_name
  619.     contents.font.size = $game_temp.fuki_font_size
  620.     w = h = 0 # 初始化长宽
  621.     text_con = get_message
  622.     for text in text_con
  623.       x = @contents_x
  624.       loop do
  625.         c = text.slice!(/./m)             # 获取下一个文字
  626.         case c
  627.         when nil                          # 没有可以显示的文字
  628.           break
  629.         else                              # 普通文字
  630.           c_width = contents.text_size(c).width
  631.           x += c_width
  632.         end
  633.       end
  634.       w = [x, w].max
  635.       if $game_message.face_name.empty?
  636.         h = $game_message.texts.size * (FUKI::FONT_SIZE + 2) + 32
  637.       else
  638.         if FUKI::IN_CONTENT
  639.           h_min = face_height + FUKI::FACE_Y_ADJ
  640.           h = [h_min, text_con.size*(FUKI::FONT_SIZE + 2) + 32].max
  641.         else
  642.           h = [48, text_con.size*(FUKI::FONT_SIZE + 2) + 32].max
  643.         end
  644.       end
  645.     end
  646.     # 调整名称显示的高度差
  647.     h += FUKI::NAME_Y_ADJ if @show_name
  648.     # 输入数值的情况
  649.     if $game_message.num_input_variable_id > 0
  650.       w = [w, 24 + $game_message.num_input_digits_max * 16 + face_width].max
  651.       # 预留数值窗口高度
  652.       h += FUKI::FONT_SIZE + 2
  653.       # 避开空对话内容的情况
  654.       h = [h, @number_input_window.height].max
  655.     end
  656.     return w-16, h
  657.   end
  658.   #--------------------------------------------------------------------------
  659.   # ◎ 重设位图容器
  660.   #--------------------------------------------------------------------------
  661.   def reset_contents
  662.     self.contents.dispose
  663.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # ◎ 重设对话框尺寸
  667.   #--------------------------------------------------------------------------
  668.   def reset_msg_size
  669.     size = get_window_size
  670.     self.width = size[0] + 48
  671.     self.height = size[1]
  672.   end
  673.   #--------------------------------------------------------------------------
  674.   # ◎ 重设对话框坐标
  675.   #--------------------------------------------------------------------------
  676.   def reset_msg_pos
  677.     self.pause = false if use_fuki?                  # 关闭暂停标志
  678.     # 调整对话框坐标
  679.     pos = get_character_pos
  680.     case pos
  681.     when nil                                         # 当前屏幕无对话角色时
  682.       @arrow_sprite.visible = false
  683.       reset_window
  684.       set_face(0)
  685.     else
  686.       # X 坐标
  687.       if pos[0] < 0
  688.         self.x = 0
  689.       elsif pos[0] > Graphics.width - self.width
  690.         self.x = Graphics.width - self.width
  691.       else
  692.         self.x = pos[0]
  693.       end
  694.       # Y 坐标 ◎
  695.       compare = FUKI::IN_CONTENT ? self.height : face_height
  696.       if pos[1] < compare
  697.         self.y = pos[1] + self.height + FUKI::MSG_Y_ADJ
  698.         # 调整对话框箭头
  699.         set_arrow(0, pos)
  700.       else
  701.         self.y = pos[1] - pos[2] - FUKI::MSG_Y_ADJ
  702.         # 调整对话框箭头
  703.         set_arrow(1, pos)
  704.       end
  705.     end
  706.     # 调整头像
  707.     set_face(1)
  708.     # 调整数据输入窗体坐标
  709.     set_input_window(x, y, $game_temp.face_type)
  710.   end
  711.   #--------------------------------------------------------------------------
  712.   # ◎ 调整数值输入
  713.   #     align  : 对齐方式 (1:左 ;0:右)
  714.   #              和头像相反方向
  715.   #--------------------------------------------------------------------------
  716.   def set_input_window(x, y, align)
  717.     return unless @number_input_window.active
  718.     case align
  719.     when 1
  720.       @number_input_window.x = x
  721.       @number_input_window.y = y + @contents_y
  722.     when 0
  723.       @number_input_window.x = x + face_width
  724.       @number_input_window.y = y + @contents_y
  725.     end
  726.     @number_input_window.visible = true
  727.   end
  728.   #--------------------------------------------------------------------------
  729.   # ◎ 调整对话框箭头#######
  730.   #     type : 上下标志 (0: 箭头在上; 1: 箭头在下)
  731.   #     pos    : 坐标数组 (get_character_pos)
  732.   #--------------------------------------------------------------------------
  733.   def set_arrow(type, pos)
  734.     return if pos == nil
  735.     if type == 0
  736.       arrow_name = FUKI::SKIN + "_arrow_up.png"
  737.       @arrow_sprite.bitmap = Cache.system(arrow_name)
  738.       @arrow_sprite.x = pos[0] + (self.width / 2) + FUKI::ARR0W_UP_X_ADJ
  739.       @arrow_sprite.y = self.y - @arrow_sprite.height + FUKI::ARR0W_UP_Y_ADJ
  740.     else
  741.       arrow_name = FUKI::SKIN + "_arrow_down.png"
  742.       @arrow_sprite.bitmap = Cache.system(arrow_name)
  743.       @arrow_sprite.x = pos[0] + (self.width / 2) + FUKI::ARR0W_DOWN_X_ADJ
  744.       @arrow_sprite.y = self.y + self.height + FUKI::ARR0W_DOWN_Y_ADJ
  745.     end
  746.     @arrow_sprite.visible = true
  747.   end
  748.   #--------------------------------------------------------------------------
  749.   # ◎ 调整头像
  750.   #     type  : 头像位置标志 (0:普通对话框 ;1:呼出对话框)
  751.   #--------------------------------------------------------------------------
  752.   def set_face(type)
  753.     case type
  754.     when 0                                    # 普通对话框
  755.       if $game_temp.face_type == 0
  756.         @face_sprite.x = 16
  757.         @face_sprite.mirror = false
  758.       else
  759.         @face_sprite.x = self.width - face_width
  760.         @face_sprite.mirror = true
  761.       end
  762.       @face_sprite.y = self.y + 16
  763.     when 1                                    # 呼出对话框
  764.       # 调整横坐标
  765.       case $game_temp.face_type
  766.       when 0
  767.         @face_sprite.x = self.x + FUKI::FACE_X_ADJ
  768.         @face_sprite.mirror = false
  769.       when 1
  770.         @face_sprite.x = self.x + self.width - face_width - FUKI::FACE_X_ADJ
  771.         @face_sprite.mirror = true
  772.       end
  773.       # 调整纵坐标
  774.       case FUKI::V_ALIGN
  775.       when 0
  776.         @face_sprite.y = self.y
  777.       when 1
  778.         @face_sprite.y = self.y + (self.height - face_height)/2
  779.       when 2
  780.         @face_sprite.y = self.y + self.height - face_height
  781.       end
  782.       @face_sprite.y += FUKI::FACE_Y_ADJ
  783.       # 头像在对话框内的情况
  784.       @face_sprite.y = self.y + FUKI::FACE_Y_ADJ if FUKI::IN_CONTENT
  785.     end
  786.     # 打开头像显示
  787.     @face_sprite.visible = true
  788.   end
  789.   #--------------------------------------------------------------------------
  790.   # ◎ 设定透明名
  791.   #     target : 对象
  792.   #--------------------------------------------------------------------------
  793.   def set_opacity(target)
  794.     target.opacity = FUKI::OPACITY
  795.   end
  796.   #--------------------------------------------------------------------------
  797.   # ◎ 事件是否在屏幕范围内
  798.   #     event : 事件
  799.   #--------------------------------------------------------------------------
  800.   def within_screen_range?(event)
  801.     # 考虑到某些长得比较高的事件
  802.     height = Cache.character(event.character_name).height
  803.     y_plus = event.character_name.include?('!) ? height/4 : height/8
  804.     range_x = (0..Graphics.width).include?(event.screen_x)
  805.     range_y = (0..Graphics.height + y_plus).include?(event.screen_y)
  806.     return range_x && range_y
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ◎ 获取角色坐标
  810.   #--------------------------------------------------------------------------
  811.   def get_character_pos
  812.     # 使用呼出对话框时
  813.     unless $game_message.face_name.empty? # 待改为@texts判断
  814.       # 事件时
  815.       for event in $game_map.events.values
  816.         next unless within_screen_range?(event)
  817.         if event.name == $game_message.face_name
  818.           x = event.screen_x - (self.width / 2)
  819.           y = event.screen_y - self.height
  820.           height = Cache.character(event.character_name).height
  821.           y_plus = event.character_name.include?('!



  822. 大家来看看改怎么改!{:4_85:}

  823. ) ? height/4 : height/8
  824.           return x, y, y_plus
  825.         end
  826.       end
  827.       # 玩家时
  828.       for member in $game_party.members
  829.         if member.name == $game_message.face_name
  830.           x = $game_player.screen_x - (self.width / 2)
  831.           y = $game_player.screen_y - self.height
  832.           height = Cache.character(member.character_name).height
  833.           y_plus = member.character_name.include?('!



  834. 大家来看看改怎么改!{:4_85:}

  835. ) ? height/4 : height/8
  836.           return x, y, y_plus
  837.         end
  838.       end
  839.     end
  840.     # 无坐标时
  841.     return nil
  842.   end
  843.   #--------------------------------------------------------------------------
  844.   # ◎ 描绘脸谱
  845.   #     face_name  : 脸谱图像文件名
  846.   #     face_index : 脸谱图像索引
  847.   #--------------------------------------------------------------------------
  848.   def draw_fuki_face(face_name, face_index)
  849.     bitmap = Cache.face(face_name)
  850.     width = bitmap.width / 4
  851.     height = bitmap.height / 2
  852.     rect = Rect.new(0, 0, 0, 0)
  853.     rect.x = face_index % 4 * width
  854.     rect.y = face_index / 4 * height
  855.     rect.width = width
  856.     rect.height = height
  857.     @face_sprite.bitmap = Bitmap.new(width, height)
  858.     @face_sprite.bitmap.blt(0, 0, bitmap, rect)
  859.     bitmap.dispose
  860.   end
  861.   #--------------------------------------------------------------------------
  862.   # ● 消息结束
  863.   #--------------------------------------------------------------------------
  864.   def terminate_message
  865.     self.active = false
  866.     @fuki_pause = false
  867.     self.index = -1
  868.     @gold_window.close
  869.     @number_input_window.active = false
  870.     @number_input_window.visible = false
  871.     $game_message.main_proc.call if $game_message.main_proc != nil
  872.     $game_message.clear
  873.     @face_sprite.visible = false
  874.     @update_pos = false                 # 对话框跟随开关关闭
  875.     default_setting                 # 还原默认设定
  876.   end
  877.   #--------------------------------------------------------------------------
  878.   # ◎ 更新消息
  879.   #--------------------------------------------------------------------------
  880.   def update_message
  881.     # 字体设定
  882.     contents.font.name = $game_temp.fuki_font_name
  883.     contents.font.size = $game_temp.fuki_font_size
  884.     contents.font.shadow = FUKI::FONT_SHADOW
  885.     loop do
  886.       c = @text.slice!(/./m)            # 获取下一条文字
  887.       case c
  888.       when nil                          # 没有可以显示的文字
  889.         finish_message                  # 更新结束
  890.         break
  891.       when "\x00"                       # 换行
  892.         # 调整名称显示的高度
  893.         if @show_name
  894.           @show_name = false
  895.           @contents_y += FUKI::NAME_Y_ADJ
  896.         end
  897.         new_line
  898.         if @line_count >= MAX_LINE      # 行数为最大时
  899.           unless @text.empty?           # 如果还有增加则继续
  900.             @fuki_pause = true           # 等待输入
  901.             break
  902.           end
  903.         end
  904.       when "\x01"                       # \C[n]  (更改文字色)
  905.         @text.sub!(/\[([0-9]+)\]/, "")
  906.         contents.font.color = text_color($1.to_i)
  907.         next
  908.       when "\x02"                       # \G  (显示所持金)
  909.         @gold_window.refresh
  910.         @gold_window.open
  911.       when "\x03"                       # \.  (等待 1/4 秒)
  912.         @wait_count = 15
  913.         break
  914.       when "\x04"                       # \|  (等待 1 秒)
  915.         @wait_count = 60
  916.         break
  917.       when "\x05"                       # \!  (等待输入)
  918.         @fuki_pause = true
  919.         break
  920.       when "\x06"                       # \>  (瞬间显示 ON)
  921.         @line_show_fast = true
  922.       when "\x07"                       # \<  (瞬间显示 OFF)
  923.         @line_show_fast = false
  924.       when "\x08"                       # \^  (不等待输入)
  925.         @pause_skip = true
  926.       else                              # 普通文字
  927.         @wait_count = $game_temp.speed  # 对话框打字速度修正
  928.         # 判断头像对文字的影响
  929.         case $game_temp.face_type
  930.         when 0
  931.           contents.draw_text\
  932.           (@contents_x, @contents_y, 40, FUKI::FONT_SIZE + 2, c)
  933.         when 1
  934.           contents.draw_text\
  935.           (@contents_x - face_width, @contents_y, 40, FUKI::FONT_SIZE + 2, c)
  936.         end
  937.         c_width = contents.text_size(c).width
  938.         @contents_x += c_width
  939.       end
  940.       break unless @show_fast or @line_show_fast
  941.     end
  942.   end
  943.   #--------------------------------------------------------------------------
  944.   # ● 消息更新结束
  945.   #--------------------------------------------------------------------------
  946.   def finish_message
  947.     if $game_message.choice_max > 0
  948.       start_choice
  949.     elsif $game_message.num_input_variable_id > 0
  950.       start_number_input
  951.     elsif @pause_skip
  952.       terminate_message
  953.     else
  954.       @fuki_pause = true
  955.     end
  956.     @wait_count = 10
  957.     @text = nil
  958.   end
  959.   #--------------------------------------------------------------------------
  960.   # ● 开始选择项
  961.   #--------------------------------------------------------------------------
  962.   def start_choice
  963.     self.active = true
  964.     self.index = 0
  965.   end
  966.   #--------------------------------------------------------------------------
  967.   # ◎ 开始输入数值
  968.   #--------------------------------------------------------------------------
  969.   def start_number_input
  970.     digits_max = $game_message.num_input_digits_max
  971.     number = $game_variables[$game_message.num_input_variable_id]
  972.     @number_input_window.digits_max = digits_max
  973.     @number_input_window.number = number
  974.     @number_input_window.y = y + @contents_y
  975.     @number_input_window.active = true
  976.     @number_input_window.update
  977.   end
  978.   #--------------------------------------------------------------------------
  979.   # ◎ 更新光标
  980.   #--------------------------------------------------------------------------
  981.   def update_cursor
  982.     if @index >= 0
  983.       # 获取光标的横坐标
  984.       if $game_message.face_name.empty? or FUKI::H_ALIGN == 1
  985.         x = 0
  986.       else
  987.         x = face_width
  988.       end
  989.       # 获取光标的纵坐标
  990.       y = ($game_message.choice_start + @index) * (FUKI::FONT_SIZE + 2)
  991.       # 修正名称行
  992.       unless $game_message.face_name.empty?
  993.         y += FUKI::NAME_Y_ADJ + FUKI::FONT_SIZE + 2
  994.       end
  995.       width = contents.width - face_width
  996.       self.cursor_rect.set(x, y, width, FUKI::FONT_SIZE + 2)
  997.     else
  998.       self.cursor_rect.empty
  999.     end
  1000.   end
  1001.   #--------------------------------------------------------------------------
  1002.   # ● 文章显示输入处理
  1003.   #--------------------------------------------------------------------------
  1004.   def input_pause
  1005.     if Input.trigger?(Input::B) or Input.trigger?(Input::C)
  1006.       @fuki_pause = false
  1007.       if @text != nil and not @text.empty?
  1008.         new_page if @line_count >= MAX_LINE
  1009.       else
  1010.         terminate_message
  1011.       end
  1012.     end
  1013.   end
  1014.   #--------------------------------------------------------------------------
  1015.   # ● 选择项输入处理
  1016.   #--------------------------------------------------------------------------
  1017.   def input_choice
  1018.     if Input.trigger?(Input::B)
  1019.       if $game_message.choice_cancel_type > 0
  1020.         Sound.play_cancel
  1021.         $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
  1022.         terminate_message
  1023.       end
  1024.     elsif Input.trigger?(Input::C)
  1025.       Sound.play_decision
  1026.       $game_message.choice_proc.call(self.index)
  1027.       terminate_message
  1028.     end
  1029.   end
  1030.   #--------------------------------------------------------------------------
  1031.   # ● 数值输入处理
  1032.   #--------------------------------------------------------------------------
  1033.   def input_number
  1034.     if Input.trigger?(Input::C)
  1035.       Sound.play_decision
  1036.       $game_variables[$game_message.num_input_variable_id] =
  1037.         @number_input_window.number
  1038.       $game_map.need_refresh = true
  1039.       terminate_message
  1040.     end
  1041.   end
  1042. end
复制代码
大家来看看该怎么改!

Lv1.梦旅人

梦石
0
星屑
50
在线时间
273 小时
注册时间
2011-5-20
帖子
295
2
发表于 2011-7-13 16:23:52 | 只看该作者
812行开始是神马?

点评

不小心的  发表于 2011-7-13 16:34
回复

使用道具 举报

Lv4.逐梦者

醉啸 长风万里

梦石
0
星屑
6062
在线时间
6586 小时
注册时间
2007-12-16
帖子
4501

贵宾

3
发表于 2011-7-13 16:29:31 | 只看该作者

点评

额,就这个了,3Q  发表于 2011-7-13 16:34

还在龟速填坑中
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-14 10:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表