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

Project1

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

[已经解决] 请问如何制作对话框按钮?

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3532
在线时间
595 小时
注册时间
2010-6-28
帖子
85
跳转到指定楼层
1
发表于 2021-5-7 05:13:38 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 步平凡 于 2021-5-8 15:57 编辑

就像天之痕对话框那样,文字显示完毕后右下角会出现按钮,按下回车或空格之后显示下一个对话?另外还想问一下,NPC对话如何制作成像天之痕那样的对话框效果?

Project2.zip (252.17 KB, 下载次数: 25)





Lv3.寻梦者

梦石
0
星屑
3532
在线时间
595 小时
注册时间
2010-6-28
帖子
85
2
 楼主| 发表于 2021-5-7 13:55:57 | 只看该作者
人呢?求解答
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3827
在线时间
1965 小时
注册时间
2013-1-3
帖子
9532
3
发表于 2021-5-7 16:41:36 | 只看该作者
可以搜索增强对话 论坛提问帖里有
  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. class Window_Message < Window_Selectable
  94.   #--------------------------------------------------------------------------
  95.   # ● 初始化状态
  96.   #--------------------------------------------------------------------------
  97.   def initialize
  98.     super(80, 304, 480, 160)
  99.     self.contents = Bitmap.new(width - 32, height - 32)
  100.     self.visible = false
  101.     self.z = 9998
  102.     @fade_in = false
  103.     @fade_out = false
  104.     @contents_showing = false
  105.     @cursor_width = 0
  106.     self.active = false
  107.     self.index = -1
  108.     @popchar = -2
  109.     @alignment = true
  110.     @wait_count = 0
  111.     @type_speed = 0
  112.     @type_wait = 0
  113.     @text_buffer = []
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 释放
  117.   #--------------------------------------------------------------------------
  118.   def dispose
  119.     terminate_message
  120.     $game_temp.message_window_showing = false
  121.     if @input_number_window != nil
  122.       @input_number_window.dispose
  123.     end
  124.     super
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ● 处理信息结束
  128.   #--------------------------------------------------------------------------
  129.   def terminate_message
  130.     self.active = false
  131.     self.pause = false
  132.     self.index = -1
  133.     self.contents.clear
  134.     # 清除显示中标志
  135.     @contents_showing = false
  136.     # 呼叫信息调用
  137.     if $game_temp.message_proc != nil
  138.       $game_temp.message_proc.call
  139.     end
  140.     # 清除文章、选择项、输入数值的相关变量
  141.     $game_temp.message_text = nil
  142.     $game_temp.message_proc = nil
  143.     $game_temp.choice_start = 99
  144.     $game_temp.choice_max = 0
  145.     $game_temp.choice_cancel_type = 0
  146.     $game_temp.choice_proc = nil
  147.     $game_temp.num_input_start = 99
  148.     $game_temp.num_input_variable_id = 0
  149.     $game_temp.num_input_digits_max = 0
  150.     # 开放金钱窗口
  151.     if @gold_window != nil
  152.       @gold_window.dispose
  153.       @gold_window = nil
  154.     end
  155.     # 开放时间窗口
  156.     if @playtime_window != nil
  157.       @playtime_window.dispose
  158.       @playtime_window = nil
  159.     end
  160.     # 开放姓名窗口
  161.     if @name_window != nil
  162.       @name_window.dispose
  163.       @name_window = nil
  164.     end
  165.     if @name_airtext != nil
  166.       @name_airtext.dispose
  167.       @name_airtext = nil
  168.     end
  169.     # 开放角色图片
  170.     if @right_picture != nil and @right_keep == true
  171.       @right_picture.dispose
  172.     end
  173.     if @left_picture != nil and @left_keep == true
  174.       @left_picture.dispose
  175.     end
  176.     @face_bitmap = nil
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 刷新
  180.   #--------------------------------------------------------------------------
  181.   def refresh
  182.     # 初期化
  183.     self.contents.clear
  184.     self.contents.font.color = normal_color
  185.     self.contents.font.size = Font.default_size
  186.     x = y = max_x = max_y = @indent = lines = 0
  187.     @left_keep = @right_keep = false
  188.     @face_indent = 0
  189.     [url=home.php?mod=space&uid=316553]@opacity[/url] = 255
  190.     @cursor_width = 0
  191.     @wait_set = 0
  192.     face = nil
  193.     if $game_temp.choice_start == 0
  194.       x = 8
  195.     end
  196.     if $game_temp.message_text != nil
  197.       text = $game_temp.message_text
  198.       
  199.       # 变量的替换
  200.       begin
  201.         last_text = text.clone
  202.         text.gsub!(/\\[Vv]\[([ACEIMNSTVWaceimnstvw]?)([0-9]+)[:]?([0-9]*)\]/) {
  203.           convert_value($1, $2.to_i, $3)
  204.         }
  205.       end until text == last_text
  206.       
  207.       # 显示后等待的判定
  208.       if (/\\[Ww]\[([0-9]+)\]/.match(text)) != nil
  209.         @wait_set = $1.to_i * 2 - 1
  210.         text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "" }
  211.       end
  212.       
  213.       # 文字位置的判定
  214.       if (/\\[Pp]\[([-0-9]+)\]/.match(text))!=nil then
  215.         @popchar = $1.to_i
  216.         if @popchar == -1 and not $game_temp.in_battle
  217.           x = @indent = 48
  218.           y = 4
  219.         end
  220.         text.gsub!(/\\[Pp]\[([-0-9]+)\]/) { "" }
  221.         if $game_temp.in_battle
  222.           if @popchar >= 4
  223.             @alignment = true
  224.           else
  225.             @alignment = false
  226.           end
  227.         end
  228.       elsif (/\\[Pp]/.match(text))!=nil then
  229.         @popchar = 1000
  230.         text.gsub!(/\\[Pp]/) { "" }
  231.       end
  232.       
  233.       #——对齐设置
  234.       if (/\\([Aa])/.match(text))!=nil then
  235.         if $1 == "A"
  236.           @alignment = true
  237.         else
  238.           @alignment = false
  239.         end
  240.         text.gsub!(/\\([Aa])/) { "" }
  241.       end
  242.       
  243.       #——头像设置
  244.       if (/\\([Ff])\[(.+?)\]/.match(text))!=nil then
  245.         face = "66rpg_" + $2 + "_f.png"
  246.         if $1 == "f" and $game_actors[$2.to_i] != nil
  247.           face = $game_actors[$2.to_i].battler_name + "_f.png"
  248.         end
  249.         if $encrypted or FileTest.exist?("Graphics/Battlers/#{face}")
  250.           @face_bitmap = Bitmap.new("Graphics/Battlers/#{face}")
  251.           if @alignment
  252.             @face_indent = 128
  253.             x += @face_indent
  254.           end
  255.         else
  256.           @face_bitmap = nil
  257.         end
  258.         text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  259.       end
  260.       
  261.       #——左半身像设置
  262.       if (/\\([Ll])\[(.+?)\]/.match(text))!=nil then
  263.         face = "66rpg_" + $2 + "_h.png"
  264.         if $1 == "l" and $game_actors[$2.to_i] != nil
  265.           face = $game_actors[$2.to_i].battler_name + "_h.png"
  266.         end
  267.         if $encrypted or FileTest.exist?("Graphics/battlers/#{face}")
  268.           if @left_picture != nil
  269.             @left_picture.dispose
  270.           end
  271.           @left_picture = Sprite.new
  272.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  273.           @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  274.           @left_picture.x = 0
  275.           @left_picture.mirror = true
  276.           @popchar = -2
  277.           text.gsub!(/\\([Ll])\[(.*?)\]/) { "" }
  278.         end        
  279.       end
  280.       
  281.       #——右半身像设置
  282.       if (/\\([Rr])\[(.+?)\]/.match(text))!=nil then
  283.         face = "66rpg_" + $2 + "_h.png"
  284.         if $1 == "r" and $game_actors[$2.to_i] != nil
  285.           face = $game_actors[$2.to_i].battler_name + "_h.png"
  286.         end
  287.         if $encrypted or FileTest.exist?("Graphics/battlers/#{face}")
  288.           if @right_picture != nil
  289.             @right_picture.dispose
  290.           end
  291.           @right_picture = Sprite.new
  292.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  293.           @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  294.           @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  295.           @popchar = -2
  296.           text.gsub!(/\\([Rr])\[(.*?)\]/) { "" }
  297.         end
  298.       end
  299.       if (/\\[Rr][Kk]/.match(text)) != nil
  300.         @right_keep = true
  301.         text.sub!(/\\[Rr]k/) { "" }
  302.       end
  303.       if (/\\[Ll][Kk]/.match(text)) != nil
  304.         @left_keep = true
  305.         text.sub!(/\\[Ll]k/) { "" }
  306.       end
  307.       
  308.       # 替换人物姓名
  309.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  310.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  311.       end
  312.       
  313.       # 显示人物姓名
  314.       name_window_set = false
  315.       if (/\\[Mm]([0-9]*?)\[(.+?)\]/.match(text)) != nil
  316.         name_window_set = true
  317.         if $1 == ""
  318.           color = 0
  319.         else
  320.           color = $1.to_i
  321.         end
  322.         if color >= 0 and color <= 7
  323.           name_color = color
  324.         end
  325.         name_text = $2
  326.         text.gsub!(/\\[Mm]([0-9]*?)\[(.*?)\]/) { "" }
  327.       end
  328.       
  329.       # 打字效果设定
  330.       if (/\\[Ss]\[([0-9]+)\]/.match(text)) != nil
  331.         @type_speed = [$1.to_i, 9].min
  332.         text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "" }
  333.       # 关闭打字效果
  334.       elsif (/\\[Ss]/.match(text))!=nil then
  335.         @type_speed = -1
  336.         text.gsub!(/\\[Ss]/) { "" }
  337.       end
  338.       
  339.       # 窗口位置计算
  340.       if @popchar >= 0 or (@popchar == -1 and $game_temp.in_battle)
  341.         # 浮于事件上方的情况
  342.         max_x = 16
  343.         # 获得行数
  344.         textlines = text.split(/\n/)
  345.         cy = max_y = textlines.size
  346.         for i in 0..max_y - 1
  347.           line = plain_text(textlines[i])
  348.           if line == ""
  349.             cy -= 1
  350.             next
  351.           end
  352.           cx = contents.text_size(line).width
  353.           if i >= $game_temp.choice_start and $game_temp.choice_start > 0
  354.             cx += 16
  355.           end
  356.           # 获得最大宽度
  357.           max_x = cx if cx > max_x
  358.         end
  359.         # 计算宽度和高度
  360.         max_y = cy if cy < max_y
  361.         max_y = [max_y, 1].max
  362.         self.width = max_x + 32 + @face_indent
  363.         self.width += 16 if $game_temp.choice_start == 0
  364.         # 右边有头像的情况宽度再加 128
  365.         self.width += 128 if @face_bitmap != nil and not @alignment
  366.         max_x += 8 if $game_temp.choice_start == 0
  367.         # 有输入数值的情况下增加一行并调整宽度
  368.         if $game_temp.num_input_variable_id > 0
  369.           max_y += 1
  370.           dummy_bitmap = Bitmap.new(32, 32)
  371.           cursor_width = dummy_bitmap.text_size("0").width + 8
  372.           dummy_bitmap.dispose
  373.           cx = cursor_width * $game_temp.num_input_digits_max + 16
  374.           max_x = cx if cx > max_x
  375.         end
  376.         self.height = max_y * 32 + 32
  377.         # 有头像的情况高度定为 160
  378.         self.height = [self.height, 160].max if @face_bitmap != nil
  379.       # 不是浮于事件上方的情况
  380.       else
  381.         max_x = self.width - 32 - @face_indent
  382.         self.height = [text.split(/\n/).size * 32 + 32, 160].max
  383.       end
  384.       
  385.       # 绘制窗体样式
  386.       reset_window
  387.       
  388.       # 姓名框
  389.       if name_window_set
  390.         w = self.contents.text_size(name_text).width + 16
  391.         xn = @alignment ? self.x : self.x + self.width - w
  392.         if self.y < 20
  393.           if @popchar >= 0
  394.             self.y += self.height + 48 if @popchar >= 0
  395.           else
  396.             self.y = 36
  397.           end
  398.         end
  399.         yn = self.y - 20
  400.         @name_window = Window_Name.new(xn, yn, w)
  401.         @name_window.z = self.z + 1
  402.         @name_airtext = Window_AirText.new(xn + 8, yn + 8, name_text, name_color)
  403.         @name_airtext.z = self.z + 2
  404.         @name_window.back_opacity = self.back_opacity
  405.       end
  406.       
  407.       # 逐字打印文本
  408.       text.gsub!(/\\\\/) { "\000" }
  409.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  410.       text.gsub!(/\\[Gg]/) { "\002" }
  411.       text.gsub!(/\\[Tt]/) { "\003" }
  412.       text.gsub!(/\\[Uu]\[([0-9A-Fa-f]{6})\]/) { "\004[#{$1}]" }
  413.       text.gsub!(/\\[Xx]\[([0-9]+)\]/) { "\005[#{$1}]" }
  414.       text.gsub!(/\\[Zz]\[([0-9]+)\]/) { "\022[#{$1}]" }
  415.       text.gsub!(/\\[Ii]/) { "\023" }
  416.       text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  417.       text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  418.       text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  419.       text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  420.       start_x = @indent + @face_indent
  421.       @text_buffer = []
  422.       c_wait = 0

  423.       while ((c = text.slice!(/./m)) != nil)
  424.         if c == "\000"
  425.           c = "\\"
  426.         end
  427.         if c == "\001"
  428.           text.sub!(/\[([0-9]+)\]/, "")
  429.           color = $1.to_i
  430.           if color >= 0 and color <= 7
  431.             if @type_speed < 0
  432.               self.contents.font.color = text_color(color)
  433.             else
  434.               @text_buffer.push([nil, -1, text_color(color)])
  435.             end
  436.           end
  437.           next
  438.         end
  439.         if c == "\002"
  440.           if @gold_window == nil
  441.             @gold_window = Window_Gold.new
  442.             @gold_window.x = 560 - @gold_window.width
  443.             if $game_temp.in_battle
  444.               @gold_window.y = 192
  445.             else
  446.               @gold_window.y = self.y >= 128 ? 32 : 384
  447.             end
  448.             @gold_window.opacity = self.opacity
  449.             @gold_window.back_opacity = self.back_opacity
  450.           end
  451.           next
  452.         end
  453.         if c == "\003"
  454.           if @playtime_window == nil
  455.             @playtime_window = Window_PlayTime.new
  456.             @playtime_window.x = 80
  457.             if $game_temp.in_battle
  458.               @playtime_window.y = 192
  459.             else
  460.               @playtime_window.y = self.y >= 128 ? 32 : 384
  461.             end
  462.             @playtime_window.opacity = self.opacity
  463.             @playtime_window.back_opacity = self.back_opacity
  464.           end
  465.           next
  466.         end
  467.         if c == "\004"
  468.           text.sub!(/\[([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})\]/, "")
  469.           if @type_speed < 0
  470.             self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16), 255)
  471.           else
  472.             @text_buffer.push([nil, -1, Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16), 255)])
  473.           end
  474.           next
  475.         end
  476.         if c == "\005"
  477.           text.sub!(/\[([0-9]+)\]/, "")
  478.           tab = ($1.to_i - 1) * self.contents.text_size("0").width
  479.           x = start_x + tab if x < start_x + tab
  480.           next
  481.         end
  482.         
  483.         if c == "\022"
  484.           text.sub!(/\[([0-9]+)\]/, "")
  485.           c_wait += $1.to_i
  486.           next
  487.         end
  488.       
  489.         if c == "\023"
  490.           @indent = x
  491.           next
  492.         end
  493.         if c == "\024"
  494.           text.sub!(/\[([0-9]+)\]/, "")
  495.           if @type_speed < 0
  496.             self.contents.font.color.alpha = [[0, $1.to_i].max, 255].min
  497.           else
  498.             color = self.contents.font.color.clone
  499.             color.alpha = [[0, $1.to_i].max, 255].min
  500.             @text_buffer.push([nil, -1, color])
  501.           end
  502.           next
  503.         end
  504.         if c == "\025"
  505.           text.sub!(/\[([0-9]+)\]/, "")
  506.           self.contents.font.size = [[$1.to_i, 6].max, 32].min
  507.           if @type_speed >= 0
  508.             @text_buffer.push([nil, -1, self.contents.font.size])
  509.           end
  510.           next
  511.         end
  512.         if c == "\026"
  513.           text.sub!(/\[([0-9]+)\]/, "")
  514.           x += $1.to_i
  515.           next
  516.         end
  517.         if c == "\027"
  518.           text.sub!(/\[([0-9]+)\]/, "")
  519.           x += $1.to_i * self.contents.text_size("0").width
  520.           next
  521.         end

  522.         if c == "\030"
  523.           text.sub!(/\[(.*?)\]/, "")
  524.           if @type_speed < 0
  525.             self.contents.blt(x , y * line_height + 4, RPG::Cache.icon($1),
  526.               Rect.new(0, 0, 24, 24))
  527.           else
  528.             @text_buffer.push([Rect.new(x, y * line_height + 4, 24, 24),
  529.               c_wait, RPG::Cache.icon($1)])
  530.             c_wait = @type_speed
  531.           end
  532.           x += 24
  533.           next
  534.         end
  535.         if c == "\n"
  536.           if x == start_x and (@popchar != -2 and not $game_temp.in_battle)
  537.             $game_temp.choice_start -= 1
  538.             lines -= 1
  539.             y -= 1
  540.           end
  541.           if lines >= $game_temp.choice_start
  542.             @cursor_width = [@cursor_width, x - @face_indent].max
  543.           end
  544.           lines += 1
  545.           y += 1
  546.           start_x = @face_indent + @indent
  547.           x = start_x
  548.           if lines >= $game_temp.choice_start
  549.             x += 8
  550.           end
  551.           next
  552.         end
  553.         # 描绘文字
  554.         c_width = self.contents.text_size(c).width
  555.         c_height = line_height
  556.         if @type_speed < 0
  557.           self.contents.draw_text(x, c_height * y, c_width, c_height, c)
  558.         else
  559.           @text_buffer.push([Rect.new(x, c_height * y, c_width, c_height),
  560.             c_wait, c])
  561.           c_wait = @type_speed
  562.         end
  563.         x += c_width
  564.       end
  565.       @type_wait = @text_buffer[0][1] if @text_buffer.size > 0
  566.     end
  567.     if @type_speed < 0 and $game_temp.choice_max > 0
  568.       @item_max = $game_temp.choice_max
  569.       self.active = true
  570.       self.index = 0
  571.     end
  572.     if $game_temp.num_input_variable_id > 0
  573.       digits_max = $game_temp.num_input_digits_max
  574.       number = $game_variables[$game_temp.num_input_variable_id]
  575.       @input_number_window = Window_InputNumber.new(digits_max)
  576.       @input_number_window.number = number
  577.       @input_number_window.x = self.x + 8
  578.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  579.     end
  580.   end
  581.   #--------------------------------------------------------------------------
  582.   # ● 更新
  583.   #--------------------------------------------------------------------------
  584.   def update
  585.     super
  586.     # 渐变的情况下
  587.     if @fade_in
  588.       self.contents_opacity += 24
  589.       if @input_number_window != nil
  590.         @input_number_window.contents_opacity += 24
  591.       end
  592.       if self.contents_opacity == 255
  593.         @fade_in = false
  594.       end
  595.       return
  596.     end
  597.     # 打字的情况下
  598.     if @text_buffer.size > 0
  599.       # 按键跳过打字
  600.       if Input.trigger?(Input::C) or Input.trigger?(Input::B)
  601.         type_next_char until @text_buffer.size == 0
  602.         return
  603.       end
  604.       # 等待打字延时
  605.       if @type_wait > 0
  606.         @type_wait -= 1
  607.       end
  608.       # 传送位图
  609.       if @type_wait <= 0
  610.         type_next_char
  611.       end
  612.       return
  613.     end
  614.     # 输入数值的情况下
  615.     if @input_number_window != nil
  616.       if @input_number_window.contents_opacity < 255
  617.         @input_number_window.contents_opacity += 24
  618.         return
  619.       end
  620.       @input_number_window.update
  621.       # 确定
  622.       if Input.trigger?(Input::C)
  623.         $game_system.se_play($data_system.decision_se)
  624.         $game_variables[$game_temp.num_input_variable_id] =
  625.           @input_number_window.number
  626.         $game_map.need_refresh = true
  627.         # 释放输入数值窗口
  628.         @input_number_window.dispose
  629.         @input_number_window = nil
  630.         terminate_message
  631.       end
  632.       return
  633.     end
  634.     # 显示信息中的情况下
  635.     if @contents_showing
  636.       # 如果不是在显示选择项中就显示暂停标志
  637.       if $game_temp.choice_max == 0
  638.         self.pause = true
  639.       end
  640.       # 取消
  641.       if Input.trigger?(Input::B)
  642.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  643.           $game_system.se_play($data_system.cancel_se)
  644.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  645.           terminate_message
  646.         end
  647.       end
  648.       # 确定
  649.       if Input.trigger?(Input::C)
  650.         if $game_temp.choice_max > 0
  651.           $game_system.se_play($data_system.decision_se)
  652.           $game_temp.choice_proc.call(self.index)
  653.         end
  654.         terminate_message
  655.       end
  656.       # 时间窗口可见的情况下
  657.       if @playtime_window != nil
  658.         @playtime_window.update
  659.       end
  660.       # 等待中的情况下
  661.       if @wait_count > 0
  662.         @wait_count -= 1
  663.         if @wait_count == 0
  664.           terminate_message
  665.         end
  666.       end
  667.       return
  668.     end
  669.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  670.     if @fade_out == false and $game_temp.message_text != nil
  671.       @contents_showing = true
  672.       $game_temp.message_window_showing = true
  673.       refresh
  674.       Graphics.frame_reset
  675.       @wait_count = 0
  676.       if @wait_set != 0
  677.         @wait_count = @wait_set
  678.       end
  679.       self.visible = true
  680.       if @type_speed < 0
  681.         self.contents_opacity = 0
  682.         @fade_in = true
  683.       else
  684.         self.contents_opacity = 255
  685.       end
  686.       if @input_number_window != nil
  687.         @input_number_window.contents_opacity = 0
  688.       end
  689.       return
  690.     end
  691.     # 没有可以显示的信息、但是窗口为可见的情况下
  692.     if self.visible
  693.       @fade_out = true
  694.       self.opacity -= 48
  695.       if self.opacity == 0
  696.         self.visible = false
  697.         @fade_out = false
  698.         $game_temp.message_window_showing = false
  699.       end
  700.       return
  701.     end
  702.   end
  703.   #--------------------------------------------------------------------------
  704.   # ● 获得角色
  705.   #--------------------------------------------------------------------------
  706.   def get_character(parameter)
  707.     case parameter
  708.     when 1000 # 本事件
  709.       return $game_system.map_interpreter.get_character(0)
  710.     when 0 # 角色
  711.       return $game_player
  712.     else # 其他事件
  713.       return $game_system.map_interpreter.get_character(parameter)
  714.     end
  715.   end
  716.   #--------------------------------------------------------------------------
  717.   # ● 设置窗口位置与不透明度
  718.   #--------------------------------------------------------------------------
  719.   def reset_window
  720.     # 位置判定
  721.     if $game_temp.in_battle
  722.       if @popchar >= 4
  723.         x = $game_troop.enemies[@popchar - 4].screen_x - self.width / 2
  724.         y = $game_troop.enemies[@popchar - 4].screen_y - self.height - 100
  725.         self.x = [[x, 0].max, 640 - self.width].min
  726.         self.y = [y, 16].max
  727.       elsif @popchar >= 0
  728.         x = $game_party.actors[@popchar].screen_x - self.width / 2
  729.         y = $game_party.actors[@popchar].screen_y - self.height - 100
  730.         self.x = [[x, 0].max, 640 - self.width].min
  731.         self.y = [y, 16].max
  732.       elsif @popchar == -1
  733.         self.x = 320 - self.width / 2
  734.         self.y = 192 - self.height / 2
  735.       elsif @popchar == -2
  736.         self.y = 16
  737.       end
  738.     else
  739.       if @popchar >= 0
  740.         events = $game_map.events
  741.         if events != nil
  742.           character = get_character(@popchar)
  743.           if character != nil
  744.             x = [[character.screen_x - self.width / 2, 4].max, 636 - self.width].min
  745.             y = character.screen_y - 48 - self.height
  746.             y = character.screen_y if y < 4
  747.             y = [y, 476 - self.height].min
  748.             self.x = x
  749.             self.y = y
  750.           else
  751.             @popchar = -2
  752.           end
  753.         end
  754.       elsif @popchar == -1
  755.         self.x = -4
  756.         self.y = -4
  757.         self.width = 648
  758.         self.height = 488
  759.       else
  760.         case $game_system.message_position
  761.         when 0 # 上
  762.           self.y = 16
  763.         when 1 # 中
  764.           self.y = [240 - self.height / 2, 16].max
  765.         when 2 # 下
  766.           self.y = [[304, 464 - self.height].min, 16].max
  767.         end
  768.         if (@left_picture != nil and not @left_keep) or
  769.           (@right_picture != nil and not @right_keep)
  770.           self.y = [[304, 464 - self.height].min, 16].max
  771.         end
  772.         self.x = 80
  773.         if @face_bitmap == nil
  774.           self.width = 480
  775.         else
  776.           self.width = 600
  777.           self.x -= 60
  778.         end
  779.       end
  780.     end
  781.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  782.     if @face_bitmap != nil
  783.       if @alignment
  784.         self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  785.       else
  786.         self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  787.           Rect.new(0, 0, 96, 96))
  788.       end
  789.       @face_bitmap.dispose
  790.       @face_bitmap = nil
  791.     end
  792.     if @popchar == -1 and not $game_temp.in_battle
  793.       self.opacity = 255
  794.       self.back_opacity = 0
  795.     elsif $game_system.message_frame == 0
  796.       self.opacity = 255
  797.       self.back_opacity = 224
  798.     else
  799.       self.opacity = 0
  800.       self.back_opacity = 160
  801.     end
  802.   end
  803.   #--------------------------------------------------------------------------
  804.   # ● 行高
  805.   #--------------------------------------------------------------------------
  806.   def line_height
  807.     if self.contents.font.size >= 20 and self.contents.font.size <= 24
  808.       return 32
  809.     else
  810.       return self.contents.font.size * 15 / 10
  811.     end
  812.   end
  813.   #--------------------------------------------------------------------------
  814.   # ● 纯文本变换
  815.   #--------------------------------------------------------------------------
  816.   def plain_text(text)
  817.     plain = text.clone
  818.     plain.gsub!(/\\\\/) { "\\" }
  819.     plain.gsub!(/\\[CcGgTtUuOoHhIiZz]+(\[([0-9A-Fa-f]+)\])*/) { "" }
  820.     plain.gsub!(/\030\[(.*?)\]/) { " " * (24.0 / self.contents.font.size * 2).ceil }
  821.     plain.gsub!(/\\[Bb]\[([0-9]+)\]/) { " " * ($1.to_f / self.contents.font.size * 2).ceil }
  822.     plain.gsub!(/\\[Dd]\[([0-9]+)\]/) { " " * $1.to_i}
  823.     plain.gsub!(/^.*?\\[Xx]\[([0-9]+)\]/) { " " * ($1.to_i - 1)}
  824.     return plain
  825.   end  
  826.   #--------------------------------------------------------------------------
  827.   # ● \V 变换
  828.   #--------------------------------------------------------------------------
  829.   def convert_value(option, index, width)
  830.     option == nil ? option = "" : nil
  831.     option.downcase!
  832.     case option
  833.       when "a"
  834.         unless $data_armors[index].name == nil
  835.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  836.         end
  837.       when "c"
  838.         unless $data_classes[index] == nil
  839.           r = $data_classes[index].name
  840.         end
  841.       when "e"
  842.         unless $data_system.elements[index] == nil
  843.           r = $data_system.elements[index]
  844.         end
  845.       when "i"
  846.         unless $data_items[index].name == nil
  847.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  848.         end
  849.       when "m"
  850.         unless $data_maps == nil or $data_maps[index].name == nil
  851.           r = $data_maps[index].name
  852.         end
  853.       when "n"
  854.         unless $game_actors[index] == nil
  855.           case width
  856.           when "0"
  857.             r = $game_actors[index].level
  858.           when "1"
  859.             r = $game_actors[index].exp
  860.           when "2"
  861.             r = $game_actors[index].hp
  862.           when "3"
  863.             r = $game_actors[index].sp
  864.           when "4"
  865.             r = $game_actors[index].maxhp
  866.           when "5"
  867.             r = $game_actors[index].maxsp
  868.           when "6"
  869.             r = $game_actors[index].str
  870.           when "7"
  871.             r = $game_actors[index].dex
  872.           when "8"
  873.             r = $game_actors[index].agi
  874.           when "9"
  875.             r = $game_actors[index].int
  876.           when "10"
  877.             r = $game_actors[index].atk
  878.           when "11"
  879.             r = $game_actors[index].pdef
  880.           when "12"
  881.             r = $game_actors[index].mdef
  882.           when "13"
  883.             r = $game_actors[index].eva
  884.           else
  885.             r = $game_actors[index].name
  886.           end
  887.         end
  888.       when "s"
  889.         unless $data_skills[index].name == nil
  890.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  891.         end
  892.       when "t"
  893.         unless $data_states[index] == nil
  894.           r = $data_states[index].name
  895.         end
  896.       when "v"
  897.         unless $game_map == nil or index < 0 or
  898.           $game_system.map_interpreter.get_character(index) == nil
  899.           r = $game_system.map_interpreter.get_character(index).name
  900.         end
  901.       when "w"
  902.         unless $data_weapons[index].name == nil
  903.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  904.         end
  905.       else
  906.         if width != ""
  907.           r = sprintf("%0#{width}d", $game_variables[index])
  908.         else
  909.           r = $game_variables[index]
  910.         end
  911.     end
  912.     r == nil ? r = "" : nil
  913.     return r
  914.   end
  915.   #--------------------------------------------------------------------------
  916.   # ● 更新光标矩形
  917.   #--------------------------------------------------------------------------
  918.   def update_cursor_rect
  919.     if @index >= 0
  920.       n = $game_temp.choice_start + @index
  921.       self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  922.     else
  923.       self.cursor_rect.empty
  924.     end
  925.   end
  926.   #--------------------------------------------------------------------------
  927.   # ● 打印下一个字
  928.   #--------------------------------------------------------------------------
  929.   def type_next_char
  930.     c = @text_buffer.shift
  931.     rc = c[0]
  932.     case c[2]
  933.     when Bitmap
  934.       self.contents.blt(rc.x, rc.y, c[2], c[2].rect)
  935.     when Color
  936.       self.contents.font.color = c[2]
  937.     when Integer
  938.       self.contents.font.size = c[2]
  939.     else
  940.       self.contents.draw_text(rc, c[2])
  941.     end
  942.     if @text_buffer.size > 0
  943.       @type_wait = @text_buffer[0][1]
  944.       type_next_char if @type_wait == -1
  945.     else
  946.       if $game_temp.choice_max > 0
  947.         @item_max = $game_temp.choice_max
  948.         self.active = true
  949.         self.index = 0
  950.       end
  951.     end
  952.   end
  953. end

  954. #==============================================================================
  955. # ■ Window_Name
  956. #------------------------------------------------------------------------------
  957. #  显示对话人姓名的窗口。
  958. #==============================================================================

  959. class Window_Name < Window_Base
  960.   #--------------------------------------------------------------------------
  961.   # ● 初始化窗口
  962.   #--------------------------------------------------------------------------
  963.   def initialize(x, y, width)
  964.     super(x, y, width, 40)
  965.     self.contents = nil
  966.     self.back_opacity = 160
  967.   end
  968. end

  969. #==============================================================================
  970. # ■ Window_AirText
  971. #------------------------------------------------------------------------------
  972. #  显示对话人姓名的文字。
  973. #==============================================================================

  974. class Window_AirText < Window_Base
  975.   #--------------------------------------------------------------------------
  976.   # ● 初始化窗口
  977.   #--------------------------------------------------------------------------
  978.   def initialize(x, y, designate_text, color)
  979.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  980.     self.opacity = 0
  981.     self.back_opacity = 0
  982.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  983.     w = self.contents.width
  984.     h = self.contents.height
  985.     if color.is_a?(Integer)
  986.       self.contents.font.color = text_color(color)
  987.     else
  988.       self.contents.font.color = color
  989.     end
  990.     self.contents.draw_text(0, 0, w, h, designate_text)
  991.   end
  992. end

  993. #==============================================================================
  994. # ■ Game_Event
  995. #------------------------------------------------------------------------------
  996. #  处理事件的类。条件判断、事件页的切换、并行处理、执行事件功能
  997. # 在 Game_Map 类的内部使用。
  998. #==============================================================================

  999. class Game_Event < Game_Character
  1000.   #--------------------------------------------------------------------------
  1001.   # ● 事件名字
  1002.   #--------------------------------------------------------------------------
  1003.   def name
  1004.     return @event.name
  1005.   end
  1006. end
