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

Project1

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

[已经解决] 求助如何让角色名和说的话可以分开显示.

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
2 小时
注册时间
2013-7-6
帖子
5
跳转到指定楼层
1
发表于 2013-7-6 15:50:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
类似于这种效果..我试了网上找的代码好像木有成功OTL

未命名.jpg (11.18 KB, 下载次数: 12)

未命名.jpg

Lv5.捕梦者 (版主)

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

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

2
发表于 2013-7-6 15:59:07 | 只看该作者
试试增强型对话框吧
RUBY 代码复制
  1. # ————————————————————————————————————
  2. # 本脚本来自[url]www.66rpg.com[/url],转载请保留此信息
  3. # ————————————————————————————————————
  4. #——说明
  5. #默认为一个字一个字的方式,如果需要一次全部显示,
  6. #请在游戏中使用脚本:$game_system.typing = true
  7. # 其他在对话中可以使用的功能:
  8.  
  9. # \n[1]:显示1号角色的姓名
  10. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  11. # \name[\n[1]]:显示1号主角的姓名方框
  12. # \p[1]:对话框出现在1号事件的上方
  13. # \p[0]:主人公上方出现对话框
  14. #——————————————————使用\p功能后可以自动调整对话框大小
  15. # \>   :文字不用打字方式
  16. # \<   :文字使用打字方式
  17. # \\:显示"\"这个符号
  18. # \c[1-8]:更改颜色
  19. # \g:显示金钱窗口
  20. # \t: 显示游戏时间窗口
  21. # \v[7]:显示7号变量的值
  22. # \v[a7]:显示7号防具的名称
  23. # \v[s7]:显示7号特技的名称
  24. # \v[w7]:显示7号武器的名称
  25. # \v[i7]:显示7号道具的名称
  26. # \I   :下一行从这个位置开始
  27. # \o[123]:文字透明度改为123,模拟将死之人(汗)
  28. # \h[12]:改用12号字
  29. # \b[50]:空50象素
  30. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  31. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  32. # \Lk:清除左边的图像
  33. # \Rk:清除右边的图像
  34. # \A:头像及姓名框靠左排列
  35. # \a:头像及姓名框靠右排列
  36. # \M[60]:等待60帧文字直接消失
  37. # \MS[1-8]:更改文字背景颜色
  38. # \ME:恢复文字背景颜色
  39. #颜色自定义设定范围0-255
  40. #使用方法:在文章前输入如下脚本定义颜色
  41. #          $color0 = 数值
  42. #          $color1 = 数值
  43. #          $color2 = 数值
  44. #\name参数的颜色自定义设定范围0-255
  45. #使用方法:在文章前输入如下脚本定义颜色
  46. #          $ncolor0 = 数值
  47. #          $ncolor1 = 数值
  48. #          $ncolor2 = 数值
  49. # \!   :等待玩家按回车再继续
  50. #$speed :文字的打字速度设置用的,数字越大速度越慢。
  51.  
  52. #============================
  53. class Game_System
  54. attr_accessor :typing
  55. alias carol3_ini initialize
  56. def initialize
  57. carol3_ini
  58. @typing = true
  59. end
  60. end
  61. #=================================#==============================================================================
  62. # ■ Window_Message
  63. #------------------------------------------------------------------------------
  64. class Window_Message < Window_Selectable
  65.   #颜色自定义用的全局变量定义
  66.   $color0 = 255
  67.   $color1 = 255
  68.   $color2 = 255
  69.   #颜色自定义用的全局变量定义
  70.  
  71.   #说话速度设置用的全局变量
  72.  
  73.   $speed = 1
  74.  
  75. #--------------------------------------------------------------------------
  76. # ● 初始化状态
  77. #--------------------------------------------------------------------------
  78. def initialize
  79.   super(40, 50, 820, 160)
  80.   self.contents = Bitmap.new(width - 40, height - 32)
  81.   self.visible = false
  82.   self.z = 199
  83.   @fade_in = false
  84.   @fade_out = false
  85.   @contents_showing = false
  86.   @cursor_width = 0
  87. # Start
  88.   @bflag = false
  89. # End
  90.   @autoclosetime = -1
  91.   self.active = false
  92.   self.index = -1
  93.   @opacity_text_buf = Bitmap.new(32, 32)
  94. end
  95. #--------------------------------------------------------------------------
  96. # ● 释放
  97. #--------------------------------------------------------------------------
  98. def dispose
  99.   terminate_message
  100.   $game_temp.message_window_showing = false
  101.   if @input_number_window != nil
  102.     @input_number_window.dispose
  103.   end
  104.   super
  105. end
  106. #--------------------------------------------------------------------------
  107. # ● 处理信息结束
  108. #--------------------------------------------------------------------------
  109. def terminate_message
  110.   self.active = false
  111.   self.pause = false
  112.   self.index = -1
  113.   self.contents.clear
  114.   # 清除显示中标志
  115.   @contents_showing = false
  116.   # 呼叫信息调用
  117.   if $game_temp.message_proc != nil
  118.     $game_temp.message_proc.call
  119.   end
  120.   # 清除文章、选择项、输入数值的相关变量
  121.   $game_temp.message_text = nil
  122.   $game_temp.message_proc = nil
  123.   $game_temp.choice_start = 99
  124.   $game_temp.choice_max = 0
  125.   $game_temp.choice_cancel_type = 0
  126.   $game_temp.choice_proc = nil
  127.   $game_temp.num_input_start = 99
  128.   $game_temp.num_input_variable_id = 0
  129.   $game_temp.num_input_digits_max = 0
  130.   # 开放金钱窗口
  131.   if @gold_window != nil
  132.     @gold_window.dispose
  133.     @gold_window = nil
  134.   end
  135. #Start
  136.   # ピクチャ廃棄処理
  137.   begin
  138. #      if @spgra.disposed? == false
  139.       @spgra.dispose
  140. #      end
  141. #      if @backgraphic.disposed? == false
  142.       @backgraphic.dispose
  143. #      end
  144.   rescue
  145. #      print "ピクチャが読み込めていません!"
  146.   end
  147. #End
  148.   # 开放时间窗口
  149.   if @playtime_window != nil
  150.     @playtime_window.dispose
  151.     @playtime_window = nil
  152.   end
  153.   if @name_window_frame != nil
  154.     @name_window_frame.dispose
  155.     @name_window_frame = nil
  156.   end
  157.   if @name_window_text != nil
  158.     @name_window_text.dispose
  159.     @name_window_text = nil
  160.   end
  161.   if @right_picture != nil and @right_keep == true
  162.     @right_picture.dispose
  163.   end   
  164.   if @left_picture != nil and @left_keep == true
  165.     @left_picture.dispose
  166.   end
  167.   @face_bitmap = nil
  168. end
  169. def refresh
  170.   # 初期化
  171.   self.contents.clear
  172.   self.contents.font.color = normal_color
  173.   self.contents.font.size = Font.default_size
  174.   @x = @y = @max_x = @max_y = @indent = @lines = 0
  175.   @left_keep = @right_keep = false
  176.   @face_indent = 0
  177.   [url=home.php?mod=space&uid=316553]@opacity[/url] = 255
  178.   @cursor_width = 0
  179.   @autoclosetime = -1
  180.   @write_speed = $speed
  181.   @write_wait = 0
  182.   @mid_stop = false
  183.   face = nil
  184.   @popchar = -2
  185.   @alignment = true
  186.   if $game_temp.choice_start == 0
  187.     @x = 8
  188.   end
  189.   if $game_temp.message_text != nil
  190.     @now_text = $game_temp.message_text
  191.     #——对齐设置
  192.     if (/\\([Aa])/.match(@now_text))!=nil then
  193.       if $1 == "A"
  194.         @alignment = true
  195.       else
  196.         @alignment = false
  197.       end
  198.       @now_text.gsub!(/\\([Aa])/) { "" }
  199.     end
  200.     #——头像设置
  201.      if (/\\([Ff])\[(.+?)\]/.match(@now_text))!=nil then
  202.        [url=home.php?mod=space&uid=84331]@face[/url] = $2 + "_f.png"
  203.        if $1 == "f" and $game_actors[$2.to_i] != nil
  204.          face = $game_actors[$2.to_i].battler_name + "_f.png"
  205.        end
  206.        if FileTest.exist?("Graphics/Pictures/#{face}")
  207.          @face_bitmap = Bitmap.new("Graphics/Pictures/#{face}")
  208.          if @alignment
  209.            @x = @face_indent = 128
  210.            self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  211.          else
  212.            self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  213.              Rect.new(0, 0, 96, 96))
  214.          end
  215.        else
  216.          face = nil
  217.          @face_bitmap = nil
  218.        end
  219.        @now_text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  220.      end
  221.     #——左半身像设置
  222.     if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  223.       @face = "66rpg_" + $1 + "_h.png"
  224.       if $加密 == true
  225.         if @left_picture != nil
  226.           @left_picture.dispose
  227.         end
  228.         @left_picture = Sprite.new
  229.         @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  230.         @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  231.         @left_picture.x = 0
  232.         @left_picture.mirror = true
  233.         @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  234.       else         
  235.         if FileTest.exist?("Graphics/battlers/#{@face}")
  236.           if @left_picture != nil
  237.             @left_picture.dispose
  238.           end
  239.           @left_picture = Sprite.new
  240.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  241.           @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  242.           @left_picture.x = 0
  243.           @left_picture.mirror = true
  244.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  245.         end
  246.       end        
  247.     end
  248.     #——右半身像设置
  249.     if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  250.       @face = "66rpg_" + $1 + "_h.png"
  251.       if $加密 == true
  252.         if @right_picture != nil
  253.           @right_picture.dispose
  254.         end
  255.         @right_picture = Sprite.new
  256.         @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  257.         @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  258.         @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  259.         @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  260.       else
  261.         if FileTest.exist?("Graphics/battlers/#{@face}")
  262.           if @right_picture != nil
  263.             @right_picture.dispose
  264.           end
  265.           @right_picture = Sprite.new
  266.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  267.           @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  268.           @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  269.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  270.         end
  271.       end
  272.     end
  273.     if (/\\[Rr]k/.match(@now_text)) != nil
  274.       @right_keep = true
  275.       @now_text.sub!(/\\[Rr]k/) { "" }
  276.     end
  277.     if (/\\[Ll]k/.match(@now_text)) != nil
  278.       @left_keep = true
  279.       @now_text.sub!(/\\[Ll]k/) { "" }
  280.     end
  281.     # 替换人物姓名
  282.     @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  283.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  284.     end
  285.     # 显示人物姓名
  286.     name_window_set = false
  287.     if (/\\[Nn][Aa][Mm][Ee](.*?)\[(.+?)\]/.match(@now_text)) != nil
  288.       name_window_set = true
  289.       name_text = $2
  290.       @now_text.sub!(/\\[Nn][Aa][Mm][Ee](.*?)\[(.*?)\]/) { "" }
  291.     end
  292.     # 文字位置的判定
  293.     if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  294.       @popchar = $1.to_i
  295.       if @popchar == -1
  296.         @x = @indent = 48
  297.         @y = 4
  298.       end
  299.       @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  300.     end
  301.  
  302.     # 开始
  303.     begin
  304.       last_text = @now_text.clone
  305.       @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  306.     end until @now_text == last_text
  307.   @now_text.gsub!(/\\\\/) { "\000" }
  308.   @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  309.   @now_text.gsub!(/\\[Gg]/) { "\002" }
  310.   @now_text.gsub!(/\\[Tt]/) { "\004" }
  311.   @now_text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\050[#{$1}]" }
  312.   @now_text.gsub!(/\\[Ii]/) { "\023" }
  313.   @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  314.   @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  315.   @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  316.   @now_text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  317.   @now_text.gsub!(/\\[!]/) { "\020" }
  318. @now_text.gsub!(/\\[>]/) { "\016" }
  319. @now_text.gsub!(/\\[<]/) { "\017" }
  320.  
  321. # Start
  322. # ◎
  323.     # "\\MS" を "\052" に、 "\\ME" を "\053" に変更
  324.     @now_text.gsub!(/\\[Mm][Ss]\[([0-9]+)\]/) { "\052[#{$1}]" }
  325.     @now_text.gsub!(/\\[Mm][Ee]/) { "\053" }
  326. # ◎
  327. # End
  328.  
  329.   if @popchar >= 0
  330.     @text_save = @now_text.clone
  331.     @max_x = 0
  332.     @max_y = 4
  333.     for i in 0..3
  334.       line = @now_text.split(/\n/)[3-i]
  335.       @max_y -= 1 if line == nil and @max_y <= 4-i
  336.       next if line == nil
  337.       cx = contents.text_size(line).width
  338.       @max_x = cx if cx > @max_x
  339.     end
  340.     self.width = @max_x + 48 + @face_indent
  341.     self.height = (@max_y - 1) * 32 + 64
  342.   else
  343.     @max_x = self.width - 32 - @face_indent
  344.   end
  345.   reset_window
  346.     if name_window_set
  347.       off_x = 0
  348.       off_y = -40
  349.       space = 2
  350.       w = self.contents.text_size(name_text).width + 26 + space
  351.       x = @alignment ? self.x + off_x - space / 2 : self.x + off_x - space / 2 + self.width - w
  352.       y = self.y + off_y - space / 2
  353.       h = 40 + space
  354.       @name_window_frame = Window_Frame.new(x, y, w, h)
  355.       @name_window_frame.z = self.z + 1
  356.       x = @alignment ? self.x + off_x - space / 2 + 4 : self.x + off_x - space / 2 + 4 + self.width - w
  357.       y = self.y + off_y - space / 2
  358.       @name_window_text = Air_Text.new(x+4, y+6, name_text)
  359.       @name_window_text.z = self.z + 2
  360.     end
  361.   end
  362.   reset_window
  363.   if $game_temp.choice_max > 0
  364.     @item_max = $game_temp.choice_max
  365.     self.active = true
  366.     self.index = 0
  367.   end
  368.   if $game_temp.num_input_variable_id > 0
  369.     digits_max = $game_temp.num_input_digits_max
  370.     number = $game_variables[$game_temp.num_input_variable_id]
  371.     @input_number_window = Window_InputNumber.new(digits_max)
  372.     @input_number_window.number = number
  373.     @input_number_window.x = self.x + 8
  374.     @input_number_window.y = self.y + $game_temp.num_input_start * 32
  375.   end
  376. end
  377. #--------------------------------------------------------------------------
  378. # ● 更新
  379. #--------------------------------------------------------------------------
  380. def update
  381.   super
  382.     if @autoclosetime == 0
  383.     @autoclosetime = -1
  384.     terminate_message
  385. end
  386.   if @autoclosetime >= 1
  387.     @autoclosetime -= 1
  388.   end
  389.   if @fade_in
  390.     self.contents_opacity += 24
  391.     if @input_number_window != nil
  392.       @input_number_window.contents_opacity += 24
  393.     end
  394.     if self.contents_opacity == 255
  395.       @fade_in = false
  396.     end
  397.     return
  398.   end
  399.   @now_text = nil if @now_text == ""
  400.  
  401.   if @now_text != nil and @mid_stop == false
  402.     if @write_wait > 0
  403.       @write_wait -= 1
  404.       return
  405.     end
  406.     text_not_skip = $game_system.typing
  407.     while true
  408.       @max_x = @x if @max_x < @x
  409.       @max_y = @y if @max_y < @y
  410.       if (c = @now_text.slice!(/./m)) != nil
  411.         if c == "\000"
  412.           c = "\\"
  413.         end
  414.         if c == "\001"
  415.           @now_text.sub!(/\[([0-9]+)\]/, "")
  416.           color = $1.to_i
  417.           if color >= 0 and color <= 7
  418.             self.contents.font.color = text_color(color)
  419.           end
  420.           c = ""
  421.         end
  422.         if c == "\002"
  423.           if @gold_window == nil and @popchar <= 0
  424.             @gold_window = Window_Gold.new
  425.             @gold_window.x = 560 - @gold_window.width
  426.             if $game_temp.in_battle
  427.               @gold_window.y = 192
  428.             else
  429.               @gold_window.y = self.y >= 128 ? 32 : 384
  430.             end
  431.             @gold_window.opacity = self.opacity
  432.             @gold_window.back_opacity = self.back_opacity
  433.           end
  434.           c = ""
  435.         end
  436.       if c == "\004"
  437.         if @playtime_window == nil and @popchar <=0
  438.           @playtime_window = Window_PlayTime.new
  439.           @playtime_window.x = 80
  440.           if $game_temp.in_battle
  441.             @playtime_window.y = 192
  442.           else
  443.             @playtime_window.y = self.y >= 128 ? 32 : 384
  444.           end
  445.           @playtime_window.opacity = self.opacity
  446.           @playtime_window.back_opacity = self.back_opacity
  447.         end
  448.       end
  449.        if c == "\016"
  450.          text_not_skip = false
  451.          c = ""
  452.        end
  453.        if c == "\017"
  454.          text_not_skip = true
  455.          c = ""
  456.        end
  457.        if c == "\020"
  458.          @mid_stop = true
  459.          c = ""
  460.        end        
  461.         if c == "\023"
  462.           @indent = @x
  463.           c = ""
  464.         end
  465.         if c == "\024"
  466.           @now_text.sub!(/\[([0-9]+)\]/, "")
  467.           @opacity = $1.to_i
  468.           c = ""
  469.         end
  470.         if c == "\025"
  471.           @now_text.sub!(/\[([0-9]+)\]/, "")
  472.           self.contents.font.size = [[$1.to_i, 6].max, 32].min
  473.           c = ""
  474.         end
  475.         if c == "\026"
  476.           @now_text.sub!(/\[([0-9]+)\]/, "")
  477.           @x += $1.to_i
  478.           c = ""
  479.         end
  480.       if c == "\027"
  481.         @now_text.sub!(/\[([0-9]+)\]/, "")
  482.         @x += $1.to_i * self.contents.font.size / 2
  483.         next
  484.       end
  485.         if c == "\030"
  486.           @now_text.sub!(/\[(.*?)\]/, "")
  487.           self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  488.           @x += 24
  489.           c = ""
  490.         end
  491.         if c == "\050"
  492.         @now_text.sub!(/\[([0-9]+)\]/, "")
  493.         @autoclosetime = $1.to_i
  494.         next
  495.       end
  496. # Start
  497. # ◎
  498.       # \MSの場合
  499.       if c == "\052"
  500.         @now_text.sub!(/\[([0-9]+)\]/, "")
  501.         bcolor = $1.to_i
  502.         @bflag = true
  503.       end
  504.       # \MEの場合
  505.       if c == "\053"
  506.         @bflag = false
  507.         bcolor = 0
  508.       end
  509. # ◎
  510. # End
  511. # Start
  512. # ◎
  513.       if @bflag == true
  514.         if bcolor >= 0 and bcolor <= 7
  515.           bsize = self.contents.text_size(c).width
  516.           self.contents.fill_rect(4 + @x, 32 * @y, bsize, 32, text_color(bcolor))
  517.         end
  518.       end
  519. # ◎
  520. # End
  521.         if c == "\n"
  522.           if @lines >= $game_temp.choice_start
  523.             @cursor_width = [@cursor_width, @max_x - @face_indent].max
  524.           end
  525.           @lines += 1
  526.           @y += 1
  527.           @x = 0 + @indent + @face_indent
  528.           if @lines >= $game_temp.choice_start
  529.             @x = 8 + @indent + @face_indent
  530.           end
  531.           c = ""
  532.         end
  533.         if c != ""
  534.           # 文字描画
  535.           @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  536.         end
  537.         if Input.press?(Input::B) and $game_switches[93] == false
  538.           text_not_skip = false
  539.         end
  540.       else
  541.         text_not_skip = true
  542.         break
  543.       end
  544.       # 終了判定
  545.       if text_not_skip
  546.         break
  547.       end
  548.     end
  549.     @write_wait += @write_speed
  550.     return
  551.   end
  552.   if @input_number_window != nil
  553.     @input_number_window.update
  554.     # 決定
  555.  
  556.  
  557.    if Input.trigger?(Input::C) and $game_switches[93] == false
  558.  
  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.  
  567.   end
  568.     return
  569.   end
  570.   if @contents_showing
  571.     if $game_temp.choice_max == 0
  572.       self.pause = true
  573.     end
  574.     # 取消
  575.  
  576.  
  577.     if Input.trigger?(Input::B) and $game_switches[93] == false
  578.  
  579.       if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  580.         $game_system.se_play($data_system.cancel_se)
  581.         $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  582.         terminate_message
  583.  
  584.     end
  585.   end  
  586.     # 決定
  587.     if Input.trigger?(Input::C) and $game_switches[93] == false
  588.       if $game_temp.choice_max > 0
  589.         $game_system.se_play($data_system.decision_se)
  590.         $game_temp.choice_proc.call(self.index)
  591.       end
  592.       if @mid_stop
  593.         @mid_stop = false
  594.         return
  595.       else
  596.         terminate_message
  597.       end
  598.     end
  599.     return
  600.   end
  601.   if @fade_out == false and $game_temp.message_text != nil
  602.     @contents_showing = true
  603.     $game_temp.message_window_showing = true
  604.     refresh
  605.     Graphics.frame_reset
  606.     self.visible = true
  607.     self.contents_opacity = 0
  608.   if @input_number_window != nil
  609.     @input_number_window.contents_opacity = 0
  610.   end
  611.     @fade_in = true
  612.     return
  613.   end
  614.   if self.visible
  615.     @fade_out = true
  616.     self.opacity -= 48
  617.     if self.opacity == 0
  618.       self.visible = false
  619.       @fade_out = false
  620.       $game_temp.message_window_showing = false
  621.     end
  622.     return
  623.   end
  624. end
  625. #--------------------------------------------------------------------------
  626. # ● 获得字符
  627. #--------------------------------------------------------------------------
  628. def get_character(parameter)
  629.   case parameter
  630.   when 0
  631.     return $game_player
  632.   else
  633.     events = $game_map.events
  634.     return events == nil ? nil : events[parameter]
  635.   end
  636. end
  637. #--------------------------------------------------------------------------
  638. # ● ウィンドウの位置と不透明度の設定
  639. #--------------------------------------------------------------------------
  640. def reset_window
  641.   # 判定
  642.   if @popchar >= 0
  643.     events = $game_map.events
  644.     if events != nil
  645.       character = get_character(@popchar)
  646.       x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  647.       y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  648.       self.x = x
  649.       self.y = y
  650.     end
  651.   elsif @popchar == -1
  652.     self.x = -4
  653.     self.y = -4
  654.     self.width = 50
  655.     self.height = 488
  656.   else
  657.     if $game_temp.in_battle
  658.        case $game_system.message_position
  659.        when 0 # 上
  660.         self.y = 16
  661.        when 1 # 中
  662.         self.y = 160
  663.        when 2 # 下
  664.         self.y = 315
  665.       case $game_system.message_position  
  666.       when 0  
  667.         self.x = 0
  668.       when 1
  669.         self.x = 180
  670.       when 2
  671.         self.x = 0
  672.       end      
  673.     end
  674.     else
  675.       case $game_system.message_position
  676.       when 0 # 上
  677.         self.y = 16
  678.       when 1 # 中
  679.         self.y = 160
  680.       when 2 # 下
  681.         self.y = 315
  682.       end
  683.       case $game_system.message_position  
  684.       when 0  
  685.         self.x = 0
  686.       when 1
  687.         self.x = 160
  688.       when 2
  689.         self.x = 0
  690.       end
  691.  
  692.        if @face_bitmap == nil
  693.          self.width = 800
  694.        else
  695.          self.width = 800
  696.          self.x -= 20
  697.        end
  698.        self.height = 170
  699.      end
  700.    end
  701.   self.contents = Bitmap.new(self.width - 32, self.height - 32)
  702.    if @face_bitmap != nil
  703.      if @alignment
  704.        self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  705.      else
  706.        self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  707.          Rect.new(0, 0, 96, 96))
  708.      end
  709.    end
  710.    if @popchar == -1
  711.     self.opacity = 255
  712.     self.back_opacity = 0
  713.   elsif $game_system.message_frame == 0
  714.     self.opacity = 255
  715.     self.back_opacity = 100
  716.   else
  717.     self.opacity = 0
  718.     self.back_opacity = 100
  719.   end
  720. end
  721. #--------------------------------------------------------------------------
  722. # ● line_height
  723. #--------------------------------------------------------------------------
  724. # 返回値:行高
  725. #--------------------------------------------------------------------------
  726. def line_height
  727.   return 32
  728.   if self.contents.font.size >= 20 and self.contents.font.size <= 24
  729.     return 32
  730.   else
  731.     return self.contents.font.size * 15 / 10
  732.   end
  733. end
  734. #--------------------------------------------------------------------------
  735. # ● \V 变换
  736. #--------------------------------------------------------------------------
  737. def convart_value(option, index)
  738.   option == nil ? option = "" : nil
  739.   option.downcase!
  740.   case option
  741.     when "i"
  742.       unless $data_items[index].name == nil
  743.         r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  744.       end
  745.     when "w"
  746.       unless $data_weapons[index].name == nil
  747.         r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  748.       end
  749.     when "a"
  750.       unless $data_armors[index].name == nil
  751.         r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  752.       end
  753.     when "s"
  754.       unless $data_skills[index].name == nil
  755.         r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  756.       end
  757.     else
  758.     r = $game_variables[index]
  759.   end
  760.   r == nil ? r = "" : nil
  761.   return r
  762. end
  763. #--------------------------------------------------------------------------
  764. # ● 透過文字描画
  765. #--------------------------------------------------------------------------
  766. # target :描画対象。Bitmapクラスを指定。
  767. # x :x座標
  768. # y :y座標
  769. # str  :描画文字列
  770. # opacity:透過率(0~255)
  771. # 返回値 :文字幅(@x増加値)。
  772. #--------------------------------------------------------------------------
  773. def opacity_draw_text(target, x, y, str,opacity)
  774.   height = target.font.size
  775.   width = target.text_size(str).width
  776.   opacity = [[opacity, 0].max, 255].min
  777.   if opacity == 255
  778.     target.draw_text(x, y, width, height, str)
  779.     return width
  780.   else
  781.     if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  782.       @opacity_text_buf.dispose
  783.       @opacity_text_buf = Bitmap.new(width, height)
  784.     else
  785.       @opacity_text_buf.clear
  786.     end
  787.     @opacity_text_buf.font.size = target.font.size
  788.     @opacity_text_buf.draw_text(0, 0, width, height, str)
  789.     target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  790.   return width
  791.   end
  792. end
  793. def ruby_draw_text(target, x, y, str,opacity)
  794.   sizeback = target.font.size
  795.   target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  796.   rubysize = [rubysize, 6].max
  797.  
  798.   opacity = [[opacity, 0].max, 255].min
  799.   split_s = str.split(/,/)
  800.  
  801.   split_s[0] == nil ? split_s[0] = "" : nil
  802.   split_s[1] == nil ? split_s[1] = "" : nil
  803.  
  804.   height = sizeback + rubysize
  805.   width = target.text_size(split_s[0]).width
  806.  
  807.   target.font.size = rubysize
  808.   ruby_width = target.text_size(split_s[1]).width
  809.   target.font.size = sizeback
  810.  
  811.   buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  812.  
  813.   width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  814.  
  815.   if opacity == 255
  816.     target.font.size = rubysize
  817.     target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  818.     target.font.size = sizeback
  819.     target.draw_text(x, y, width, target.font.size, split_s[0])
  820.     return width
  821.   else
  822.     if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  823.       @opacity_text_buf.dispose
  824.       @opacity_text_buf = Bitmap.new(buf_width, height)
  825.     else
  826.       @opacity_text_buf.clear
  827.     end
  828.     @opacity_text_buf.font.size = rubysize
  829.     @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  830.     @opacity_text_buf.font.size = sizeback
  831.     @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  832.     if sub_x >= 0
  833.       target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  834.     else
  835.       target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  836.     end
  837.     return width
  838.   end
  839. end
  840. #--------------------------------------------------------------------------
  841. # ● 解放
  842. #--------------------------------------------------------------------------
  843. def dispose
  844.   terminate_message
  845.   if @gaiji_cache != nil
  846.     unless @gaiji_cache.disposed?
  847.       @gaiji_cache.dispose
  848.     end
  849.   end
  850.   unless @opacity_text_buf.disposed?
  851.     @opacity_text_buf.dispose
  852.   end
  853.   $game_temp.message_window_showing = false
  854.   if @input_number_window != nil
  855.     @input_number_window.dispose
  856.   end
  857.   super
  858. end
  859. #--------------------------------------------------------------------------
  860. # ● 矩形更新
  861. #--------------------------------------------------------------------------
  862. def update_cursor_rect
  863.   if @index >= 0
  864.     n = $game_temp.choice_start + @index
  865.     self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  866.   else
  867.     self.cursor_rect.empty
  868.   end
  869. end
  870. end
  871. #==============================================================================
  872. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  873. #==============================================================================
  874. class Window_Frame < Window_Base
  875. #--------------------------------------------------------------------------
  876. # ● オブジェクト初期化
  877. #--------------------------------------------------------------------------
  878. def initialize(x, y, width, height)
  879.   super(x, y, width, height)
  880.   self.contents = nil
  881.   self.back_opacity = 100
  882. end
  883. #--------------------------------------------------------------------------
  884. # ● 解放
  885. #--------------------------------------------------------------------------
  886. def dispose
  887.   super
  888.   end
  889. end
  890. #==============================================================================
  891. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  892. #==============================================================================
  893. class Air_Text < Window_Base
  894.  
  895.  
  896.   #参数的颜色自定义设定范围0-255
  897.   $ncolor0 = 255
  898.   $ncolor1 = 255
  899.   $ncolor2 = 255
  900.   #参数的颜色自定义设定范围0-255
  901.  
  902. #--------------------------------------------------------------------------
  903. # ● オブジェクト初期化
  904. #--------------------------------------------------------------------------
  905. def initialize(x, y, designate_text)
  906.   super(x-16, y-16, 32 + designate_text.size * 12, 56)
  907.   self.opacity = 0
  908.   self.back_opacity = 0
  909.   self.contents = Bitmap.new(self.width - 50, self.height - 32)
  910.   w = self.contents.width
  911.   h = self.contents.height
  912.  
  913.  
  914.     #颜色自定义设定范围0-255
  915.     self.contents.font.color = Color.new($ncolor0, $ncolor1, $ncolor2)
  916.     #颜色自定义设定范围0-255
  917.  
  918.  
  919.  
  920. #    self.contents.font.color = text_color(color)
  921.   self.contents.draw_text(0, 0, w, h, designate_text)
  922. end
  923. #--------------------------------------------------------------------------
  924. # ● 解放
  925. #--------------------------------------------------------------------------
  926. def dispose
  927.   self.contents.clear
  928.   super
  929. end
  930. end
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
2 小时
注册时间
2013-7-6
帖子
5
3
 楼主| 发表于 2013-7-6 16:03:32 | 只看该作者
