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

Project1

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

[已经过期] 用了气泡对话框脚本,怎么给对话里的字加阴影呢

[复制链接]

Lv2.观梦者

梦石
0
星屑
292
在线时间
68 小时
注册时间
2022-11-22
帖子
13
跳转到指定楼层
1
发表于 2022-12-22 01:32:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 jinae2022 于 2022-12-22 01:34 编辑
  1. #==============================================================================
  2. # 本脚本来自https://rpg.blue,使用和转载请保留此信息
  3. #------------------------------------------------------------------------------
  4. # 原版:趙雲
  5. # 重制:RyanBern  2015.08.24
  6. #------------------------------------------------------------------------------
  7. # 更新记录:
  8. #     2015.09.06    少许BUG修复,附加战斗场景对话效果
  9. #     2015.11.05    修复临时更改字号功能
  10. #     2015.11.13    增加更改姓名颜色的功能,修复显示 BUG
  11. #     2016.01.19    增加大型半身像对话框设置,快捷方式设置,高级快捷方式设置
  12. #     2016.05.10    增加对话框开关,打开指定开关时暂时屏蔽本对话加强窗口
  13. #                   增加\f[头像]的功能,可以显示正方形的说话者头像
  14. #     2016.08.26    简化代码,增加自动对话功能,高速跳过对话功能
  15. #     2016.11.05    增加自动调节文字位置的功能,当对话框太靠近屏幕上方或者下方
  16. #                   时,脚本会更换成另外一个显示的方向。
  17. #     2017.01.11    增加连行功能和兼容 VA 的头像组功能
  18. #     2021.10.12    修复淡入淡出不正常的 BUG
  19. #                   数值输入对话框现在会在打字结束后显示(而不是一开始就显示出来)
  20. #                   \> 和 \< 的功能可以使用了
  21. #                   增加一个开关,控制对话框淡入淡出效果
  22. #==============================================================================

  23. #——说明

  24. # 使用时,要在Graphics文件夹下新建一个名为Faces的文件夹,用于存储头像
  25. # 对话框的窗口素材可不必和系统窗口相同,请将对话框窗口素材放到
  26. # Graphics/Windowskins文件夹下,并附上两个气泡箭头素材,用于指向说话者,
  27. # 命名规则为“对话框窗口素材名-top”和“对话框窗口素材名-under”
  28. # 然后在本脚本的设置区域修改。

  29. # 默认为一个字一个字的方式,如果需要一次全部显示,
  30. # 请打开特定开关(默认为 31 号)

  31. # 打开开关(默认为 32 号)后,对话时按下[空格键]可以瞬间显示全部对话。

  32. # 打卡开关(默认为 33 号)后,屏蔽加强对话框,将使用 XP 默认对话框。

  33. # 打开开关(默认为 34 号)后,对话框可以在对话显示完毕后自动消失,适合制作
  34. # 场景 CG,需要进行选择或数字输入的情况不会自动消失。此外在文本框中使用\t[数字]
  35. # 也可达到相似效果,不过作用范围仅限本次对话框。

  36. # 打开开关(默认为 35 号)后,按下 CTRL 键可以快速跳过对话,需要进行选择或者数字
  37. # 输入的情况不会跳过。

  38. # 打开开关(默认为 36 号)后,对话框的位置会自动调节,使其不会遮挡说话者

  39. # 打开开关(默认为 37 号)后,对话框显示和消失时将不会有淡入淡出效果。

  40. # 默认对话字没有声音,如果需要声音,
  41. # 请在游戏中使用脚本:$game_system.soundname_on_speak = "这里输入文件名"
  42. # 我唯一一个见过“胡乱配音”的游戏是天使帝国2代,该游戏说话的时候每个字符随机发一个外星语音

  43. #------------------------------------------------------------------------------

  44. # 其他在对话中可以使用的功能(部分功能在关闭打字效果时无效):

  45. # \n[1]:显示1号角色的姓名

  46. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  47. # \nc[0-7]:更改姓名框颜色

  48. # 非战斗时,\p功能可以自动调整对话框位置
  49. # \p[1] :对话框出现在1号事件的上方
  50. # \p[0] :主人公上方出现对话框
  51. # \p[-1]:对话框出现在屏幕下方,这种特殊类型的对话框在有大型半身像时使用
  52. #——————————————————使用\p功能后可以自动调整对话框大小
  53. # 使用\p功能后,使用事件指令[更改文章选项]可更改对话框的位置
  54. #   [上] :对话框出现在说话者上方
  55. #   [下] :对话框出现在说话者下方
  56. #   [中] :对话框出现在屏幕正中
  57. # 战斗时,\p功能有所变化
  58. # \p[1]:对话框出现在ID为1的角色战斗图附近(这个角色必须是队伍中的成员)
  59. # \p[1001]:对话框出现在Index为1的敌人战斗图附近--也就是说敌人的位置从
  60. #           1001开始算起,1002则是代表Index为2的敌人。
  61. # 战斗时使用\p指令+[更改文章选项]依然是有效的,但是如果不使用\p指令,那么
  62. # 对话框则会一直出现在屏幕正上方。

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

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

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

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

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

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

  69. # \ic[001-Weapon01] : 显示图标"001-Weapon01.png"

  70. # \c[0-7]:更改颜色

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

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

  73. # \s[0-19]:更改弹字的速度,数值越小描绘越快(超过 19 时设置无效)

  74. # \.   :停顿一刹那(5帧,不包含描绘时的自然停顿)
  75. # \|   :停顿片刻(20帧,不包含描绘时的自然停顿)

  76. # \>   :文字不用打字方式
  77. # \<   :文字使用打字方式

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

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

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

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

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

  84. # \t[20]:对话显示完毕后等待 20 帧自动消失

  85. # \L[001]:在左边显示半身像"Graphics/Faces/001.png",并左右镜像反转
  86. # \R[001]:在右边显示半身像"Graphics/Faces/001.png"
  87. # \f[001]:在左边显示正方形头像"Graphics/Faces/001.png"
  88. # 注:不推荐同时使用显示半身像的功能和显示头像的功能。显示的头像图片大小
  89. #     不得超过 120x120,如果图片超过这个大小,图片将会被放缩
  90. # \gf[001, 0]:在左边显示正方形头像组"Graphics/Faces/001.png"的第一个
  91. # 注:头像组排序方式默认如下(先数第一行,再数第二行,可调节每行的头像个数)
  92. #  -----------------
  93. #  | 0 | 1 | 2 | 3 |
  94. #  -----------------
  95. #  | 4 | 5 | 6 | 7 |
  96. #  -----------------

  97. # \+:必须放在每一行的末尾,表示连行,它将合并下一个【显示文章】指令(需要
  98. #     在下面的设置区域调节 Max_Lines 以保证文字能正常显示出来)

  99. #==============================================================================
  100. # 设置区域(其他参数的调节请看这里)
  101. #==============================================================================
  102. module RB
  103. end
  104. module RB::Mes_Config
  105.   # 打开 XX 号开关后,关闭打字效果
  106.   No_Typing = 31
  107.   # 打开 XX 号开关后,按下[空格键]可以瞬间显示全部文字
  108.   Write_Skip = 32
  109.   # 打开 XX 号开关后,屏蔽加强对话框(使用默认对话框)
  110.   Mes_Disabled = 33
  111.   # 主角名字字符缩写
  112.   Regex_Player_Name = /pn(\d+)/
  113.   # 主角姓名框底色(RGBA)
  114.   Name_Bar_Color = Color.new(36, 64, 127, 80)
  115.   # 字体大小
  116.   Size = 18
  117.   # 对话框窗口皮肤(不写为和系统皮肤相同)
  118.   Mes_Windowskin = ""
  119.   # 最大行数(初值为 4,尽量不要修改,如果考虑合并选择项和连行,可以设置为 6 以上)
  120.   # 此最大行数仅在 \p 指令下有效,如果不使用 \p 指令那么对话框还是 4 行的高度
  121.   Max_Lines = 8
  122.   # 画面宽度和高度(width / height)
  123.   # 此设置一般不需要更改,当使用分辨率扩张脚本时,将如下的值改成你游戏的分辨率即可。
  124.   Graphics_Width = 640
  125.   Graphics_Height = 480
  126.   # 打开 XX 号开关后,对话自动结束(不用按下 C 键)
  127.   Auto_Terminate = 34
  128.   # 打开 XX 号开关后,按下 CTRL 可以高速跳过对话
  129.   Text_Skip_Fast = 35
  130.   # 打开 XX 号开关后,自动调节对话框使其不会挡住说话者
  131.   Auto_Adjust_Mes_Pos = 36
  132.   # 对话自动结束延迟(单位:帧)
  133.   Auto_Terminate_Frame = 10
  134.   # 打开 XX 号开关后,对话框不会有淡入淡出效果
  135.   No_Fade = 37
  136.   # 头像组:横向单元数
  137.   Face_Group_W = 4
  138.   # 头像组:纵向单元数
  139.   Face_Group_H = 2  
  140.   # 默认姓名文字颜色(和系统默认编号一致)
  141.   Name_Color_Default = 6
  142.   # 快捷指令,定义后,可以直接在文本框中输入快捷指令
  143.   # 定义方式为 快捷指令 => 完整指令 ,使用方式为 \sc[快捷指令]
  144.   # 注意,指令中通常包含反斜线'\',因此需要使用单引号的字符串,
  145.   # 或者用"\\"进行转义。下面是一个例子:
  146.   # 这样定义后,输入\sc[pn1]就等效为 \name[pn1]\r[L1]\p[-1]
  147.   Shortcuts = {
  148.     #'pn1' => '\name[pn1]\r[L1]\p[-1]'
  149.   }
  150.   # 高级快捷指令定义,类似于宏展开,需要借助正则表达式(高级用户使用)
  151.   Shortcuts_Regexp = {
  152.     /\\pn1/ => '\name[pn1]\r[L1]\p[-1]',
  153.     /\\[Rr]ed\[(.*?)\]/m => '\c[2]\1\c[0]',
  154.     /\\[Cc]ol\[(\d+)\]\{(.*?)\}/m => '\c[\1]\2\c[0]',
  155.   }
  156. end
  157. #==============================================================================
  158. # RPG::Cache
  159. #------------------------------------------------------------------------------
  160. # RPG::Cache 追加定义
  161. #==============================================================================
  162. module RPG::Cache
  163.   def self.face(filename)
  164.     self.load_bitmap("Graphics/Faces/", filename)
  165.   end
  166. end

  167. #==============================================================================
  168. # ■ Game_System
  169. #------------------------------------------------------------------------------
  170. #  处理系统附属数据的类。也可执行诸如 BGM 管理之类的功能。本类的实例请参考
  171. # $game_system 。
  172. #==============================================================================

  173. class Game_System
  174.   attr_accessor :soundname_on_speak
  175.   alias carol3_ini initialize
  176.   def initialize
  177.     carol3_ini
  178.     @soundname_on_speak = nil
  179.   end
  180. end

  181. #==============================================================================
  182. # ■ Window_Message
  183. #------------------------------------------------------------------------------
  184. #   修改的对话框类。
  185. #==============================================================================
  186. class Window_Message_RB < Window_Selectable
  187.   include RB::Mes_Config
  188.   # 定义经过变换后不可见的字符,描绘结束后直接描绘下一个字符,不进入下一帧
  189.   Invisible_Chars = [
  190.     "\001", "\003", "\n", "\023", "\024", "\025", "\076"]
  191.   #--------------------------------------------------------------------------
  192.   # ● 初始化状态
  193.   #--------------------------------------------------------------------------
  194.   def initialize
  195.     super(80, 304, 480, 160)
  196.     self.contents = Bitmap.new(1, 1)
  197.     self.visible = false
  198.     self.z = 9998
  199.     @fade_in = false
  200.     @fade_out = false
  201.     @contents_showing = false
  202.     @write_skip = false
  203.     @text_skip = false
  204.     @cursor_width = 0
  205.     @face_h = 0
  206.     self.active = false
  207.     self.index = -1
  208.     if $game_system.soundname_on_speak == nil then
  209.       $game_system.soundname_on_speak = ""
  210.     end
  211.     self.windowskin = RPG::Cache.windowskin(Mes_Windowskin) if Mes_Windowskin != ""
  212.     @opacity_text_buf = Bitmap.new(32, 32)
  213.     @all_opa = 0;
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● 释放
  217.   #--------------------------------------------------------------------------
  218.   def dispose
  219.     terminate_message
  220.     $game_temp.message_window_showing = false
  221.     if @input_number_window != nil
  222.       @input_number_window.dispose
  223.     end
  224.     super
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● 处理信息结束
  228.   #--------------------------------------------------------------------------
  229.   def terminate_message
  230.     self.active = false
  231.     self.pause = false
  232.     self.index = -1
  233.     self.contents.clear
  234.     # 清除显示中标志
  235.     @contents_showing = false
  236.     # 呼叫信息调用
  237.     if $game_temp.message_proc != nil
  238.       $game_temp.message_proc.call
  239.     end
  240.     # 清除文章、选择项、输入数值的相关变量
  241.     $game_temp.message_text = nil
  242.     $game_temp.message_proc = nil
  243.     $game_temp.choice_start = 99
  244.     $game_temp.choice_max = 0
  245.     $game_temp.choice_cancel_type = 0
  246.     $game_temp.choice_proc = nil
  247.     $game_temp.num_input_start = 99
  248.     $game_temp.num_input_variable_id = 0
  249.     $game_temp.num_input_digits_max = 0
  250.     # 清除头像(由于是 RPG::Cache 所以无需释放)
  251.     @face_bitmap = nil
  252.     @face_group_bitmap = nil
  253.     @face_ok = false
  254.     # 清除跳过标志
  255.     @write_skip = false
  256.     @text_skip = false
  257.     # 释放金钱窗口
  258.     if @gold_window != nil
  259.       @gold_window.dispose
  260.       @gold_window = nil
  261.     end
  262.     # 释放姓名窗口
  263.     if @name_window_text != nil
  264.       @name_window_text.dispose
  265.       @name_window_text = nil
  266.     end
  267.     # 释放右侧立绘
  268.     if @right_picture != nil
  269.       @right_picture.dispose
  270.       @right_picture = nil
  271.     end   
  272.     # 释放左侧立绘
  273.     if @left_picture != nil
  274.       @left_picture.dispose
  275.       @left_picture = nil
  276.     end
  277.     # 释放姓名蓝条
  278.     if @bar != nil
  279.       @bar.bitmap.dispose
  280.       @bar.dispose
  281.       @bar = nil
  282.     end
  283.     # 释放气泡图标
  284.     if @k_tale != nil
  285.       @k_tale.dispose
  286.       @k_tale = nil
  287.     end
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   # ● 刷新
  291.   #--------------------------------------------------------------------------
  292.   def refresh
  293.     # 初期化
  294.     @x = @y = @max_x = @max_y = @indent = @lines = 0
  295.     @face_indent = 0
  296.     @opacity = 255
  297.     @cursor_width = 0
  298.     @write_speed = 0
  299.     @write_wait = 0
  300.     @mid_stop = false
  301.     @popchar = -2
  302.     @auto_terminate = -1
  303.     if $game_temp.choice_start == 0
  304.       @x = 8
  305.     end
  306.     if $game_temp.message_text != nil
  307.       @now_text = $game_temp.message_text
  308.       # \` 预处理
  309.       @now_text.gsub!(/\\`/){ "\077" }
  310.       # `foo` 预处理
  311.       @protected = @now_text.scan(/`(.+?)`/m).flatten
  312.       @now_text.gsub!(/`(.+?)`/m){ "\076" }
  313.       # Shortcuts 预处理
  314.       @now_text.gsub!(/\\sc\[(.*?)\]/) { Shortcuts[$1] || "" }
  315.       # Shortcuts_Regexp 预处理
  316.       Shortcuts_Regexp.each_pair do |regex, str|
  317.         @now_text.gsub!(regex, str)
  318.       end
  319.       # 头像设置
  320.       if (/\\[Ff]\[(.+?)\]/.match(@now_text)) != nil
  321.         @face_bitmap = RPG::Cache.face($1)
  322.         @x = @face_indent = [128, @face_bitmap.width + 4].min
  323.         @now_text.gsub!(/\\[Ff]\[(.+?)\]/) { "" }
  324.       end
  325.       # 头像组设置
  326.       if (/\\[Gg]f\[(.+?)\s*,\s*(\d+)\]/).match(@now_text) != nil
  327.         @face_group_bitmap = RPG::Cache.face($1)
  328.         idx = $2.to_i
  329.         ix, iy = idx % Face_Group_W, idx / Face_Group_W
  330.         w, h = @face_group_bitmap.width / Face_Group_W, @face_group_bitmap.height / Face_Group_H
  331.         @face_bitmap = Bitmap.new(w, h)
  332.         @face_bitmap.blt(0, 0, @face_group_bitmap, Rect.new(ix * w, iy * h, w, h))
  333.         @x = @face_indent = [128, @face_bitmap.width + 4].min
  334.         @now_text.gsub!(/\\[Gg]f\[(.+?)\s*,\s*(\d+)\]/) { "" }
  335.       end
  336.       #——左半身像设置
  337.       if (/\\[Ll]\[(.+?)\]/.match(@now_text)) != nil then
  338.         @face = $1
  339.         if @left_picture != nil
  340.           @left_picture.dispose
  341.         end
  342.         @left_picture = Sprite.new
  343.         @left_picture.bitmap = RPG::Cache.face(@face)
  344.         @left_picture.mirror = true
  345.         @x = @face_indent = @left_picture.bitmap.width
  346.         @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  347.       end
  348.       #——右半身像设置
  349.       if (/\\[Rr]\[(.+?)\]/.match(@now_text)) != nil then
  350.         @face = $1
  351.         if @right_picture != nil
  352.           @right_picture.dispose
  353.         end
  354.         @right_picture = Sprite.new
  355.         @right_picture.bitmap = RPG::Cache.face(@face)
  356.         @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  357.       end
  358.       # 显示人物姓名
  359.       name_window_set = false
  360.       if (/\\[Nn]m\[(.+?)\]/.match(@now_text)) != nil
  361.         name_window_set = true
  362.         name_text = $1
  363.         if Regex_Player_Name =~ name_text
  364.           name_text = $game_actors[$1.to_i].name
  365.         end
  366.         @now_text.sub!(/\\[Nn]m\[(.*?)\]/) { "" }
  367.       end
  368.       # 人物姓名颜色
  369.       name_color = text_color(Name_Color_Default)
  370.       if (/\\[Nn]c\[(\d+)\]/.match(@now_text)) != nil
  371.         name_color = text_color($1.to_i)
  372.         @now_text.sub!(/\\[Nn]c\[(\d+)\]/) { "" }
  373.       end
  374.       # 文字位置的判定
  375.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text)) != nil then
  376.         @popchar = $1.to_i
  377.         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  378.       end
  379.       # 自动结束判定
  380.       @auto_terminate = Auto_Terminate_Frame if $game_switches[Auto_Terminate]
  381.       if (/\\[Tt]\[(\d+)\]/).match(@now_text)
  382.         @auto_terminate = $1.to_i
  383.         @now_text.gsub!(/\\[Tt]\[(\d+)\]/) { "" }
  384.       end
  385.       # 开始替换文字(\v)
  386.       begin
  387.         last_text = @now_text.clone
  388.         @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  389.       end until @now_text == last_text
  390.       # 替换控制码
  391.       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  392.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  393.       end
  394.       @now_text.gsub!(/\\\\/) { "\000" }
  395.       @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  396.       @now_text.gsub!(/\\[Gg]/) { "\002" }
  397.       @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  398.       @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  399.       @now_text.gsub!(/\\[.]/) { "\005" }
  400.       @now_text.gsub!(/\\[|]/) { "\006" }
  401.       @now_text.gsub!(/\\[Ii]c\[(.*?)\]/) { "\030[#{$1}] "}
  402.       @now_text.gsub!(/\\[>]/) { "\016" }
  403.       @now_text.gsub!(/\\[<]/) { "\017" }
  404.       @now_text.gsub!(/\\[!]/) { "\020" }
  405.       @now_text.gsub!(/\\[~]/) { "\021" }
  406.       @now_text.gsub!(/\\[Ii]/) { "\023" }
  407.       @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  408.       @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  409.       @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  410.       # 根据 \p 的不同设置对话框大小
  411.       if @popchar >= 0 # \p 的情况下自动调节
  412.         @text_save = @now_text.clone
  413.         process_real_text
  414.         @max_x = name_window_set ? contents.text_size(name_text).width : 0
  415.         @max_y = Max_Lines
  416.         for i in 0...Max_Lines
  417.           line = @text_save.split(/\n/)[Max_Lines-i-1]
  418.           @max_y -= 1 if line == nil && @max_y <= Max_Lines - i
  419.           next if line == nil
  420.           contents.font.size = Size
  421.           cx = contents.text_size(line).width
  422.           @max_x = cx if cx > @max_x
  423.         end
  424.         if @right_picture != nil && !@right_picture.disposed?
  425.           self.width = @max_x + 48 + @face_indent + @right_picture.bitmap.width
  426.         else
  427.           self.width = @max_x + 48 + @face_indent
  428.         end
  429.         @face_h = @face_bitmap == nil ? 0 : [120, @face_bitmap.height].min
  430.         if $game_temp.num_input_variable_id > 0
  431.           self.height = [(@max_y - 1) * line_height + 96, @face_h + 32].max
  432.         else
  433.           self.height = [(@max_y - 1) * line_height + 64, @face_h + 32].max
  434.         end
  435.         # 生成气泡图标
  436.         @k_tale = Sprite.new
  437.       elsif @popchar == -1
  438.         line_count = @now_text.split(/\n/).size
  439.         line_count = [Max_Lines , [line_count, 4].max].min
  440.         self.width = Graphics_Width
  441.         self.height = [64 + line_height * (line_count - 1), @face_h + 32].max
  442.         @max_x = self.width - 32 - @face_indent
  443.       else
  444.         self.width = Graphics_Width * 0.6
  445.         self.height = 64 + line_height * 3
  446.         @max_x = self.width - 32 - @face_indent
  447.       end
  448.       # 如果设置了姓名框
  449.       if name_window_set
  450.         off_x = 0
  451.         off_y = -40
  452.         space = 2
  453.         x = self.x + off_x - space / 2
  454.         y = self.y + off_y - space / 2
  455.         w = self.contents.text_size(name_text).width + 26 + space
  456.         h = 40 + space
  457.         x = self.x + off_x + 4
  458.         y = self.y + off_y
  459.         @name_window_text = Air_Text.new(self.x + @face_indent+4+8, self.y+16, name_text, name_color)
  460.         @name_window_text.z = self.z + 2
  461.         @bar = Sprite.new
  462.         @bar.bitmap = Bitmap.new(self.width, 24)
  463.         face_cut = @face_bitmap == nil ? 0 : @face_indent + 2
  464.         @bar.x = self.x + 8 + face_cut
  465.         @bar.y = self.y + 16
  466.         @bar.z = self.z + 2
  467.         @bar.bitmap.fill_rect(0,0,self.width-16-face_cut,24, Name_Bar_Color)
  468.       end
  469.       # 一切设置完毕后,创建 contents
  470.       if self.contents != nil
  471.         self.contents.dispose
  472.         self.contents = nil
  473.       end
  474.       self.contents = Bitmap.new(width - 32, height - 32)
  475.       self.contents.font.color = normal_color
  476.       self.contents.font.size = Size
  477.     end
  478.     # 如果选择项被设置
  479.     if $game_temp.choice_max > 0
  480.       @item_max = $game_temp.choice_max
  481.       self.active = true
  482.       self.index = 0
  483.     end
  484.     # 如果数值输入被设置
  485.     if $game_temp.num_input_variable_id > 0
  486.       digits_max = $game_temp.num_input_digits_max
  487.       number = $game_variables[$game_temp.num_input_variable_id]
  488.       @input_number_window = Window_InputNumber.new(digits_max)
  489.       @input_number_window.number = number
  490.       @input_number_window.visible = false
  491.     end
  492.     # 设置背景不透明度
  493.     self.back_opacity = 200
  494.     # 更新窗口位置
  495.     update_window_pos
  496.   end
  497.   #--------------------------------------------------------------------------
  498.   # ● 更新
  499.   #--------------------------------------------------------------------------
  500.   def update
  501.     super
  502.     # 使用默认窗口外观的情况下,如果窗口的外关被变更了、再设置
  503.     if $game_system.windowskin_name != @windowskin_name && Mes_Windowskin == ""
  504.       @windowskin_name = $game_system.windowskin_name
  505.       self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  506.     end
  507.     # 地图中实时更新位置
  508.     if @k_tale != nil && @k_tale.visible && !$game_temp.in_battle
  509.       update_window_pos
  510.     end
  511.     # [空格键]跳过描绘
  512.     if $game_switches[Write_Skip] && Input.trigger?(Input::C)
  513.       @write_skip = true
  514.     end
  515.     # CTRL 高速跳过对话
  516.     if $game_switches[Text_Skip_Fast] && Input.trigger?(Input::CTRL)
  517.       # 选择项或数字输入时无法高速跳过
  518.       if $game_temp.choice_max > 0 || @input_number_window != nil
  519.         @write_skip = true
  520.       else
  521.         @text_skip = true
  522.       end
  523.     end
  524.     # 描绘头像
  525.     if @face_bitmap != nil && !@face_ok
  526.       face_real_w = [120, @face_bitmap.width].min
  527.       face_real_h = [120, @face_bitmap.height].min
  528.       self.contents.stretch_blt(Rect.new(0, 0, face_real_w, face_real_h), @face_bitmap, Rect.new(0, 0, @face_bitmap.width, @face_bitmap.height))
  529.       @face_ok = true
  530.     end
  531.     # 淡入中的情况下
  532.     if @fade_in
  533.       self.all_opa += 64
  534.       if self.all_opa >= 255
  535.         @fade_in = false
  536.       end
  537.       return
  538.     end
  539.     @now_text = nil if @now_text == ""
  540.     # 逐个描绘文字
  541.     if @now_text != nil && @mid_stop == false && !@text_skip
  542.       @write_wait = 0 if @write_skip
  543.       if @write_wait > 0
  544.         @write_wait -= 1
  545.         return
  546.       end
  547.       tmp_text_skip = false
  548.       while true
  549.         @max_x = @x if @max_x < @x
  550.         @max_y = @y if @max_y < @y
  551.         # 处理字符
  552.         if (c = @now_text.slice!(/./m)) != nil
  553.           is_c_invisible = Invisible_Chars.include?(c)
  554.           # \\的情况下
  555.           if c == "\000"
  556.             c = "\\"
  557.           end
  558.           # \c的情况下
  559.           if c == "\001"
  560.             @now_text.sub!(/\[([0-9]+)\]/, "")
  561.             color = $1.to_i
  562.             if color >= 0 and color <= 7
  563.               self.contents.font.color = text_color(color)
  564.             end
  565.             c = ""
  566.           end
  567.           # \g的情况下
  568.           if c == "\002"
  569.             if @gold_window == nil && @popchar <= 0
  570.               @gold_window = Window_Gold.new
  571.               @gold_window.x = 560 - @gold_window.width
  572.               if $game_temp.in_battle
  573.                 @gold_window.y = 192
  574.               else
  575.                 @gold_window.y = self.y >= 128 ? 32 : 384
  576.               end
  577.               @gold_window.opacity = self.opacity
  578.               @gold_window.back_opacity = self.back_opacity
  579.             end
  580.             c = ""
  581.           end
  582.           # \s的情况下
  583.           if c == "\003"
  584.             @now_text.sub!(/\[([0-9]+)\]/, "")
  585.             speed = $1.to_i
  586.             if speed >= 0 and speed <= 19
  587.               @write_speed = speed
  588.             end
  589.             c = ""
  590.           end
  591.           # \a的情况下
  592.           if c == "\004"
  593.             @now_text.sub!(/\[(.*?)\]/, "")
  594.             se_filename = "Audio/SE/#{$1}"
  595.             if FileTest.exist?(se_filename)
  596.               Audio.se_play(se_filename)
  597.             end
  598.             c = ""
  599.           end
  600.           # \.的情况下
  601.           if c == "\005"
  602.             @write_wait += 5
  603.             c = ""
  604.           end
  605.           # \|的情况下
  606.           if c == "\006"
  607.             @write_wait += 20
  608.             c = ""
  609.           end
  610.           # \>的情况下
  611.           if c == "\016"
  612.             tmp_text_skip = true
  613.             c = ""
  614.           end
  615.           # \<的情况下
  616.           if c == "\017"
  617.             tmp_text_skip = false
  618.             c = ""
  619.           end
  620.           # \!的情况下
  621.           if c == "\020"
  622.             # 当有其他跳过绘制功能的输入时,\! 无效
  623.             @mid_stop = true if !@write_skip
  624.             c = ""
  625.           end
  626.           # \~的情况下
  627.           if c == "\021"
  628.             terminate_message
  629.             return
  630.           end
  631.           # \i的情况下
  632.           if c == "\023"
  633.             @indent = @x
  634.             c = ""
  635.           end
  636.           # \o的情况下
  637.           if c == "\024"
  638.             @now_text.sub!(/\[([0-9]+)\]/, "")
  639.             @opacity = $1.to_i
  640.             c = ""
  641.           end
  642.           # \h的情况下
  643.           if c == "\025"
  644.             @now_text.sub!(/\[([0-9]+)\]/, "")
  645.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  646.             c = ""
  647.           end
  648.           # \b的情况下
  649.           if c == "\026"
  650.             @now_text.sub!(/\[([0-9]+)\]/, "")
  651.             @x += $1.to_i
  652.             c = ""
  653.           end
  654.           # 图标的情况
  655.           if c == "\030"
  656.             @now_text.sub!(/\[(.*?)\]/, "")
  657.             self.contents.blt(@x , @y * line_height + (line_height - 24) / 2, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  658.             if $game_system.soundname_on_speak != ""
  659.               Audio.se_play($game_system.soundname_on_speak)
  660.             end
  661.             @x += 24
  662.             c = ""
  663.           end
  664.           # 另起一行的情况下
  665.           if c == "\n"
  666.             if @lines >= $game_temp.choice_start
  667.               @cursor_width = [@cursor_width, @max_x - @face_indent].max
  668.             end
  669.             @lines += 1
  670.             @y += 1
  671.             @x = 0 + @indent + @face_indent
  672.             if @lines >= $game_temp.choice_start
  673.               @x = 8 + @indent + @face_indent
  674.             end
  675.             c = ""
  676.           end
  677.           # \` 的情况下
  678.           if c == "\077"
  679.             c = "`"
  680.           end
  681.           # `foo` 的情况下
  682.           if c == "\076"
  683.             @now_text = @protected.shift + @now_text
  684.             c = ""
  685.           end
  686.           if c != ""
  687.             # 文字描画
  688.             @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size) / 2, c, @opacity)
  689.             if $game_system.soundname_on_speak != "" then
  690.               Audio.se_play($game_system.soundname_on_speak)
  691.             end
  692.           end
  693.         else
  694.           break
  695.         end
  696.         # 当 c 包含实际内容时才进行下一次绘制
  697.         # 否则会绘制一个空字符,产生若干卡顿
  698.         if !$game_switches[No_Typing] && !@write_skip && !is_c_invisible && !tmp_text_skip
  699.           break
  700.         end
  701.       end
  702.       @write_wait += @write_speed
  703.       return
  704.     end
  705.     # 数值输入的处理
  706.     if @input_number_window != nil
  707.       @input_number_window.visible = true
  708.       @input_number_window.update
  709.       # 确认
  710.       if Input.trigger?(Input::C)
  711.         $game_system.se_play($data_system.decision_se)
  712.         $game_variables[$game_temp.num_input_variable_id] =
  713.           @input_number_window.number
  714.         $game_map.need_refresh = true
  715.         @input_number_window.dispose
  716.         @input_number_window = nil
  717.         terminate_message
  718.       end
  719.       return
  720.     end
  721.     # 跳过对话
  722.     if @text_skip
  723.       @now_text = nil
  724.       terminate_message
  725.       return
  726.     end
  727.     # 文章显示中的情况下
  728.     if @contents_showing
  729.       if $game_temp.choice_max == 0
  730.         self.pause = true
  731.       end
  732.       # auto terminate
  733.       if $game_temp.choice_max == 0 && @auto_terminate > 0
  734.         @auto_terminate -= 1
  735.         if @auto_terminate == 0
  736.           terminate_message
  737.         end
  738.         return
  739.       end
  740.       # 取消
  741.       if Input.trigger?(Input::B)
  742.         if $game_temp.choice_max > 0 && $game_temp.choice_cancel_type > 0
  743.           $game_system.se_play($data_system.cancel_se)
  744.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  745.           terminate_message
  746.         end
  747.       end
  748.       # 确定
  749.       if Input.trigger?(Input::C)
  750.         if @mid_stop
  751.           @mid_stop = false
  752.           return
  753.         else
  754.           if $game_temp.choice_max > 0
  755.             $game_system.se_play($data_system.decision_se)
  756.             $game_temp.choice_proc.call(self.index)
  757.           end
  758.           terminate_message
  759.         end
  760.       end
  761.       return
  762.     end
  763.     if self.visible
  764.       if $game_switches[No_Fade]
  765.         $game_temp.message_window_showing = false
  766.         self.visible = false
  767.       else # 4 帧淡出
  768.         @fade_out = true
  769.         self.opacity -= 64
  770.         if self.opacity == 0
  771.           self.visible = false
  772.           @fade_out = false
  773.           $game_temp.message_window_showing = false
  774.         end
  775.       end
  776.       return
  777.     end
  778.     if @fade_out == false and $game_temp.message_text != nil
  779.       @contents_showing = true
  780.       $game_temp.message_window_showing = true
  781.       refresh
  782.       Graphics.frame_reset
  783.       self.visible = true
  784.       if $game_switches[No_Fade]
  785.         self.all_opa = 255
  786.       else
  787.         self.all_opa = 0
  788.         @fade_in = true
  789.       end
  790.       return
  791.     end
  792.   end
  793.   #--------------------------------------------------------------------------
  794.   # ● 预览实际描绘内容(计算窗口宽用)
  795.   #--------------------------------------------------------------------------
  796.   #    实际对 @text_save 进行操作
  797.   #    此方法用于去除某些控制码引起窗口过长的影响
  798.   #--------------------------------------------------------------------------
  799.   def process_real_text
  800.     return if @text_save.nil?
  801.     regex = /[\001-\006\016\017\020\021\024](\[.*?\]){0,1}/
  802.     regex30 = /\030\[.*?\]/
  803.     @text_save.gsub!(regex, "")
  804.     @text_save.gsub!(regex30, "   ")
  805.   end
  806.   #--------------------------------------------------------------------------
  807.   # ● 获得角色(\p功能)
  808.   #--------------------------------------------------------------------------
  809.   def get_character(parameter)
  810.     case parameter
  811.     when 0
  812.       return $game_player
  813.     else
  814.       events = $game_map.events
  815.       return events == nil ? nil : events[parameter]
  816.     end
  817.   end
  818.   #--------------------------------------------------------------------------
  819.   # ● 获得战斗者(\p功能,此功能仅在战斗中有效)
  820.   #--------------------------------------------------------------------------
  821.   #    parameter : 1-999 表示主角 ID,1001-1008 表示索引为1-8的各个敌人
  822.   #--------------------------------------------------------------------------
  823.   def get_battler(parameter)
  824.     if parameter < 1000
  825.       return $game_actors[parameter]
  826.     else
  827.       return $game_troop.enemies[parameter - 1001]
  828.     end
  829.   end
  830.   #--------------------------------------------------------------------------
  831.   # ● 计算 y 偏移量(\p功能,这是考虑到不同战斗图/行走图的高度不同)
  832.   #--------------------------------------------------------------------------
  833.   #    character : 角色/战斗者
  834.   #--------------------------------------------------------------------------
  835.   def process_y_shift(character)
  836.     rate = character.is_a?(Game_Battler) ? 1 : 4
  837.     bmp = character.is_a?(Game_Battler) ?
  838.       RPG::Cache.battler(character.battler_name, character.battler_hue) :
  839.       RPG::Cache.character(character.character_name, character.character_hue)
  840.     return bmp.height / rate + 16
  841.   end
  842.   #--------------------------------------------------------------------------
  843.   # ● 更新窗口位置(所有组件)
  844.   #--------------------------------------------------------------------------
  845.   def update_window_pos
  846.     # 如果使用了 \p 设置位置
  847.     if @popchar >= 0
  848.       character = $game_temp.in_battle ? get_battler(@popchar) : get_character(@popchar)
  849.       final_pos = $game_system.message_position
  850.       if character != nil
  851.         x = [[character.screen_x - self.width / 2, 4].max, Graphics_Width - 4 - self.width].min
  852.         # adjust final_pos automatically when it is enabled
  853.         # ignore the case when pos == 1
  854.         if $game_switches[Auto_Adjust_Mes_Pos] && final_pos != 1
  855.           # try default mes_pos first
  856.           temp_y = final_pos == 2 ? [character.screen_y + 16, 4].max :
  857.             character.screen_y - process_y_shift(character) - self.height
  858.          
  859.           # set pos == 0 if temp_y exceeds the boundary of the screen
  860.           final_pos = 0 if temp_y > Graphics_Height - 4 - self.height && final_pos == 2
  861.           final_pos = 2 if temp_y < 4 && final_pos == 0
  862.         end
  863.         if final_pos == 2
  864.           y = [[character.screen_y + 16, 4].max, Graphics_Height - 4 - self.height].min
  865.         elsif final_pos == 0
  866.           y = [[character.screen_y - process_y_shift(character) - self.height, 4].max, Graphics_Height - 4 - self.height].min
  867.         else
  868.           x = (Graphics_Width - self.width) / 2
  869.           y = (Graphics_Height - self.height) / 2
  870.         end
  871.         self.x = x
  872.         self.y = y
  873.         # 设置气泡图标
  874.         if @k_tale != nil
  875.           @k_tale.x = character.is_a?(Game_Character) ?
  876.             ( character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16 :
  877.             character.screen_x
  878.           k_tale_filename = Mes_Windowskin == "" ? $game_system.windowskin_name : Mes_Windowskin
  879.           suffix = final_pos == 2 ? "-under" : "-top"
  880.           # reload @k_tale's bitmap
  881.           @k_tale.bitmap = RPG::Cache.windowskin(k_tale_filename + suffix)
  882.           if final_pos == 2
  883.             @k_tale.y = self.y - 16
  884.           elsif final_pos == 0
  885.             @k_tale.y = self.y + self.height - 16
  886.           else
  887.             @k_tale.visible = false
  888.           end
  889.           @k_tale.z = 9999
  890.         end
  891.       end
  892.     elsif @popchar == -1
  893.       self.x = 0
  894.       self.y = Graphics_Height - self.height
  895.     else # 无 \p 的情况下
  896.       self.x = (Graphics_Width - self.width) / 2
  897.       # 处于战斗中时
  898.       if $game_temp.in_battle
  899.         self.y = 16
  900.       else
  901.         # 显示文章位置的分支
  902.         case $game_system.message_position
  903.         when 0 # 上
  904.           self.y = 16
  905.         when 1 # 中
  906.           self.y = (Graphics_Height - self.height) / 2
  907.         when 2 # 下
  908.           self.y = (Graphics_Height - self.height - 16)
  909.         end
  910.       end
  911.     end # of @popchar >= 0
  912.     # 设置左侧立绘
  913.     if @left_picture != nil and !@left_picture.disposed?
  914.       @left_picture.x = self.x + 8
  915.       @left_picture.y = self.y - @left_picture.bitmap.height + self.height - 8
  916.       @left_picture.z = self.z + 4
  917.     end
  918.     # 设置右侧立绘
  919.     if @right_picture != nil and !@right_picture.disposed?
  920.       @right_picture.x = self.x + self.width - @right_picture.bitmap.width - 8
  921.       @right_picture.y = self.y - @right_picture.bitmap.height + self.height - 8
  922.       @right_picture.z = self.z + 4
  923.     end
  924.     # 设置姓名空气文字坐标
  925.     if @name_window_text != nil
  926.       @name_window_text.x = self.x + @face_indent - 4
  927.       @name_window_text.y = self.y
  928.     end
  929.     # 设置姓名蓝条坐标
  930.     if @bar != nil
  931.       face_cut = @face_bitmap == nil ? 0 : @face_indent + 2
  932.       @bar.x = self.x + 8 + face_cut
  933.       @bar.y = self.y + 16
  934.     end
  935.     # 设置数字处理
  936.     if @input_number_window != nil
  937.       @input_number_window.x = self.x + @face_indent
  938.       @input_number_window.y = self.y + 8 + $game_temp.num_input_start * line_height
  939.     end
  940.   end
  941.   #--------------------------------------------------------------------------
  942.   # ● line_height
  943.   #--------------------------------------------------------------------------
  944.   # 返回值 : 行高
  945.   #--------------------------------------------------------------------------
  946.   def line_height
  947.     return [[Size * 15 / 10, 18].max, 32].min
  948.   end
  949.   #--------------------------------------------------------------------------
  950.   # ● 文字描画
  951.   #--------------------------------------------------------------------------
  952.   # target :描绘的目标 bitmap 对象
  953.   # x      :x 坐标
  954.   # y      :y 坐标
  955.   # str   :描绘的文字
  956.   # opacity:不透明度(0~255)
  957.   # 返回值 :文字宽度(@x 的增加值)。
  958.   #--------------------------------------------------------------------------

  959.   
  960.   def opacity_draw_text(target, x, y, str,opacity)
  961.     height = target.font.size
  962.     width = target.text_size(str).width
  963.     opacity = [[opacity, 0].max, 255].min
  964.     if opacity == 255
  965.       target.draw_text(x, y, width, height, str)
  966.       return width
  967.     else
  968.       if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  969.         @opacity_text_buf.dispose
  970.         @opacity_text_buf = Bitmap.new(width, height)
  971.       else
  972.         @opacity_text_buf.clear
  973.       end
  974.       @opacity_text_buf.font.size = target.font.size
  975.       @opacity_text_buf.draw_text(0, 0, width, height, str)
  976.       target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  977.     return width
  978.     end
  979.   end
  980.   #--------------------------------------------------------------------------
  981.   # ● \V 变换
  982.   #--------------------------------------------------------------------------
  983.   # option : 选项,'i'物品,'w'武器,'a'防具,'s'技能
  984.   # index  : 数据库的索引
  985.   #--------------------------------------------------------------------------
  986.   def convart_value(option, index)
  987.     option == nil ? option = "" : nil
  988.     option.downcase!
  989.     case option
  990.       when "i"
  991.         unless $data_items[index].name == nil
  992.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  993.         end
  994.       when "w"
  995.         unless $data_weapons[index].name == nil
  996.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  997.         end
  998.       when "a"
  999.         unless $data_armors[index].name == nil
  1000.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  1001.         end
  1002.       when "s"
  1003.         unless $data_skills[index].name == nil
  1004.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  1005.         end
  1006.       else
  1007.       r = $game_variables[index]
  1008.     end
  1009.     r == nil ? r = "" : nil
  1010.     return r
  1011.   end
  1012.   #--------------------------------------------------------------------------
  1013.   # ● 释放
  1014.   #--------------------------------------------------------------------------
  1015.   def dispose
  1016.     terminate_message
  1017.     unless @opacity_text_buf.disposed?
  1018.       @opacity_text_buf.dispose
  1019.     end
  1020.     $game_temp.message_window_showing = false
  1021.     if @input_number_window != nil
  1022.       @input_number_window.dispose
  1023.     end
  1024.     super
  1025.   end
  1026.   #--------------------------------------------------------------------------
  1027.   # ● 刷新光标矩形
  1028.   #--------------------------------------------------------------------------
  1029.   def update_cursor_rect
  1030.     if @index >= 0
  1031.       n = $game_temp.choice_start + @index
  1032.       self.cursor_rect.set(4 + @indent + @face_indent, n * line_height, @cursor_width, line_height)
  1033.     else
  1034.       self.cursor_rect.empty
  1035.     end
  1036.   end
  1037.   #--------------------------------------------------------------------------
  1038.   # ● 设置不透明度(所有组件)
  1039.   #--------------------------------------------------------------------------
  1040.   def all_opa=(opa)
  1041.     opa = [255, [opa, 0].max].min
  1042.     @all_opa = opa
  1043.     if $game_system.message_frame == 0
  1044.       self.opacity = opa
  1045.       @k_tale.opacity = opa if @k_tale
  1046.     else
  1047.       self.opacity = 0
  1048.       @k_tale.opacity = 0 if @k_tale
  1049.     end
  1050.     self.contents_opacity = opa
  1051.     @gold_window.opacity = opa if @gold_window
  1052.     @name_window_text.contents_opacity = opa if @name_window_text
  1053.     @right_picture.opacity = opa if @right_picture
  1054.     @left_picture.opacity = opa if @left_picture
  1055.     @bar.opacity = opa if @bar
  1056.   end
  1057.   #--------------------------------------------------------------------------
  1058.   # ● 获取不透明度(所有组件)
  1059.   #--------------------------------------------------------------------------
  1060.   def all_opa
  1061.     @all_opa
  1062.   end
  1063. end
  1064. #==============================================================================
  1065. # ■ Air_Text
  1066. #------------------------------------------------------------------------------
  1067. #   空气文字,借助窗口显示文字,但是不显示窗口载体。
  1068. #==============================================================================
  1069. class Air_Text < Window_Base
  1070.   #--------------------------------------------------------------------------
  1071.   # ● 对象初始化
  1072.   #--------------------------------------------------------------------------
  1073.   def initialize(x, y, designate_text, color)
  1074.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  1075.     self.opacity = 0
  1076.     self.back_opacity = 0
  1077.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  1078.     self.contents.font.size = 20
  1079.     self.contents.font.color = color
  1080.     w = self.contents.width
  1081.     h = self.contents.height
  1082.     self.contents.draw_text(0, 0, w, h, designate_text)
  1083.   end
  1084.   

  1085.   #--------------------------------------------------------------------------
  1086.   # ● 释放
  1087.   #--------------------------------------------------------------------------
  1088.   def dispose
  1089.     self.contents.clear
  1090.     super
  1091.   end
  1092. end

  1093. class Interpreter
  1094.   include RB::Mes_Config
  1095.   #--------------------------------------------------------------------------
  1096.   # ● 显示文章
  1097.   #--------------------------------------------------------------------------
  1098.   def command_101
  1099.     # 另外的文章已经设置过 message_text 的情况下
  1100.     if $game_temp.message_text != nil
  1101.       # 结束
  1102.       return false
  1103.     end
  1104.     # 设置信息结束后待机和返回调用标志
  1105.     @message_waiting = true
  1106.     $game_temp.message_proc = Proc.new { @message_waiting = false }
  1107.     # message_text 设置为 1 行
  1108.     # check whether \+ exists
  1109.     append = /\\\+$/ =~ @list[@index].parameters[0]
  1110.     line = @list[@index].parameters[0].sub(/\\\+$/, "")
  1111.     $game_temp.message_text = line + "\n"
  1112.     line_count = 1
  1113.     # 循环
  1114.     loop do
  1115.       # 下一个事件指令为文章两行以上的情况
  1116.       if @list[@index+1].code == 401 || @list[@index+1].code == 101 && append
  1117.         append = /\\\+$/ =~ @list[@index+1].parameters[0]
  1118.         line = @list[@index+1].parameters[0].sub(/\\\+$/, "")
  1119.         # message_text 添加到第 2 行以下
  1120.         $game_temp.message_text += line + "\n"
  1121.         line_count += 1
  1122.       # 事件指令不在文章两行以下的情况
  1123.       else
  1124.         # 下一个事件指令为显示选择项的情况下
  1125.         if @list[@index+1].code == 102
  1126.           # 如果选择项能收纳在画面里
  1127.           if @list[@index+1].parameters[0].size <= Max_Lines - line_count
  1128.             # 推进索引
  1129.             @index += 1
  1130.             # 设置选择项
  1131.             $game_temp.choice_start = line_count
  1132.             setup_choices(@list[@index].parameters)
  1133.           end
  1134.         # 下一个事件指令为处理输入数值的情况下
  1135.         elsif @list[@index+1].code == 103
  1136.           # 如果数值输入窗口能收纳在画面里
  1137.           if line_count < Max_Lines
  1138.             # 推进索引
  1139.             @index += 1
  1140.             # 设置输入数值
  1141.             $game_temp.num_input_start = line_count
  1142.             $game_temp.num_input_variable_id = @list[@index].parameters[0]
  1143.             $game_temp.num_input_digits_max = @list[@index].parameters[1]
  1144.           end
  1145.         end
  1146.         # 继续
  1147.         return true
  1148.       end
  1149.       # 推进索引
  1150.       @index += 1
  1151.     end
  1152.   end
  1153. end

  1154. class Scene_Map
  1155.   include RB::Mes_Config
  1156.   alias rb_update_20160408 update
  1157.   def update
  1158.     if @rb_mes_disabled != $game_switches[Mes_Disabled]
  1159.       @rb_mes_disabled = $game_switches[Mes_Disabled]
  1160.       @message_window.dispose if @message_window != nil
  1161.       @message_window = @rb_mes_disabled ? Window_Message.new : Window_Message_RB.new
  1162.     end
  1163.     rb_update_20160408
  1164.   end
  1165. end

  1166. class Scene_Battle
  1167.   include RB::Mes_Config
  1168.   alias rb_update_20160408 update
  1169.   def update
  1170.     if @rb_mes_disabled != $game_switches[Mes_Disabled]
  1171.       @rb_mes_disabled = $game_switches[Mes_Disabled]
  1172.       @message_window.dispose if @message_window != nil
  1173.       @message_window = @rb_mes_disabled ? Window_Message.new : Window_Message_RB.new
  1174.     end
  1175.     rb_update_20160408
  1176.   end
  1177. end


  1178. #==============================================================================
  1179. # 本脚本来自https://rpg.blue,使用和转载请保留此信息
  1180. #==============================================================================
复制代码


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

本版积分规则

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

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

GMT+8, 2024-4-28 16:56

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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