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

Project1

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

[原创发布] 6R增强对话框升级版

[复制链接]

Lv5.捕梦者 (版主)

遠航の猫咪

梦石
3
星屑
22517
在线时间
2338 小时
注册时间
2005-10-15
帖子
1160

开拓者

跳转到指定楼层
1
发表于 2012-9-26 13:02:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这个对话框多久没人维护了……是不是大家都用fuki去了
小日本写的东西,6R翻译了一遍。原来的刷新机制给搞的一塌糊涂,用了一大堆临时变量去保存状态……

姐抽空维护了一下这个玩意
1)增加了一堆\v变换内容
2)去掉了打字声效,win7下调midi格式的se和me伤不起
3)附带按C键或B键跳过打字效果
4)打字效果关掉或改速度是长时生效的
5)部分命令字修改(如\name,全部字母化),说话人姓名支持颜色表记

以后姐有空整合一下fuki吧,看心情,这个对素材要求还是有一些的,当然可以切窗口的角当sprite后angel=45/225来搞……太山寨……

其他看注释,姐不想多说,累……

RUBY 代码复制
  1. #==============================================================================
  2. # ■ Window_Message
  3. #------------------------------------------------------------------------------
  4. #  显示文章、选择项等信息的窗口。
  5. #==============================================================================
  6. #
  7. # 系统默认控制符:
  8. # \\:显示"\"这个符号
  9. # \c[0-7]:更改颜色
  10. # \g:显示金钱窗口
  11. # \n[1]:显示1号角色的姓名
  12. # \v[7]:显示7号变量的值
  13. #
  14. # 加强控制符(除非含义不同,否则命令不区分大小写):
  15. # \A:头像及姓名框靠左排列
  16. # \a:头像及姓名框靠右排列
  17. #
  18. # \b[50]:空50象素
  19. #
  20. # \d[4]:空4个字节(2个汉字)的位置
  21. #
  22. # \F[001]:在对话显示头像“Graphics/battlers/66rpg_001_f.png”
  23. # \f[1]:在对话中显示1号角色的头像,没有的话同\F[1]效果
  24. #
  25. # \h[12]:改用12号字
  26. #
  27. # \i:下一行从这个位置开始
  28. #
  29. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  30. # \l[1]:在左边显示1号角色的半身像,没有的话同\L[1]效果
  31. # \Lk:清除左边的图像
  32. # 使用半身像功能将把对话框固定在屏幕下方,无视\p和[显示文章选项]的设定
  33. #
  34. # \m[李逍遥]:用默认颜色(颜色0)显示一个“李逍遥”方框,表示说话人姓名
  35. # \m2[\n[1]]:用颜色2显示1号主角的姓名方框
  36. #
  37. # \o[123]:文字透明度改为123,模拟将死之人(汗)
  38. #
  39. # 地图画面
  40. # \p[-1]:对话框全屏显示
  41. # \p:本事件上方出现对话框,如果上方空间不够则出现在下方
  42. # \p[0]:主人公上方(或下方)出现对话框
  43. # \p[1]:对话框出现在1号事件的上方(或下方)
  44. # \p[-2]:恢复系统的对话框位置
  45. # 用正数参数使用\p功能时,会自动调整对话框的大小和位置
  46. #
  47. # 战斗画面
  48. # \p[-1]:对话框最小化并居中显示
  49. # \p[0-3]:我方战斗者上方出现对话框
  50. # \p[4-11]:敌方战斗者上方出现对话框
  51. # \p[-2]:恢复系统的对话框位置
  52. # 用不是-2的参数使用\p功能时,会自动调整对话框的大小和位置
  53. #
  54. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  55. # \r[1]:在右边显示1号角色的半身像,没有的话同\R[1]效果
  56. # \Rk:清除右边的图像
  57. # 使用半身像功能将把对话框固定在屏幕下方,无视\p和[显示文章选项]的设定
  58. #
  59. # \s:关闭打字效果
  60. # \s[0-9]:打字速度设定,越大越慢
  61. #
  62. # \t:显示游戏时间窗口
  63. #
  64. # \u[rrggbb]:直接以十六进制指定颜色,注意这里会把透明度重设为255
  65. #
  66. # \v[7:3]:显示7号变量的值,不足3位的话补零
  67. # \v[a7]:显示7号防具的图标和名称
  68. # \v[c7]:显示7号职业的名称
  69. # \v[e7]:显示7号属性的名称
  70. # \v[i7]:显示7号道具的图标和名称
  71. # \v[m7]:显示7号地图的名称
  72. #         (注:需配合$data_maps加载使用)
  73. # \v[n7]:显示7号角色的名称(和\n[7]重复,主要功能在下面)
  74. # \v[n7:7]:显示7号角色的灵巧,参数0-13分别表示等级、EXP、HP、SP、MaxHP、MaxSP
  75. #           力量、灵巧、速度、魔力、攻击、防御、魔防、回避
  76. # \v[s7]:显示7号特技的图标和名称
  77. # \v[t7]:显示7号状态的名称
  78. # \v[v7]:显示7号事件的名称,v0为显示本事件名称
  79. # \v[w7]:显示7号武器的图标和名称
  80. #
  81. # \w[20]:等待20帧(1秒)后自动关闭窗口
  82. #
  83. # \x[20]:本行之后文字定位到第20列,已超宽的话忽略
  84. #
  85. # \z[20]:打字到这里时停顿20帧,关闭打字效果的话忽略
  86. #
  87. #==============================================================================
  88. # 如果游戏加密请将以下内容解除注释
  89. # $encrypted = true
  90. # 如果要使用地图名显示功能请将以下内容解除注释
  91.   $data_maps = load_data("Data/MapInfos.rxdata")
  92. #==============================================================================
  93.  
  94. class Window_Message < Window_Selectable
  95.   #--------------------------------------------------------------------------
  96.   # ● 初始化状态
  97.   #--------------------------------------------------------------------------
  98.   def initialize
  99.     super(80, 304, 480, 160)
  100.     self.contents = Bitmap.new(width - 32, height - 32)
  101.     self.visible = false
  102.     self.z = 9998
  103.     @fade_in = false
  104.     @fade_out = false
  105.     @contents_showing = false
  106.     @cursor_width = 0
  107.     self.active = false
  108.     self.index = -1
  109.     @popchar = -2
  110.     @alignment = true
  111.     @wait_count = 0
  112.     @type_speed = 0
  113.     @type_wait = 0
  114.     @text_buffer = []
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● 释放
  118.   #--------------------------------------------------------------------------
  119.   def dispose
  120.     terminate_message
  121.     $game_temp.message_window_showing = false
  122.     if @input_number_window != nil
  123.       @input_number_window.dispose
  124.     end
  125.     super
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 处理信息结束
  129.   #--------------------------------------------------------------------------
  130.   def terminate_message
  131.     self.active = false
  132.     self.pause = false
  133.     self.index = -1
  134.     self.contents.clear
  135.     # 清除显示中标志
  136.     @contents_showing = false
  137.     # 呼叫信息调用
  138.     if $game_temp.message_proc != nil
  139.       $game_temp.message_proc.call
  140.     end
  141.     # 清除文章、选择项、输入数值的相关变量
  142.     $game_temp.message_text = nil
  143.     $game_temp.message_proc = nil
  144.     $game_temp.choice_start = 99
  145.     $game_temp.choice_max = 0
  146.     $game_temp.choice_cancel_type = 0
  147.     $game_temp.choice_proc = nil
  148.     $game_temp.num_input_start = 99
  149.     $game_temp.num_input_variable_id = 0
  150.     $game_temp.num_input_digits_max = 0
  151.     # 开放金钱窗口
  152.     if @gold_window != nil
  153.       @gold_window.dispose
  154.       @gold_window = nil
  155.     end
  156.     # 开放时间窗口
  157.     if @playtime_window != nil
  158.       @playtime_window.dispose
  159.       @playtime_window = nil
  160.     end
  161.     # 开放姓名窗口
  162.     if @name_window != nil
  163.       @name_window.dispose
  164.       @name_window = nil
  165.     end
  166.     if @name_airtext != nil
  167.       @name_airtext.dispose
  168.       @name_airtext = nil
  169.     end
  170.     # 开放角色图片
  171.     if @right_picture != nil and @right_keep == true
  172.       @right_picture.dispose
  173.     end
  174.     if @left_picture != nil and @left_keep == true
  175.       @left_picture.dispose
  176.     end
  177.     @face_bitmap = nil
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 刷新
  181.   #--------------------------------------------------------------------------
  182.   def refresh
  183.     # 初期化
  184.     self.contents.clear
  185.     self.contents.font.color = normal_color
  186.     self.contents.font.size = Font.default_size
  187.     x = y = max_x = max_y = @indent = lines = 0
  188.     @left_keep = @right_keep = false
  189.     @face_indent = 0
  190.     @opacity = 255
  191.     @cursor_width = 0
  192.     @wait_set = 0
  193.     face = nil
  194.     if $game_temp.choice_start == 0
  195.       x = 8
  196.     end
  197.     if $game_temp.message_text != nil
  198.       text = $game_temp.message_text
  199.  
  200.       # 变量的替换
  201.       begin
  202.         last_text = text.clone
  203.         text.gsub!(/\\[Vv]\[([ACEIMNSTVWaceimnstvw]?)([0-9]+)[:]?([0-9]*)\]/) {
  204.           convert_value($1, $2.to_i, $3)
  205.         }
  206.       end until text == last_text
  207.  
  208.       # 显示后等待的判定
  209.       if (/\\[Ww]\[([0-9]+)\]/.match(text)) != nil
  210.         @wait_set = $1.to_i * 2 - 1
  211.         text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "" }
  212.       end
  213.  
  214.       # 文字位置的判定
  215.       if (/\\[Pp]\[([-0-9]+)\]/.match(text))!=nil then
  216.         @popchar = $1.to_i
  217.         if @popchar == -1 and not $game_temp.in_battle
  218.           x = @indent = 48
  219.           y = 4
  220.         end
  221.         text.gsub!(/\\[Pp]\[([-0-9]+)\]/) { "" }
  222.         if $game_temp.in_battle
  223.           if @popchar >= 4
  224.             @alignment = true
  225.           else
  226.             @alignment = false
  227.           end
  228.         end
  229.       elsif (/\\[Pp]/.match(text))!=nil then
  230.         @popchar = 1000
  231.         text.gsub!(/\\[Pp]/) { "" }
  232.       end
  233.  
  234.       #——对齐设置
  235.       if (/\\([Aa])/.match(text))!=nil then
  236.         if $1 == "A"
  237.           @alignment = true
  238.         else
  239.           @alignment = false
  240.         end
  241.         text.gsub!(/\\([Aa])/) { "" }
  242.       end
  243.  
  244.       #——头像设置
  245.       if (/\\([Ff])\[(.+?)\]/.match(text))!=nil then
  246.         face = "66rpg_" + $2 + "_f.png"
  247.         if $1 == "f" and $game_actors[$2.to_i] != nil
  248.           face = $game_actors[$2.to_i].battler_name + "_f.png"
  249.         end
  250.         if $encrypted or FileTest.exist?("Graphics/Battlers/#{face}")
  251.           @face_bitmap = Bitmap.new("Graphics/Battlers/#{face}")
  252.           if @alignment
  253.             @face_indent = 128
  254.             x += @face_indent
  255.           end
  256.         else
  257.           @face_bitmap = nil
  258.         end
  259.         text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  260.       end
  261.  
  262.       #——左半身像设置
  263.       if (/\\([Ll])\[(.+?)\]/.match(text))!=nil then
  264.         face = "66rpg_" + $2 + "_h.png"
  265.         if $1 == "l" and $game_actors[$2.to_i] != nil
  266.           face = $game_actors[$2.to_i].battler_name + "_h.png"
  267.         end
  268.         if $encrypted or FileTest.exist?("Graphics/battlers/#{face}")
  269.           if @left_picture != nil
  270.             @left_picture.dispose
  271.           end
  272.           @left_picture = Sprite.new
  273.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  274.           @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  275.           @left_picture.x = 0
  276.           @left_picture.mirror = true
  277.           @popchar = -2
  278.           text.gsub!(/\\([Ll])\[(.*?)\]/) { "" }
  279.         end        
  280.       end
  281.  
  282.       #——右半身像设置
  283.       if (/\\([Rr])\[(.+?)\]/.match(text))!=nil then
  284.         face = "66rpg_" + $2 + "_h.png"
  285.         if $1 == "r" and $game_actors[$2.to_i] != nil
  286.           face = $game_actors[$2.to_i].battler_name + "_h.png"
  287.         end
  288.         if $encrypted or FileTest.exist?("Graphics/battlers/#{face}")
  289.           if @right_picture != nil
  290.             @right_picture.dispose
  291.           end
  292.           @right_picture = Sprite.new
  293.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  294.           @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  295.           @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  296.           @popchar = -2
  297.           text.gsub!(/\\([Rr])\[(.*?)\]/) { "" }
  298.         end
  299.       end
  300.       if (/\\[Rr][Kk]/.match(text)) != nil
  301.         @right_keep = true
  302.         text.sub!(/\\[Rr]k/) { "" }
  303.       end
  304.       if (/\\[Ll][Kk]/.match(text)) != nil
  305.         @left_keep = true
  306.         text.sub!(/\\[Ll]k/) { "" }
  307.       end
  308.  
  309.       # 替换人物姓名
  310.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  311.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  312.       end
  313.  
  314.       # 显示人物姓名
  315.       name_window_set = false
  316.       if (/\\[Mm]([0-9]*?)\[(.+?)\]/.match(text)) != nil
  317.         name_window_set = true
  318.         if $1 == ""
  319.           color = 0
  320.         else
  321.           color = $1.to_i
  322.         end
  323.         if color >= 0 and color <= 7
  324.           name_color = color
  325.         end
  326.         name_text = $2
  327.         text.gsub!(/\\[Mm]([0-9]*?)\[(.*?)\]/) { "" }
  328.       end
  329.  
  330.       # 打字效果设定
  331.       if (/\\[Ss]\[([0-9]+)\]/.match(text)) != nil
  332.         @type_speed = [$1.to_i, 9].min
  333.         text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "" }
  334.       # 关闭打字效果
  335.       elsif (/\\[Ss]/.match(text))!=nil then
  336.         @type_speed = -1
  337.         text.gsub!(/\\[Ss]/) { "" }
  338.       end
  339.  
  340.       # 窗口位置计算
  341.       if @popchar >= 0 or (@popchar == -1 and $game_temp.in_battle)
  342.         # 浮于事件上方的情况
  343.         max_x = 16
  344.         # 获得行数
  345.         textlines = text.split(/\n/)
  346.         cy = max_y = textlines.size
  347.         for i in 0..max_y - 1
  348.           line = plain_text(textlines[i])
  349.           if line == ""
  350.             cy -= 1
  351.             next
  352.           end
  353.           cx = contents.text_size(line).width
  354.           if i >= $game_temp.choice_start and $game_temp.choice_start > 0
  355.             cx += 16
  356.           end
  357.           # 获得最大宽度
  358.           max_x = cx if cx > max_x
  359.         end
  360.         # 计算宽度和高度
  361.         max_y = cy if cy < max_y
  362.         max_y = [max_y, 1].max
  363.         self.width = max_x + 32 + @face_indent
  364.         self.width += 16 if $game_temp.choice_start == 0
  365.         # 右边有头像的情况宽度再加 128
  366.         self.width += 128 if @face_bitmap != nil and not @alignment
  367.         max_x += 8 if $game_temp.choice_start == 0
  368.         # 有输入数值的情况下增加一行并调整宽度
  369.         if $game_temp.num_input_variable_id > 0
  370.           max_y += 1
  371.           dummy_bitmap = Bitmap.new(32, 32)
  372.           cursor_width = dummy_bitmap.text_size("0").width + 8
  373.           dummy_bitmap.dispose
  374.           cx = cursor_width * $game_temp.num_input_digits_max + 16
  375.           max_x = cx if cx > max_x
  376.         end
  377.         self.height = max_y * 32 + 32
  378.         # 有头像的情况高度定为 160
  379.         self.height = [self.height, 160].max if @face_bitmap != nil
  380.       # 不是浮于事件上方的情况
  381.       else
  382.         max_x = self.width - 32 - @face_indent
  383.         self.height = [text.split(/\n/).size * 32 + 32, 160].max
  384.       end
  385.  
  386.       # 绘制窗体样式
  387.       reset_window
  388.  
  389.       # 姓名框
  390.       if name_window_set
  391.         w = self.contents.text_size(name_text).width + 16
  392.         xn = @alignment ? self.x : self.x + self.width - w
  393.         if self.y < 20
  394.           if @popchar >= 0
  395.             self.y += self.height + 48 if @popchar >= 0
  396.           else
  397.             self.y = 36
  398.           end
  399.         end
  400.         yn = self.y - 20
  401.         @name_window = Window_Name.new(xn, yn, w)
  402.         @name_window.z = self.z + 1
  403.         @name_airtext = Window_AirText.new(xn + 8, yn + 8, name_text, name_color)
  404.         @name_airtext.z = self.z + 2
  405.         @name_window.back_opacity = self.back_opacity
  406.       end
  407.  
  408.       # 逐字打印文本
  409.       text.gsub!(/\\\\/) { "\000" }
  410.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  411.       text.gsub!(/\\[Gg]/) { "\002" }
  412.       text.gsub!(/\\[Tt]/) { "\003" }
  413.       text.gsub!(/\\[Uu]\[([0-9A-Fa-f]{6})\]/) { "\004[#{$1}]" }
  414.       text.gsub!(/\\[Xx]\[([0-9]+)\]/) { "\005[#{$1}]" }
  415.       text.gsub!(/\\[Zz]\[([0-9]+)\]/) { "\022[#{$1}]" }
  416.       text.gsub!(/\\[Ii]/) { "\023" }
  417.       text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  418.       text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  419.       text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  420.       text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  421.       start_x = @indent + @face_indent
  422.       @text_buffer = []
  423.       c_wait = 0
  424.  
  425.       while ((c = text.slice!(/./m)) != nil)
  426.         if c == "\000"
  427.           c = "\\"
  428.         end
  429.         if c == "\001"
  430.           text.sub!(/\[([0-9]+)\]/, "")
  431.           color = $1.to_i
  432.           if color >= 0 and color <= 7
  433.             if @type_speed < 0
  434.               self.contents.font.color = text_color(color)
  435.             else
  436.               @text_buffer.push([nil, -1, text_color(color)])
  437.             end
  438.           end
  439.           next
  440.         end
  441.         if c == "\002"
  442.           if @gold_window == nil
  443.             @gold_window = Window_Gold.new
  444.             @gold_window.x = 560 - @gold_window.width
  445.             if $game_temp.in_battle
  446.               @gold_window.y = 192
  447.             else
  448.               @gold_window.y = self.y >= 128 ? 32 : 384
  449.             end
  450.             @gold_window.opacity = self.opacity
  451.             @gold_window.back_opacity = self.back_opacity
  452.           end
  453.           next
  454.         end
  455.         if c == "\003"
  456.           if @playtime_window == nil
  457.             @playtime_window = Window_PlayTime.new
  458.             @playtime_window.x = 80
  459.             if $game_temp.in_battle
  460.               @playtime_window.y = 192
  461.             else
  462.               @playtime_window.y = self.y >= 128 ? 32 : 384
  463.             end
  464.             @playtime_window.opacity = self.opacity
  465.             @playtime_window.back_opacity = self.back_opacity
  466.           end
  467.           next
  468.         end
  469.         if c == "\004"
  470.           text.sub!(/\[([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})\]/, "")
  471.           if @type_speed < 0
  472.             self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16), 255)
  473.           else
  474.             @text_buffer.push([nil, -1, Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16), 255)])
  475.           end
  476.           next
  477.         end
  478.         if c == "\005"
  479.           text.sub!(/\[([0-9]+)\]/, "")
  480.           tab = ($1.to_i - 1) * self.contents.text_size("0").width
  481.           x = start_x + tab if x < start_x + tab
  482.           next
  483.         end
  484.  
  485.         if c == "\022"
  486.           text.sub!(/\[([0-9]+)\]/, "")
  487.           c_wait += $1.to_i
  488.           next
  489.         end
  490.  
  491.         if c == "\023"
  492.           @indent = x
  493.           next
  494.         end
  495.         if c == "\024"
  496.           text.sub!(/\[([0-9]+)\]/, "")
  497.           if @type_speed < 0
  498.             self.contents.font.color.alpha = [[0, $1.to_i].max, 255].min
  499.           else
  500.             color = self.contents.font.color.clone
  501.             color.alpha = [[0, $1.to_i].max, 255].min
  502.             @text_buffer.push([nil, -1, color])
  503.           end
  504.           next
  505.         end
  506.         if c == "\025"
  507.           text.sub!(/\[([0-9]+)\]/, "")
  508.           self.contents.font.size = [[$1.to_i, 6].max, 32].min
  509.           if @type_speed >= 0
  510.             @text_buffer.push([nil, -1, self.contents.font.size])
  511.           end
  512.           next
  513.         end
  514.         if c == "\026"
  515.           text.sub!(/\[([0-9]+)\]/, "")
  516.           x += $1.to_i
  517.           next
  518.         end
  519.         if c == "\027"
  520.           text.sub!(/\[([0-9]+)\]/, "")
  521.           x += $1.to_i * self.contents.text_size("0").width
  522.           next
  523.         end
  524.  
  525.         if c == "\030"
  526.           text.sub!(/\[(.*?)\]/, "")
  527.           if @type_speed < 0
  528.             self.contents.blt(x , y * line_height + 4, RPG::Cache.icon($1),
  529.               Rect.new(0, 0, 24, 24))
  530.           else
  531.             @text_buffer.push([Rect.new(x, y * line_height + 4, 24, 24),
  532.               c_wait, RPG::Cache.icon($1)])
  533.             c_wait = @type_speed
  534.           end
  535.           x += 24
  536.           next
  537.         end
  538.         if c == "\n"
  539.           if x == start_x and (@popchar != -2 and not $game_temp.in_battle)
  540.             $game_temp.choice_start -= 1
  541.             lines -= 1
  542.             y -= 1
  543.           end
  544.           if lines >= $game_temp.choice_start
  545.             @cursor_width = [@cursor_width, x - @face_indent].max
  546.           end
  547.           lines += 1
  548.           y += 1
  549.           start_x = @face_indent + @indent
  550.           x = start_x
  551.           if lines >= $game_temp.choice_start
  552.             x += 8
  553.           end
  554.           next
  555.         end
  556.         # 描绘文字
  557.         c_width = self.contents.text_size(c).width
  558.         c_height = line_height
  559.         if @type_speed < 0
  560.           self.contents.draw_text(x, c_height * y, c_width, c_height, c)
  561.         else
  562.           @text_buffer.push([Rect.new(x, c_height * y, c_width, c_height),
  563.             c_wait, c])
  564.           c_wait = @type_speed
  565.         end
  566.         x += c_width
  567.       end
  568.       @type_wait = @text_buffer[0][1] if @text_buffer.size > 0
  569.     end
  570.     if @type_speed < 0 and $game_temp.choice_max > 0
  571.       @item_max = $game_temp.choice_max
  572.       self.active = true
  573.       self.index = 0
  574.     end
  575.     if $game_temp.num_input_variable_id > 0
  576.       digits_max = $game_temp.num_input_digits_max
  577.       number = $game_variables[$game_temp.num_input_variable_id]
  578.       @input_number_window = Window_InputNumber.new(digits_max)
  579.       @input_number_window.number = number
  580.       @input_number_window.x = self.x + 8
  581.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  582.     end
  583.   end
  584.   #--------------------------------------------------------------------------
  585.   # ● 更新
  586.   #--------------------------------------------------------------------------
  587.   def update
  588.     super
  589.     # 渐变的情况下
  590.     if @fade_in
  591.       self.contents_opacity += 24
  592.       if @input_number_window != nil
  593.         @input_number_window.contents_opacity += 24
  594.       end
  595.       if self.contents_opacity == 255
  596.         @fade_in = false
  597.       end
  598.       return
  599.     end
  600.     # 打字的情况下
  601.     if @text_buffer.size > 0
  602.       # 按键跳过打字
  603.       if Input.trigger?(Input::C) or Input.trigger?(Input::B)
  604.         type_next_char until @text_buffer.size == 0
  605.         return
  606.       end
  607.       # 等待打字延时
  608.       if @type_wait > 0
  609.         @type_wait -= 1
  610.       end
  611.       # 传送位图
  612.       if @type_wait <= 0
  613.         type_next_char
  614.       end
  615.       return
  616.     end
  617.     # 输入数值的情况下
  618.     if @input_number_window != nil
  619.       if @input_number_window.contents_opacity < 255
  620.         @input_number_window.contents_opacity += 24
  621.         return
  622.       end
  623.       @input_number_window.update
  624.       # 确定
  625.       if Input.trigger?(Input::C)
  626.         $game_system.se_play($data_system.decision_se)
  627.         $game_variables[$game_temp.num_input_variable_id] =
  628.           @input_number_window.number
  629.         $game_map.need_refresh = true
  630.         # 释放输入数值窗口
  631.         @input_number_window.dispose
  632.         @input_number_window = nil
  633.         terminate_message
  634.       end
  635.       return
  636.     end
  637.     # 显示信息中的情况下
  638.     if @contents_showing
  639.       # 如果不是在显示选择项中就显示暂停标志
  640.       if $game_temp.choice_max == 0
  641.         self.pause = true
  642.       end
  643.       # 取消
  644.       if Input.trigger?(Input::B)
  645.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  646.           $game_system.se_play($data_system.cancel_se)
  647.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  648.           terminate_message
  649.         end
  650.       end
  651.       # 确定
  652.       if Input.trigger?(Input::C)
  653.         if $game_temp.choice_max > 0
  654.           $game_system.se_play($data_system.decision_se)
  655.           $game_temp.choice_proc.call(self.index)
  656.         end
  657.         terminate_message
  658.       end
  659.       # 时间窗口可见的情况下
  660.       if @playtime_window != nil
  661.         @playtime_window.update
  662.       end
  663.       # 等待中的情况下
  664.       if @wait_count > 0
  665.         @wait_count -= 1
  666.         if @wait_count == 0
  667.           terminate_message
  668.         end
  669.       end
  670.       return
  671.     end
  672.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  673.     if @fade_out == false and $game_temp.message_text != nil
  674.       @contents_showing = true
  675.       $game_temp.message_window_showing = true
  676.       refresh
  677.       Graphics.frame_reset
  678.       @wait_count = 0
  679.       if @wait_set != 0
  680.         @wait_count = @wait_set
  681.       end
  682.       self.visible = true
  683.       if @type_speed < 0
  684.         self.contents_opacity = 0
  685.         @fade_in = true
  686.       else
  687.         self.contents_opacity = 255
  688.       end
  689.       if @input_number_window != nil
  690.         @input_number_window.contents_opacity = 0
  691.       end
  692.       return
  693.     end
  694.     # 没有可以显示的信息、但是窗口为可见的情况下
  695.     if self.visible
  696.       @fade_out = true
  697.       self.opacity -= 48
  698.       if self.opacity == 0
  699.         self.visible = false
  700.         @fade_out = false
  701.         $game_temp.message_window_showing = false
  702.       end
  703.       return
  704.     end
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   # ● 获得角色
  708.   #--------------------------------------------------------------------------
  709.   def get_character(parameter)
  710.     case parameter
  711.     when 1000 # 本事件
  712.       return $game_system.map_interpreter.get_character(0)
  713.     when 0 # 角色
  714.       return $game_player
  715.     else # 其他事件
  716.       return $game_system.map_interpreter.get_character(parameter)
  717.     end
  718.   end
  719.   #--------------------------------------------------------------------------
  720.   # ● 设置窗口位置与不透明度
  721.   #--------------------------------------------------------------------------
  722.   def reset_window
  723.     # 位置判定
  724.     if $game_temp.in_battle
  725.       if @popchar >= 4
  726.         x = $game_troop.enemies[@popchar - 4].screen_x - self.width / 2
  727.         y = $game_troop.enemies[@popchar - 4].screen_y - self.height - 100
  728.         self.x = [[x, 0].max, 640 - self.width].min
  729.         self.y = [y, 16].max
  730.       elsif @popchar >= 0
  731.         x = $game_party.actors[@popchar].screen_x - self.width / 2
  732.         y = $game_party.actors[@popchar].screen_y - self.height - 100
  733.         self.x = [[x, 0].max, 640 - self.width].min
  734.         self.y = [y, 16].max
  735.       elsif @popchar == -1
  736.         self.x = 320 - self.width / 2
  737.         self.y = 192 - self.height / 2
  738.       elsif @popchar == -2
  739.         self.y = 16
  740.       end
  741.     else
  742.       if @popchar >= 0
  743.         events = $game_map.events
  744.         if events != nil
  745.           character = get_character(@popchar)
  746.           if character != nil
  747.             x = [[character.screen_x - self.width / 2, 4].max, 636 - self.width].min
  748.             y = character.screen_y - 48 - self.height
  749.             y = character.screen_y if y < 4
  750.             y = [y, 476 - self.height].min
  751.             self.x = x
  752.             self.y = y
  753.           else
  754.             @popchar = -2
  755.           end
  756.         end
  757.       elsif @popchar == -1
  758.         self.x = -4
  759.         self.y = -4
  760.         self.width = 648
  761.         self.height = 488
  762.       else
  763.         case $game_system.message_position
  764.         when 0 # 上
  765.           self.y = 16
  766.         when 1 # 中
  767.           self.y = [240 - self.height / 2, 16].max
  768.         when 2 # 下
  769.           self.y = [[304, 464 - self.height].min, 16].max
  770.         end
  771.         if (@left_picture != nil and not @left_keep) or
  772.           (@right_picture != nil and not @right_keep)
  773.           self.y = [[304, 464 - self.height].min, 16].max
  774.         end
  775.         self.x = 80
  776.         if @face_bitmap == nil
  777.           self.width = 480
  778.         else
  779.           self.width = 600
  780.           self.x -= 60
  781.         end
  782.       end
  783.     end
  784.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  785.     if @face_bitmap != nil
  786.       if @alignment
  787.         self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  788.       else
  789.         self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  790.           Rect.new(0, 0, 96, 96))
  791.       end
  792.       @face_bitmap.dispose
  793.       @face_bitmap = nil
  794.     end
  795.     if @popchar == -1 and not $game_temp.in_battle
  796.       self.opacity = 255
  797.       self.back_opacity = 0
  798.     elsif $game_system.message_frame == 0
  799.       self.opacity = 255
  800.       self.back_opacity = 224
  801.     else
  802.       self.opacity = 0
  803.       self.back_opacity = 160
  804.     end
  805.   end
  806.   #--------------------------------------------------------------------------
  807.   # ● 行高
  808.   #--------------------------------------------------------------------------
  809.   def line_height
  810.     if self.contents.font.size >= 20 and self.contents.font.size <= 24
  811.       return 32
  812.     else
  813.       return self.contents.font.size * 15 / 10
  814.     end
  815.   end
  816.   #--------------------------------------------------------------------------
  817.   # ● 纯文本变换
  818.   #--------------------------------------------------------------------------
  819.   def plain_text(text)
  820.     plain = text.clone
  821.     plain.gsub!(/\\\\/) { "\\" }
  822.     plain.gsub!(/\\[CcGgTtUuOoHhIiZz]+(\[([0-9A-Fa-f]+)\])*/) { "" }
  823.     plain.gsub!(/\030\[(.*?)\]/) { " " * (24.0 / self.contents.font.size * 2).ceil }
  824.     plain.gsub!(/\\[Bb]\[([0-9]+)\]/) { " " * ($1.to_f / self.contents.font.size * 2).ceil }
  825.     plain.gsub!(/\\[Dd]\[([0-9]+)\]/) { " " * $1.to_i}
  826.     plain.gsub!(/^.*?\\[Xx]\[([0-9]+)\]/) { " " * ($1.to_i - 1)}
  827.     return plain
  828.   end  
  829.   #--------------------------------------------------------------------------
  830.   # ● \V 变换
  831.   #--------------------------------------------------------------------------
  832.   def convert_value(option, index, width)
  833.     option == nil ? option = "" : nil
  834.     option.downcase!
  835.     case option
  836.       when "a"
  837.         unless $data_armors[index].name == nil
  838.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  839.         end
  840.       when "c"
  841.         unless $data_classes[index] == nil
  842.           r = $data_classes[index].name
  843.         end
  844.       when "e"
  845.         unless $data_system.elements[index] == nil
  846.           r = $data_system.elements[index]
  847.         end
  848.       when "i"
  849.         unless $data_items[index].name == nil
  850.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  851.         end
  852.       when "m"
  853.         unless $data_maps == nil or $data_maps[index].name == nil
  854.           r = $data_maps[index].name
  855.         end
  856.       when "n"
  857.         unless $game_actors[index] == nil
  858.           case width
  859.           when "0"
  860.             r = $game_actors[index].level
  861.           when "1"
  862.             r = $game_actors[index].exp
  863.           when "2"
  864.             r = $game_actors[index].hp
  865.           when "3"
  866.             r = $game_actors[index].sp
  867.           when "4"
  868.             r = $game_actors[index].maxhp
  869.           when "5"
  870.             r = $game_actors[index].maxsp
  871.           when "6"
  872.             r = $game_actors[index].str
  873.           when "7"
  874.             r = $game_actors[index].dex
  875.           when "8"
  876.             r = $game_actors[index].agi
  877.           when "9"
  878.             r = $game_actors[index].int
  879.           when "10"
  880.             r = $game_actors[index].atk
  881.           when "11"
  882.             r = $game_actors[index].pdef
  883.           when "12"
  884.             r = $game_actors[index].mdef
  885.           when "13"
  886.             r = $game_actors[index].eva
  887.           else
  888.             r = $game_actors[index].name
  889.           end
  890.         end
  891.       when "s"
  892.         unless $data_skills[index].name == nil
  893.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  894.         end
  895.       when "t"
  896.         unless $data_states[index] == nil
  897.           r = $data_states[index].name
  898.         end
  899.       when "v"
  900.         unless $game_map == nil or index < 0 or
  901.           $game_system.map_interpreter.get_character(index) == nil
  902.           r = $game_system.map_interpreter.get_character(index).name
  903.         end
  904.       when "w"
  905.         unless $data_weapons[index].name == nil
  906.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  907.         end
  908.       else
  909.         if width != ""
  910.           r = sprintf("%0#{width}d", $game_variables[index])
  911.         else
  912.           r = $game_variables[index]
  913.         end
  914.     end
  915.     r == nil ? r = "" : nil
  916.     return r
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # ● 更新光标矩形
  920.   #--------------------------------------------------------------------------
  921.   def update_cursor_rect
  922.     if @index >= 0
  923.       n = $game_temp.choice_start + @index
  924.       self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  925.     else
  926.       self.cursor_rect.empty
  927.     end
  928.   end
  929.   #--------------------------------------------------------------------------
  930.   # ● 打印下一个字
  931.   #--------------------------------------------------------------------------
  932.   def type_next_char
  933.     c = @text_buffer.shift
  934.     rc = c[0]
  935.     case c[2]
  936.     when Bitmap
  937.       self.contents.blt(rc.x, rc.y, c[2], c[2].rect)
  938.     when Color
  939.       self.contents.font.color = c[2]
  940.     when Integer
  941.       self.contents.font.size = c[2]
  942.     else
  943.       self.contents.draw_text(rc, c[2])
  944.     end
  945.     if @text_buffer.size > 0
  946.       @type_wait = @text_buffer[0][1]
  947.       type_next_char if @type_wait == -1
  948.     else
  949.       if $game_temp.choice_max > 0
  950.         @item_max = $game_temp.choice_max
  951.         self.active = true
  952.         self.index = 0
  953.       end
  954.     end
  955.   end
  956. end
  957.  
  958. #==============================================================================
  959. # ■ Window_Name
  960. #------------------------------------------------------------------------------
  961. #  显示对话人姓名的窗口。
  962. #==============================================================================
  963.  
  964. class Window_Name < Window_Base
  965.   #--------------------------------------------------------------------------
  966.   # ● 初始化窗口
  967.   #--------------------------------------------------------------------------
  968.   def initialize(x, y, width)
  969.     super(x, y, width, 40)
  970.     self.contents = nil
  971.     self.back_opacity = 160
  972.   end
  973. end
  974.  
  975. #==============================================================================
  976. # ■ Window_AirText
  977. #------------------------------------------------------------------------------
  978. #  显示对话人姓名的文字。
  979. #==============================================================================
  980.  
  981. class Window_AirText < Window_Base
  982.   #--------------------------------------------------------------------------
  983.   # ● 初始化窗口
  984.   #--------------------------------------------------------------------------
  985.   def initialize(x, y, designate_text, color)
  986.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  987.     self.opacity = 0
  988.     self.back_opacity = 0
  989.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  990.     w = self.contents.width
  991.     h = self.contents.height
  992.     if color.is_a?(Integer)
  993.       self.contents.font.color = text_color(color)
  994.     else
  995.       self.contents.font.color = color
  996.     end
  997.     self.contents.draw_text(0, 0, w, h, designate_text)
  998.   end
  999. end
  1000.  
  1001. #==============================================================================
  1002. # ■ Game_Event
  1003. #------------------------------------------------------------------------------
  1004. #  处理事件的类。条件判断、事件页的切换、并行处理、执行事件功能
  1005. # 在 Game_Map 类的内部使用。
  1006. #==============================================================================
  1007.  
  1008. class Game_Event < Game_Character
  1009.   #--------------------------------------------------------------------------
  1010.   # ● 事件名字
  1011.   #--------------------------------------------------------------------------
  1012.   def name
  1013.     return @event.name
  1014.   end
  1015. end



