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

Project1

 找回密码
 注册会员
搜索
查看: 1985|回复: 1

[已经解决] 如何绑定对话配音

 关闭 [复制链接]

Lv1.梦旅人

末日咏叹者

梦石
0
星屑
50
在线时间
235 小时
注册时间
2010-3-16
帖子
175
发表于 2011-8-2 10:40:44 | 显示全部楼层 |阅读模式
本帖最后由 fux2 于 2011-8-3 11:14 编辑

做游戏已经做到一半了  用的对话脚本是6R非官方整合FUKI  能够自动读取人名的哪种  
可是在事件中播放SE配音,当配音未结束时进入下一个对话,那么配音仍会继续播放。有没有什么办法解决?

P.S.:我又66+FUKI的整合脚本,但是游戏已经制作一半,如果现在需要换脚本的话哪位大虾帮忙改写一下,弄成可以在对话中自动读取人名的。如输入“约书亚:”,则将“约书亚:”自动替换成Heads文件夹内名为“约书亚.png”的头像。
脚本太长,所以分两段
  1. #============================================================================
  2. # 66加强对话框Fuki对话框整合+附送功能
  3. # By whbm
  4. #============================================================================

  5. #   说明:
  6. #     这是一个整合了66加强对话框和Fuki对话框功能脚本,你可以靠改变开关来切换
  7. #     两个脚本。
  8.      
  9. #     附送功能:
  10. #     在对话中按enter键跳过打字效果

  11. #   33号开关控制对话框的切换:
  12. #     打开--使用66加强对话框
  13. #     关闭--使用Fuki对话框
  14. #   34号开关控制附送功能的打开与关闭:
  15. #     打开--使用附送功能
  16. #     关闭--不使用附送功能

  17. #============================================================================
  18. # 66加强对话框说明--66rpg
  19. #============================================================================

  20. #默认为一个字一个字的方式,如果需要一次全部显示,
  21. #请在游戏中使用脚本:$game_system.typing = true
  22.       
  23. #默认对话字没有声音,如果需要声音,
  24. #请在游戏中使用脚本:$game_system.soundname_on_speak = "这里输入文件名"
  25. #我唯一一个见过“胡乱配音”的游戏是天使帝国2代,该游戏说话的时候每个字符随机发一个外星语音

  26. # 其他在对话中可以使用的功能:
  27.   
  28. # \n[1]:显示1号角色的姓名

  29. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名

  30. # \p[1]:对话框出现在1号事件的上方
  31. # \p[0]:主人公上方出现对话框
  32. #——————————————————使用\p功能后可以自动调整对话框大小

  33. # \\:显示"\"这个符号

  34. # \v[1] :显示变量1

  35. # \v[a1] :显示防具1

  36. # \v[w1] :显示武器1

  37. # \v[i1] :显示物品1

  38. # \v[s1] :显示特技1

  39. # \c[1-8]:更改颜色

  40. # \g:显示金钱窗口

  41. # \a[SE文件名]:对话的时候播放SE

  42. # \s[1-19]:更改弹字的速度

  43. # \.   :停顿一刹那(1、2帧)
  44. # \|   :停顿片刻(20帧)

  45. # \>   :文字不用打字方式
  46. # \<   :文字使用打字方式

  47. # \!   :等待玩家按回车再继续
  48. # \~   :文字直接消失

  49. # \I   :下一行从这个位置开始

  50. # \o[123]:文字透明度改为123,模拟将死之人(汗)

  51. # \h[12]:改用12号字

  52. # \b[50]:空50象素

  53. # \K[今天天气不错]:在出现“今天天气不错”这几个字的时候播放$game_system.soundname_on_speak设置的音效

  54. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  55. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”

  56. # \Lk:清除左边的图像
  57. # \Rk:清除右边的图像







  58. #============================================================================
  59. # Fuki对话框说明--bbschat
  60. #============================================================================
  61. #
  62. #    呼出对话框 ver. 1.31 By パラ犬(日)
  63. #  来自 [url]http://rpg.para.s3p.net/[/url]
  64. #
  65. #  汉化修改 66RPG bbschat(2006.1.5)
  66. #    来自
  67. #
  68. #    ●准备工作-窗口Skin
  69. #
  70. #    首先,确认自己使用的对话框窗口Skin,(数据库-系统-窗口外观图形)
  71. #    然后根据该窗口Skin制作对话框尾部使用的两个箭头图形
  72. #    尾部箭头图形命名方式:“窗口skin名-top”,“窗口skin名-under”
  73. #    将该图形文件存放在“Graphics/Windowskins”文件夹下。
  74. #
  75. #    本演示游戏内置2套窗口和箭头图形,
  76. #    一套是游戏默认的“001-Blue01”,一套是定制的“fk”
  77. #    玩家可以根据自己的需要参照样本定制自己的呼出对话框窗口Skin。
  78. #
  79. #    ●呼出对话框使用方法
  80. #
  81. #    在事件命令行使用[脚本]将事件ID代入[$mes_id]
  82. #    该事件就可以使用呼出对话框了。
  83. #   (举例:$mes_id=4)
  84. #
  85. #    ID 代入 -1 表示玩家,代入 0 表示事件自身。
  86. #    代入 nil 或者 "" 则返回成通常的信息窗口。
  87. #    对话框的表示位置可以通过事件的“更改文章选项”来设定(上、中、下)。
  88. #    表示位置为“中央”的话,不管事件位置在哪里,对话框都将显示在画面中央。
  89. #
  90. #    ●角色名字窗口的使用文字的方法
  91. #
  92. #    在事件命令行使用[脚本]将文字列代入[$mes_name]
  93. #    对话框就会显示角色名字窗口
  94. #   (举例:$mes_name="阿尔西斯")
  95. #    代入 nil 或者 "" 则不显示角色名字窗口。
  96. #
  97. #    以上两个机能是独立的,所以可以单独使用
  98. #
  99. #   $mes_id=(ID) + $mes_name="名字"  :呼出对话框显示 + 角色名字窗口
  100. #   $mes_id=(ID) + $mes_name=""      :呼出对话框显示(没有角色名字)
  101. #   $mes_id=nil  + $mes_name="名字"  :默认信息窗口 + 角色名字窗口
  102. #   $mes_id=nil  + $mes_name=""      :默认信息窗口(没有角色名字)
  103. #
  104. #    ●角色名字窗口使用角色图片的方法(汉化特别追加功能,原脚本只能使用文字)
  105. #   
  106. #    如果能在对应文件夹中找到文件名和角色名字相同的图片,   
  107. #    则角色名字窗口显示角色头像图片,角色图片最好能包括角色的名字。
  108. #    默认头像图片保存目录为“Graphics/Heads/”,玩家可自行修改。
  109. #
  110. #    如果不想使用角色名字直接作为头像文件名。
  111. #    可以使用下面在 Game_Temp 类里增加的namebmp属性。
  112. #    重新设定角色名字与文件名的对应关系。
  113. #
  114. #    ●信息表示速度的变更方法
  115. #
  116. #    在事件命令行使用[脚本]将数值代入[$mes_speed]
  117. #    速度为 0 即瞬间显示全部信息,数字越大,信息表示速度越慢。
  118. #   (举例:$mes_speed=1)
  119. #
  120. #    ●其他设置
  121. #
  122. #    请参照下面的注释
  123. #
  124. #    补一句,用脚本chat(id,"名字")就相当于$mes_id=ID;$mes_name="名字"
  125. #==============================================================================

  126. module FUKI

  127. # 头像图片保存目录的设定
  128. HEAD_PIC_DIR = "Graphics/Heads/"

  129. # 是否显示尾部图标
  130. TAIL_SHOW = true

  131. # Skin的设定
  132. # 使用数据库默认窗口Skin情况下这里使用[""]
  133. FUKI_SKIN_NAME = "fk2"   # 呼出对话框用Skin
  134. NAME_SKIN_NAME = "fk2"   # 角色名字窗口用Skin

  135. # 字体大小
  136. MES_FONT_SIZE = 20    # 呼出对话框
  137. NAME_FONT_SIZE = 14   # 角色名字窗口

  138. # 字体颜色
  139. #(设定为 Color.new(0, 0, 0, 0) 表示使用普通文字色)
  140. FUKI_COLOR = Color.new(255, 255, 255, 255)  # 呼出对话框
  141. NAME_COLOR = Color.new(255, 255, 255, 255)  # 角色名字窗口

  142. # 窗口透明度
  143. # 如修改窗口透明度请同时修改尾部箭头图形内部的透明度
  144. FUKI_OPACITY = 255    # 呼出对话框
  145. MES_OPACITY = 255     # 默认信息窗口
  146. NAME_OPACITY = 255    # 角色名字窗口

  147. # 角色名字窗口的相对位置
  148. NAME_SHIFT_X = 0      # 横坐标
  149. NAME_SHIFT_Y = 16     # 纵坐标

  150. # 窗口表示时是否根据画面大小自动检查窗口出现的位置,
  151. # 自动改变位置( true / false )
  152. # 设置成 true 可能出现箭头图标颠倒的问题 <- bbschat
  153. POS_FIX = false

  154. # 在画面最边缘表示时的稍微挪动
  155. # 使用圆形Skin的角和方框的角重合的情况下为 true
  156. CORNER_SHIFT = false
  157. SHIFT_PIXEL = 4   # true 时挪动的象素

  158. # 角色高度尺寸
  159. CHARACTOR_HEIGHT = 48
  160. # 呼出对话框的相对位置(纵坐标)
  161. POP_SHIFT_TOP = 0         # 表示位置为上的时候
  162. POP_SHIFT_UNDER = 0       # 表示位置为下的时候

  163. # 信息的表示速度(数字越小速度越快,0为瞬间表示)
  164. # 游戏中 可随时用数字代入 $mes_speed 来改变消息表示速度。
  165. MES_SPEED = 1

  166. end

  167. #==============================================================================
  168. # 方便用户同时设置2个常用参数而使用的函数
  169. #==============================================================================
  170. def chat(id = 0,name = "")
  171. $mes_id = id
  172. $mes_name = name
  173. end

  174. #==============================================================================
  175. # □ Game_Temp
  176. #==============================================================================

  177. class Game_Temp
  178. attr_accessor  :namebmp              #保存头像图片的Hash表
  179. alias initialize_fuki initialize
  180. def initialize
  181.    initialize_fuki
  182.    # 如果不想使用角色名字直接作为头像文件名
  183.    # 可在这里重新设定角色名字与文件名的对应关系
  184.    @namebmp ={"玩家"=>"001-Player-Face", "维斯特"=>"002-Player-Face"}
  185. end
  186. end
  187. #==============================================================================
  188. # □ Game_System
  189. #==============================================================================
  190. class Game_System
  191. attr_accessor :typing
  192. attr_accessor :soundname_on_speak
  193. alias carol3_ini initialize
  194. def initialize
  195.    carol3_ini
  196.    @typing = true
  197.    @soundname_on_speak = nil
  198. end
  199. end
  200. #==============================================================================
  201. # □ Window_FukiMessage
  202. #==============================================================================

  203. class Window_FukiMessage < Window_Selectable

  204. #--------------------------------------------------------------------------
  205. # ● 初始化状态
  206. #--------------------------------------------------------------------------
  207. def initialize
  208.    super(80, 304, 480, 160)
  209.    self.contents = Bitmap.new(width - 32, height - 32)
  210.    self.visible = false
  211.    self.z = 9998
  212.    @fade_in = false
  213.    @fade_out = false
  214.    @contents_showing = false
  215.    @cursor_width = 0
  216.    self.active = false
  217.    self.index = -1
  218.    #........................................................................
  219.    if $game_system.soundname_on_speak == nil then
  220.      $game_system.soundname_on_speak = ""
  221.    end
  222.    @opacity_text_buf = Bitmap.new(32, 32)
  223.    #........................................................................
  224.    @w = 0
  225.    @h = 0
  226.    @wait = 0
  227.    @dx = 0
  228.    @dy = 0
  229.    $mes_speed = FUKI::MES_SPEED
  230. end

  231. #--------------------------------------------------------------------------
  232. # ○ 决定窗口尺寸并生成窗口
  233. #--------------------------------------------------------------------------
  234. def refresh_create
  235.    self.contents.clear
  236.    self.contents.font.color = normal_color
  237.    self.contents.font.size = FUKI::MES_FONT_SIZE
  238.    # 取得窗口尺寸
  239.    get_windowsize
  240.    w = @w + 32 + 8
  241.    h = @h * (self.contents.font.size + 10) + 26
  242.    # 生成呼出窗口
  243.    set_fukidasi(self.x, self.y, w, h)
  244.    # 生成角色名字窗口
  245.    set_namewindow
  246.    # 初始化信息表示使用的变量
  247.    @dx = @dy = 0
  248.    @cursor_width = 0
  249.    @contents_drawing = true
  250.    # 瞬间表示的情况下
  251.    if $mes_speed == 0
  252.      # 循环信息描绘处理
  253.      while $game_temp.message_text != ""
  254.        draw_massage
  255.      end
  256.      draw_opt_text
  257.      @contents_showing_end = true
  258.      @contents_drawing = false
  259.    else
  260.      # 一个一个描绘文字
  261.      refresh_drawtext
  262.    end
  263. end

  264. #--------------------------------------------------------------------------
  265. # ○ 一个一个描绘文字
  266. #--------------------------------------------------------------------------
  267. def refresh_drawtext
  268.    #........................................................................
  269.    if Input.trigger?(Input::C) and $game_switches[34]
  270.      # 循环信息描绘处理
  271.      while $game_temp.message_text != ""
  272.        draw_massage
  273.      end
  274.      draw_opt_text
  275.      @contents_showing_end = true
  276.      @contents_drawing = false
  277.    end
  278.    #........................................................................
  279.    if $game_temp.message_text != nil
  280.      if @wait > 0
  281.        @wait -= 1
  282.      elsif @wait == 0
  283.        # 描绘处理
  284.        draw_massage
  285.        @wait = $mes_speed
  286.      end
  287.    end
  288.    # 描绘结束
  289.    if $game_temp.message_text == ""
  290.      draw_opt_text
  291.      @contents_showing_end = true
  292.      @contents_drawing = false
  293.    end
  294. end

  295. #--------------------------------------------------------------------------
  296. # ○ 66rpg-refresh
  297. #--------------------------------------------------------------------------
  298.   def refresh
  299.     # 初期化
  300.     self.contents.clear
  301.     self.contents.font.color = normal_color
  302.     self.contents.font.size = Font.default_size
  303.     @x = @y = @max_x = @max_y = @indent = @lines = 0
  304.     @left_keep = @right_keep = false
  305.     @face_indent = 0
  306.     @opacity = 255
  307.     @cursor_width = 0
  308.     @write_speed = 0
  309.     @write_wait = 0
  310.     @mid_stop = false
  311.     @face_file = nil
  312.     @popchar = -2
  313.     if $game_temp.choice_start == 0
  314.       @x = 8
  315.     end
  316.     if $game_temp.message_text != nil
  317.       @now_text = $game_temp.message_text
  318.       #——头像设置
  319.       if (/\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
  320.         @face_file = $1 + ".png"
  321.         @x = @face_indent = 128
  322.         if FileTest.exist?("Graphics/Pictures/" + $1 + ".png")
  323.           self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  324.         end
  325.         @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
  326.       end
  327.       #——左半身像设置
  328.       if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  329.         @face = "66rpg_" + $1 + "_h.png"
  330.         if $加密 == true
  331.           if @left_picture != nil
  332.             @left_picture.dispose
  333.           end
  334.           @left_picture = Sprite.new
  335.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  336.           @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  337.           @left_picture.x = 0
  338.           @left_picture.mirror = true
  339.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  340.         else         
  341.           if FileTest.exist?("Graphics/battlers/#{@face}")
  342.             if @left_picture != nil
  343.               @left_picture.dispose
  344.             end
  345.             @left_picture = Sprite.new
  346.             @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  347.             @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  348.             @left_picture.x = 0
  349.             @left_picture.mirror = true
  350.             @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  351.           end
  352.         end        
  353.       end
  354.       #——右半身像设置
  355.       if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  356.         @face = "66rpg_" + $1 + "_h.png"
  357.         if $加密 == true
  358.           if @right_picture != nil
  359.             @right_picture.dispose
  360.           end
  361.           @right_picture = Sprite.new
  362.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  363.           @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  364.           @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  365.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  366.         else
  367.           if FileTest.exist?("Graphics/battlers/#{@face}")
  368.             if @right_picture != nil
  369.               @right_picture.dispose
  370.             end
  371.             @right_picture = Sprite.new
  372.             @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  373.             @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  374.             @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  375.             @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  376.           end
  377.         end
  378.       end
  379.       if (/\\[Rr]k/.match(@now_text)) != nil
  380.         @right_keep = true
  381.         @now_text.sub!(/\\[Rr]k/) { "" }
  382.       end
  383.       if (/\\[Ll]k/.match(@now_text)) != nil
  384.         @left_keep = true
  385.         @now_text.sub!(/\\[Ll]k/) { "" }
  386.       end
  387.       # 显示人物姓名
  388.       name_window_set = false
  389.       if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
  390.         name_window_set = true
  391.         name_text = $1
  392.         @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  393.       end
  394.       
  395.       # 文字位置的判定
  396.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  397.         @popchar = $1.to_i
  398.         if @popchar == -1
  399.           @x = @indent = 48
  400.           @y = 4
  401.         end
  402.         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  403.       end
  404.       
  405.       # 开始
  406.       begin
  407.         last_text = @now_text.clone
  408.         @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  409.       end until @now_text == last_text
  410.       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  411.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  412.     end
  413.     @now_text.gsub!(/\\\\/) { "\000" }
  414.     @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  415.     @now_text.gsub!(/\\[Gg]/) { "\002" }
  416.     @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  417.     @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  418.     @now_text.gsub!(/\\[.]/) { "\005" }
  419.     @now_text.gsub!(/\\[|]/) { "\006" }

  420.     @now_text.gsub!(/\\[>]/) { "\016" }
  421.     @now_text.gsub!(/\\[<]/) { "\017" }
  422.     @now_text.gsub!(/\\[!]/) { "\020" }
  423.     @now_text.gsub!(/\\[~]/) { "\021" }
  424.    
  425.     @now_text.gsub!(/\\[Ii]/) { "\023" }
  426.     @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  427.     @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  428.     @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  429.     @now_text.gsub!(/\\[Kk]\[(.*?)\]/) { "\027[#{$1}]" }
  430.     if @popchar >= 0
  431.       @text_save = @now_text.clone
  432.       @max_x = 0
  433.       @max_y = 4
  434.       for i in 0..3
  435.         line = @now_text.split(/\n/)[3-i]
  436.         @max_y -= 1 if line == nil and @max_y <= 4-i
  437.         next if line == nil
  438.         cx = contents.text_size(line).width
  439.         @max_x = cx if cx > @max_x
  440.       end
  441.       self.width = @max_x + 48 + @face_indent
  442.       self.height = (@max_y - 1) * 32 + 64
  443.     else
  444.       @max_x = self.width - 32 - @face_indent
  445.     end
  446.     reset_window
  447.       if name_window_set
  448.         off_x = 0
  449.         off_y = -40
  450.         space = 2
  451.         x = self.x + off_x - space / 2
  452.         y = self.y + off_y - space / 2
  453.         w = self.contents.text_size(name_text).width + 26 + space
  454.         h = 40 + space
  455.         @name_window_frame = Window_Frame.new(x, y, w, h)
  456.         @name_window_frame.z = self.z + 1
  457.         x = self.x + off_x + 4
  458.         y = self.y + off_y
  459.         @name_window_text = Air_Text.new(x+4, y+6, name_text)
  460.         @name_window_text.z = self.z + 2
  461.       end
  462.     end
  463.     reset_window
  464.     if $game_temp.choice_max > 0
  465.       @item_max = $game_temp.choice_max
  466.       self.active = true
  467.       self.index = 0
  468.     end
  469.     if $game_temp.num_input_variable_id > 0
  470.       digits_max = $game_temp.num_input_digits_max
  471.       number = $game_variables[$game_temp.num_input_variable_id]
  472.       @input_number_window = Window_InputNumber.new(digits_max)
  473.       @input_number_window.number = number
  474.       @input_number_window.x = self.x + 8
  475.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  476.     end
  477.   end
复制代码
  1. #==============================================================================
  2. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  3. #==============================================================================
  4. class Window_Frame < Window_Base
  5. #--------------------------------------------------------------------------
  6. # ● オブジェクト初期化
  7. #--------------------------------------------------------------------------
  8. def initialize(x, y, width, height)
  9.    super(x, y, width, height)
  10.    self.contents = nil
  11.    self.back_opacity = 100
  12. end
  13. #--------------------------------------------------------------------------
  14. # ● 解放
  15. #--------------------------------------------------------------------------
  16. def dispose
  17.    super
  18. end
  19. end

  20. #==============================================================================
  21. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  22. #==============================================================================
  23. class Air_Text < Window_Base
  24.   #--------------------------------------------------------------------------
  25.   # ● オブジェクト初期化
  26.   #--------------------------------------------------------------------------
  27.   def initialize(x, y, designate_text)
  28.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  29.     self.opacity = 0
  30.     self.back_opacity = 0
  31.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  32.     w = self.contents.width
  33.     h = self.contents.height
  34.     self.contents.draw_text(0, 0, w, h, designate_text)
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 解放
  38.   #--------------------------------------------------------------------------
  39.   def dispose
  40.     self.contents.clear
  41.     super
  42.   end
  43. end


  44. #--------------------------------------------------------------------------
  45. # ○ 取得窗口尺寸
  46. #--------------------------------------------------------------------------
  47. def get_windowsize
  48.    x = y = 0
  49.    @h = @w = 0
  50.    @cursor_width = 0
  51.    # 有选择项的话,处理字的缩进
  52.    if $game_temp.choice_start == 0
  53.      x = 16
  54.    end
  55.    # 有等待显示的文字的情况下
  56.    if $game_temp.message_text != nil
  57.    text = $game_temp.message_text.clone
  58.      # 限制文字处理
  59.      begin
  60.        last_text = text.clone
  61.        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  62.      end until text == last_text
  63.      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  64.        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  65.      end
  66.      # 为了方便、将 "\\\\" 变换为 "\000"
  67.      text.gsub!(/\\\\/) { "\000" }
  68.      # "\\C" 变为 "\001" 、"\\G" 变为 "\002"
  69.      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001" }
  70.      text.gsub!(/\\[Gg]/) { "\002" }
  71.      # c 获取 1 个字 (如果不能取得文字就循环)
  72.      while ((c = text.slice!(/./m)) != nil)
  73.        # \\ 的情况下
  74.        if c == "\000"
  75.          # 还原为本来的文字
  76.          c = "\\"
  77.        end
  78.        # \C[n] 或者 \G 的情况下
  79.        if c == "\001" or c == "\002"
  80.          # 下面的文字
  81.          next
  82.        end
  83.        # 另起一行文字的情况下
  84.        if c == "\n"
  85.          # y 累加 1
  86.          y += 1
  87.          # 取得纵横尺寸
  88.          @h = y
  89.          @w = x > @w ? x : @w
  90.          if y >= $game_temp.choice_start
  91.            @w = x + 8 > @w ? x + 8 : @w
  92.          end
  93.          x = 0
  94.          # 移动到选择项的下一行
  95.          if y >= $game_temp.choice_start
  96.            x = 8
  97.          end
  98.          # 下面的文字
  99.          next
  100.        end
  101.        # x 为要描绘文字的宽度加法运算
  102.        x += self.contents.text_size(c).width
  103.      end
  104.    end
  105.    # 输入数值的情况
  106.    if $game_temp.num_input_variable_id > 0
  107.      digits_max = $game_temp.num_input_digits_max
  108.      number = $game_variables[$game_temp.num_input_variable_id]
  109.      @h += 1
  110.      x = digits_max * self.contents.font.size + 16
  111.      @w = x > @w ? x : @w
  112.    end
  113. end

  114. #--------------------------------------------------------------------------
  115. # ○ 描绘信息处理
  116. #--------------------------------------------------------------------------
  117. def draw_massage
  118.    # 有等待显示的文字的情况下
  119.    if $game_temp.message_text != nil
  120.      text = $game_temp.message_text
  121.      # 限制文字处理
  122.      begin
  123.        last_text = text.clone
  124.        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  125.      end until text == last_text
  126.      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  127.        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  128.      end
  129.      # 为了方便、将 "\\\\" 变换为 "\000"
  130.      text.gsub!(/\\\\/) { "\000" }
  131.      # "\\C" 变为 "\001"、"\\G" 变为 "\002"
  132.      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  133.      text.gsub!(/\\[Gg]/) { "\002" }
  134.      # c 获取 1 个字
  135.      if ((c = text.slice!(/./m)) != nil)
  136.        # 选择项的情况
  137.        if @dy >= $game_temp.choice_start
  138.          # 处理字的缩进
  139.          @dx = 8
  140.          # 描绘文字
  141.          self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
  142.          # x 为要描绘文字宽度的加法运算
  143.          @dx += self.contents.text_size(c).width
  144.          # 循环
  145.          while ((c = text.slice!(/./m)) != "\n")
  146.            # 描绘文字
  147.            self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
  148.            # x 为要描绘文字宽度的加法运算
  149.            @dx += self.contents.text_size(c).width
  150.          end
  151.          if c == "\n"
  152.            # 更新光标宽度
  153.            @cursor_width = [@cursor_width, @dx].max
  154.            # dy 累加 1
  155.            @dy += 1
  156.            @dx = 0
  157.          end
  158.          return
  159.        end
  160.        # \\ 的情况下
  161.        if c == "\000"
  162.          # 还原为本来的文字
  163.          c = "\\"
  164.        end
  165.        #\C[n] 的情况下
  166.        if c == "\001"
  167.          # 更改文字色
  168.          text.sub!(/\[([0-9]+)\]/, "")
  169.          color = $1.to_i
  170.          if color >= 0 and color <= 7
  171.            self.contents.font.color = text_color(color)
  172.          end
  173.        end
  174.        # \G 的情况下
  175.        if c == "\002"
  176.          # 生成金钱窗口
  177.          if @gold_window == nil
  178.            @gold_window = Window_Gold.new
  179.            @gold_window.x = 560 - @gold_window.width
  180.            if $game_temp.in_battle
  181.              @gold_window.y = 192
  182.            else
  183.              @gold_window.y = self.y >= 128 ? 32 : 384
  184.            end
  185.            @gold_window.opacity = self.opacity
  186.            @gold_window.back_opacity = self.back_opacity
  187.          end
  188.        end
  189.        # 另起一行文字的情况下
  190.        if c == "\n"
  191.          # dy 累加 1
  192.          @dy += 1
  193.          @dx = 0
  194.        end
  195.        # 描绘文字
  196.        self.contents.font.size = FUKI::MES_FONT_SIZE
  197.        font_size = self.contents.font.size
  198.        self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
  199.        # dx 为要描绘文字的宽度加法运算
  200.        @dx += self.contents.text_size(c).width
  201.      end
  202.    end
  203. end

  204. #--------------------------------------------------------------------------
  205. # ○ 选择项和输入数值的情况下
  206. #--------------------------------------------------------------------------
  207. def draw_opt_text
  208.    # 选择项的情况下
  209.    if $game_temp.choice_max > 0
  210.      @item_max = $game_temp.choice_max
  211.      self.active = true
  212.      self.index = 0
  213.    end
  214.    # 输入数值的情况下
  215.    if $game_temp.num_input_variable_id > 0
  216.      digits_max = $game_temp.num_input_digits_max
  217.      number = $game_variables[$game_temp.num_input_variable_id]
  218.      @input_number_window = Window_InputNumber.new(digits_max)
  219.      @input_number_window.number = number
  220.      @input_number_window.x = self.x + 8
  221.      @input_number_window.y = self.y + $game_temp.num_input_start * 32
  222.    end
  223. end

  224. #--------------------------------------------------------------------------
  225. # ○ 设置呼出对话框
  226. #--------------------------------------------------------------------------
  227. def set_fukidasi(x, y, width, height)
  228.    # $mes_id 为空的时候,不显示呼出对话框
  229.    if $mes_id == nil or $mes_id == ""
  230.      del_fukidasi
  231.      reset_window
  232.    else
  233.      # 不显示暂停标志
  234.      self.pause = false
  235.      # 取得对话框位置
  236.      pos = get_fuki_pos(width, height)
  237.      x = pos[0]
  238.      y = pos[1]
  239.      skin = FUKI::FUKI_SKIN_NAME != "" ? FUKI::FUKI_SKIN_NAME : $game_system.windowskin_name
  240.      # 生成呼出对话框
  241.      self.windowskin = RPG::Cache.windowskin(skin)
  242.      self.x = x
  243.      self.y = y
  244.      self.height = height
  245.      self.width = width
  246.      self.contents.dispose
  247.      self.contents = Bitmap.new(width - 32, height - 32)
  248.      self.back_opacity = FUKI::FUKI_OPACITY
  249.      self.contents.clear
  250.      self.contents.font.color = normal_color
  251.      self.contents.font.size = FUKI::MES_FONT_SIZE
  252.      # 描绘尾部图标
  253.      if $game_system.message_frame == 0
  254.        # 取得位置
  255.        tale_pos = get_tale_pos
  256.        @tale = Sprite.new
  257.        # 是否显示尾部图标 <- bbschat
  258.        if FUKI::TAIL_SHOW == true
  259.          case @message_position
  260.            when 0  # 上
  261.              @tale.bitmap = RPG::Cache.windowskin(skin + "-top")
  262.              @tale.x = tale_pos[0]
  263.              @tale.y = tale_pos[1]
  264.              @tale.z = self.z + 1
  265.            when 1  # 中
  266.              @tale.dispose
  267.              @tale = nil
  268.            when 2  # 下
  269.              @tale.bitmap = RPG::Cache.windowskin(skin + "-under")
  270.              @tale.x = tale_pos[0]
  271.              @tale.y = tale_pos[1]
  272.              @tale.z = self.z + 1
  273.          end
  274.        end
  275.      end
  276.    end
  277. end

  278. #--------------------------------------------------------------------------
  279. # ○ 计算呼出对话框的位置
  280. #--------------------------------------------------------------------------
  281. def get_fuki_pos(width, height)
  282.    
  283.    # 取得角色
  284.    @character = get_character($mes_id)
  285.    if @character == nil
  286.      # 角色不存在的情况下使用默认信息框
  287.      del_fukidasi
  288.      reset_window
  289.      return
  290.    end
  291.    # 处理坐标
  292.    x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - (width / 2)
  293.    # 为尽量显示在画面内而移动横坐标
  294.    if x + width > 640
  295.      x = 640 - width
  296.    elsif x < 0
  297.      x = 0
  298.    end
  299.    # 决定窗口位置
  300.    case $game_system.message_position
  301.      when 0  # 上
  302.        y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  303.      when 1  # 中
  304.        y = (480 - height) / 2
  305.        x = (640 - width) / 2
  306.      when 2  # 下
  307.        y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  308.    end
  309.    # 纪录文章显示位置
  310.    @message_position = $game_system.message_position
  311.    # 如果选择自动修正,则如果文章会显示到画面外则自动改变窗口的尺寸(高度)
  312.    if FUKI::POS_FIX
  313.      case @message_position
  314.        when 0  # 上
  315.          if y <= 0
  316.            @message_position = 2
  317.            y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  318.          end
  319.        when 2  # 下
  320.          if y + height >= 480
  321.            p "上"
  322.            @message_position = 0
  323.            y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  324.          end
  325.      end
  326.    end
  327.    return [x,y]
  328.    
  329. end

  330. #--------------------------------------------------------------------------
  331. # ○ 计算尾部图标的位置
  332. #--------------------------------------------------------------------------
  333. def get_tale_pos
  334.    case @message_position
  335.      when 0  # 上
  336.        # 处理坐标
  337.        x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  338.        # 画面边缘的话则移动位置
  339.        if FUKI::CORNER_SHIFT
  340.          if x == 0
  341.            x = FUKI::SHIFT_PIXEL
  342.          elsif x == 640 - 32
  343.            x = 640 - 32 - FUKI::SHIFT_PIXEL
  344.          end
  345.        end
  346.        y = self.y + self.height - 16
  347.      when 1  # 中
  348.        x = nil
  349.        y = nil
  350.      when 2  # 下
  351.        # 处理坐标
  352.        x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  353.        # 画面边缘的话则移动位置
  354.        if FUKI::CORNER_SHIFT
  355.          if x == 0
  356.            x = FUKI::SHIFT_PIXEL
  357.          elsif @tale.x == 640 - 32
  358.            x = 640 - 32 - FUKI::SHIFT_PIXEL
  359.          end
  360.        end
  361.        y = self.y - 16
  362.    end
  363.    return [x,y]
  364. end

  365. #--------------------------------------------------------------------------
  366. # ○ 计算名字窗口的位置
  367. #--------------------------------------------------------------------------
  368. def get_name_pos
  369.    case @face_pic_txt
  370.      when 0  # 文字
  371.        x = self.x + FUKI::NAME_SHIFT_X
  372.        y = self.y - FUKI::NAME_FONT_SIZE - 16 + FUKI::NAME_SHIFT_Y
  373.      when 1  # 图片
  374.        if self.x >= @pic_width + 5
  375.          # 默认头像显示在对话框左边
  376.          x = self.x-@pic_width-5
  377.        else
  378.          # 对话框左边放不下时头像显示在右边
  379.          x = self.x + self.width
  380.        end
  381.        y = self.y+self.height/2 - (@pic_height + 5)/2
  382.      end

  383.    return [x,y]
  384. end

  385. #--------------------------------------------------------------------------
  386. # ○ 设置角色名字窗口
  387. #--------------------------------------------------------------------------
  388. def set_namewindow
  389.    
  390.    # $mes_name为空时不显示角色名字窗口
  391.    if $mes_name == nil or $mes_name == ""
  392.      return
  393.    else
  394.      # 设定变量
  395.      mes_name = $mes_name
  396.      skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
  397.      
  398.      #判断名称是否有对应的图片"Graphics/heads/" +
  399.      if $game_temp.namebmp[mes_name] == nil then
  400.        sFile = "Graphics/heads/" + mes_name + ".png"
  401.      else
  402.        sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + ".png"
  403.      end
  404.      
  405.      if FileTest.exist?(sFile) == true then
  406.       
  407.        @face_pic_txt = 1                       #名字窗口使用头像<- bbschat
  408.       
  409.        # 生成头像
  410.        bmp = Bitmap.new(sFile)
  411.        @pic_width = bmp.width
  412.        @pic_height = bmp.height
  413.       
  414.        if self.x >= @pic_width + 5
  415.          # 默认头像显示在对话框左边
  416.          name_x = self.x-@pic_width-5
  417.        else
  418.          # 对话框左边放不下时头像显示在右边
  419.          name_x = self.x + self.width
  420.        end
  421.        name_y = self.y+self.height/2 - (@pic_height + 5)/2
  422.       
  423.        # 生成角色头像窗口
  424.        @name_win = Window_Base.new(name_x, name_y, @pic_width + 5, @pic_height + 5)
  425.        @name_win.windowskin = RPG::Cache.windowskin(skin)
  426.        @name_win.back_opacity =0     
  427.        @name_win.z = self.z + 1
  428.       
  429.        @name_contents = Sprite.new
  430.        @name_contents.x = name_x + 2
  431.        @name_contents.y = name_y + 2
  432.        @name_contents.bitmap = bmp
  433.        #@name_contents.z = @name_win.z + 2     #这个用了似乎效果不好<- bbschat
  434.       
  435.      else
  436.       
  437.        @face_pic_txt = 0                       #名字窗口使用文字<- bbschat

  438.        # 生成名字
  439.        name_width = mes_name.size / 2 * FUKI::NAME_FONT_SIZE
  440.        name_height = FUKI::NAME_FONT_SIZE
  441.        name_x = self.x + FUKI::NAME_SHIFT_X
  442.        name_y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y

  443.        # 生成角色名字窗口(只有边框)
  444.        @name_win = Window_Base.new(name_x, name_y, name_width + 16, name_height + 16)
  445.        @name_win.windowskin = RPG::Cache.windowskin(skin)
  446.        @name_win.back_opacity = FUKI::NAME_OPACITY
  447.        @name_win.z = self.z + 1
  448.       
  449.        # 为了使空白比Windows类限定的更小使用双重结构
  450.        @name_contents = Sprite.new
  451.        @name_contents.x = name_x + 12
  452.        @name_contents.y = name_y + 8
  453.        @name_contents.bitmap = Bitmap.new(name_width, name_height)
  454.        @name_contents.z = @name_win.z + 2
  455.       
  456.        # 设定文字色
  457.        nil_color = Color.new(0,0,0,0)
  458.        if FUKI::NAME_COLOR != nil_color
  459.          @name_contents.bitmap.font.color = FUKI::NAME_COLOR
  460.        else
  461.          @name_contents.bitmap.font.color = normal_color
  462.        end
  463.        @name_contents.bitmap.font.size = FUKI::NAME_FONT_SIZE
  464.        # 调整窗口尺寸
  465.        rect = @name_contents.bitmap.text_size(mes_name)
  466.        @name_win.width = rect.width + 32
  467.        # 描画名字
  468.        @name_contents.bitmap.draw_text(rect, mes_name)
  469.      end
  470.    end

  471. end

  472. #--------------------------------------------------------------------------
  473. # ○ 释放呼出对话框和角色名字窗口
  474. #--------------------------------------------------------------------------
  475. def del_fukidasi
  476.    if @tale != nil
  477.      @tale.dispose
  478.      @tale = nil
  479.    end
  480.    if @name_win != nil
  481.      @name_win.dispose
  482.      @name_win = nil
  483.      @name_contents.dispose
  484.      @name_contents = nil
  485.    end
  486.    self.opacity = 0
  487.    self.x = 80
  488.    self.width = 480
  489.    self.height = 160
  490.    self.contents.dispose
  491.    self.contents = Bitmap.new(width - 32, height - 32)
  492.    self.pause = true
  493. end

  494. #--------------------------------------------------------------------------
  495. # ○ 取得角色
  496. #     parameter : 参数
  497. #--------------------------------------------------------------------------
  498. def get_character(parameter)
  499.   if $game_switches[33]
  500.    #........................................................................
  501.    case parameter
  502.    when 0
  503.      return $game_player
  504.    else
  505.      events = $game_map.events
  506.      return events == nil ? nil : events[parameter]
  507.    end
  508.    #........................................................................
  509.   else
  510.    # 参数分歧
  511.    case parameter
  512.    when -1  # 玩家
  513.      return $game_player
  514.    when 0   # 该事件
  515.      events = $game_map.events
  516.      return events == nil ? nil : events[$active_event_id]
  517.    else     # 特定事件
  518.     if parameter >0
  519.       events = $game_map.events
  520.       return events == nil ? nil : events[parameter]
  521.     else
  522.       $game_party.return_char(-parameter-2)
  523.     end
  524.    end
  525.   end
  526. end

  527. #--------------------------------------------------------------------------
  528. # ● 设定窗口位置和不透明度
  529. #--------------------------------------------------------------------------
  530. def reset_window
  531.   if $game_switches[33]
  532.     #........................................................................
  533.     # 判定
  534.     if @popchar >= 0
  535.       events = $game_map.events
  536.       if events != nil
  537.         character = get_character(@popchar)
  538.         x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  539.         y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  540.         self.x = x
  541.         self.y = y
  542.       end
  543.     elsif @popchar == -1
  544.       self.x = -4
  545.       self.y = -4
  546.       self.width = 648
  547.       self.height = 488
  548.     else
  549.       if $game_temp.in_battle
  550.         self.y = 16
  551.       else
  552.         case $game_system.message_position
  553.         when 0 # 上
  554.           self.y = 16
  555.         when 1 # 中
  556.           self.y = 160
  557.         when 2 # 下
  558.           self.y = 304
  559.         end
  560.         self.x = 80
  561.         if @face_file == nil
  562.           self.width = 480
  563.         else
  564.           self.width = 600
  565.           self.x -= 60
  566.         end
  567.         self.height = 160
  568.       end
  569.     end
  570.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  571.     if @face_file != nil
  572.       self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  573.     end
  574.     if @popchar == -1
  575.       self.opacity = 255
  576.       self.back_opacity = 0
  577.     elsif $game_system.message_frame == 0
  578.       self.opacity = 255
  579.       self.back_opacity = 200
  580.     else
  581.       self.opacity = 0
  582.       self.back_opacity = 200
  583.     end
  584.     #........................................................................
  585.   else
  586.    if $game_temp.in_battle
  587.      self.y = 16
  588.    else
  589.      case $game_system.message_position
  590.      when 0  # 上
  591.        self.y = 16
  592.      when 1  # 中
  593.        self.y = 160
  594.      when 2  # 下
  595.        self.y = 304
  596.      end
  597.    end
  598.    if $game_system.message_frame == 0
  599.      self.opacity = 255
  600.    else
  601.      self.opacity = 0
  602.    end
  603.    self.back_opacity = FUKI::MES_OPACITY
  604.   end
  605. end

  606. #--------------------------------------------------------------------------
  607. # ● line_height-66rpg
  608. #--------------------------------------------------------------------------
  609. # 返回値:行高
  610. #--------------------------------------------------------------------------
  611. def line_height
  612.    return 32
  613.    if self.contents.font.size >= 20 and self.contents.font.size <= 24
  614.      return 32
  615.    else
  616.      return self.contents.font.size * 15 / 10
  617.    end
  618. end
  619. #--------------------------------------------------------------------------
  620. # ● \V 变换-66rpg
  621. #--------------------------------------------------------------------------
  622. def convart_value(option, index)
  623.    option == nil ? option = "" : nil
  624.    option.downcase!
  625.    case option
  626.      when "i"
  627.        unless $data_items[index].name == nil
  628.          r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  629.        end
  630.      when "w"
  631.        unless $data_weapons[index].name == nil
  632.          r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  633.        end
  634.      when "a"
  635.        unless $data_armors[index].name == nil
  636.          r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  637.        end
  638.      when "s"
  639.        unless $data_skills[index].name == nil
  640.          r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  641.        end
  642.      else
  643.      r = $game_variables[index]
  644.    end
  645.    r == nil ? r = "" : nil
  646.    return r
  647. end
  648. #--------------------------------------------------------------------------
  649. # ● 刷新画面
  650. #--------------------------------------------------------------------------
  651. def update
  652.    if $game_switches[33]
  653.     #........................................................................
  654.     super
  655.     if @fade_in
  656.       self.contents_opacity += 24
  657.       if @input_number_window != nil
  658.         @input_number_window.contents_opacity += 24
  659.       end
  660.       if self.contents_opacity == 255
  661.         @fade_in = false
  662.       end
  663.       return
  664.     end
  665.     @now_text = nil if @now_text == ""
  666.    
  667.     if @now_text != nil and @mid_stop == false
  668.       if @write_wait > 0
  669.         @write_wait -= 1
  670.         return
  671.       end
  672.       text_not_skip = $game_system.typing
  673.       while true
  674.         @max_x = @x if @max_x < @x
  675.         @max_y = @y if @max_y < @y
  676.         if (c = @now_text.slice!(/./m)) != nil
  677.           if c == "\000"
  678.             c = "\\"
  679.           end
  680.           if c == "\001"
  681.             @now_text.sub!(/\[([0-9]+)\]/, "")
  682.             color = $1.to_i
  683.             if color >= 0 and color <= 7
  684.               self.contents.font.color = text_color(color)
  685.             end
  686.             c = ""
  687.           end
  688.           if c == "\002"
  689.             if @gold_window == nil and @popchar <= 0
  690.               @gold_window = Window_Gold.new
  691.               @gold_window.x = 560 - @gold_window.width
  692.               if $game_temp.in_battle
  693.                 @gold_window.y = 192
  694.               else
  695.                 @gold_window.y = self.y >= 128 ? 32 : 384
  696.               end
  697.               @gold_window.opacity = self.opacity
  698.               @gold_window.back_opacity = self.back_opacity
  699.             end
  700.             c = ""
  701.           end
  702.           if c == "\003"
  703.             @now_text.sub!(/\[([0-9]+)\]/, "")
  704.             speed = $1.to_i
  705.             if speed >= 0 and speed <= 19
  706.               @write_speed = speed
  707.             end
  708.             c = ""
  709.           end
  710.           if c == "\004"
  711.             @now_text.sub!(/\[(.*?)\]/, "")
  712.             buftxt = $1.dup.to_s
  713.             if buftxt.match(/\//) == nil and buftxt != "" then
  714.               $game_system.soundname_on_speak = "Audio/SE/" + buftxt
  715.             else
  716.               $game_system.soundname_on_speak = buftxt.dup
  717.             end
  718.             c = ""
  719.           elsif c == "\004"
  720.             c = ""
  721.           end
  722.           if c == "\005"
  723.             @write_wait += 5
  724.             c = ""
  725.           end
  726.           if c == "\006"
  727.             @write_wait += 20
  728.             c = ""
  729.           end
  730.           if c == "\016"
  731.             text_not_skip = false
  732.             c = ""
  733.           end
  734.           if c == "\017"
  735.             text_not_skip = true
  736.             c = ""
  737.           end
  738.           if c == "\020"
  739.             @mid_stop = true
  740.             c = ""
  741.           end
  742.           if c == "\021"
  743.             terminate_message
  744.             return
  745.           end
  746.           if c == "\023"
  747.             @indent = @x
  748.             c = ""
  749.           end
  750.           if c == "\024"
  751.             @now_text.sub!(/\[([0-9]+)\]/, "")
  752.             @opacity = $1.to_i
  753.             c = ""
  754.           end
  755.           if c == "\025"
  756.             @now_text.sub!(/\[([0-9]+)\]/, "")
  757.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  758.             c = ""
  759.           end
  760.           if c == "\026"
  761.             @now_text.sub!(/\[([0-9]+)\]/, "")
  762.             @x += $1.to_i
  763.             c = ""
  764.           end
  765.           if c == "\027"
  766.             @now_text.sub!(/\[(.*?)\]/, "")
  767.             @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  768.             if $game_system.soundname_on_speak != ""
  769.               Audio.se_play($game_system.soundname_on_speak)
  770.             end
  771.             c = ""
  772.           end
  773.           if c == "\030"
  774.             @now_text.sub!(/\[(.*?)\]/, "")
  775.             self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  776.            if $game_system.soundname_on_speak != ""
  777.               Audio.se_play($game_system.soundname_on_speak)
  778.             end
  779.             @x += 24
  780.             c = ""
  781.           end
  782.           if c == "\n"
  783.             if @lines >= $game_temp.choice_start
  784.               @cursor_width = [@cursor_width, @max_x - @face_indent].max
  785.             end
  786.             @lines += 1
  787.             @y += 1
  788.             @x = 0 + @indent + @face_indent
  789.             if @lines >= $game_temp.choice_start
  790.               @x = 8 + @indent + @face_indent
  791.             end
  792.             c = ""
  793.           end
  794.           if c != ""
  795.             # 文字描画
  796.             @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  797.             if $game_system.soundname_on_speak != "" then
  798.             Audio.se_play($game_system.soundname_on_speak)
  799.             end
  800.           end
  801.           if Input.press?(Input::C) and $game_switches[34]
  802.             text_not_skip = false
  803.           end
  804.           if Input.press?(Input::B)
  805.             text_not_skip = false
  806.           end
  807.         else
  808.           text_not_skip = true
  809.           break
  810.         end
  811.         # 終了判定
  812.         if text_not_skip
  813.           break
  814.         end
  815.       end
  816.       @write_wait += @write_speed
  817.       return
  818.     end
  819.     if @input_number_window != nil
  820.       @input_number_window.update
  821.       # 決定
  822.       if Input.trigger?(Input::C)
  823.         $game_system.se_play($data_system.decision_se)
  824.         $game_variables[$game_temp.num_input_variable_id] =
  825.         @input_number_window.number
  826.         $game_map.need_refresh = true
  827.         @input_number_window.dispose
  828.         @input_number_window = nil
  829.         terminate_message
  830.       end
  831.       return
  832.     end
  833.     if @contents_showing
  834.       if $game_temp.choice_max == 0
  835.         self.pause = true
  836.       end
  837.       # 取消
  838.       if Input.trigger?(Input::B)
  839.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  840.           $game_system.se_play($data_system.cancel_se)
  841.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  842.           terminate_message
  843.         end
  844.       end
  845.       # 決定
  846.       if Input.trigger?(Input::C)
  847.         if $game_temp.choice_max > 0
  848.           $game_system.se_play($data_system.decision_se)
  849.           $game_temp.choice_proc.call(self.index)
  850.         end
  851.         if @mid_stop
  852.           @mid_stop = false
  853.           return
  854.         else
  855.           terminate_message
  856.         end
  857.       end
  858.       return
  859.     end
  860.     if @fade_out == false and $game_temp.message_text != nil
  861.       @contents_showing = true
  862.       $game_temp.message_window_showing = true
  863.       refresh
  864.       Graphics.frame_reset
  865.       self.visible = true
  866.       self.contents_opacity = 0
  867.     if @input_number_window != nil
  868.       @input_number_window.contents_opacity = 0
  869.     end
  870.       @fade_in = true
  871.       return
  872.     end
  873.     if self.visible
  874.       @fade_out = true
  875.       self.opacity -= 48
  876.       if self.opacity == 0
  877.         self.visible = false
  878.         @fade_out = false
  879.         $game_temp.message_window_showing = false
  880.       end
  881.       return
  882.     end
  883.     #........................................................................
  884.   else
  885.    super
  886.    # 呼出模式下跟随事件移动
  887.    if @tale != nil
  888.      pos = get_fuki_pos(self.width, self.height)
  889.      self.x = pos[0]
  890.      self.y = pos[1]

  891.      tale_pos = get_tale_pos
  892.      @tale.x = tale_pos[0]
  893.      @tale.y = tale_pos[1]
  894.      
  895.      if @name_win != nil
  896.        name_pos = get_name_pos
  897.        @name_win.x = name_pos[0]
  898.        @name_win.y = name_pos[1]
  899.        case @face_pic_txt
  900.          when 0  # 文字
  901.            @name_contents.x = @name_win.x + 12
  902.            @name_contents.y = @name_win.y + 8
  903.          when 1  # 图片
  904.            @name_contents.x = @name_win.x + 2
  905.            @name_contents.y = @name_win.y + 2
  906.          end
  907.      end
  908.    end
  909.    
  910.    # 渐变的情况下
  911.    if @fade_in
  912.      self.contents_opacity += 24
  913.      if @name_win != nil
  914.        @name_win.opacity += 24
  915.      end
  916.      if @tale != nil
  917.        @tale.opacity += 24
  918.      end
  919.      if @input_number_window != nil
  920.        @input_number_window.contents_opacity += 24
  921.      end
  922.      if self.contents_opacity == 255
  923.        @fade_in = false
  924.      end
  925.      return
  926.    end
  927.    # 显示信息中的情况下
  928.    if @contents_drawing
  929.      refresh_drawtext
  930.      return
  931.    end
  932.    # 输入数值的情况下
  933.    if @input_number_window != nil
  934.      @input_number_window.update
  935.      # 确定
  936.      if Input.trigger?(Input::C)
  937.        $game_system.se_play($data_system.decision_se)
  938.        $game_variables[$game_temp.num_input_variable_id] =
  939.          @input_number_window.number
  940.        $game_map.need_refresh = true
  941.        # 释放输入数值窗口
  942.        @input_number_window.dispose
  943.        @input_number_window = nil
  944.        terminate_message
  945.      end
  946.      return
  947.    end
  948.    # 显示信息结束的情况下
  949.    if @contents_showing_end
  950.      # 不是显示选择项且不是呼出对话模式则显示暂停标志
  951.      if $game_temp.choice_max == 0 and @tale == nil
  952.        self.pause = true
  953.      else
  954.        self.pause = false
  955.      end
  956.      # 取消
  957.      if Input.trigger?(Input::B)
  958.        if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  959.          $game_system.se_play($data_system.cancel_se)
  960.          $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  961.          terminate_message
  962.        end
  963.      end
  964.      # 确定
  965.      if Input.trigger?(Input::C)
  966.        if $game_temp.choice_max > 0
  967.          $game_system.se_play($data_system.decision_se)
  968.          $game_temp.choice_proc.call(self.index)
  969.        end
  970.        terminate_message
  971.        # 释放呼出窗口
  972.        del_fukidasi
  973.      end
  974.      return
  975.    end
  976.    # 在渐变以外的状态下有等待显示的信息与选择项的场合
  977.    if @fade_out == false and $game_temp.message_text != nil
  978.      @contents_showing = true
  979.      $game_temp.message_window_showing = true
  980.      reset_window
  981.      refresh_create
  982.      if @name_win != nil
  983.        @name_win.opacity = 0
  984.      end
  985.      if @tale != nil
  986.        @tale.opacity = 0
  987.      end
  988.      Graphics.frame_reset
  989.      self.visible = true
  990.      self.contents_opacity = 0
  991.      if @input_number_window != nil
  992.        @input_number_window.contents_opacity = 0
  993.      end
  994.      @fade_in = true
  995.      return
  996.    end
  997.    # 没有可以显示的信息、但是窗口为可见的情况下
  998.    if self.visible
  999.      @fade_out = true
  1000.      self.opacity -= 48
  1001.      if @name_win != nil
  1002.        @name_win.opacity -= 48
  1003.      end
  1004.      if @tale != nil
  1005.        @tale.opacity -= 48
  1006.      end
  1007.      if self.opacity == 0
  1008.        self.visible = false
  1009.        @fade_out = false
  1010.        $game_temp.message_window_showing = false
  1011.        del_fukidasi
  1012.      end
  1013.      return
  1014.    end
  1015.   end
  1016. end

  1017. #--------------------------------------------------------------------------
  1018. # ● 透過文字描画 - 66rpg
  1019. #--------------------------------------------------------------------------
  1020. # target :描画対象。Bitmapクラスを指定。
  1021. # x :x座標
  1022. # y :y座標
  1023. # str  :描画文字列
  1024. # opacity:透過率(0~255)
  1025. # 返回値 :文字幅(@x増加値)。
  1026. #--------------------------------------------------------------------------
  1027. def opacity_draw_text(target, x, y, str,opacity)
  1028.    height = target.font.size
  1029.    width = target.text_size(str).width
  1030.    opacity = [[opacity, 0].max, 255].min
  1031.    if opacity == 255
  1032.      target.draw_text(x, y, width, height, str)
  1033.      return width
  1034.    else
  1035.      if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  1036.        @opacity_text_buf.dispose
  1037.        @opacity_text_buf = Bitmap.new(width, height)
  1038.      else
  1039.        @opacity_text_buf.clear
  1040.      end
  1041.      @opacity_text_buf.font.size = target.font.size
  1042.      @opacity_text_buf.draw_text(0, 0, width, height, str)
  1043.      target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  1044.    return width
  1045.    end
  1046. end
  1047. def ruby_draw_text(target, x, y, str,opacity)
  1048.    sizeback = target.font.size
  1049.    target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  1050.    rubysize = [rubysize, 6].max
  1051.    
  1052.    opacity = [[opacity, 0].max, 255].min
  1053.    split_s = str.split(/,/)
  1054.    
  1055.    split_s[0] == nil ? split_s[0] = "" : nil
  1056.    split_s[1] == nil ? split_s[1] = "" : nil
  1057.    
  1058.    height = sizeback + rubysize
  1059.    width = target.text_size(split_s[0]).width
  1060.    
  1061.    target.font.size = rubysize
  1062.    ruby_width = target.text_size(split_s[1]).width
  1063.    target.font.size = sizeback
  1064.    
  1065.    buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  1066.    
  1067.    width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  1068.    
  1069.    if opacity == 255
  1070.      target.font.size = rubysize
  1071.      target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  1072.      target.font.size = sizeback
  1073.      target.draw_text(x, y, width, target.font.size, split_s[0])
  1074.      return width
  1075.    else
  1076.      if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  1077.        @opacity_text_buf.dispose
  1078.        @opacity_text_buf = Bitmap.new(buf_width, height)
  1079.      else
  1080.        @opacity_text_buf.clear
  1081.      end
  1082.      @opacity_text_buf.font.size = rubysize
  1083.      @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  1084.      @opacity_text_buf.font.size = sizeback
  1085.      @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  1086.      if sub_x >= 0
  1087.        target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  1088.      else
  1089.        target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  1090.      end
  1091.      return width
  1092.    end
  1093. end

  1094. #--------------------------------------------------------------------------
  1095. # ● 释放
  1096. #--------------------------------------------------------------------------
  1097. def dispose
  1098.   if $game_switches[33]
  1099.    #........................................................................
  1100.    terminate_message
  1101.    if @gaiji_cache != nil
  1102.      unless @gaiji_cache.disposed?
  1103.        @gaiji_cache.dispose
  1104.      end
  1105.    end
  1106.    unless @opacity_text_buf.disposed?
  1107.      @opacity_text_buf.dispose
  1108.    end
  1109.    $game_temp.message_window_showing = false
  1110.    if @input_number_window != nil
  1111.      @input_number_window.dispose
  1112.    end
  1113.    super
  1114.    #........................................................................
  1115.   else
  1116.    terminate_message
  1117.    $game_temp.message_window_showing = false
  1118.    if @input_number_window != nil
  1119.      @input_number_window.dispose
  1120.    end
  1121.    super
  1122.   end
  1123. end

  1124. #--------------------------------------------------------------------------
  1125. # ● 信息结束处理
  1126. #--------------------------------------------------------------------------
  1127. def terminate_message
  1128.   if $game_switches[33]
  1129.    #........................................................................
  1130.    self.active = false
  1131.    self.pause = false
  1132.    self.index = -1
  1133.    self.contents.clear
  1134.    # 清除显示中标志
  1135.    @contents_showing = false
  1136.    # 呼叫信息调用
  1137.    if $game_temp.message_proc != nil
  1138.      $game_temp.message_proc.call
  1139.    end
  1140.    # 清除文章、选择项、输入数值的相关变量
  1141.    $game_temp.message_text = nil
  1142.    $game_temp.message_proc = nil
  1143.    $game_temp.choice_start = 99
  1144.    $game_temp.choice_max = 0
  1145.    $game_temp.choice_cancel_type = 0
  1146.    $game_temp.choice_proc = nil
  1147.    $game_temp.num_input_start = 99
  1148.    $game_temp.num_input_variable_id = 0
  1149.    $game_temp.num_input_digits_max = 0
  1150.    # 开放金钱窗口
  1151.    if @gold_window != nil
  1152.      @gold_window.dispose
  1153.      @gold_window = nil
  1154.    end
  1155.    if @name_window_frame != nil
  1156.      @name_window_frame.dispose
  1157.      @name_window_frame = nil
  1158.    end
  1159.    if @name_window_text != nil
  1160.      @name_window_text.dispose
  1161.      @name_window_text = nil
  1162.    end
  1163.    if @right_picture != nil and @right_keep == true
  1164.      @right_picture.dispose
  1165.    end   
  1166.    if @left_picture != nil and @left_keep == true
  1167.      @left_picture.dispose
  1168.    end
  1169.    #........................................................................
  1170.   else
  1171.    self.active = false
  1172.    self.pause = false
  1173.    self.index = -1
  1174.    self.contents.clear
  1175.    # 清除显示中标志
  1176.    @contents_showing = false
  1177.    @contents_showing_end = false
  1178.    # 呼叫信息调用
  1179.    if $game_temp.message_proc != nil
  1180.      $game_temp.message_proc.call
  1181.    end
  1182.    # 清除文章、选择项、输入数值的相关变量
  1183.    $game_temp.message_text = nil
  1184.    $game_temp.message_proc = nil
  1185.    $game_temp.choice_start = 99
  1186.    $game_temp.choice_max = 0
  1187.    $game_temp.choice_cancel_type = 0
  1188.    $game_temp.choice_proc = nil
  1189.    $game_temp.num_input_start = 99
  1190.    $game_temp.num_input_variable_id = 0
  1191.    $game_temp.num_input_digits_max = 0
  1192.    # 释放金钱窗口
  1193.    if @gold_window != nil
  1194.      @gold_window.dispose
  1195.      @gold_window = nil
  1196.    end
  1197.   end
  1198. end

  1199. #--------------------------------------------------------------------------
  1200. # ● 刷新光标矩形
  1201. #--------------------------------------------------------------------------
  1202. def update_cursor_rect
  1203.   if $game_switches[33]
  1204.    #.........................................................................
  1205.    if @index >= 0
  1206.      n = $game_temp.choice_start + @index
  1207.      self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  1208.    else
  1209.      self.cursor_rect.empty
  1210.    end
  1211.    #.........................................................................
  1212.   else
  1213.    if @index >= 0
  1214.      n = $game_temp.choice_start + @index
  1215.      self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  1216.    else
  1217.      self.cursor_rect.empty
  1218.    end
  1219.   end
  1220. end
  1221. #--------------------------------------------------------------------------
  1222. # ● 取得普通文字色
  1223. #--------------------------------------------------------------------------
  1224. def normal_color
  1225.    nil_color = Color.new(0,0,0,0)
  1226.    if FUKI::FUKI_COLOR != nil_color
  1227.      color = FUKI::FUKI_COLOR
  1228.    else
  1229.      color = super
  1230.    end
  1231.    return color
  1232. end
  1233. end

  1234. #==============================================================================
  1235. # ■ Interpreter
  1236. #==============================================================================

  1237. class Interpreter
  1238. #--------------------------------------------------------------------------
  1239. # ● 设置事件
  1240. #     event_id : 事件 ID
  1241. #--------------------------------------------------------------------------
  1242. alias setup_fuki setup
  1243. def setup(list, event_id)
  1244.    setup_fuki(list, event_id)
  1245.    # 如果不是战斗中
  1246.    if !($game_temp.in_battle)
  1247.      # 记录事件 ID
  1248.      $active_event_id = event_id
  1249.    end
  1250. end
  1251. end

  1252. #==============================================================================
  1253. # ■ Scene_Map
  1254. #==============================================================================

  1255. class Scene_Map
  1256. #--------------------------------------------------------------------------
  1257. # ● 主处理
  1258. #--------------------------------------------------------------------------
  1259. def main
  1260.    # 生成活动块
  1261.    @spriteset = Spriteset_Map.new
  1262.    # 生成信息窗口
  1263.    @message_window = Window_FukiMessage.new
  1264.    # 执行过渡
  1265.    Graphics.transition
  1266.    # 主循环
  1267.    loop do
  1268.      # 刷新游戏画面
  1269.      Graphics.update
  1270.      # 刷新输入信息
  1271.      Input.update
  1272.      # 刷新画面
  1273.      update
  1274.      # 如果画面切换的话就中断循环
  1275.      if $scene != self
  1276.        break
  1277.      end
  1278.    end
  1279.    # 准备过渡
  1280.    Graphics.freeze
  1281.    # 释放活动块
  1282.    @spriteset.dispose
  1283.    # 释放信息窗口
  1284.    @message_window.dispose
  1285.    # 标题画面切换中的情况下
  1286.    if $scene.is_a?(Scene_Title)
  1287.      # 淡入淡出画面
  1288.      Graphics.transition
  1289.      Graphics.freeze
  1290.    end
  1291. end
  1292. end

  1293. #==============================================================================
  1294. # ■ Window_InputNumber
  1295. #==============================================================================

  1296. class Window_InputNumber < Window_Base
  1297. #--------------------------------------------------------------------------
  1298. # ● 初始化对像
  1299. #     digits_max : 位数
  1300. #--------------------------------------------------------------------------
  1301. def initialize(digits_max)
  1302.    @digits_max = digits_max
  1303.    @number = 0
  1304.    # 从数字的幅度计算(假定与 0~9 等幅)光标的幅度
  1305.    dummy_bitmap = Bitmap.new(32, 32)
  1306.    dummy_bitmap.font.size = FUKI::MES_FONT_SIZE
  1307.    @cursor_width = dummy_bitmap.text_size("0").width + 8
  1308.    dummy_bitmap.dispose
  1309.    super(0, 0, @cursor_width * @digits_max + 32, 64)
  1310.    self.contents = Bitmap.new(width - 32, height - 32)
  1311.    self.contents.font.size = FUKI::MES_FONT_SIZE
  1312.    self.z += 9999
  1313.    self.opacity = 0
  1314.    @index = 0
  1315.    refresh
  1316.    update_cursor_rect
  1317. end
  1318. end
复制代码

Lv1.梦旅人

梦石
0
星屑
50
在线时间
29 小时
注册时间
2010-9-4
帖子
36
发表于 2011-8-3 15:52:03 | 显示全部楼层
本帖最后由 uniquetruth 于 2011-8-3 15:54 编辑

第二段脚本,731和732行之间加一行:
Audio.se_stop

我在单纯的66加强对话脚本里试过,没用过LZ的这套脚本
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 17:06

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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