美丽晨露 发表于 2013-7-6 15:59
试试增强型对话框吧
# ————————————————————————————————————
# 本脚 ...

Q_Q那个..请问177行会报错是什么原因?
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

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

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

4
发表于 2013-7-6 16:06:14 | 只看该作者
anlailuguo 发表于 2013-7-6 16:03
Q_Q那个..请问177行会报错是什么原因?

贴脚本时会出现这种BUG
这些删除
这些删除
再保存试试
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
2 小时
注册时间
2013-7-6
帖子
5
5
 楼主| 发表于 2013-7-6 16:12:46 | 只看该作者
美丽晨露 发表于 2013-7-6 16:06
贴脚本时会出现这种BUG
这些删除
这些删除

呜..我把那些注释掉了= =可以运行了..不过运行不出来结果..感觉上应该是插入图片的地方出问题了咩=-=因为我这边没有图片的关系?
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

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

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

6
发表于 2013-7-6 16:22:22 | 只看该作者
anlailuguo 发表于 2013-7-6 16:12
呜..我把那些注释掉了= =可以运行了..不过运行不出来结果..感觉上应该是插入图片的地方出问题了咩=-=因为 ...

Project40.zip (369 KB, 下载次数: 63)
给个范例参考

点评

3Q,脚本看不懂,返利看的懂!  发表于 2013-7-6 20:29

评分

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

查看全部评分

大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
2 小时
注册时间
2013-7-6
帖子
5
7
 楼主| 发表于 2013-7-6 16:32:48 | 只看该作者
美丽晨露 发表于 2013-7-6 16:22
给个范例参考

哦哦哦= =我明白了..非常感谢QAQ!请问这个论坛有什么可以对帮助的人进行感谢的操作咩..我是新来的不是特别了解QAQ总之非常感谢!

点评

总之非常感谢  发表于 2013-7-6 16:46
没事,帮上忙就好  发表于 2013-7-6 16:42
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
92 小时
注册时间
2011-9-4
帖子
59
8
发表于 2013-7-6 22:10:47 | 只看该作者
先收范例!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
9 小时
注册时间
2013-6-11
帖子
8
9
发表于 2013-7-27 18:25:18 手机端发表。 | 只看该作者
马一下,这边也需要分开显示
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
52
在线时间
586 小时
注册时间
2012-5-31
帖子
768
10
发表于 2013-7-28 09:38:55 | 只看该作者
177行应该是这样的 @opacity= 255
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-10-6 23:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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