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

Project1

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

[有事请教] 对话框加强版的选择项问题

[复制链接]

Lv2.观梦者

梦石
0
星屑
800
在线时间
166 小时
注册时间
2019-6-11
帖子
52
跳转到指定楼层
1
发表于 2019-7-3 23:43:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 丝月 于 2019-7-4 00:00 编辑

关于对话框加强版的选项框问题有几个。
下载的范例没有第1,2的问题出现。
问题1:事件里编辑选项框。写完第一个聊天框后,在下一行里打开事件指令-选项的显示。
是,否的选项都有。然后确定。
接着测试游戏后,发现那个第一个聊天框的字都有,然后下面是选项,是否各一行。
然后是聊天框最右上方也有显示选项框,但是只有一行的‘’否“的选项,没有‘’‘是‘’的选项啊~怎么会这样。
问题2:测试游戏,选项一出来可选择的动态框框直接是在最右上的选项框里的。因为只显示一行。否的选项,
可编辑事件里可得到东西的只有‘’是‘’的选项。没有‘’否‘’的选项。这是个加强版对话的BUG吗?
问题3:这个脚本可否实现只有最右上的选项框的信息出现,聊天框里多出了两个是否的选项信息怎么去除呢?而且那个选项信息没有办法选择。
只能用选择框框选择最右上方的。
所以,我还想问下,最右上的那个选择框如歌更改到画面中间呢。而且还有如果加宽度和高度的。
明显,这个加强版的选项框,只能显示一行选择,其余的选项都没看到啊~
是不是BUG的问题?
就在vx妖精图书馆里的。
在线等~~有点急需这个问题的解决办法~
脚本如下:
  1. #==============================================================================
  2. # ■ [VX] 对话框加强版
  3. #    [VX] Window_message Plus
  4. #----------------------------------------------------------------------------
  5. # 此脚本可代替官方 Window_Message 全脚本
  6. #----------------------------------------------------------------------------
  7. # 使用说明:
  8. #
  9. #   ⑴ 对话框第一行输入引号内文字"名称:",脚本会把名称提取出来美化显示
  10. #      例如"张三:",显示为"【张三】" ,美化符可在参数设定中修改
  11. #
  12. #   ⑵ 默认头像在左边显示
  13. #      当您需要右边显示时,在第一行输入的名称时加"\r"(大小写不限)
  14. #      例: "拉尔夫\r:"
  15. #          请注意此时头像将进行左右翻转显示
  16. #
  17. #   ⑶ 在对话中更改字体的方法:
  18. #       \f[sX]:更改字号为X
  19. #       \f[nX]:更改字体名称为"预设字体库"第X号字体(预设字体库请看参数设定)
  20. #              更改字体名称失败(无指定字体或字体损坏)时,启用游戏默认字体
  21. #       \f[cX]:更改字色为第X号颜色 (text_color中的定义)
  22. #       \f[c#FF0000]:使用16进制指定字体颜色,如本句表示红色
  23. #       \f[aX]:更改字体附加效果为第X号效果
  24. #       附加样式列表:
  25. #         X=0 :无附加; X=1 :阴影字; X=2 :粗体字;
  26. #         X=4 :斜体字; X=8 :描边字; X=16:发光字
  27. #              叠加效果即数字相加,示例: 3:阴影+粗体  14:粗体+斜体+描边
  28. #              注意!此三种效果互斥: 阴影/描边/发光
  29. #
  30. #   ⑷ 在对话中显示(技能 物品 武器 防具)图标和名称的方法:
  31. #       \s[X]: 显示第X号技能图标和名称
  32. #       \i[X]: 显示第X号物品图标和名称
  33. #       \w[X]: 显示第X号武器图标和名称
  34. #       \a[X]: 显示第X号防具图标和名称
  35. #
  36. #   ⑸ 在对话中更改文字不透明度的方法:
  37. #       \o[X]: 把文字不透明度更改为X (取值范围在0~255)
  38. #
  39. #   ⑹ 指定时间后自动关闭对话框的方法:
  40. #       \x[X]: 对话框将在X帧后自动关闭
  41. #       \x:    省略参数时,将于AutoClose帧后自动关闭(AutoClose值在参数设定中)
  42. #
  43. #   ⑺ 调整文字显示速度的方法:
  44. #       \p[X]: 文字在X帧后显示
  45. #
  46. #   ⑻ 对话中更换对话框皮肤(或直接使用图片)的方法:
  47. #       \b[X]: 更改字体名称为"预设样式库"第X号样式 (预设样式库请看参数设定)
  48. #              注: vx对话框可使用Window皮肤或直接使用图片,请配合事件页设定
  49. #
  50. #      素材格式和命名规则:
  51. #       在对应的Window皮肤或对话框图片的文件名后+"_pause",做为自定义暂停标记
  52. #       的名称,并和对应皮肤或图片文件放在一起.
  53. #
  54. #   ⑼ 启用头像动态显示的方法:
  55. #       \e[X]: 设定头像动态显示的值为X
  56. #       X=0 :关闭动态效果; X=1 :水平趋中; X=2 :渐显
  57. #
  58. #   ⑽ 在对话中更换头像:
  59. #       \@[X]: 设定头像索引号为X X值范围0-7
  60. #              可更改的仅是索引号,头像文件名称不可改 主要用于对话中换表情
  61. #
  62. #   ⑾ 输入文章时设定冻结字符和注释字符:
  63. #       #[XX]: 字符串XX被冻结,不受转义等影响直接显示
  64. #       #<XX>: 字符串XX被当作注释,显示文章时不出现
  65. #------------------------------------------------------------------------------
  66. # 素材要求:
  67. #
  68. #   ① 采用vx默认头像素材(Graphics\Faces)的格式
  69. #      即每个素材文件由2行4列共8格头像组成
  70. #
  71. #   ② 要求所有头像朝向一致(默认是正面偏右)
  72. #
  73. #   ③ 自定义暂停标记的素材采用横向多帧格式,每帧图片大小一致
  74. #      注意: 帧数在脚本参数中设定.
  75. #      在对应的Window皮肤或对话框图片的文件名后+"_pause",做为自定义暂停标记
  76. #      的名称,并和对应皮肤或图片文件放在一起.
  77. #------------------------------------------------------------------------------
  78. # 合并功能附加说明:
  79. #
  80. #   ① 对话框合并
  81. #      头像、背景、位置等相同的上下两段对话都会被合并成一段对话;
  82. #      如果要打断合并,请在两段对话之间加个非对话框的执行项,比如空注释.
  83. #
  84. #   ② 选择项合并
  85. #      当前选项组满4项,且取消设定不为"分歧",且下一个执行项也是选择组,就合并;
  86. #      取消键的规定: 如果有"分歧",必须设定在最后一个选项组,其它不限.
  87. #                    合并后最多只有一个取消设定,多个设定时,仅最后一个有效.
  88. #----------------------------------------------------------------------------
  89. #    更新作者: 沉影不器
  90. #    许可协议: FSL
  91. #    项目版本: 1.09.1031
  92. #    引用网址: http://bbs.66rpg.com/thread-158161-1-1.html
  93. #----------------------------------------------------------------------------
  94. #    - *1.09.1031* (2010-10-31) By 沉影不器
  95. #      *新增 指定被冻结的字符串
  96. #      *新增 允许字符串做为注释
  97. #
  98. #    - *1.08.1030* (2010-10-30) By 沉影不器
  99. #      *新增 对话中更改头像
  100. #      *新增 允许指定16进制颜色为字色
  101. #      *修改 取消对话中切换[是否独立显示选项窗体]的开关
  102. #
  103. #    - *1.07.1029* (2010-10-29) By 沉影不器
  104. #      *优化 重写合并选择项的功能,大幅降低冲突
  105. #
  106. #    - *1.06.1026* (2010-10-26) By 沉影不器
  107. #      *修改 头像在右的控制符改为"\r"(大小写不限)
  108. #      *优化 改变字体失败时使用默认字体
  109. #      *新增 允许独立显示选项窗体
  110. #      *新增 合并多个事件页选项(突破4选项上限)
  111. #
  112. #    - *1.05.1007* (2010-10-07) By 沉影不器
  113. #      *修复 冒号被脚本占用而无法显示
  114. #      *优化 预处理部分数据
  115. #      *新增 自定义暂停标记
  116. #      *新增 全局和局部字速调整
  117. #      *新增 支持滚动显示多行对话内容
  118. #      *新增 显示动画功能(数据库动画/心情动画)
  119. #
  120. #    - *1.04.0207* (2009-02-07) By 沉影不器
  121. #      *新增 字体附加效果:发光字
  122. #      *新增 更换对话皮肤功能
  123. #      *新增 头像动态显现功能
  124. #
  125. #    - *1.03.1107* (2008-11-07) By 沉影不器
  126. #      *优化 字体附加效果的叠加方法
  127. #      *新增 字体附加效果:斜体字
  128. #
  129. #    - *1.02.1023* (2008-10-23) By 沉影不器
  130. #      *修复 自动关闭对话框时可能存在的关闭延后生效
  131. #      *新增 字体附加效果:无效果、阴影字、粗体字、描边字
  132. #      *新增 更改字体无效时,使用游戏默认字体
  133. #
  134. #    - *1.01.0911* (2008-09-11) By 沉影不器
  135. #      *新增 更改字体功能
  136. #      *新增 显示(技能 物品 武器 防具)图标和名称
  137. #      *新增 更改文字不透明度
  138. #      *新增 自动关闭对话框
  139. #
  140. #    - *1.00.0831* (2008-08-31) By 沉影不器
  141. #      *初版
  142. #==============================================================================
  143. $fscript = {} if $fscript == nil
  144. $fscript["Window_message_Plus"] = "1.09.1031"
  145. #----------------------------------------------------------------------------
  146. # ▼ 通用配置模块
  147. #----------------------------------------------------------------------------
  148. module FSL
  149.   module Window_message_Plus
  150.     ## 对话框的预设样式库(其中"Window"和"MessageBack"是vx默认样式)
  151.     Msg_StyleLib = {0=>["Window","Sinicism"],   ## Window皮肤
  152.                     1=>["MessageBack","Black"]} ## 图片皮肤

  153.     ## 字体参数.第一个黑体
  154.     Font_Lib = ["印品工版宋", "仿宋_GB2312", "幼圆"]  ## 预设字体库
  155.     Font_Space = 4                              ## 字间距
  156.     EdgeColor = 15                              ## 描边颜色
  157.     GlowColor = 10                              ## 发光颜色
  158.    
  159.     ## 名称条参数
  160.     Name_Symbol = "【】"         ## 为名称添加的修饰符(一对)
  161.     Name_SpaceX = 6              ## 名称条宽度缩进值
  162.     Name_SpaceY = 6              ## 名称与对话内容之间的附加距离
  163.     Name_FontIndex = 0           ## 名称文字字体在预设字体库中的序号
  164.     Name_FontSize = 18           ## 名称文字字号18
  165.     Name_FontColor = 16          ## 名称文字颜色
  166.     Name_FontAdj = 1             ## 名称文字附加效果
  167.     NameBar_Color = 0            ## 名称背景条颜色
  168.     NameBar_Opacity = 64         ## 名称背景条透明度
  169.    
  170.     ## 头像参数
  171.     Face_Enter = 0               ## 头像显示模式
  172.     Face_EnterRate = 12          ## 头像进入画面的时间   
  173.     Face_AdjX = 6                ## 头像横坐标微调
  174.     Face_AdjY = -6               ## 头像纵坐标微调
  175.     Face_Align = 2               ## 头像垂直对齐方式
  176.                                  ## 0:顶端对齐; 1:居中对齐; 2:底端对齐

  177.     ## 对话框参数
  178.     Msg_FontName = 1             ## 对话文字字体在预设字体库中的序号
  179.     Msg_FontSize = 18            ## 对话文字字号16
  180.     Msg_FontColor = 0            ## 对话文字颜色
  181.     Msg_FontPlus = 1             ## 对话文字附加效果
  182.    
  183.     ## 全局功能参数
  184.     FastShow = true              ## 确定键快速显示文字
  185.     AutoClose = 80               ## 默认自动关闭时间(以帧计时)
  186.     GlobalSpeed = 0              ## 改变全局文字延时(以帧计时)
  187.    
  188.     ## 自定义暂停标记
  189.     Pause_Custom = 3    ## 位置(0:不使用 1:底边居中 2:右下角 3:跟随文字)
  190.     Pause_AdjX = -2     ## X坐标微调
  191.     Pause_AdjY = -2     ## Y坐标微调
  192.     Pause_AniCyc = 6    ## 动画周期
  193.     Pause_AniFrm = 4    ## 动画帧数
  194.    
  195.     ## 对话和选择项合并.Wait = 30.MaxLines = 4
  196.     MultiLinesWait = 0 ## 滚动显示对话的等待时间(0表示禁止合并多段对话)
  197.     Choice_Strip = true ## 是否单独显示选项窗体
  198.                         ## 注: 选择项合并功能仅在单独显示的选项窗体生效
  199.     Choice_MaxLines = 0 ## 选项窗体的最大行数(0表示禁止合并多段选择项)
  200.                         ## 注: 本参数仅在单独显示选项窗体时生效
  201.   end
  202. end
  203. #==============================================================================
  204. # ■ Window_Message
  205. #==============================================================================
  206. class Window_Message < Window_Selectable
  207.   include FSL::Window_message_Plus
  208.   #--------------------------------------------------------------------------
  209.   # ● 常量
  210.   #--------------------------------------------------------------------------
  211.   MAX_LINE = 4                            # 最大行数
  212.   #--------------------------------------------------------------------------
  213.   # ◎ 初始化对象
  214.   #--------------------------------------------------------------------------
  215.   def initialize
  216.     h = [Name_FontSize,Msg_FontSize].max + Name_SpaceY +
  217.          (Msg_FontSize+Font_Space)*(MAX_LINE-1) + 34
  218.     y = Graphics.height - h
  219.     super(0, y, Graphics.width, h)
  220.     self.z = 200
  221.     self.active = false
  222.     self.index = -1
  223.     self.openness = 0
  224.     @opening = false            # 窗体正在打开的标志
  225.     @closing = false            # 窗体正在关闭的标志
  226.     @text = nil                 # 已经没有可显示的文章
  227.     @contents_x = 0             # 下一条文字描绘的 X 坐标
  228.     @contents_y = 0             # 下一条文字描绘的 Y 坐标
  229.     @line_count = 0             # 现在描绘的行数
  230.     @wait_count = 0             # 等待计数
  231.     @background = 0             # 背景类型
  232.     @position = 2               # 显示位置
  233.     @show_fast = false          # 快速显示标志
  234.     @line_show_fast = false     # 以行为单位快速显示
  235.     @pause_skip = false         # 省略等待输入标志
  236.     ## 冻结字符池
  237.     @frozen_char = []
  238.     ## 显示名称
  239.     @show_name = false
  240.     ## 自定义暂停标记
  241.     @custom_pause = false if Pause_Custom > 0
  242.     ## 多行对话框标记
  243.     @multi_lines = false
  244.     ## 字体附加效果
  245.     @font_adj = Msg_FontPlus
  246.     create_gold_window
  247.     create_number_input_window
  248.     create_back_sprite
  249.     ## 头像左右判断
  250.     @show_right = false
  251.     ## 头像宽度
  252.     @face_width = 0
  253.     ## 生成自定义暂停标记
  254.     create_custom_pause
  255.     ## 生成名称背景条
  256.     create_namebar_sprite
  257.     ## 生成头像
  258.     create_face_sprite
  259.     ## 修改默认字体
  260.     contents.font = default_font
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 释放
  264.   #--------------------------------------------------------------------------
  265.   def dispose
  266.     super
  267.     dispose_gold_window
  268.     dispose_number_input_window
  269.     dispose_back_sprite
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ◎ 更新画面
  273.   #--------------------------------------------------------------------------
  274.   def update
  275.     super
  276.     update_gold_window
  277.     update_number_input_window
  278.     update_back_sprite
  279.     update_show_fast
  280.     ## 更新自定义暂停标记
  281.     update_custom_pause
  282.     unless @opening or @closing             # 除窗体关闭以外
  283.       if @wait_count > 0                    # 文章内等待中
  284.         @wait_count -= 1
  285.       elsif @multi_lines
  286.         scroll_line
  287.       elsif custom_pause                    # 等待文章翻页待机中
  288.         input_pause
  289.       elsif self.active || @choice         ## 正在输入选择项
  290.         input_choice
  291.       elsif @number_input_window.visible    # 正在输入数值
  292.         input_number
  293.       elsif @text != nil                    # 还有剩余的文章
  294.         update_message                        # 更新消息
  295.       elsif continue?                       # 继续的情况
  296.         start_message                         # 开始消息
  297.         open                                  # 打开窗体
  298.         $game_message.visible = true
  299.       else                                  # 不继续的情况
  300.         close                                 # 关闭窗体
  301.         $game_message.visible = @closing
  302.       end
  303.     end
  304.     ## 头像动态显现
  305.     if @face_sprite.visible
  306.       ## 水平趋中
  307.       result =  @face_x <=> @face_sprite.x
  308.       x_enter = [(@face_x - @face_sprite.x).abs,Face_EnterRate].min
  309.       @face_sprite.x += x_enter if result > 0
  310.       @face_sprite.x -= x_enter if result < 0
  311.       ## 渐显
  312.       @face_sprite.opacity += Face_EnterRate if @face_sprite.opacity < 255
  313.     end
  314.     ## 自动关闭对话框
  315.     if @auto_close != nil
  316.       if @auto_close > 0
  317.         @auto_close -= 1
  318.       else
  319.         terminate_message
  320.       end
  321.     end
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ◎ 生成所持金窗体
  325.   #--------------------------------------------------------------------------
  326.   def create_gold_window
  327.     @gold_window = Window_Gold.new(384, 0)
  328.     @gold_window.openness = 0
  329.     ## 统一字体
  330.     @gold_window.contents.font = default_font
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ◎ 生成数值输入窗体
  334.   #--------------------------------------------------------------------------
  335.   def create_number_input_window
  336.     @number_input_window = Window_NumberInput.new
  337.     @number_input_window.visible = false
  338.     ## 统一字体
  339.     @number_input_window.contents.font = default_font
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ● 生成背景活动块
  343.   #--------------------------------------------------------------------------
  344.   def create_back_sprite
  345.     @back_sprite = Sprite.new
  346.     @back_sprite.bitmap = Cache.system("MessageBack")
  347.     @back_sprite.visible = (@background == 1)
  348.     @back_sprite.z = 190
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ● 释放所持金窗体
  352.   #--------------------------------------------------------------------------
  353.   def dispose_gold_window
  354.     @gold_window.dispose
  355.   end
  356.   #--------------------------------------------------------------------------
  357.   # ● 释放数值输入窗体
  358.   #--------------------------------------------------------------------------
  359.   def dispose_number_input_window
  360.     @number_input_window.dispose
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # ● 释放背景活动块
  364.   #--------------------------------------------------------------------------
  365.   def dispose_back_sprite
  366.     @back_sprite.dispose
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   # ● 更新所持金窗体
  370.   #--------------------------------------------------------------------------
  371.   def update_gold_window
  372.     @gold_window.update
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ● 更新数值输入窗体
  376.   #--------------------------------------------------------------------------
  377.   def update_number_input_window
  378.     @number_input_window.update
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● 更新背景活动块
  382.   #--------------------------------------------------------------------------
  383.   def update_back_sprite
  384.     @back_sprite.visible = (@background == 1)
  385.     @back_sprite.y = y - 16
  386.     @back_sprite.opacity = openness
  387.     @back_sprite.update
  388.   end
  389.   #--------------------------------------------------------------------------
  390.   # ◎ 更新快速显示标志
  391.   #--------------------------------------------------------------------------
  392.   def update_show_fast
  393.     if custom_pause or self.openness < 255
  394.       @show_fast = false
  395.     elsif Input.trigger?(Input::C)
  396.       if FastShow ## 快速显示文字
  397.         @show_fast = true
  398.         @wait_count = 0
  399.       end
  400.     elsif not Input.press?(Input::C)
  401.       @show_fast = false
  402.     end
  403.     if @show_fast and @wait_count > 0
  404.       @wait_count -= 1
  405.     end
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● 判断下一消息继续显示
  409.   #--------------------------------------------------------------------------
  410.   def continue?
  411.     return true if $game_message.num_input_variable_id > 0
  412.     return false if $game_message.texts.empty?
  413.     if self.openness > 0 and not $game_temp.in_battle
  414.       return false if @background != $game_message.background
  415.       return false if @position != $game_message.position
  416.     end
  417.     return true
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # ◎ 开始显示消息
  421.   #--------------------------------------------------------------------------
  422.   def start_message
  423.     ## 重设窗体背景与位置
  424.     reset_window
  425.     ## 还原头像左右判断
  426.     @show_right = false
  427.     ## 暂存消息
  428.     temp_texts = []
  429.     $game_message.texts.each do |text|
  430.       tmp = text.clone
  431.       ## 判断对话框皮肤
  432.       if tmp.sub!(/\\B\[(\d+)\]/i) { "" }
  433.         filename = Msg_StyleLib[@background][$1.to_i]
  434.         if @background == 0
  435.           self.windowskin = Cache.system(filename)
  436.           if Pause_Custom>0 && !@pause_sprite.nil? && !@pause_sprite.disposed?
  437.             @pause_sprite.bitmap = Cache.system(filename + "_pause")
  438.           end
  439.         else
  440.           @back_sprite.bitmap = Cache.system(filename)
  441.           if Pause_Custom>0 && !@pause_sprite.nil? && !@pause_sprite.disposed?
  442.             @pause_sprite.bitmap = Cache.system(filename + "_pause")
  443.           end
  444.         end
  445.         ## 开始自定义暂停标记动画
  446.         @pause_aniindex = -1
  447.       end
  448.       ## 判断头像显现
  449.       @face_enter = $1.to_i if tmp.sub!(/\\E\[(\d+)\]/i) { "" }
  450.       temp_texts.push(tmp)
  451.     end
  452.     ## 判断头像方向
  453.     if !temp_texts[0].nil? and temp_texts[0].sub!(/\\R/i){ "" }
  454.       @show_right = true
  455.     end
  456.     ## 判断名称
  457.     if temp_texts[0] != nil and temp_texts[0] =~ /[::]/
  458.       if temp_texts[0] =~ /\\[::]/
  459.         ## 忽略名称的处理
  460.         temp_texts[0].sub!(/\\:/)  { ":" }
  461.         temp_texts[0].sub!(/\\:/) { ":" }
  462.       else
  463.         ## 去冒号加修饰符(可选)
  464.         unless Name_Symbol.empty?
  465.           temp_texts[0].sub!(/[::]/) { "" }
  466.           temp_texts[0] = Name_Symbol[0,Name_Symbol.size/2] +
  467.           temp_texts[0] + Name_Symbol[Name_Symbol.size/2,Name_Symbol.size/2]
  468.         end
  469.         ## 设定文字颜色
  470.         temp_texts[0] = "\\C[#{Name_FontColor}]" +
  471.         temp_texts[0] + "\\C[#{Msg_FontColor}]"
  472.         ## 设定文字字体
  473.         temp_texts[0] = "\\F[N#{Name_FontIndex}]" +
  474.         temp_texts[0] + "\\F[N#{Msg_FontName}]"
  475.         ## 设定文字大小
  476.         temp_texts[0] = "\\F[S#{Name_FontSize}]" +
  477.         temp_texts[0] + "\\F[S#{Msg_FontSize}]"
  478.         ## 设定文字附加效果
  479.         temp_texts[0] = "\\F[A#{Name_FontAdj}]" +
  480.         temp_texts[0] + "\\F[A#{Msg_FontPlus}]"
  481.         ## 显示名称背景条
  482.         show_namebar_sprite
  483.       end
  484.     end
  485.     @text = ""
  486.     for i in 0...temp_texts.size
  487.       @text += "  " if i >= $game_message.choice_start
  488.       @text += temp_texts[i].clone + "\x00"
  489.     end
  490.     @item_max = $game_message.choice_max
  491.     convert_special_characters
  492.     new_page
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ◎ 更换页面处理
  496.   #--------------------------------------------------------------------------
  497.   def new_page
  498.     contents.clear
  499.     ## 初始化文字描绘起点
  500.     @contents_x = 0
  501.     ## 除名称外文字右移1字符
  502.     @contents_x += Msg_FontSize+Font_Space unless @show_name
  503.     if $game_message.face_name.empty?
  504.       @face_sprite.bitmap.clear
  505.     else
  506.       name = $game_message.face_name
  507.       index = $game_message.face_index
  508.       ## 获取头像宽度
  509.       set_face_width(name)
  510.       ## 计算文字横坐标起始
  511.       @contents_x += @face_width-16 unless @show_right
  512.       draw_msg_face(name, index)
  513.       ## 头像进入画面
  514.       face_in
  515.     end
  516.     @contents_y = 0
  517.     @line_count = 0
  518.     @show_fast = false
  519.     @line_show_fast = false
  520.     @pause_skip = false
  521.     contents.font.color = text_color(0)
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ◎ 换行处理
  525.   #--------------------------------------------------------------------------
  526.   def new_line
  527.     ## 提前处理自定义暂停标记
  528.     set_custom_pause_pos
  529.     @contents_x = 0
  530.     unless $game_message.face_name.empty?
  531.       ## 头像显示在左时
  532.       @contents_x = @face_width-16 unless @show_right
  533.     end
  534.     ## 除名称外文字右移1字符
  535.     @contents_x += (Msg_FontSize+Font_Space)
  536.     ## 显示名称之后,对话内容下移 Name_SpaceY
  537.     @contents_y += Name_SpaceY if @line_count == 0 and @show_name
  538.     ## 以字号为新间距
  539.     @contents_y += (Msg_FontSize+Font_Space)
  540.     @line_count += 1
  541.     @line_show_fast = false
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # ◎ 特殊文字变换
  545.   #--------------------------------------------------------------------------
  546.   def convert_special_characters
  547.     ## 特定字符处理
  548.     @text.gsub!(/#\[(.*?)\]/)    {@frozen_char.push($1); "\xff"}
  549.     @text.gsub!(/#\<(.*?)\>/)    {""}
  550.     ## 默认控制符
  551.     @text.gsub!(/\\V\[(\d+)\]/i) {$game_variables[$1.to_i]}
  552.     @text.gsub!(/\\V\[(\d+)\]/i) {$game_variables[$1.to_i]}
  553.     @text.gsub!(/\\N\[(\d+)\]/i) {$game_actors[$1.to_i].name}
  554.     @text.gsub!(/\\C\[(\d+)\]/i) {"\x01[#{$1}]"}
  555.     @text.gsub!(/\\G/)           {"\x02"}
  556.     @text.gsub!(/\\\./)          {"\x03"}
  557.     @text.gsub!(/\\\|/)          {"\x04"}
  558.     @text.gsub!(/\\!/)           {"\x05"}
  559.     @text.gsub!(/\\>/)           {"\x06"}
  560.     @text.gsub!(/\\</)           {"\x07"}
  561.     @text.gsub!(/\\\^/)          {"\x08"}
  562.     @text.gsub!(/\\\\/)          {"\\"}
  563.     ## 更改不透明度
  564.     @text.gsub!(/\\O\[(\d+)\]/i) {"\x09[#{$1}]"}
  565.     ## 显示数据库元素
  566.     @text.gsub!(/\\S\[(\d+)\]/i) {"\x0a[#{$1}]" + $data_skills[$1.to_i].name}
  567.     @text.gsub!(/\\I\[(\d+)\]/i) {"\x0b[#{$1}]" + $data_items[$1.to_i].name}
  568.     @text.gsub!(/\\W\[(\d+)\]/i) {"\x0c[#{$1}]" + $data_weapons[$1.to_i].name}
  569.     @text.gsub!(/\\A\[(\d+)\]/i) {"\x0d[#{$1}]" + $data_armors[$1.to_i].name}
  570.     ## 更改字体
  571.     @text.gsub!(/\\F\[S(\d+)\]/i){"\x0e[#{$1}]"}
  572.     @text.gsub!(/\\F\[N(\d+)\]/i){"\x0f[#{$1}]"}
  573.     @text.gsub!(/\\F\[C(\d+)\]/i){"\x01[#{$1}]"}
  574.     ## 16进制颜色
  575.     @text.gsub!(/\\F\[C\#([a-f0-9]+)\]/i) {"\x10[#{$1}]"}
  576.     ## 字体附加效果
  577.     @text.gsub!(/\\F\[A(\d+)\]/i){"\x11[#{$1}]"}
  578.     ## 自动关闭
  579.     @text.gsub!(/\\X\[(\d+)\]/i) {"\x12[#{$1}]"}
  580.     @text.gsub!(/\\X/i)          {"\x13"}
  581.     ## 字速控制
  582.     @text.gsub!(/\\P\[(\d+)\]/i) {"\x14[#{$1}]"}
  583.     ## 提取动画对象和 ID
  584.     @text.gsub!(/\\A\[(\S+)\,(\d+)\]/i) {"\x15[#{$1},#{$2}]"}
  585.     @text.gsub!(/\\B\[(\S+)\,(\d+)\]/i) {"\x16[#{$1},#{$2}]"}
  586.     ## 切换头像index
  587.     @text.gsub!(/\\@\[(\d+)\]/)  {"\x17[#{$1}]"}
  588.   end
  589.   #--------------------------------------------------------------------------
  590.   # ◎ 设置窗体背景与位置
  591.   #--------------------------------------------------------------------------
  592.   def reset_window
  593.     @background = $game_message.background
  594.     @position = $game_message.position
  595.     if @background == 0   # 普通窗体
  596.       self.opacity = 255
  597.     else                  # 背景变暗、透明
  598.       self.opacity = 0
  599.     end
  600.     case @position
  601.     when 0  # 上
  602.       fh = get_face_height($game_message.face_name)
  603.       self.y = fh - self.height - Face_AdjY
  604.       self.y = 0 if self.y < 0
  605.       @gold_window.y = 360
  606.     when 1  # 中
  607.       self.y = (Graphics.height-self.height)/2
  608.       @gold_window.y = 0
  609.     when 2  # 下
  610.       self.y = Graphics.height-self.height
  611.       @gold_window.y = 0
  612.     end
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # ◎ 消息结束
  616.   #--------------------------------------------------------------------------
  617.   def terminate_message
  618.     ## 选项窗体
  619.     Choice_Strip ? @choice = false : self.active = false
  620.     self.custom_pause = false
  621.     self.index = -1
  622.     @gold_window.close
  623.     @number_input_window.active = false
  624.     @number_input_window.visible = false
  625.     $game_message.main_proc.call if $game_message.main_proc != nil
  626.     $game_message.clear
  627.     ## 还原自动关闭
  628.     @auto_close = nil
  629.     ## 处理名称背景条和头像
  630.     @show_name = false
  631.     @namebar_sprite.visible = false
  632.     @face_sprite.visible = false
  633.     @face_sprite.bitmap.clear
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ◎ 更新消息
  637.   #--------------------------------------------------------------------------
  638.   def update_message
  639.     loop do
  640.       c = @text.slice!(/./m)            # 获取下一条文字
  641.       case c
  642.       when nil                          # 没有可以显示的文字
  643.         finish_message                  # 更新结束
  644.         break
  645.       when "\x00"                       # 换行
  646.         new_line
  647.         if @line_count >= MAX_LINE      # 行数为最大时
  648.           unless @text.empty?           # 如果还有增加则继续
  649.             ## 等待滚动
  650.             @wait_count = MultiLinesWait
  651.             @multi_lines = true
  652.             break
  653.           end
  654.         end
  655.       when "\x01"                       # \C[n]  (更改文字色)
  656.         @text.sub!(/\[([0-9]+)\]/, "")
  657.         contents.font.color = text_color($1.to_i)
  658.         next
  659.       when "\x02"                       # \G  (显示所持金)
  660.         @gold_window.refresh
  661.         @gold_window.open
  662.       when "\x03"                       # \.  (等待 1/4 秒)
  663.         @wait_count = 15
  664.         break
  665.       when "\x04"                       # \|  (等待 1 秒)
  666.         @wait_count = 60
  667.         break
  668.       when "\x05"                       # \!  (等待输入)
  669.         self.custom_pause = true
  670.         break
  671.       when "\x06"                       # \>  (瞬间显示 ON)
  672.         @line_show_fast = true
  673.       when "\x07"                       # \<  (瞬间显示 OFF)
  674.         @line_show_fast = false
  675.       when "\x08"                       # \^  (不等待输入)
  676.         @pause_skip = true
  677.       ## 更改不透明度的情况下
  678.       when "\x09"
  679.         @text.sub!(/\[(\d+)\]/, "")
  680.         contents.font.color.alpha = $1.to_i
  681.       ## 显示技能情况下
  682.       when "\x0a"
  683.         @text.sub!(/\[(\d+)\]/, "")
  684.         draw_icon($data_skills[$1.to_i].icon_index, @contents_x, @contents_y)
  685.         ## 横坐标增加图标宽度
  686.         @contents_x += 24
  687.       ## 显示物品情况下
  688.       when "\x0b"
  689.         @text.sub!(/\[(\d+)\]/, "")
  690.         draw_icon($data_items[$1.to_i].icon_index, @contents_x, @contents_y)
  691.         ## 横坐标增加图标宽度
  692.         @contents_x += 24
  693.       ## 显示武器情况下
  694.       when "\x0c"
  695.         @text.sub!(/\[(\d+)\]/, "")
  696.         draw_icon($data_weapons[$1.to_i].icon_index, @contents_x, @contents_y)
  697.         ## 横坐标增加图标宽度
  698.         @contents_x += 24
  699.       ## 显示防具情况下
  700.       when "\x0d"
  701.         @text.sub!(/\[(\d+)\]/, "")
  702.         draw_icon($data_armors[$1.to_i].icon_index, @contents_x, @contents_y)
  703.         ## 横坐标增加图标宽度
  704.         @contents_x += 24
  705.       ## 更改字体的情况下
  706.       when "\x0e"
  707.         @text.sub!(/\[(\d+)\]/, "")
  708.         contents.font.size = $1.to_i
  709.       when "\x0f"
  710.         @text.sub!(/\[(\d+)\]/, "")
  711.         name = Font_Lib[$1.to_i]
  712.         contents.font.name = Font.exist?(name) ? name : Font.default_name
  713.       ## 16进制颜色
  714.       when "\x10"
  715.         @text.sub!(/\[(\w+)\]/, "")
  716.         r,g,b = $1.scan(/../)
  717.         contents.font.color = Color.new(r.hex, g.hex, b.hex)
  718.       ## 字体附加效果
  719.       when "\x11"
  720.         @text.sub!(/\[(\d+)\]/, "")
  721.         ## 获取字体附加效果
  722.         @font_adj = $1.to_i
  723.       ## 自动关闭对话框的情况下
  724.       when "\x12"
  725.         @text.sub!(/\[(\d+)\]/, "")
  726.         @auto_close = $1.to_i
  727.       when "\x13"
  728.         @auto_close = AutoClose
  729.       ## \P[n] (字速)
  730.       when "\x14"
  731.         @text.sub!(/\[(\d+)\]/, "")
  732.         ## 获取字体显示速度
  733.         @speed = $1.to_i
  734.       ## 显示角色动画
  735.       when "\x15"
  736.         @text.sub!(/\[(\S+)\,(\d+)\]/, "")
  737.         character = interpreter.get_character($1.to_i)
  738.         character.animation_id = $2.to_i unless character.nil?
  739.         next
  740.       ## 显示心情动画
  741.       when "\x16"
  742.         @text.sub!(/\[(\S+)\,(\d+)\]/, "")
  743.         character = interpreter.get_character($1.to_i)
  744.         character.balloon_id = $2.to_i unless character.nil?
  745.         next
  746.       ## 换头像
  747.       when "\x17"
  748.         @text.sub!(/\[(\d+)\]/, "")
  749.         name  = $game_message.face_name
  750.         index = $game_message.face_index = $1.to_i
  751.         draw_msg_face(name, index)
  752.       ## 选择项
  753.       when "\x18"
  754.         finish_message
  755.         break
  756.       ## 特定字符处理
  757.       when "\xff"
  758.         @text.insert(0, @frozen_char.shift)
  759.       else
  760.         ## 字速控制
  761.         @wait_count = GlobalSpeed
  762.         @wait_count = @speed if @speed != nil
  763.         h = contents.font.size + Font_Space
  764.         ## 字体附加效果
  765.         if @font_adj & 1 != 0
  766.           contents.font.shadow = true
  767.         else
  768.           contents.font.shadow = false
  769.         end
  770.         if @font_adj & 2 != 0
  771.           contents.font.bold = true
  772.         else
  773.           contents.font.bold = false
  774.         end
  775.         if @font_adj & 4 != 0
  776.           contents.font.italic = true
  777.         else
  778.           contents.font.italic = false
  779.         end
  780.         if @font_adj & 8 != 0     ## 描边字
  781.           color = text_color(EdgeColor)
  782.           contents.draw_edge_text(@contents_x,@contents_y,h,h,c,0,color)
  783.         elsif @font_adj & 16 != 0 ## 发光字
  784.           color = text_color(GlowColor)
  785.           contents.draw_glow_text(@contents_x,@contents_y,h,h,c,0,color)
  786.         else                      ## 普通字
  787.           contents.draw_text(@contents_x, @contents_y, h, h, c)
  788.         end
  789.         c_width = contents.text_size(c).width
  790.         @contents_x += c_width
  791.       end
  792.       break unless @show_fast or @line_show_fast
  793.     end
  794.   end
  795.   #--------------------------------------------------------------------------
  796.   # ◎ 消息更新结束
  797.   #--------------------------------------------------------------------------
  798.   def finish_message
  799.     if $game_message.choice_max > 0
  800.       start_choice
  801.     elsif $game_message.num_input_variable_id > 0
  802.       start_number_input
  803.     elsif @pause_skip
  804.       terminate_message
  805.     else
  806.       self.custom_pause = true
  807.     end
  808.     @wait_count = 10
  809.     @text = nil
  810.     ## 临时字速还原
  811.     @speed = nil
  812.   end
  813.   #--------------------------------------------------------------------------
  814.   # ◎ 开始选择项
  815.   #--------------------------------------------------------------------------
  816.   def start_choice
  817.     if Choice_Strip
  818.       @choice = true
  819.       width = 0
  820.       commands = []
  821.       for i in $game_message.choice_start+1 ...$game_message.texts.size
  822.         commands.push $game_message.texts[i]
  823.         iw = contents.text_size($game_message.texts[i]).width
  824.         width = iw if width < iw
  825.       end
  826.       ## 计算高度.(width+42, commands, 1, row_max)
  827.       if commands.size > Choice_MaxLines
  828.         row_max = Choice_MaxLines
  829.       else
  830.         row_max = commands.size
  831.       end
  832.       @choice_window = Window_Command.new(width+42, commands, 1, row_max)
  833.       @choice_window.contents.font = default_font
  834.       @choice_window.refresh
  835.       ## 计算坐标@position == 0
  836.       if @show_right
  837.         @choice_window.x = self.x
  838.       else
  839.         @choice_window.x = self.x + self.width - @choice_window.width
  840.       end
  841.       if @position == 0
  842.         @choice_window.y = self.y + self.height
  843.       else
  844.         @choice_window.y = self.y - @choice_window.height
  845.       end
  846.     else
  847.       self.active = true
  848.       self.index = 0
  849.     end
  850.   end
  851.   #--------------------------------------------------------------------------
  852.   # ◎ 开始输入数值
  853.   #--------------------------------------------------------------------------
  854.   def start_number_input
  855.     digits_max = $game_message.num_input_digits_max
  856.     number = $game_variables[$game_message.num_input_variable_id]
  857.     @number_input_window.digits_max = digits_max
  858.     @number_input_window.number = number
  859.     if $game_message.face_name.empty?
  860.       @number_input_window.x = x
  861.     else
  862.       ## 代入头像宽度
  863.       @number_input_window.x = @show_right ? x : x + @face_width
  864.     end
  865.     @number_input_window.y = y + @contents_y
  866.     @number_input_window.active = true
  867.     @number_input_window.visible = true
  868.     @number_input_window.update
  869.   end
  870.   #--------------------------------------------------------------------------
  871.   # ◎ 更新光标 ###可能仍须增加判断
  872.   #--------------------------------------------------------------------------
  873.   def update_cursor
  874.     if @index >= 0
  875.       if $game_message.face_name.empty?
  876.         x = 0
  877.         y = ($game_message.choice_start+@index)*(Msg_FontSize+Font_Space)
  878.         width = contents.width
  879.       else
  880.         x = @show_right ? 0 : @face_width
  881.         y = ($game_message.choice_start+@index)*(Msg_FontSize+Font_Space) +
  882.              Name_SpaceY
  883.         width = contents.width - @face_width
  884.       end
  885.       self.cursor_rect.set(x, y, width, (Msg_FontSize+Font_Space))
  886.     else
  887.       self.cursor_rect.empty
  888.     end
  889.   end
  890.   #--------------------------------------------------------------------------
  891.   # ◎ 文章显示输入处理
  892.   #--------------------------------------------------------------------------
  893.   def input_pause
  894.     if Input.trigger?(Input::C) or Input.trigger?(Input::B)
  895.       ## 还原自定义暂停标记
  896.       self.custom_pause = false
  897.       if @text != nil and not @text.empty?
  898.         new_page if @line_count >= MAX_LINE
  899.       else
  900.         terminate_message
  901.       end
  902.     end
  903.   end
  904.   #--------------------------------------------------------------------------
  905.   # ◎ 选择项输入处理
  906.   #--------------------------------------------------------------------------
  907.   def input_choice
  908.     if Input.trigger?(Input::B)
  909.       if $game_message.choice_cancel_type > 0
  910.         Sound.play_cancel
  911.         $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
  912.         terminate_message
  913.       end
  914.     elsif Input.trigger?(Input::C)
  915.       Sound.play_decision
  916.       ## 获取相应index
  917.       index = Choice_Strip ? @choice_window.index : self.index
  918.       $game_message.choice_proc.call(index)
  919.       terminate_message
  920.     end
  921.     ## 刷新选项窗体
  922.     return unless Choice_Strip
  923.     if @choice
  924.       @choice_window.update
  925.     else
  926.       @choice_window.dispose
  927.       @choice_window = nil
  928.     end
  929.   end
  930.   #--------------------------------------------------------------------------
  931.   # ● 数值输入处理
  932.   #--------------------------------------------------------------------------
  933.   def input_number
  934.     if Input.trigger?(Input::C)
  935.       Sound.play_decision
  936.       $game_variables[$game_message.num_input_variable_id] =
  937.         @number_input_window.number
  938.       $game_map.need_refresh = true
  939.       terminate_message
  940.     end
  941.   end
  942.   #--------------------------------------------------------------------------
  943.   # ○ 生成名称背景条
  944.   #--------------------------------------------------------------------------
  945.   def create_namebar_sprite
  946.     @namebar_sprite = Sprite.new
  947.     @namebar_sprite.bitmap = Bitmap.new(width-Name_SpaceX, Name_FontSize+4)
  948.     ## 可视性
  949.     @namebar_sprite.visible = false
  950.     ## 准备参数
  951.     rect = Rect.new(Name_SpaceX,0,@namebar_sprite.width,@namebar_sprite.height)
  952.     color1 = text_color(NameBar_Color)
  953.     color2 = text_color(NameBar_Color)
  954.     color1.alpha = NameBar_Opacity
  955.     color2.alpha = 0
  956.     ## 描绘渐变条
  957.     @namebar_sprite.bitmap.gradient_fill_rect(rect, color1, color2)
  958.   end
  959.   #--------------------------------------------------------------------------
  960.   # ○ 显示名称背景条
  961.   #--------------------------------------------------------------------------
  962.   def show_namebar_sprite
  963.     @show_name = true
  964.     return if @background == 1
  965.     ## 坐标跟随
  966.     @namebar_sprite.x = self.x
  967.     @namebar_sprite.y = self.y + 16 - 1
  968.     @namebar_sprite.z = self.z + 1
  969.     ## 可视性
  970.     @namebar_sprite.visible = true
  971.   end
  972.   #--------------------------------------------------------------------------
  973.   # ○ 生成头像
  974.   #--------------------------------------------------------------------------
  975.   def create_face_sprite
  976.     @face_sprite = Sprite.new
  977.     @face_sprite.bitmap = Bitmap.new(1,1)
  978.     @face_sprite.z = self.z + 2
  979.     @face_sprite.visible = false
  980.     @old_name = ""                        # 判断头像是否改变
  981.     @old_index = 0                        # 判断头像是否改变
  982.     @face_enter = Face_Enter              # 头像显示模式
  983.   end
  984.   #--------------------------------------------------------------------------
  985.   # ○ 描绘头像
  986.   #     face_name  : 头像图像文件名
  987.   #     face_index : 头像图像索引
  988.   #--------------------------------------------------------------------------
  989.   def draw_msg_face(face_name, face_index)
  990.     bitmap = Cache.face(face_name)
  991.     width = bitmap.width / 4
  992.     height = bitmap.height / 2
  993.     rect = Rect.new(0, 0, 0, 0)
  994.     rect.x = face_index % 4 * width
  995.     rect.y = face_index / 4 * height
  996.     rect.width = width
  997.     rect.height = height
  998.     @face_sprite.bitmap = Bitmap.new(width, height)
  999.     @face_sprite.bitmap.blt(0, 0, bitmap, rect)
  1000.     @face_sprite.mirror = @show_right
  1001.   end
  1002.   #--------------------------------------------------------------------------
  1003.   # ○ 设定头像宽度
  1004.   #     face_name  : 头像图像文件名
  1005.   #--------------------------------------------------------------------------
  1006.   def set_face_width(face_name)
  1007.     bitmap = Cache.face(face_name)
  1008.     @face_width = bitmap.width / 4
  1009.   end
  1010.   #--------------------------------------------------------------------------
  1011.   # ○ 获取头像高度
  1012.   #     face_name  : 头像图像文件名
  1013.   #--------------------------------------------------------------------------
  1014.   def get_face_height(face_name)
  1015.     bitmap = Cache.face(face_name)
  1016.     return bitmap.height / 2
  1017.   end
  1018.   #--------------------------------------------------------------------------
  1019.   # ○ 头像进入画面
  1020.   #--------------------------------------------------------------------------
  1021.   def face_in
  1022.     fw = @face_sprite.width
  1023.     fh = @face_sprite.height
  1024.     ## 水平坐标
  1025.     if @show_right
  1026.       @face_x = self.width - fw - Face_AdjX
  1027.     else
  1028.       @face_x = self.x + Face_AdjX
  1029.     end
  1030.     @face_sprite.x = @face_x
  1031.     ## 垂直坐标
  1032.     case Face_Align
  1033.     when 0
  1034.       @face_sprite.y = self.y + Face_AdjY
  1035.     when 1
  1036.       @face_sprite.y = self.y + (self.height - fh) / 2
  1037.     when 2
  1038.       @face_sprite.y = self.y + (self.height - fh) + Face_AdjY
  1039.     end
  1040.     case @face_enter
  1041.     when 1 ## 水平趋中时
  1042.       @face_sprite.x += (@show_right ? fw : -fw)
  1043.     when 2 ## 渐显时
  1044.       @face_sprite.opacity = 0
  1045.     end
  1046.     ## 可视性
  1047.     @face_sprite.visible = true
  1048.   end
  1049.   #--------------------------------------------------------------------------
  1050.   # ○ 生成自定义暂停标记
  1051.   #--------------------------------------------------------------------------
  1052.   def create_custom_pause
  1053.     return if Pause_Custom == 0
  1054.     @pause_sprite = Sprite.new
  1055.     @pause_sprite.visible = false
  1056.     @pause_sprite.z = self.z + 3
  1057.     @pause_sprite.bitmap = Cache.system("Window_pause")
  1058.     @pause_aniindex = -1
  1059.     @pause_anispeed = 0
  1060.   end
  1061.   #--------------------------------------------------------------------------
  1062.   # ○ 获取暂停标记
  1063.   #--------------------------------------------------------------------------
  1064.   def custom_pause
  1065.     return @custom_pause
  1066.   end
  1067.   #--------------------------------------------------------------------------
  1068.   # ○ 更改暂停标记
  1069.   #--------------------------------------------------------------------------
  1070.   def custom_pause=(val)
  1071.     @custom_pause = val
  1072.     self.pause = val if Pause_Custom == 0
  1073.   end
  1074.   #--------------------------------------------------------------------------
  1075.   # ○ 更新暂停标记
  1076.   #--------------------------------------------------------------------------
  1077.   def update_custom_pause
  1078.     return if Pause_Custom == 0
  1079.     @pause_sprite.visible = @custom_pause
  1080.     @pause_sprite.visible = false if @pause_aniindex == -1
  1081.     return if !@custom_pause
  1082.     if @pause_anispeed > 0
  1083.       @pause_anispeed -= 1
  1084.     else
  1085.       @pause_aniindex = (@pause_aniindex + 1) % Pause_AniFrm
  1086.       pw = @pause_sprite.bitmap.width / Pause_AniFrm
  1087.       ph = @pause_sprite.bitmap.height
  1088.       @pause_sprite.src_rect.set(@pause_aniindex*pw, 0, pw, ph)
  1089.       @pause_anispeed = Pause_AniCyc
  1090.     end
  1091.   end
  1092.   #--------------------------------------------------------------------------
  1093.   # ○ 设定暂停标记坐标
  1094.   #--------------------------------------------------------------------------
  1095.   def set_custom_pause_pos
  1096.     return if Pause_Custom == 0
  1097.     pw = @pause_sprite.bitmap.width / Pause_AniFrm
  1098.     ph = @pause_sprite.bitmap.height
  1099.     case Pause_Custom
  1100.     when 1 ## 底边居中
  1101.       @pause_sprite.x = self.x + (self.width - pw)/2
  1102.       @pause_sprite.y = self.y + self.height - ph
  1103.     when 2 ## 右下角
  1104.       @pause_sprite.x = self.x + self.width - pw
  1105.       @pause_sprite.y = self.y + self.height - ph
  1106.       @pause_sprite.x -= @face_width if @show_right
  1107.     when 3 ## 文字后
  1108.       @pause_sprite.x = self.x + @contents_x + Msg_FontSize + Font_Space
  1109.       @pause_sprite.y = self.y + @contents_y + Msg_FontSize + Font_Space
  1110.     end
  1111.     @pause_sprite.x += Pause_AdjX
  1112.     @pause_sprite.y += Pause_AdjY
  1113.   end
  1114.   #--------------------------------------------------------------------------
  1115.   # ○ 滚动换行
  1116.   #--------------------------------------------------------------------------
  1117.   def scroll_line
  1118.     w = self.width - 32
  1119.     hm = Msg_FontSize + Font_Space
  1120.     if @show_name
  1121.       l = MAX_LINE - 2
  1122.       hn = Name_FontSize + Font_Space + Name_SpaceY
  1123.       rect = Rect.new(0, hn+hm, w, hm*l)
  1124.     else
  1125.       l = MAX_LINE - 1
  1126.       hn = 0
  1127.       rect = Rect.new(0, hm, w, hm*l)
  1128.     end
  1129.     ## 复制位图
  1130.     buff = Bitmap.new(w, hm*l)
  1131.     buff.blt(0, 0, contents, rect)
  1132.     ## 描绘位图
  1133.     contents.clear_rect Rect.new(0, hn, w, hm*l+hm)
  1134.     contents.blt 0, hn, buff, Rect.new(0, 0, w, hm*l)
  1135.     buff.dispose
  1136.     @contents_y -= Msg_FontSize + Font_Space
  1137.     @multi_lines = false
  1138.   end
  1139.   #--------------------------------------------------------------------------
  1140.   # ○ 默认字体
  1141.   #--------------------------------------------------------------------------
  1142.   def default_font
  1143.     font = Font.new(Font.default_name, Msg_FontSize)
  1144.     font.shadow = Font.default_shadow
  1145.     font.italic = Font.default_italic
  1146.     font.color = text_color(Msg_FontColor)
  1147.     font.bold = Font.default_bold
  1148.     return font
  1149.   end
  1150.   #--------------------------------------------------------------------------
  1151.   # ○ 当前解释器
  1152.   #--------------------------------------------------------------------------
  1153.   def interpreter
  1154.     if $game_temp.in_battle
  1155.       return $game_troop.interpreter
  1156.     else
  1157.       return $game_map.interpreter
  1158.     end
  1159.   end
  1160. end
  1161. #==============================================================================
  1162. # ■ Window_Command
  1163. #==============================================================================
  1164. class Window_Command < Window_Selectable
  1165.   #--------------------------------------------------------------------------
  1166.   # ◎ 初始化
  1167.   #     width      : 窗口宽
  1168.   #     commands   : 命令字符串列表
  1169.   #     column_max : 列数 (2 以上横向选择)
  1170.   #     row_max    : 行数 (0:与命令数一致)
  1171.   #     spacing    : 项目横向的空白空间super(0, 0, width,
  1172.   #--------------------------------------------------------------------------
  1173.   def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
  1174.     line_max = (commands.size + column_max - 1) / column_max
  1175.     row_max = line_max if row_max == 0
  1176.     super(0, 0, width, [line_max,row_max].max * WLH + 32, spacing)
  1177.     @commands = commands
  1178.     @item_max = commands.size
  1179.     @column_max = column_max
  1180.     refresh
  1181.     self.index = 0
  1182.     self.height = row_max * WLH + 32
  1183.   end
  1184. end
  1185. #==============================================================================
  1186. # ■ Game_Interpreter
  1187. #==============================================================================
  1188. class Game_Interpreter
  1189.   #--------------------------------------------------------------------------
  1190.   # ◎ 设置事件
  1191.   #     list     : 执行内容
  1192.   #     event_id : 事件 ID
  1193.   #--------------------------------------------------------------------------
  1194.   alias msg_plus_setup setup
  1195.   def setup(list, event_id = 0)
  1196.     msg_plus_setup(list, event_id)
  1197.     ## 获取执行列表
  1198.     @list = Marshal.load(Marshal.dump list)
  1199.   end
  1200.   #--------------------------------------------------------------------------
  1201.   # ◎ 显示文章
  1202.   #--------------------------------------------------------------------------
  1203.   def command_101
  1204.     unless $game_message.busy
  1205.       $game_message.face_name = @params[0]
  1206.       $game_message.face_index = @params[1]
  1207.       $game_message.background = @params[2]
  1208.       $game_message.position = @params[3]
  1209.       @index += 1
  1210.       loop do
  1211.         case @list[@index].code
  1212.         when 101 ## 对话设定
  1213.           multi_lines? ? @index += 1 : break
  1214.         when 401 ## 对话数据
  1215.           $game_message.texts.push(@list[@index].parameters[0])
  1216.           @index += 1
  1217.         else
  1218.           break
  1219.         end
  1220.       end
  1221.       if @list[@index].code == 102          # 显示选择项
  1222.         setup_choices(@list[@index].parameters)
  1223.       elsif @list[@index].code == 103       # 处理数值输入
  1224.         setup_num_input(@list[@index].parameters)
  1225.       end
  1226.       set_message_waiting                   # 消息待机状态
  1227.     end
  1228.     return false
  1229.   end
  1230.   #--------------------------------------------------------------------------
  1231.   # ◎ 设置选择项
  1232.   #--------------------------------------------------------------------------
  1233.   def setup_choices(params)
  1234.     if FSL::Window_message_Plus::Choice_Strip &&
  1235.        FSL::Window_message_Plus::Choice_MaxLines > 0
  1236.       ## 备重建
  1237.       @modify = []
  1238.       @delete = []
  1239.       @cancel = 0
  1240.       ## 获取合并后的command
  1241.       command = @list[@index].clone
  1242.       command.parameters = connect_choice(@index), @cancel
  1243.       ## 消息参数
  1244.       $game_message.choice_start = $game_message.texts.size
  1245.       $game_message.choice_max = command.parameters[0].size
  1246.       $game_message.texts.push "\x18"
  1247.       command.parameters[0].each{|s| $game_message.texts.push(s)}
  1248.       ## 重建数据
  1249.       @modify.each_index do |i|
  1250.         key,value = @modify[i].is_a?(Array) ? @modify[i] : [@modify[i],i]
  1251.         @list[key].parameters[0] = value
  1252.       end
  1253.       @delete.reverse.each{|i| @list[i,1] = nil}
  1254.       @list.insert(@index, command)
  1255.       $game_message.choice_cancel_type = @cancel
  1256.       $game_message.choice_proc = Proc.new { |n| @branch[@indent] = n }
  1257.       ## 推进
  1258.       @index += 1
  1259.     else
  1260.       ## 默认情况
  1261.       if $game_message.texts.size <= 4 - params[0].size
  1262.         $game_message.choice_start = $game_message.texts.size
  1263.         $game_message.choice_max = params[0].size
  1264.         for s in params[0]
  1265.           $game_message.texts.push(s)
  1266.         end
  1267.         $game_message.choice_cancel_type = params[1]
  1268.         $game_message.choice_proc = Proc.new { |n| @branch[@indent] = n }
  1269.         @index += 1
  1270.       end
  1271.     end
  1272.   end
  1273.   #--------------------------------------------------------------------------
  1274.   # ◎ 取消的情况下
  1275.   #--------------------------------------------------------------------------
  1276.   alias msg_plus_command_403 command_403
  1277.   def command_403
  1278.     ## 合并选项时
  1279.     if !@params[0].nil? && @branch[@indent] == @params[0] - 1
  1280.       @branch.delete(@indent)
  1281.       return true
  1282.     end
  1283.     msg_plus_command_403
  1284.   end
  1285.   #--------------------------------------------------------------------------
  1286.   # ## 合并选项
  1287.   #--------------------------------------------------------------------------
  1288.   def connect_choice(index, result=[])
  1289.     params = @list[index].parameters
  1290.     indent = @list[index].indent
  1291.     ## 取消项
  1292.     @cancel = result.size + params[1] if params[1] > 0
  1293.     params[0].each{|s| result.push(s)}
  1294.     @delete.push(index) ## 102
  1295.     index = next_choice(index)
  1296.     ## 判断合并的条件 选项:满4项;取消:非分歧
  1297.     if index && params[0].size == 4 && params[1] < 5
  1298.       @delete.push(index-1) ## 404
  1299.       connect_choice(index, result)
  1300.     else
  1301.       return result
  1302.     end
  1303.   end
  1304.   #--------------------------------------------------------------------------
  1305.   # ## 下个选项
  1306.   #--------------------------------------------------------------------------
  1307.   def next_choice(index)
  1308.     params = @list[index].parameters
  1309.     indent = @list[index].indent
  1310.     until @list[index+1].nil?
  1311.       index += 1
  1312.       if indent == @list[index].indent
  1313.         case @list[index].code
  1314.         when 402
  1315.           @modify.push(index)
  1316.         when 403
  1317.           @modify.push([index,@cancel])
  1318.         when 404
  1319.           ## 判断合并的条件 下一个同级执行项102
  1320.           return @list[index+1].code == 102 ? index+1 : nil
  1321.         end
  1322.       end
  1323.     end
  1324.   end
  1325.   #--------------------------------------------------------------------------
  1326.   # ○ 多行模式?
  1327.   #--------------------------------------------------------------------------
  1328.   def multi_lines?
  1329.     return false if FSL::Window_message_Plus::MultiLinesWait <= 0
  1330.     return false if $game_message.face_name != @list[@index].parameters[0]
  1331.     return false if $game_message.face_index != @list[@index].parameters[1]
  1332.     return false if $game_message.background != @list[@index].parameters[2]
  1333.     return false if $game_message.position != @list[@index].parameters[3]
  1334.     return true
  1335.   end
  1336.   #--------------------------------------------------------------------------
  1337.   # ○ 心情图标扩展
  1338.   #     character_id: 角色 ID (-1 为角色、0 为本事件、除此之外为事件 ID)
  1339.   #     balloon_id  : 心情动画 ID (从1开始)
  1340.   #--------------------------------------------------------------------------
  1341.   def balloon_extend(character_id, balloon_id)
  1342.     character = get_character(character_id)
  1343.     if character != nil
  1344.       character.balloon_id = balloon_id
  1345.     end
  1346.     return true
  1347.   end
  1348. end
  1349. #==============================================================================
  1350. # ■ Bitmap
  1351. #==============================================================================
  1352. class Bitmap
  1353.   #--------------------------------------------------------------------------
  1354.   # ○ 描边字
  1355.   #--------------------------------------------------------------------------
  1356.   def draw_edge_text(x, y, width, height, str, align = 0, color = nil)
  1357.     font_backup = self.font.clone
  1358.     self.font.color.set(color.red,color.green,color.blue) if color
  1359.     self.font.shadow = false
  1360.     # 描绘边缘
  1361.     self.draw_text(x-1, y-1, width, height, str, align)
  1362.     self.draw_text(x-1, y+1, width, height, str, align)
  1363.     self.draw_text(x+1, y-1, width, height, str, align)
  1364.     self.draw_text(x+1, y+1, width, height, str, align)
  1365.     self.draw_text(x, y-1, width, height, str, align)
  1366.     self.draw_text(x, y+1, width, height, str, align)
  1367.     self.draw_text(x-1, y, width, height, str, align)
  1368.     self.draw_text(x+1, y, width, height, str, align)
  1369.     # 描绘主文字
  1370.     self.font.color = font_backup.color
  1371.     self.draw_text(x, y, width, height, str, align)
  1372.     # 还原默认字体
  1373.     self.font = font_backup
  1374.   end
  1375.   #--------------------------------------------------------------------------
  1376.   # ○ 发光字
  1377.   #--------------------------------------------------------------------------
  1378.   def draw_glow_text(x, y, width, height, str, align = 0, color = nil)
  1379.     buff = Bitmap.new(width, height)
  1380.     buff.font = self.font.clone
  1381.     buff.font.shadow = false
  1382.     buff.font.color.set(color.red,color.green,color.blue) if color
  1383.     # 描绘边缘
  1384.     buff.draw_text(-1, -1, width, height, str, align)
  1385.     buff.draw_text(-1, 1, width, height, str, align)
  1386.     buff.draw_text(1, -1, width, height, str, align)
  1387.     buff.draw_text(1, 1, width, height, str, align)
  1388.     buff.draw_text(0, -1, width, height, str, align)
  1389.     buff.draw_text(0, 1, width, height, str, align)
  1390.     buff.draw_text(0-1, 0, width, height, str, align)
  1391.     buff.draw_text(1, 0, width, height, str, align)
  1392.     buff.blur
  1393.     # 描绘主文字
  1394.     buff.font.color = self.font.color
  1395.     buff.draw_text(0, 0, width, height, str, align)
  1396.     self.blt(x, y, buff, Rect.new(0, 0, width, height))
  1397.     buff.dispose
  1398.   end
  1399.   #--------------------------------------------------------------------------
  1400.   # ○ 多层字
  1401.   #--------------------------------------------------------------------------
  1402.   def draw_sedimentary_text(x, y, width, height, str, align = 0, *color)
  1403.     color.unshift font.color
  1404.     sheet = (font.size.to_f / color.size).ceil
  1405.     buff = Bitmap.new(width, sheet)
  1406.     buff.font = font.clone
  1407.     max = (height - font.size)/2 > 0 ? (height - font.size)/2 : 0
  1408.     min = buff.font.size < height ? buff.font.size : height
  1409.     color.each_index do |i|
  1410.       buff.clear
  1411.       buff.font.color = color[i]
  1412.       buff.draw_text(0, -i*sheet, width, min, str, align)
  1413.       blt(x, y+i*sheet+max, buff, Rect.new(0, 0, width, sheet))
  1414.       break if i*sheet >= height
  1415.     end
  1416.   end
  1417. end
复制代码

Lv2.观梦者

梦石
0
星屑
800
在线时间
166 小时
注册时间
2019-6-11
帖子
52
2
 楼主| 发表于 2019-7-13 19:54:41 | 只看该作者
已经解决~
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-26 07:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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