复制代码
《宿愿·寻剑篇》正式版已经发布!快去看看!点击进入论坛发布贴
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3532
在线时间
595 小时
注册时间
2010-6-28
帖子
85
4
 楼主| 发表于 2021-5-7 17:00:37 | 只看该作者
紫英晓狼1130 发表于 2021-5-7 16:41
可以搜索增强对话 论坛提问帖里有

论坛里的找不到想要的效果

点评

我附上的代码绝对够用了 不可能有直接能用的源码 还得自己改  发表于 2021-5-8 10:31
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3532
在线时间
595 小时
注册时间
2010-6-28
帖子
85
5
 楼主| 发表于 2021-5-7 22:38:38 | 只看该作者
求解答啊~
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

遠航の猫咪

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

开拓者

6
发表于 2021-5-8 11:20:26 | 只看该作者
本帖最后由 SailCat 于 2021-5-8 11:31 编辑

重载window_message#pause=
随便写个思路,不保证原代码能直接用
RUBY 代码复制
  1. class Window_Message
  2.   alias sailcat_dispose dispose
  3.   alias sailcat_update update
  4.   def dispose
  5.      sailcat_dispose
  6.      @pause_sprite.dispose if @pause_sprite
  7.   end
  8.   def update
  9.      sailcat_update
  10.      if @pause_sprite and @pause_sprite.visible
  11.        case Graphics.frame_count % 4
  12.        when 0..1
  13.           @pause_sprite.y += 1
  14.        when 2..3
  15.           @pause_sprite.y -= 1
  16.        end
  17.      end
  18.   end
  19.   def pause=(pause)
  20.     unless @pause_sprite
  21.        @pause_sprite = Sprite.new(self.viewport)
  22.        @pause_sprite.bitmap = b = RPG::Cache.windowskins("pause")
  23.        @pause_sprite.src_rect = b.rect
  24.        @pause_sprite.x = self.x + self.width - b.width - 16
  25.        @pause_sprite.y = self.y + self.height - b.height - 16
  26.     end
  27.     @pause_sprite.visible = pause
  28.   end
  29. end


