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

Project1

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

[已经解决] 怎么做出文字自动一个个显示出来的对话?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
328 小时
注册时间
2014-1-24
帖子
132
跳转到指定楼层
1
发表于 2014-8-12 12:35:09 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
问题都写在题目上面了

点评

那个,楼下说的是Fuki对话框  发表于 2014-8-12 13:59

评分

参与人数 1星屑 +20 收起 理由
︶ㄣ牛排ぶ + 20 纯伸手贴吗……

查看全部评分

Lv1.梦旅人

梦石
0
星屑
50
在线时间
206 小时
注册时间
2014-2-8
帖子
396
3
发表于 2014-8-12 22:29:50 | 只看该作者
FUKI对话框,或者用这个脚本
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————
  4. #——说明
  5. #默认为一个字一个字的方式,如果需要一次全部显示,
  6. #请在游戏中使用脚本:$game_system.typing = true
  7. # 其他在对话中可以使用的功能:

  8. # \n[1]:显示1号角色的姓名
  9. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  10. # \name[\n[1]]:显示1号主角的姓名方框
  11. # \p[1]:对话框出现在1号事件的上方
  12. # \p[0]:主人公上方出现对话框
  13. #——————————————————使用\p功能后可以自动调整对话框大小
  14. # \>   :文字不用打字方式
  15. # \<   :文字使用打字方式
  16. # \\:显示"\"这个符号
  17. # \c[1-8]:更改颜色
  18. # \g:显示金钱窗口
  19. # \t: 显示游戏时间窗口
  20. # \v[7]:显示7号变量的值
  21. # \v[a7]:显示7号防具的名称
  22. # \v[s7]:显示7号特技的名称
  23. # \v[w7]:显示7号武器的名称
  24. # \v[i7]:显示7号道具的名称
  25. # \I   :下一行从这个位置开始
  26. # \o[123]:文字透明度改为123,模拟将死之人(汗)
  27. # \h[12]:改用12号字
  28. # \b[50]:空50象素
  29. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  30. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  31. # \Lk:清除左边的图像
  32. # \Rk:清除右边的图像
  33. # \A:头像及姓名框靠左排列
  34. # \a:头像及姓名框靠右排列
  35. # \M[60]:等待60帧文字直接消失
  36. # \MS[1-8]:更改文字背景颜色
  37. # \ME:恢复文字背景颜色
  38. #颜色自定义设定范围0-255
  39. #使用方法:在文章前输入如下脚本定义颜色
  40. #          $color0 = 数值
  41. #          $color1 = 数值
  42. #          $color2 = 数值
  43. #\name参数的颜色自定义设定范围0-255
  44. #使用方法:在文章前输入如下脚本定义颜色
  45. #          $ncolor0 = 数值
  46. #          $ncolor1 = 数值
  47. #          $ncolor2 = 数值
  48. # \!   :等待玩家按回车再继续
  49. #$speed :文字的打字速度设置用的,数字越大速度越慢。

  50. #============================
  51. class Game_System
  52. attr_accessor :typing
  53. alias carol3_ini initialize
  54. def initialize
  55. carol3_ini
  56. @typing = true
  57. end
  58. end
  59. #=================================#==============================================================================
  60. # ■ Window_Message
  61. #------------------------------------------------------------------------------
  62. class Window_Message < Window_Selectable
  63.   #颜色自定义用的全局变量定义
  64.   $color0 = 255
  65.   $color1 = 255
  66.   $color2 = 255
  67.   #颜色自定义用的全局变量定义
  68.   
  69.   #说话速度设置用的全局变量
  70.   
  71.   $speed = 1
  72.   
  73. #--------------------------------------------------------------------------
  74. # ● 初始化状态
  75. #--------------------------------------------------------------------------
  76. def initialize
  77.   super(80, 304, 480, 160)
  78.   self.contents = Bitmap.new(width - 32, height - 32)
  79.   self.visible = false
  80.   self.z = 9998
  81.   @fade_in = false
  82.   @fade_out = false
  83.   @contents_showing = false
  84.   @cursor_width = 0
  85. # Start
  86.   @bflag = false
  87. # End
  88.   @autoclosetime = -1
  89.   self.active = false
  90.   self.index = -1
  91.   @opacity_text_buf = Bitmap.new(32, 32)
  92. end
  93. #--------------------------------------------------------------------------
  94. # ● 释放
  95. #--------------------------------------------------------------------------
  96. def dispose
  97.   terminate_message
  98.   $game_temp.message_window_showing = false
  99.   if @input_number_window != nil
  100.     @input_number_window.dispose
  101.   end
  102.   super
  103. end
  104. #--------------------------------------------------------------------------
  105. # ● 处理信息结束
  106. #--------------------------------------------------------------------------
  107. def terminate_message
  108.   self.active = false
  109.   self.pause = false
  110.   self.index = -1
  111.   self.contents.clear
  112.   # 清除显示中标志
  113.   @contents_showing = false
  114.   # 呼叫信息调用
  115.   if $game_temp.message_proc != nil
  116.     $game_temp.message_proc.call
  117.   end
  118.   # 清除文章、选择项、输入数值的相关变量
  119.   $game_temp.message_text = nil
  120.   $game_temp.message_proc = nil
  121.   $game_temp.choice_start = 99
  122.   $game_temp.choice_max = 0
  123.   $game_temp.choice_cancel_type = 0
  124.   $game_temp.choice_proc = nil
  125.   $game_temp.num_input_start = 99
  126.   $game_temp.num_input_variable_id = 0
  127.   $game_temp.num_input_digits_max = 0
  128.   # 开放金钱窗口
  129.   if @gold_window != nil
  130.     @gold_window.dispose
  131.     @gold_window = nil
  132.   end
  133. #Start
  134.   # ピクチャ廃棄処理
  135.   begin
  136. #      if @spgra.disposed? == false
  137.       @spgra.dispose
  138. #      end
  139. #      if @backgraphic.disposed? == false
  140.       @backgraphic.dispose
  141. #      end
  142.   rescue
  143. #      print "ピクチャが読み込めていません!"
  144.   end
  145. #End
  146.   # 开放时间窗口
  147.   if @playtime_window != nil
  148.     @playtime_window.dispose
  149.     @playtime_window = nil
  150.   end
  151.   if @name_window_frame != nil
  152.     @name_window_frame.dispose
  153.     @name_window_frame = nil
  154.   end
  155.   if @name_window_text != nil
  156.     @name_window_text.dispose
  157.     @name_window_text = nil
  158.   end
  159.   if @right_picture != nil and @right_keep == true
  160.     @right_picture.dispose
  161.   end   
  162.   if @left_picture != nil and @left_keep == true
  163.     @left_picture.dispose
  164.   end
  165.   @face_bitmap = nil
  166. end
  167. def refresh
  168.   # 初期化
  169.   self.contents.clear
  170.   self.contents.font.color = normal_color
  171.   self.contents.font.size = Font.default_size
  172.   @x = @y = @max_x = @max_y = @indent = @lines = 0
  173.   @left_keep = @right_keep = false
  174.   @face_indent = 0
  175.   @opacity = 255
  176.   @cursor_width = 0
  177.   @autoclosetime = -1
  178.   @write_speed = $speed
  179.   @write_wait = 0
  180.   @mid_stop = false
  181.   face = nil
  182.   @popchar = -2
  183.   @alignment = true
  184.   if $game_temp.choice_start == 0
  185.     @x = 8
  186.   end
  187.   if $game_temp.message_text != nil
  188.     @now_text = $game_temp.message_text
  189.     #——对齐设置
  190.     if (/\\([Aa])/.match(@now_text))!=nil then
  191.       if $1 == "A"
  192.         @alignment = true
  193.       else
  194.         @alignment = false
  195.       end
  196.       @now_text.gsub!(/\\([Aa])/) { "" }
  197.     end
  198.     #——头像设置
  199.      if (/\\([Ff])\[(.+?)\]/.match(@now_text))!=nil then
  200.        [url=home.php?mod=space&uid=84331]@face[/url] = $2 + "_f.png"
  201.        if $1 == "f" and $game_actors[$2.to_i] != nil
  202.          face = $game_actors[$2.to_i].battler_name + "_f.png"
  203.        end
  204.        if FileTest.exist?("Graphics/Pictures/#{face}")
  205.          @face_bitmap = Bitmap.new("Graphics/Pictures/#{face}")
  206.          if @alignment
  207.            @x = @face_indent = 128
  208.            self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  209.          else
  210.            self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  211.              Rect.new(0, 0, 96, 96))
  212.          end
  213.        else
  214.          face = nil
  215.          @face_bitmap = nil
  216.        end
  217.        @now_text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  218.      end
  219.     #——左半身像设置
  220.     if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  221.       @face = "66rpg_" + $1 + "_h.png"
  222.       if $加密 == true
  223.         if @left_picture != nil
  224.           @left_picture.dispose
  225.         end
  226.         @left_picture = Sprite.new
  227.         @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  228.         @left_picture.y = 480-@left_picture.bitmap.height
  229.         @left_picture.x = 0
  230.         @left_picture.mirror = true
  231.         @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  232.       else         
  233.         if FileTest.exist?("Graphics/battlers/#{@face}")
  234.           if @left_picture != nil
  235.             @left_picture.dispose
  236.           end
  237.           @left_picture = Sprite.new
  238.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  239.           @left_picture.y = 480-@left_picture.bitmap.height
  240.           @left_picture.x = 0
  241.           @left_picture.mirror = true
  242.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  243.         end
  244.       end        
  245.     end
  246.     #——右半身像设置
  247.     if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  248.       @face = "66rpg_" + $1 + "_h.png"
  249.       if $加密 == true
  250.         if @right_picture != nil
  251.           @right_picture.dispose
  252.         end
  253.         @right_picture = Sprite.new
  254.         @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  255.         @right_picture.y = 480-@right_picture.bitmap.height
  256.         @right_picture.x = 640-@right_picture.bitmap.width
  257.         @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  258.       else
  259.         if FileTest.exist?("Graphics/battlers/#{@face}")
  260.           if @right_picture != nil
  261.             @right_picture.dispose
  262.           end
  263.           @right_picture = Sprite.new
  264.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  265.           @right_picture.y = 480-@right_picture.bitmap.height
  266.           @right_picture.x = 640-@right_picture.bitmap.width
  267.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  268.         end
  269.       end
  270.     end
  271.     if (/\\[Rr]k/.match(@now_text)) != nil
  272.       @right_keep = true
  273.       @now_text.sub!(/\\[Rr]k/) { "" }
  274.     end
  275.     if (/\\[Ll]k/.match(@now_text)) != nil
  276.       @left_keep = true
  277.       @now_text.sub!(/\\[Ll]k/) { "" }
  278.     end
  279.     # 替换人物姓名
  280.     @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  281.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  282.     end
  283.     # 显示人物姓名
  284.     name_window_set = false
  285.     if (/\\[Nn][Aa][Mm][Ee](.*?)\[(.+?)\]/.match(@now_text)) != nil
  286.       name_window_set = true
  287.       name_text = $2
  288.       @now_text.sub!(/\\[Nn][Aa][Mm][Ee](.*?)\[(.*?)\]/) { "" }
  289.     end
  290.     # 文字位置的判定
  291.     if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  292.       @popchar = $1.to_i
  293.       if @popchar == -1
  294.         @x = @indent = 48
  295.         @y = 4
  296.       end
  297.       @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  298.     end
  299.    
  300.     # 开始
  301.     begin
  302.       last_text = @now_text.clone
  303.       @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  304.     end until @now_text == last_text
  305.   @now_text.gsub!(/\\\\/) { "\000" }
  306.   @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  307.   @now_text.gsub!(/\\[Gg]/) { "\002" }
  308.   @now_text.gsub!(/\\[Tt]/) { "\004" }
  309.   @now_text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\050[#{$1}]" }
  310.   @now_text.gsub!(/\\[Ii]/) { "\023" }
  311.   @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  312.   @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  313.   @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  314.   @now_text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  315.   @now_text.gsub!(/\\[!]/) { "\020" }
  316. @now_text.gsub!(/\\[>]/) { "\016" }
  317. @now_text.gsub!(/\\[<]/) { "\017" }

  318. # Start
  319. # ◎
  320.     # "\\MS" を "\052" に、 "\\ME" を "\053" に変更
  321.     @now_text.gsub!(/\\[Mm][Ss]\[([0-9]+)\]/) { "\052[#{$1}]" }
  322.     @now_text.gsub!(/\\[Mm][Ee]/) { "\053" }
  323. # ◎
  324. # End

  325.   if @popchar >= 0
  326.     @text_save = @now_text.clone
  327.     @max_x = 0
  328.     @max_y = 4
  329.     for i in 0..3
  330.       line = @now_text.split(/\n/)[3-i]
  331.       @max_y -= 1 if line == nil and @max_y <= 4-i
  332.       next if line == nil
  333.       cx = contents.text_size(line).width
  334.       @max_x = cx if cx > @max_x
  335.     end
  336.     self.width = @max_x + 48 + @face_indent
  337.     self.height = (@max_y - 1) * 32 + 64
  338.   else
  339.     @max_x = self.width - 32 - @face_indent
  340.   end
  341.   reset_window
  342.     if name_window_set
  343.       off_x = 0
  344.       off_y = -40
  345.       space = 2
  346.       w = self.contents.text_size(name_text).width + 26 + space
  347.       x = @alignment ? self.x + off_x - space / 2 : self.x + off_x - space / 2 + self.width - w
  348.       y = self.y + off_y - space / 2
  349.       h = 40 + space
  350.       @name_window_frame = Window_Frame.new(x, y, w, h)
  351.       @name_window_frame.z = self.z + 1
  352.       x = @alignment ? self.x + off_x - space / 2 + 4 : self.x + off_x - space / 2 + 4 + self.width - w
  353.       y = self.y + off_y - space / 2
  354.       @name_window_text = Air_Text.new(x+4, y+6, name_text)
  355.       @name_window_text.z = self.z + 2
  356.     end
  357.   end
  358.   reset_window
  359.   if $game_temp.choice_max > 0
  360.     @item_max = $game_temp.choice_max
  361.     self.active = true
  362.     self.index = 0
  363.   end
  364.   if $game_temp.num_input_variable_id > 0
  365.     digits_max = $game_temp.num_input_digits_max
  366.     number = $game_variables[$game_temp.num_input_variable_id]
  367.     @input_number_window = Window_InputNumber.new(digits_max)
  368.     @input_number_window.number = number
  369.     @input_number_window.x = self.x + 8
  370.     @input_number_window.y = self.y + $game_temp.num_input_start * 32
  371.   end
  372. end
  373. #--------------------------------------------------------------------------
  374. # ● 更新
  375. #--------------------------------------------------------------------------
  376. def update
  377.   super
  378.   
  379.   
  380.     #颜色自定义设定范围0-255
  381.     self.contents.font.color = Color.new($color0, $color1, $color2)
  382.     #颜色自定义设定范围0-255
  383.    
  384.    
  385.     if @autoclosetime == 0
  386.     @autoclosetime = -1
  387.     terminate_message
  388. end
  389.   if @autoclosetime >= 1
  390.     @autoclosetime -= 1
  391.   end
  392.   if @fade_in
  393.     self.contents_opacity += 24
  394.     if @input_number_window != nil
  395.       @input_number_window.contents_opacity += 24
  396.     end
  397.     if self.contents_opacity == 255
  398.       @fade_in = false
  399.     end
  400.     return
  401.   end
  402.   @now_text = nil if @now_text == ""
  403.   
  404.   if @now_text != nil and @mid_stop == false
  405.     if @write_wait > 0
  406.       @write_wait -= 1
  407.       return
  408.     end
  409.     text_not_skip = $game_system.typing
  410.     while true
  411.       @max_x = @x if @max_x < @x
  412.       @max_y = @y if @max_y < @y
  413.       if (c = @now_text.slice!(/./m)) != nil
  414.         if c == "\000"
  415.           c = "\\"
  416.         end
  417.         if c == "\001"
  418.           @now_text.sub!(/\[([0-9]+)\]/, "")
  419.           color = $1.to_i
  420.           if color >= 0 and color <= 7
  421.             self.contents.font.color = text_color(color)
  422.           end
  423.           c = ""
  424.         end
  425.         if c == "\002"
  426.           if @gold_window == nil and @popchar <= 0
  427.             @gold_window = Window_Gold.new
  428.             @gold_window.x = 560 - @gold_window.width
  429.             if $game_temp.in_battle
  430.               @gold_window.y = 192
  431.             else
  432.               @gold_window.y = self.y >= 128 ? 32 : 384
  433.             end
  434.             @gold_window.opacity = self.opacity
  435.             @gold_window.back_opacity = self.back_opacity
  436.           end
  437.           c = ""
  438.         end
  439.       if c == "\004"
  440.         if @playtime_window == nil and @popchar <=0
  441.           @playtime_window = Window_PlayTime.new
  442.           @playtime_window.x = 80
  443.           if $game_temp.in_battle
  444.             @playtime_window.y = 192
  445.           else
  446.             @playtime_window.y = self.y >= 128 ? 32 : 384
  447.           end
  448.           @playtime_window.opacity = self.opacity
  449.           @playtime_window.back_opacity = self.back_opacity
  450.         end
  451.       end
  452.        if c == "\016"
  453.          text_not_skip = false
  454.          c = ""
  455.        end
  456.        if c == "\017"
  457.          text_not_skip = true
  458.          c = ""
  459.        end
  460.        if c == "\020"
  461.          @mid_stop = true
  462.          c = ""
  463.        end        
  464.         if c == "\023"
  465.           @indent = @x
  466.           c = ""
  467.         end
  468.         if c == "\024"
  469.           @now_text.sub!(/\[([0-9]+)\]/, "")
  470.           @opacity = $1.to_i
  471.           c = ""
  472.         end
  473.         if c == "\025"
  474.           @now_text.sub!(/\[([0-9]+)\]/, "")
  475.           self.contents.font.size = [[$1.to_i, 6].max, 32].min
  476.           c = ""
  477.         end
  478.         if c == "\026"
  479.           @now_text.sub!(/\[([0-9]+)\]/, "")
  480.           @x += $1.to_i
  481.           c = ""
  482.         end
  483.       if c == "\027"
  484.         @now_text.sub!(/\[([0-9]+)\]/, "")
  485.         @x += $1.to_i * self.contents.font.size / 2
  486.         next
  487.       end
  488.         if c == "\030"
  489.           @now_text.sub!(/\[(.*?)\]/, "")
  490.           self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  491.           @x += 24
  492.           c = ""
  493.         end
  494.         if c == "\050"
  495.         @now_text.sub!(/\[([0-9]+)\]/, "")
  496.         @autoclosetime = $1.to_i
  497.         next
  498.       end
  499. # Start
  500. # ◎
  501.       # \MSの場合
  502.       if c == "\052"
  503.         @now_text.sub!(/\[([0-9]+)\]/, "")
  504.         bcolor = $1.to_i
  505.         @bflag = true
  506.       end
  507.       # \MEの場合
  508.       if c == "\053"
  509.         @bflag = false
  510.         bcolor = 0
  511.       end
  512. # ◎
  513. # End
  514. # Start
  515. # ◎
  516.       if @bflag == true
  517.         if bcolor >= 0 and bcolor <= 7
  518.           bsize = self.contents.text_size(c).width
  519.           self.contents.fill_rect(4 + @x, 32 * @y, bsize, 32, text_color(bcolor))
  520.         end
  521.       end
  522. # ◎
  523. # End
  524.         if c == "\n"
  525.           if @lines >= $game_temp.choice_start
  526.             @cursor_width = [@cursor_width, @max_x - @face_indent].max
  527.           end
  528.           @lines += 1
  529.           @y += 1
  530.           @x = 0 + @indent + @face_indent
  531.           if @lines >= $game_temp.choice_start
  532.             @x = 8 + @indent + @face_indent
  533.           end
  534.           c = ""
  535.         end
  536.         if c != ""
  537.           # 文字描画
  538.           @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  539.         end
  540.         if Input.press?(Input::B)
  541.           text_not_skip = false
  542.         end
  543.       else
  544.         text_not_skip = true
  545.         break
  546.       end
  547.       # 終了判定
  548.       if text_not_skip
  549.         break
  550.       end
  551.     end
  552.     @write_wait += @write_speed
  553.     return
  554.   end
  555.   if @input_number_window != nil
  556.     @input_number_window.update
  557.     # 決定
  558.     if Input.trigger?(Input::C)
  559.       $game_system.se_play($data_system.decision_se)
  560.       $game_variables[$game_temp.num_input_variable_id] =
  561.       @input_number_window.number
  562.       $game_map.need_refresh = true
  563.       @input_number_window.dispose
  564.       @input_number_window = nil
  565.       terminate_message
  566.     end
  567.     return
  568.   end
  569.   if @contents_showing
  570.     if $game_temp.choice_max == 0
  571.       self.pause = true
  572.     end
  573.     # 取消
  574.     if Input.trigger?(Input::B)
  575.       if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  576.         $game_system.se_play($data_system.cancel_se)
  577.         $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  578.         terminate_message
  579.       end
  580.     end
  581.     # 決定
  582.     if Input.trigger?(Input::C)
  583.       if $game_temp.choice_max > 0
  584.         $game_system.se_play($data_system.decision_se)
  585.         $game_temp.choice_proc.call(self.index)
  586.       end
  587.       if @mid_stop
  588.         @mid_stop = false
  589.         return
  590.       else
  591.         terminate_message
  592.       end
  593.     end
  594.     return
  595.   end
  596.   if @fade_out == false and $game_temp.message_text != nil
  597.     @contents_showing = true
  598.     $game_temp.message_window_showing = true
  599.     refresh
  600.     Graphics.frame_reset
  601.     self.visible = true
  602.     self.contents_opacity = 0
  603.   if @input_number_window != nil
  604.     @input_number_window.contents_opacity = 0
  605.   end
  606.     @fade_in = true
  607.     return
  608.   end
  609.   if self.visible
  610.     @fade_out = true
  611.     self.opacity -= 48
  612.     if self.opacity == 0
  613.       self.visible = false
  614.       @fade_out = false
  615.       $game_temp.message_window_showing = false
  616.     end
  617.     return
  618.   end
  619. end
  620. #--------------------------------------------------------------------------
  621. # ● 获得字符
  622. #--------------------------------------------------------------------------
  623. def get_character(parameter)
  624.   case parameter
  625.   when 0
  626.     return $game_player
  627.   else
  628.     events = $game_map.events
  629.     return events == nil ? nil : events[parameter]
  630.   end
  631. end
  632. #--------------------------------------------------------------------------
  633. # ● ウィンドウの位置と不透明度の設定
  634. #--------------------------------------------------------------------------
  635. def reset_window
  636.   # 判定
  637.   if @popchar >= 0
  638.     events = $game_map.events
  639.     if events != nil
  640.       character = get_character(@popchar)
  641.       x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  642.       y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  643.       self.x = x
  644.       self.y = y
  645.     end
  646.   elsif @popchar == -1
  647.     self.x = -4
  648.     self.y = -4
  649.     self.width = 648
  650.     self.height = 488
  651.   else
  652.     if $game_temp.in_battle
  653.        self.y = 48
  654.     else
  655.       case $game_system.message_position
  656.       when 0 # 上
  657.         self.y = 16
  658.       when 1 # 中
  659.         self.y = 160
  660.       when 2 # 下
  661.         self.y = 304
  662.       end
  663.       self.x = 80
  664.        if @face_bitmap == nil
  665.          self.width = 480
  666.        else
  667.          self.width = 600
  668.          self.x -= 60
  669.        end
  670.        self.height = 160
  671.      end
  672.    end
  673.   self.contents = Bitmap.new(self.width - 32, self.height - 32)
  674.    if @face_bitmap != nil
  675.      if @alignment
  676.        self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  677.      else
  678.        self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  679.          Rect.new(0, 0, 96, 96))
  680.      end
  681.    end
  682.    if @popchar == -1
  683.     self.opacity = 255
  684.     self.back_opacity = 0
  685.   elsif $game_system.message_frame == 0
  686.     self.opacity = 255
  687.     self.back_opacity = 100
  688.   else
  689.     self.opacity = 0
  690.     self.back_opacity = 100
  691.   end
  692. end
  693. #--------------------------------------------------------------------------
  694. # ● line_height
  695. #--------------------------------------------------------------------------
  696. # 返回値:行高
  697. #--------------------------------------------------------------------------
  698. def line_height
  699.   return 32
  700.   if self.contents.font.size >= 20 and self.contents.font.size <= 24
  701.     return 32
  702.   else
  703.     return self.contents.font.size * 15 / 10
  704.   end
  705. end
  706. #--------------------------------------------------------------------------
  707. # ● \V 变换
  708. #--------------------------------------------------------------------------
  709. def convart_value(option, index)
  710.   option == nil ? option = "" : nil
  711.   option.downcase!
  712.   case option
  713.     when "i"
  714.       unless $data_items[index].name == nil
  715.         r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  716.       end
  717.     when "w"
  718.       unless $data_weapons[index].name == nil
  719.         r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  720.       end
  721.     when "a"
  722.       unless $data_armors[index].name == nil
  723.         r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  724.       end
  725.     when "s"
  726.       unless $data_skills[index].name == nil
  727.         r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  728.       end
  729.     else
  730.     r = $game_variables[index]
  731.   end
  732.   r == nil ? r = "" : nil
  733.   return r
  734. end
  735. #--------------------------------------------------------------------------
  736. # ● 透過文字描画
  737. #--------------------------------------------------------------------------
  738. # target :描画対象。Bitmapクラスを指定。
  739. # x :x座標
  740. # y :y座標
  741. # str  :描画文字列
  742. # opacity:透過率(0~255)
  743. # 返回値 :文字幅(@x増加値)。
  744. #--------------------------------------------------------------------------
  745. def opacity_draw_text(target, x, y, str,opacity)
  746.   height = target.font.size
  747.   width = target.text_size(str).width
  748.   opacity = [[opacity, 0].max, 255].min
  749.   if opacity == 255
  750.     target.draw_text(x, y, width, height, str)
  751.     return width
  752.   else
  753.     if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  754.       @opacity_text_buf.dispose
  755.       @opacity_text_buf = Bitmap.new(width, height)
  756.     else
  757.       @opacity_text_buf.clear
  758.     end
  759.     @opacity_text_buf.font.size = target.font.size
  760.     @opacity_text_buf.draw_text(0, 0, width, height, str)
  761.     target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  762.   return width
  763.   end
  764. end
  765. def ruby_draw_text(target, x, y, str,opacity)
  766.   sizeback = target.font.size
  767.   target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  768.   rubysize = [rubysize, 6].max
  769.   
  770.   opacity = [[opacity, 0].max, 255].min
  771.   split_s = str.split(/,/)
  772.   
  773.   split_s[0] == nil ? split_s[0] = "" : nil
  774.   split_s[1] == nil ? split_s[1] = "" : nil
  775.   
  776.   height = sizeback + rubysize
  777.   width = target.text_size(split_s[0]).width
  778.   
  779.   target.font.size = rubysize
  780.   ruby_width = target.text_size(split_s[1]).width
  781.   target.font.size = sizeback
  782.   
  783.   buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  784.   
  785.   width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  786.   
  787.   if opacity == 255
  788.     target.font.size = rubysize
  789.     target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  790.     target.font.size = sizeback
  791.     target.draw_text(x, y, width, target.font.size, split_s[0])
  792.     return width
  793.   else
  794.     if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  795.       @opacity_text_buf.dispose
  796.       @opacity_text_buf = Bitmap.new(buf_width, height)
  797.     else
  798.       @opacity_text_buf.clear
  799.     end
  800.     @opacity_text_buf.font.size = rubysize
  801.     @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  802.     @opacity_text_buf.font.size = sizeback
  803.     @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  804.     if sub_x >= 0
  805.       target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  806.     else
  807.       target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  808.     end
  809.     return width
  810.   end
  811. end
  812. #--------------------------------------------------------------------------
  813. # ● 解放
  814. #--------------------------------------------------------------------------
  815. def dispose
  816.   terminate_message
  817.   if @gaiji_cache != nil
  818.     unless @gaiji_cache.disposed?
  819.       @gaiji_cache.dispose
  820.     end
  821.   end
  822.   unless @opacity_text_buf.disposed?
  823.     @opacity_text_buf.dispose
  824.   end
  825.   $game_temp.message_window_showing = false
  826.   if @input_number_window != nil
  827.     @input_number_window.dispose
  828.   end
  829.   super
  830. end
  831. #--------------------------------------------------------------------------
  832. # ● 矩形更新
  833. #--------------------------------------------------------------------------
  834. def update_cursor_rect
  835.   if @index >= 0
  836.     n = $game_temp.choice_start + @index
  837.     self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  838.   else
  839.     self.cursor_rect.empty
  840.   end
  841. end
  842. end
  843. #==============================================================================
  844. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  845. #==============================================================================
  846. class Window_Frame < Window_Base
  847. #--------------------------------------------------------------------------
  848. # ● オブジェクト初期化
  849. #--------------------------------------------------------------------------
  850. def initialize(x, y, width, height)
  851.   super(x, y, width, height)
  852.   self.contents = nil
  853.   self.back_opacity = 100
  854. end
  855. #--------------------------------------------------------------------------
  856. # ● 解放
  857. #--------------------------------------------------------------------------
  858. def dispose
  859.   super
  860.   end
  861. end
  862. #==============================================================================
  863. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  864. #==============================================================================
  865. class Air_Text < Window_Base


  866.   #参数的颜色自定义设定范围0-255
  867.   $ncolor0 = 255
  868.   $ncolor1 = 255
  869.   $ncolor2 = 255
  870.   #参数的颜色自定义设定范围0-255
  871.   
  872. #--------------------------------------------------------------------------
  873. # ● オブジェクト初期化
  874. #--------------------------------------------------------------------------
  875. def initialize(x, y, designate_text)
  876.   super(x-16, y-16, 32 + designate_text.size * 12, 56)
  877.   self.opacity = 0
  878.   self.back_opacity = 0
  879.   self.contents = Bitmap.new(self.width - 32, self.height - 32)
  880.   w = self.contents.width
  881.   h = self.contents.height

  882.   
  883.     #颜色自定义设定范围0-255
  884.     self.contents.font.color = Color.new($ncolor0, $ncolor1, $ncolor2)
  885.     #颜色自定义设定范围0-255

  886.    
  887.    
  888. #    self.contents.font.color = text_color(color)
  889.   self.contents.draw_text(0, 0, w, h, designate_text)
  890. end
  891. #--------------------------------------------------------------------------
  892. # ● 解放
  893. #--------------------------------------------------------------------------
  894. def dispose
  895.   self.contents.clear
  896.   super
  897. end
  898. end