附件是范例工程。老规矩,姐一般不提供范例工程,避免伸手党,所以收20G意思下,范例中不含配套的半身像和头像素材。
6R_Dialog.zip (209.83 KB, 下载次数: 696, 售价: 2 星屑)

评分

参与人数 1星屑 +400 收起 理由
叶子 + 400 mark

查看全部评分

SailCat (小猫子·要开心一点) 共上站 24 次,发表过 11 篇文章 上 次 在: [2006年01月28日11:41:18 星期六] 从 [162.105.120.91] 到本站一游。
菜鸟飞呀飞 该用户已被删除
2
发表于 2012-9-26 18:45:46 手机端发表。 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
58 小时
注册时间
2007-8-10
帖子
284
3
发表于 2012-11-27 22:27:11 | 只看该作者
好啊好啊好啊号
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
29 小时
注册时间
2006-9-23
帖子
3
4
发表于 2013-1-9 23:07:41 | 只看该作者
多谢!正需要强大的对话功能
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
帖子
11485

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

5
发表于 2013-1-10 19:09:22 | 只看该作者
很强大的功能
正需要这种对话框,谢谢楼主
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
26 小时
注册时间
2010-7-21
帖子
21
6
发表于 2013-2-11 22:16:52 | 只看该作者
……脚本window_message的274行发生syntaxerror是怎么个情况。。范例工程一运行就闪退。。

点评

话说这种脚步多如凡云…………  发表于 2013-2-12 11:33
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
671
在线时间
475 小时
注册时间
2011-4-25
帖子
166
7
发表于 2013-2-23 14:06:45 | 只看该作者
很强大很不错
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-2-22
帖子
7
8
发表于 2013-2-23 17:00:29 | 只看该作者
下来看一下...
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

9
发表于 2013-3-24 21:52:24 | 只看该作者
是FUCK的那种对话框吗?
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
1
星屑
4687
在线时间
362 小时
注册时间
2011-5-11
帖子
503
10
发表于 2013-5-30 18:29:13 | 只看该作者
确实占用资源较少,只是经测试,少了个一句话中几个字体变色的功能。(可以变色,但是一直变色到这句话的结尾,而不能中段字体单独变色)

点评

用\c[n]变色后在变色的字的结尾再用\c[0]变回来就行了  发表于 2013-6-1 18:52
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-14 02:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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