至于第二个问题,你需要一个皮肤文件,然后能显示对话人姓名的脚本,有一大堆……

点评

注意,一定不要在pause=里面调super 否则会调用皮肤内含的等待光标  发表于 2021-5-8 11:26
SailCat (小猫子·要开心一点) 共上站 24 次,发表过 11 篇文章 上 次 在: [2006年01月28日11:41:18 星期六] 从 [162.105.120.91] 到本站一游。
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3532
在线时间
595 小时
注册时间
2010-6-28
帖子
85
7
 楼主| 发表于 2021-5-8 12:29:30 | 只看该作者
SailCat 发表于 2021-5-8 11:20
重载window_message#pause=
随便写个思路,不保证原代码能直接用
class Window_Message

最好还是给个能用的吧
第二个显示对话人姓名的,我用的是Fuki,但是达不到图中的效果~

点评

我的代码能在系统标准对话框上使用,你可以找fuki的作者做一下兼容处理  发表于 2021-5-8 14:50
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3532
在线时间
595 小时
注册时间
2010-6-28
帖子
85
8
 楼主| 发表于 2021-5-8 15:58:35 | 只看该作者
范例已上传,求帮忙解答,第二个问题已经解决,只需要在对话框右下角显示按钮就可以了~
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6483
在线时间
119 小时
注册时间
2020-1-8
帖子
234
9
发表于 2021-5-9 10:22:27 | 只看该作者