复制代码

点评

多谢  发表于 2014-8-13 10:33

评分

参与人数 1星屑 +100 收起 理由
︶ㄣ牛排ぶ + 100 认可答案

查看全部评分

刚接触RPG的新人们裤艾来这里!在这里能够帮助你们提高自身的能力,让大家来帮助每个人实现自己的创意、构想!
也许你只是正在看RPG教程的新人,或者是正在努力学着制作自己的RPG的制作者,或者是狂热的RPG游戏喜爱者,
但都不重要!
加入我们,我们会帮助你实现梦想,或者帮助你更好的运用RPG并且创造个人的一片天地!周末我们会不定时间开放RM技术讨论活动或者RM经验交流课!
加入我们,我们愿意与你共同创造奇迹,共同进步!
QQ群号:329443038  
或者联系QQ:573932914
我们和你站在同一线!
要求只有:常能上线
我们会用十分的热情接纳你!
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33071
在线时间
5103 小时
注册时间
2012-11-19
帖子
4878

开拓者

2
发表于 2014-8-12 12:49:17 | 只看该作者
“Fuck” 对话框好像有此功能。XD

点评

不是本人原创。  发表于 2014-8-12 15:48
↓以前见过有人这么叫,现在就引用上了。  发表于 2014-8-12 15:48
“Fuck”简直好评~  发表于 2014-8-12 14:03
xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 18:52

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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