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

Project1

 找回密码
 注册会员
搜索
查看: 1459|回复: 2

[已经解决] 我使用对话加强脚本 的名字框内的透明度在哪里修改~

[复制链接]

Lv1.梦旅人

自由·战士

梦石
0
星屑
50
在线时间
31 小时
注册时间
2007-12-16
帖子
238
发表于 2012-9-7 20:37:57 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 hcm 于 2012-10-5 08:16 编辑

这个是脚本、但是现实对话的时候名字的框内是透明的,想修改成不透明  ,怎么实现?  谢谢·





  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================


  4. #——说明

  5. #默认为一个字一个字的方式,如果需要一次全部显示,
  6. #请在游戏中使用脚本:$game_system.typing = true
  7.      
  8. #默认对话字没有声音,如果需要声音,
  9. #请在游戏中使用脚本:$game_system.soundname_on_speak = "这里输入文件名"
  10. #我唯一一个见过“胡乱配音”的游戏是天使帝国2代,该游戏说话的时候每个字符随机发一个外星语音

  11. # 其他在对话中可以使用的功能:

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

  13. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名

  14. # \p[1]:对话框出现在1号事件的上方
  15. # \p[0]:主人公上方出现对话框
  16. #——————————————————使用\p功能后可以自动调整对话框大小

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

  18. # \c[1-8]:更改颜色

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

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

  21. # \s[1-19]:更改弹字的速度

  22. # \.   :停顿一刹那(1、2帧)
  23. # \|   :停顿片刻(20帧)

  24. # \>   :文字不用打字方式
  25. # \<   :文字使用打字方式

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

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

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

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

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

  32. # \K[今天天气不错]:在出现“今天天气不错”这几个字的时候播放$game_system.soundname_on_speak设置的音效

  33. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  34. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”

  35. # \Lk:清除左边的图像
  36. # \Rk:清除右边的图像
  37. # \M[60]:等待60帧文字直接消失

  38. #脚本冲突可能:
  39. #不用说了。因为改了分辨率所有原有窗口需要自己定义,基本上可以算是和所有脚本冲突。

  40. #============================
  41. class Game_System
  42. attr_accessor :typing
  43. attr_accessor :soundname_on_speak
  44. alias carol3_ini initialize
  45. def initialize
  46.    carol3_ini
  47.    @typing = true
  48.    @soundname_on_speak = nil
  49. end
  50. end
  51. #=================================
  52. #==============================================================================
  53. # ■ Window_Message
  54. #------------------------------------------------------------------------------
  55. class Window_Message < Window_Selectable
  56. #--------------------------------------------------------------------------
  57. # ● 初始化状态
  58. #--------------------------------------------------------------------------
  59. def initialize
  60.   super(80, 304, 480, 160)
  61.    self.contents = Bitmap.new(width - 32, height - 32)
  62.    self.visible = false
  63.    self.z = 9998
  64.    @fade_in = false
  65.    @fade_out = false
  66.    @contents_showing = false
  67.    @cursor_width = 0
  68.    @autoclosetime = -1
  69.    self.active = false
  70.    self.index = -1
  71.    if $game_system.soundname_on_speak == nil then
  72.      $game_system.soundname_on_speak = ""
  73.    end
  74.    @opacity_text_buf = Bitmap.new(32, 32)
  75. end
  76. #--------------------------------------------------------------------------
  77. # ● 释放
  78. #--------------------------------------------------------------------------
  79. def dispose
  80.    terminate_message
  81.    $game_temp.message_window_showing = false
  82.    if @input_number_window != nil
  83.      @input_number_window.dispose
  84.    end
  85.    super
  86. end
  87. #--------------------------------------------------------------------------
  88. # ● 处理信息结束
  89. #--------------------------------------------------------------------------
  90. def terminate_message
  91.    self.active = false
  92.    self.pause = false
  93.    self.index = -1
  94.    self.contents.clear
  95.    # 清除显示中标志
  96.    @contents_showing = false
  97.    # 呼叫信息调用
  98.    if $game_temp.message_proc != nil
  99.      $game_temp.message_proc.call
  100.    end
  101.    # 清除文章、选择项、输入数值的相关变量
  102.    $game_temp.message_text = nil
  103.    $game_temp.message_proc = nil
  104.    $game_temp.choice_start = 99
  105.    $game_temp.choice_max = 0
  106.    $game_temp.choice_cancel_type = 0
  107.    $game_temp.choice_proc = nil
  108.    $game_temp.num_input_start = 99
  109.    $game_temp.num_input_variable_id = 0
  110.    $game_temp.num_input_digits_max = 0
  111.    # 开放金钱窗口
  112.    if @gold_window != nil
  113.      @gold_window.dispose
  114.      @gold_window = nil
  115.    end
  116.    if @name_window_frame != nil
  117.      @name_window_frame.dispose
  118.      @name_window_frame = nil
  119.    end
  120.    if @name_window_text != nil
  121.      @name_window_text.dispose
  122.      @name_window_text = nil
  123.    end
  124.    if @right_picture != nil and @right_keep == true
  125.      @right_picture.dispose
  126.    end   
  127.    if @left_picture != nil and @left_keep == true
  128.      @left_picture.dispose
  129.    end
  130. end
  131. def refresh
  132.    # 初期化
  133.    self.contents.clear
  134.    self.contents.font.color = normal_color
  135.    self.contents.font.size = Font.default_size
  136.    @x = @y = @max_x = @max_y = @indent = @lines = 0
  137.    @left_keep = @right_keep = false
  138.    @face_indent = 0
  139.    @opacity = 255
  140.    @cursor_width = 0
  141.    @autoclosetime = -1
  142.    @write_speed = 0
  143.    @write_wait = 0
  144.    @mid_stop = false
  145.    @face_file = nil
  146.    @popchar = -2
  147.    if $game_temp.choice_start == 0
  148.      @x = 8
  149.    end
  150.    if $game_temp.message_text != nil
  151.      @now_text = $game_temp.message_text
  152.      #——头像设置
  153.      if (/\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
  154.        @face_file = $1 + ".png"
  155.        @x = @face_indent = 128
  156.        if FileTest.exist?("Graphics/Pictures/" + $1 + ".png")
  157.          self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  158.        end
  159.        @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
  160.      end
  161.      #——左半身像设置
  162.      if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  163.        @face = "66rpg_" + $1 + "_h.png"
  164.        if $加密 == true
  165.          if @left_picture != nil
  166.            @left_picture.dispose
  167.          end
  168.          @left_picture = Sprite.new
  169.          @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  170.          @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  171.          @left_picture.x = 0
  172.          @left_picture.mirror = true
  173.          @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  174.        else         
  175.          if FileTest.exist?("Graphics/battlers/#{@face}")
  176.            if @left_picture != nil
  177.              @left_picture.dispose
  178.            end
  179.            @left_picture = Sprite.new
  180.            @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  181.            @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  182.            @left_picture.x = 0
  183.            @left_picture.mirror = true
  184.            @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  185.          end
  186.        end        
  187.      end
  188.      #——右半身像设置
  189.      if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  190.        @face = "66rpg_" + $1 + "_h.png"
  191.        if $加密 == true
  192.          if @right_picture != nil
  193.            @right_picture.dispose
  194.          end
  195.          @right_picture = Sprite.new
  196.          @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  197.          @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  198.          @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  199.          @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  200.        else
  201.          if FileTest.exist?("Graphics/battlers/#{@face}")
  202.            if @right_picture != nil
  203.              @right_picture.dispose
  204.            end
  205.            @right_picture = Sprite.new
  206.            @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  207.            @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  208.            @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  209.            @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  210.          end
  211.        end
  212.      end
  213.      if (/\\[Rr]k/.match(@now_text)) != nil
  214.        @right_keep = true
  215.        @now_text.sub!(/\\[Rr]k/) { "" }
  216.      end
  217.      if (/\\[Ll]k/.match(@now_text)) != nil
  218.        @left_keep = true
  219.        @now_text.sub!(/\\[Ll]k/) { "" }
  220.      end
  221.      # 显示人物姓名
  222.      name_window_set = false
  223.      if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
  224.        name_window_set = true
  225.        name_text = $1
  226.        @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  227.      end
  228.      
  229.      # 文字位置的判定
  230.      if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  231.        @popchar = $1.to_i
  232.        if @popchar == -1
  233.          @x = @indent = 48
  234.          @y = 4
  235.        end
  236.        @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  237.      end
  238.      
  239.      # 开始
  240.      begin
  241.        last_text = @now_text.clone
  242.        @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  243.      end until @now_text == last_text
  244.      @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  245.      $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  246.    end
  247.    @now_text.gsub!(/\\\\/) { "\000" }
  248.    @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  249.    @now_text.gsub!(/\\[Gg]/) { "\002" }
  250.    @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  251.    @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  252.    @now_text.gsub!(/\\[.]/) { "\005" }
  253.    @now_text.gsub!(/\\[|]/) { "\006" }
  254.    @now_text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\050[#{$1}]" }
  255.    
  256.    @now_text.gsub!(/\\[>]/) { "\016" }
  257.    @now_text.gsub!(/\\[<]/) { "\017" }
  258.    @now_text.gsub!(/\\[!]/) { "\020" }
  259.    @now_text.gsub!(/\\[~]/) { "\021" }
  260.    
  261.    @now_text.gsub!(/\\[Ii]/) { "\023" }
  262.    @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  263.    @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  264.    @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  265.    @now_text.gsub!(/\\[Kk]\[(.*?)\]/) { "\027[#{$1}]" }
  266.    if @popchar >= 0
  267.      @text_save = @now_text.clone
  268.      @max_x = 0
  269.      @max_y = 4
  270.      for i in 0..3
  271.        line = @now_text.split(/\n/)[3-i]
  272.        @max_y -= 1 if line == nil and @max_y <= 4-i
  273.        next if line == nil
  274.        cx = contents.text_size(line).width
  275.        @max_x = cx if cx > @max_x
  276.      end
  277.      self.width = @max_x + 48 + @face_indent
  278.      self.height = (@max_y - 1) * 32 + 64
  279.    else
  280.      @max_x = self.width - 32 - @face_indent
  281.    end
  282.    reset_window
  283.      if name_window_set
  284.        off_x = 0
  285.        off_y = -40
  286.        space = 2
  287.        x = self.x + off_x - space / 2
  288.        y = self.y + off_y - space / 2
  289.        w = self.contents.text_size(name_text).width + 26 + space
  290.        h = 40 + space
  291.        @name_window_frame = Window_Frame.new(x, y, w, h)
  292.        @name_window_frame.z = self.z + 1
  293.        x = self.x + off_x + 4
  294.        y = self.y + off_y
  295.        @name_window_text = Air_Text.new(x+4, y+6, name_text)
  296.        @name_window_text.z = self.z + 2
  297.      end
  298.    end
  299.    reset_window
  300.    if $game_temp.choice_max > 0
  301.      @item_max = $game_temp.choice_max
  302.      self.active = true
  303.      self.index = 0
  304.    end
  305.    if $game_temp.num_input_variable_id > 0
  306.      digits_max = $game_temp.num_input_digits_max
  307.      number = $game_variables[$game_temp.num_input_variable_id]
  308.      @input_number_window = Window_InputNumber.new(digits_max)
  309.      @input_number_window.number = number
  310.      @input_number_window.x = self.x + 8
  311.      @input_number_window.y = self.y + $game_temp.num_input_start * 32
  312.    end
  313. end
  314. #--------------------------------------------------------------------------
  315. # ● 更新
  316. #--------------------------------------------------------------------------
  317. def update
  318.    super
  319.    if @autoclosetime == 0
  320.      @autoclosetime = -1
  321.      terminate_message
  322.   end
  323.    if @autoclosetime >= 1
  324.      @autoclosetime -= 1
  325.    end
  326.    if @fade_in
  327.      self.contents_opacity += 24
  328.      if @input_number_window != nil
  329.        @input_number_window.contents_opacity += 24
  330.      end
  331.      if self.contents_opacity == 255
  332.        @fade_in = false
  333.      end
  334.      return
  335.    end
  336.    @now_text = nil if @now_text == ""
  337.    
  338.    if @now_text != nil and @mid_stop == false
  339.      if @write_wait > 0
  340.        @write_wait -= 1
  341.        return
  342.      end
  343.      text_not_skip = $game_system.typing
  344.      while true
  345.        @max_x = @x if @max_x < @x
  346.        @max_y = @y if @max_y < @y
  347.        if (c = @now_text.slice!(/./m)) != nil
  348.          if c == "\000"
  349.            c = "\\"
  350.          end
  351.          if c == "\001"
  352.            @now_text.sub!(/\[([0-9]+)\]/, "")
  353.            color = $1.to_i
  354.            if color >= 0 and color <= 9
  355.              self.contents.font.color = text_color(color)
  356.            end
  357.            c = ""
  358.          end
  359.          if c == "\002"
  360.            if @gold_window == nil and @popchar <= 0
  361.              @gold_window = Window_Gold.new
  362.              @gold_window.x = 560 - @gold_window.width
  363.              if $game_temp.in_battle
  364.                @gold_window.y = 192
  365.              else
  366.                @gold_window.y = self.y >= 128 ? 32 : 384
  367.              end
  368.              @gold_window.opacity = self.opacity
  369.              @gold_window.back_opacity = self.back_opacity
  370.            end
  371.            c = ""
  372.          end
  373.          if c == "\003"
  374.            @now_text.sub!(/\[([0-9]+)\]/, "")
  375.            speed = $1.to_i
  376.            if speed >= 0 and speed <= 19
  377.              @write_speed = speed
  378.            end
  379.            c = ""
  380.          end
  381.          if c == "\004"
  382.            @now_text.sub!(/\[(.*?)\]/, "")
  383.            buftxt = $1.dup.to_s
  384.            if buftxt.match(/\//) == nil and buftxt != "" then
  385.              $game_system.soundname_on_speak = "Audio/SE/" + buftxt
  386.            else
  387.              $game_system.soundname_on_speak = buftxt.dup
  388.            end
  389.            c = ""
  390.          elsif c == "\004"
  391.            c = ""
  392.          end
  393.          if c == "\005"
  394.            @write_wait += 5
  395.            c = ""
  396.          end
  397.          if c == "\006"
  398.            @write_wait += 20
  399.            c = ""
  400.          end
  401.          if c == "\016"
  402.            text_not_skip = false
  403.            c = ""
  404.          end
  405.          if c == "\017"
  406.            text_not_skip = true
  407.            c = ""
  408.          end
  409.          if c == "\020"
  410.            @mid_stop = true
  411.            c = ""
  412.          end
  413.          if c == "\021"
  414.            terminate_message
  415.            return
  416.          end
  417.          if c == "\023"
  418.            @indent = @x
  419.            c = ""
  420.          end
  421.          if c == "\024"
  422.            @now_text.sub!(/\[([0-9]+)\]/, "")
  423.            @opacity = $1.to_i
  424.            c = ""
  425.          end
  426.          if c == "\025"
  427.            @now_text.sub!(/\[([0-9]+)\]/, "")
  428.            self.contents.font.size = [[$1.to_i, 6].max, 32].min
  429.            c = ""
  430.          end
  431.          if c == "\026"
  432.            @now_text.sub!(/\[([0-9]+)\]/, "")
  433.            @x += $1.to_i
  434.            c = ""
  435.          end
  436.          if c == "\027"
  437.            @now_text.sub!(/\[(.*?)\]/, "")
  438.            @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  439.            if $game_system.soundname_on_speak != ""
  440.              Audio.se_play($game_system.soundname_on_speak)
  441.            end
  442.            c = ""
  443.          end
  444.          if c == "\030"
  445.            @now_text.sub!(/\[(.*?)\]/, "")
  446.            self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  447.           if $game_system.soundname_on_speak != ""
  448.              Audio.se_play($game_system.soundname_on_speak)
  449.            end
  450.            @x += 24
  451.            c = ""
  452.          end
  453.          if c == "\050"

  454.          @now_text.sub!(/\[([0-9]+)\]/, "")

  455.          @autoclosetime = $1.to_i

  456.          next

  457.        end
  458.          if c == "\n"
  459.            if @lines >= $game_temp.choice_start
  460.              @cursor_width = [@cursor_width, @max_x - @face_indent].max
  461.            end
  462.            @lines += 1
  463.            @y += 1
  464.            @x = 0 + @indent + @face_indent
  465.            if @lines >= $game_temp.choice_start
  466.              @x = 8 + @indent + @face_indent
  467.            end
  468.            c = ""
  469.          end
  470.          if c != ""
  471.            # 文字描画
  472.            @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  473.            if $game_system.soundname_on_speak != "" then
  474.            Audio.se_play($game_system.soundname_on_speak)
  475.            end
  476.          end
  477.          if Input.press?(Input::B)
  478.            text_not_skip = false
  479.          end
  480.        else
  481.          text_not_skip = true
  482.          break
  483.        end
  484.        # 終了判定
  485.        if text_not_skip
  486.          break
  487.        end
  488.      end
  489.      @write_wait += @write_speed
  490.      return
  491.    end
  492.    if @input_number_window != nil
  493.      @input_number_window.update
  494.      # 決定
  495.      if Input.trigger?(Input::C)
  496.        $game_system.se_play($data_system.decision_se)
  497.        $game_variables[$game_temp.num_input_variable_id] =
  498.        @input_number_window.number
  499.        $game_map.need_refresh = true
  500.        @input_number_window.dispose
  501.        @input_number_window = nil
  502.        terminate_message
  503.      end
  504.      return
  505.    end
  506.    if @contents_showing
  507.      if $game_temp.choice_max == 0
  508.        self.pause = true
  509.      end
  510.      # 取消
  511.      if Input.trigger?(Input::B)
  512.        if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  513.          $game_system.se_play($data_system.cancel_se)
  514.          $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  515.          terminate_message
  516.        end
  517.      end
  518.      # 決定
  519.      if Input.trigger?(Input::C)
  520.        if $game_temp.choice_max > 0
  521.          $game_system.se_play($data_system.decision_se)
  522.          $game_temp.choice_proc.call(self.index)
  523.        end
  524.        if @mid_stop
  525.          @mid_stop = false
  526.          return
  527.        else
  528.          terminate_message
  529.        end
  530.      end
  531.      return
  532.    end
  533.    if @fade_out == false and $game_temp.message_text != nil
  534.      @contents_showing = true
  535.      $game_temp.message_window_showing = true
  536.      refresh
  537.      Graphics.frame_reset
  538.      self.visible = true
  539.      self.contents_opacity = 0
  540.    if @input_number_window != nil
  541.      @input_number_window.contents_opacity = 0
  542.    end
  543.      @fade_in = true
  544.      return
  545.    end
  546.    if self.visible
  547.      @fade_out = true
  548.      self.opacity -= 48
  549.      if self.opacity == 0
  550.        self.visible = false
  551.        @fade_out = false
  552.        $game_temp.message_window_showing = false
  553.      end
  554.      return
  555.    end
  556. end
  557. #--------------------------------------------------------------------------
  558. # ● 获得字符
  559. #--------------------------------------------------------------------------
  560. def get_character(parameter)
  561.    case parameter
  562.    when 0
  563.      return $game_player
  564.    else
  565.      events = $game_map.events
  566.      return events == nil ? nil : events[parameter]
  567.    end
  568. end
  569. #--------------------------------------------------------------------------
  570. # ● ウィンドウの位置と不透明度の設定
  571. #--------------------------------------------------------------------------
  572.   def reset_window
  573.     if $game_temp.in_battle
  574.       self.y = 16
  575.     else
  576.       case $game_system.message_position
  577.       when 0  # 上
  578.         self.y = 16
  579.       when 1  # 中
  580.         self.y = 160
  581.       when 2  # 下
  582.         self.y = 304
  583.       end
  584.     end
  585.     if $game_system.message_frame == 0
  586.       self.opacity = 255
  587.     else
  588.       self.opacity = 0
  589.     end
  590.     self.back_opacity = 255
  591.   end
  592. #--------------------------------------------------------------------------
  593. # ● line_height
  594. #--------------------------------------------------------------------------
  595. # 返回値:行高
  596. #--------------------------------------------------------------------------
  597. def line_height
  598.    return 32
  599.    if self.contents.font.size >= 20 and self.contents.font.size <= 24
  600.      return 32
  601.    else
  602.      return self.contents.font.size * 15 / 10
  603.    end
  604. end
  605. #--------------------------------------------------------------------------
  606. # ● 透過文字描画
  607. #--------------------------------------------------------------------------
  608. # target :描画対象。Bitmapクラスを指定。
  609. # x :x座標
  610. # y :y座標
  611. # str  :描画文字列
  612. # opacity:透過率(0~255)
  613. # 返回値 :文字幅(@x増加値)。
  614. #--------------------------------------------------------------------------
  615. def opacity_draw_text(target, x, y, str,opacity)
  616.    height = target.font.size
  617.    width = target.text_size(str).width
  618.    opacity = [[opacity, 0].max, 255].min
  619.    if opacity == 255
  620.      target.draw_text(x, y, width, height, str)
  621.      return width
  622.    else
  623.      if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  624.        @opacity_text_buf.dispose
  625.        @opacity_text_buf = Bitmap.new(width, height)
  626.      else
  627.        @opacity_text_buf.clear
  628.      end
  629.      @opacity_text_buf.font.size = target.font.size
  630.      @opacity_text_buf.draw_text(0, 0, width, height, str)
  631.      target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  632.    return width
  633.    end
  634. end
  635. def ruby_draw_text(target, x, y, str,opacity)
  636.    sizeback = target.font.size
  637.    target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  638.    rubysize = [rubysize, 6].max
  639.    
  640.    opacity = [[opacity, 0].max, 255].min
  641.    split_s = str.split(/,/)
  642.    
  643.    split_s[0] == nil ? split_s[0] = "" : nil
  644.    split_s[1] == nil ? split_s[1] = "" : nil
  645.    
  646.    height = sizeback + rubysize
  647.    width = target.text_size(split_s[0]).width
  648.    
  649.    target.font.size = rubysize
  650.    ruby_width = target.text_size(split_s[1]).width
  651.    target.font.size = sizeback
  652.    
  653.    buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  654.    
  655.    width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  656.    
  657.    if opacity == 255
  658.      target.font.size = rubysize
  659.      target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  660.      target.font.size = sizeback
  661.      target.draw_text(x, y, width, target.font.size, split_s[0])
  662.      return width
  663.    else
  664.      if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  665.        @opacity_text_buf.dispose
  666.        @opacity_text_buf = Bitmap.new(buf_width, height)
  667.      else
  668.        @opacity_text_buf.clear
  669.      end
  670.      @opacity_text_buf.font.size = rubysize
  671.      @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  672.      @opacity_text_buf.font.size = sizeback
  673.      @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  674.      if sub_x >= 0
  675.        target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  676.      else
  677.        target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  678.      end
  679.      return width
  680.    end
  681. end
  682. #--------------------------------------------------------------------------
  683. # ● \V 变换
  684. #--------------------------------------------------------------------------
  685. def convart_value(option, index)
  686.    option == nil ? option = "" : nil
  687.    option.downcase!
  688.    case option
  689.      when "i"
  690.        unless $data_items[index].name == nil
  691.          r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  692.        end
  693.      when "w"
  694.        unless $data_weapons[index].name == nil
  695.          r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  696.        end
  697.      when "a"
  698.        unless $data_armors[index].name == nil
  699.          r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  700.        end
  701.      when "s"
  702.        unless $data_skills[index].name == nil
  703.          r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  704.        end
  705.      else
  706.      r = $game_variables[index]
  707.    end
  708.    r == nil ? r = "" : nil
  709.    return r
  710. end
  711. #--------------------------------------------------------------------------
  712. # ● 解放
  713. #--------------------------------------------------------------------------
  714. def dispose
  715.    terminate_message
  716.    if @gaiji_cache != nil
  717.      unless @gaiji_cache.disposed?
  718.        @gaiji_cache.dispose
  719.      end
  720.    end
  721.    unless @opacity_text_buf.disposed?
  722.      @opacity_text_buf.dispose
  723.    end
  724.    $game_temp.message_window_showing = false
  725.    if @input_number_window != nil
  726.      @input_number_window.dispose
  727.    end
  728.    super
  729. end
  730. #--------------------------------------------------------------------------
  731. # ● 矩形更新
  732. #--------------------------------------------------------------------------
  733. def update_cursor_rect
  734.    if @index >= 0
  735.      n = $game_temp.choice_start + @index
  736.      self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  737.    else
  738.      self.cursor_rect.empty
  739.    end
  740. end
  741. end
  742. #==============================================================================
  743. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  744. #==============================================================================
  745. class Window_Frame < Window_Base
  746. #--------------------------------------------------------------------------
  747. # ● オブジェクト初期化
  748. #--------------------------------------------------------------------------
  749. def initialize(x, y, width, height)
  750.    super(x, y, width, height)
  751.    self.contents = nil
  752.    self.back_opacity = 100
  753. end
  754. #--------------------------------------------------------------------------
  755. # ● 解放
  756. #--------------------------------------------------------------------------
  757. def dispose
  758.    super
  759.    end
  760. end
  761. #==============================================================================
  762. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  763. #==============================================================================
  764. class Air_Text < Window_Base
  765. #--------------------------------------------------------------------------
  766. # ● オブジェクト初期化
  767. #--------------------------------------------------------------------------
  768. def initialize(x, y, designate_text)
  769.    super(x-16, y-16, 32 + designate_text.size * 12, 56)
  770.    self.opacity = 0
  771.    self.back_opacity = 0
  772.    self.contents = Bitmap.new(self.width - 32, self.height - 32)
  773.    w = self.contents.width
  774.    h = self.contents.height
  775.    self.contents.draw_text(0, 0, w, h, designate_text)
  776. end
  777. #--------------------------------------------------------------------------
  778. # ● 解放
  779. #--------------------------------------------------------------------------
  780. def dispose
  781.    self.contents.clear
  782.    super
  783. end
  784. end



  785. #==============================================================================
  786. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  787. #==============================================================================
复制代码


洛克人Zero-零的计划

Lv1.梦旅人

梦石
0
星屑
110
在线时间
326 小时
注册时间
2010-7-4
帖子
80
发表于 2012-9-7 21:55:18 | 显示全部楼层
780行改为   self.back_opacity = 255
注:可以设置0~255效果自己看

点评

感激不尽!不知道咋··采纳 =。=···  发表于 2012-10-2 23:37

评分

参与人数 1星屑 +200 收起 理由
hcm + 200 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

自由·战士

梦石
0
星屑
50
在线时间
31 小时
注册时间
2007-12-16
帖子
238
 楼主| 发表于 2012-9-7 22:48:45 | 显示全部楼层
@IORINO_1嗯,搞定了~~感激不尽啊~~~~

点评

那采纳我吧亲  发表于 2012-9-7 22:54
洛克人Zero-零的计划
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 21:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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