回帖奖励 +100

大概看了下你发的工程里的fuki的脚本,类似2图的效果是sprite做的,并非窗口……
换了个对话脚本,使用方法看作者的注释
基本实现图二,至于图一,没有实现立绘在窗口旁边。
工程:RB_Mes_Remake的工程
添加:楼主工程的窗口皮肤,从截图上提取的图片,稍稍修改的6楼的代码

temp1.jpg (201.69 KB, 下载次数: 6)

temp1.jpg

temp3.jpg (184.95 KB, 下载次数: 4)

temp3.jpg

temp2.jpg (199.17 KB, 下载次数: 5)

temp2.jpg

RB_Mes_Remake.zip

1.44 MB, 下载次数: 18

点评

已经解决了,但还有一个问题,就是Space显示的位置,我调过坐标之后,第一次显示文章位置正常,但之后就恢复到原始位置了,请问该如何解决呢?  发表于 2021-5-12 04:06

评分

参与人数 1星屑 +100 +1 收起 理由
RyanBern + 100 + 1 精品文章

查看全部评分

回复 支持 1 反对 0

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3532
在线时间
595 小时
注册时间
2010-6-28
帖子
85
10
 楼主| 发表于 2021-5-9 15:55:36 | 只看该作者
本帖最后由 步平凡 于 2021-5-9 21:33 编辑
RPGzh500223 发表于 2021-5-9 10:22
大概看了下你发的工程里的fuki的脚本,类似2图的效果是sprite做的,并非窗口……
换了个对话脚本,使用方法 ...


已经解决了,但还有一个问题,就是Space显示的位置,我调过坐标之后,第一次显示文章位置正常,但之后就恢复到原始位置了,请问该如何解决呢?
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-24 07:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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