幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1658|回复: 1

[RMXP] [求助]对话加强脚本

[复制链接]

193

主题

902

帖子

9515

积分

⑦老手

請堅持『人的尊重』

积分
9515
发表于 2006-11-25 14:35:26 | 显示全部楼层 |阅读模式
# \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  1. #==============================================================================
  2. # ■ Game_System
  3. #------------------------------------------------------------------------------
  4. #  处理系统附属数据的类。也可执行诸如 BGM 管理之类的功能。本类的实例请参考
  5. # $game_system 。
  6. #==============================================================================
  7. class Game_System
  8.   attr_accessor :typing
  9.   attr_accessor :soundname_on_speak
  10.   alias carol3_ini initialize
  11.   def initialize
  12.     carol3_ini
  13.     @typing = true
  14.     @soundname_on_speak = nil
  15.   end
  16. end
  17. $加密 = true
  18. #==============================================================================
  19. # ■ Window_Message
  20. #------------------------------------------------------------------------------
  21. class Window_Message < Window_Selectable
  22.   #--------------------------------------------------------------------------
  23.   # ● 初始化状态
  24.   #--------------------------------------------------------------------------
  25.   def initialize
  26.     super(80, 304, 480, 160)
  27.     self.contents = Bitmap.new(width - 32, height - 32)
  28.     self.visible = false
  29.     self.z = 9998
  30.     @fade_in = false
  31.     @fade_out = false
  32.     @contents_showing = false
  33.     @cursor_width = 0
  34.     self.active = false
  35.     self.index = -1
  36.     if $game_system.soundname_on_speak == nil then
  37.       $game_system.soundname_on_speak = ""
  38.     end
  39.     @opacity_text_buf = Bitmap.new(32, 32)
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● 释放
  43.   #--------------------------------------------------------------------------
  44.   def dispose
  45.     terminate_message
  46.     $game_temp.message_window_showing = false
  47.     if @input_number_window != nil
  48.       @input_number_window.dispose
  49.     end
  50.     super
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 处理信息结束
  54.   #--------------------------------------------------------------------------
  55.   def terminate_message
  56.     self.active = false
  57.     self.pause = false
  58.     self.index = -1
  59.     self.contents.clear
  60.     # 清除显示中标志
  61.     @contents_showing = false
  62.     # 呼叫信息调用
  63.     if $game_temp.message_proc != nil
  64.       $game_temp.message_proc.call
  65.     end
  66.     # 清除文章、选择项、输入数值的相关变量
  67.     $game_temp.message_text = nil
  68.     $game_temp.message_proc = nil
  69.     $game_temp.choice_start = 99
  70.     $game_temp.choice_max = 0
  71.     $game_temp.choice_cancel_type = 0
  72.     $game_temp.choice_proc = nil
  73.     $game_temp.num_input_start = 99
  74.     $game_temp.num_input_variable_id = 0
  75.     $game_temp.num_input_digits_max = 0
  76.     # 开放金钱窗口
  77.     if @gold_window != nil
  78.       @gold_window.dispose
  79.       @gold_window = nil
  80.     end
  81.     if @name_window_frame != nil
  82.       @name_window_frame.dispose
  83.       @name_window_frame = nil
  84.     end
  85.     if @name_window_text != nil
  86.       @name_window_text.dispose
  87.       @name_window_text = nil
  88.     end
  89.     if @right_picture != nil and @right_keep == true
  90.       @right_picture.dispose
  91.     end   
  92.     if @left_picture != nil and @left_keep == true
  93.       @left_picture.dispose
  94.     end
  95.   end
  96.   def refresh
  97.     # 初期化
  98.     self.contents.clear
  99.     self.contents.font.color = normal_color
  100.     self.contents.font.size = Font.default_size
  101.     @x = @y = @max_x = @max_y = @indent = @lines = 0
  102.     @left_keep = @right_keep = false
  103.     @face_indent = 0
  104.     @opacity = 255
  105.     @cursor_width = 0
  106.     @write_speed = 0
  107.     @write_wait = 0
  108.     @mid_stop = false
  109.     @face_file = nil
  110.     @popchar = -2
  111.     if $game_temp.choice_start == 0
  112.       @x = 8
  113.     end
  114.     if $game_temp.message_text != nil
  115.       @now_text = $game_temp.message_text
  116.       #——头像设置
  117.       if (/\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
  118.         @face_file = $1 + ".png"
  119.         @x = @face_indent = 128
  120.         if FileTest.exist?("Graphics/Pictures/" + $1 + ".png")
  121.           self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  122.         end
  123.         @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
  124.       end
  125.       #——左半身像设置
  126.       if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  127.         @face = "44_" + $1 + "_h.png"
  128.         if $加密 == true
  129.           if @left_picture != nil
  130.             @left_picture.dispose
  131.           end
  132.           @left_picture = Sprite.new
  133.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  134.           @left_picture.y = 480-@left_picture.bitmap.height
  135.           @left_picture.x = 0
  136.           @left_picture.mirror = true
  137.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  138.         else         
  139.           if FileTest.exist?("Graphics/battlers/#{@face}")
  140.             if @left_picture != nil
  141.               @left_picture.dispose
  142.             end
  143.             @left_picture = Sprite.new
  144.             @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  145.             @left_picture.y = 480-@left_picture.bitmap.height
  146.             @left_picture.x = 0
  147.             @left_picture.mirror = true
  148.             @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  149.           end
  150.         end        
  151.       end
  152.       #——右半身像设置
  153.       if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  154.         @face = "44_" + $1 + "_h.png"
  155.         if $加密 == true
  156.           if @right_picture != nil
  157.             @right_picture.dispose
  158.           end
  159.           @right_picture = Sprite.new
  160.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  161.           @right_picture.y = 480-@right_picture.bitmap.height
  162.           @right_picture.x = 640-@right_picture.bitmap.width
  163.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  164.         else
  165.           if FileTest.exist?("Graphics/battlers/#{@face}")
  166.             if @right_picture != nil
  167.               @right_picture.dispose
  168.             end
  169.             @right_picture = Sprite.new
  170.             @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  171.             @right_picture.y = 480-@right_picture.bitmap.height
  172.             @right_picture.x = 640-@right_picture.bitmap.width
  173.             @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  174.           end
  175.         end
  176.       end
  177.       if (/\\[Rr]k/.match(@now_text)) != nil
  178.         @right_keep = true
  179.         @now_text.sub!(/\\[Rr]k/) { "" }
  180.       end
  181.       if (/\\[Ll]k/.match(@now_text)) != nil
  182.         @left_keep = true
  183.         @now_text.sub!(/\\[Ll]k/) { "" }
  184.       end
  185.       # 显示人物姓名
  186.       name_window_set = false
  187.       if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
  188.         name_window_set = true
  189.         name_text = $1
  190.         @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  191.       end
  192.       
  193.       # 文字位置的判定
  194.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  195.         @popchar = $1.to_i
  196.         if @popchar == -1
  197.           @x = @indent = 48
  198.           @y = 4
  199.         end
  200.         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  201.       end
  202.       
  203.       # 开始
  204.       begin
  205.         last_text = @now_text.clone
  206.         @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  207.       end until @now_text == last_text
  208.       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  209.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  210.     end
  211.     @now_text.gsub!(/\\\\/) { "\000" }
  212.     @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  213.     @now_text.gsub!(/\\[Gg]/) { "\002" }
  214.     @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  215.     @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  216.     @now_text.gsub!(/\\[.]/) { "\005" }
  217.     @now_text.gsub!(/\\[|]/) { "\006" }
  218.     @now_text.gsub!(/\\[>]/) { "\016" }
  219.     @now_text.gsub!(/\\[<]/) { "\017" }
  220.     @now_text.gsub!(/\\[!]/) { "\020" }
  221.     @now_text.gsub!(/\\[~]/) { "\021" }
  222.    
  223.     @now_text.gsub!(/\\[Ii]/) { "\023" }
  224.     @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  225.     @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  226.     @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  227.     @now_text.gsub!(/\\[Kk]\[(.*?)\]/) { "\027[#{$1}]" }
  228.     if @popchar >= 0
  229.       @text_save = @now_text.clone
  230.       @max_x = 0
  231.       @max_y = 4
  232.       for i in 0..3
  233.         line = @now_text.split(/\n/)[3-i]
  234.         @max_y -= 1 if line == nil and @max_y <= 4-i
  235.         next if line == nil
  236.         cx = contents.text_size(line).width
  237.         @max_x = cx if cx > @max_x
  238.       end
  239.       self.width = @max_x + 48 + @face_indent
  240.       self.height = (@max_y - 1) * 32 + 64
  241.     else
  242.       @max_x = self.width - 32 - @face_indent
  243.     end
  244.     reset_window
  245.       if name_window_set
  246.         off_x = 0
  247.         off_y = -40
  248.         space = 2
  249.         x = self.x + off_x - space / 2
  250.         y = self.y + off_y - space / 2
  251.         w = self.contents.text_size(name_text).width + 26 + space
  252.         h = 40 + space
  253.         @name_window_frame = Window_Frame.new(x, y, w, h)
  254.         @name_window_frame.z = self.z + 1
  255.         x = self.x + off_x + 4
  256.         y = self.y + off_y
  257.         @name_window_text = Air_Text.new(x+4, y+6, name_text)
  258.         @name_window_text.z = self.z + 2
  259.       end
  260.     end
  261.     reset_window
  262.     if $game_temp.choice_max > 0
  263.       @item_max = $game_temp.choice_max
  264.       self.active = true
  265.       self.index = 0
  266.     end
  267.     if $game_temp.num_input_variable_id > 0
  268.       digits_max = $game_temp.num_input_digits_max
  269.       number = $game_variables[$game_temp.num_input_variable_id]
  270.       @input_number_window = Window_InputNumber.new(digits_max)
  271.       @input_number_window.number = number
  272.       @input_number_window.x = self.x + 8
  273.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  274.     end
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # ● 更新
  278.   #--------------------------------------------------------------------------
  279.   def update
  280.     super
  281.     if @fade_in
  282.       self.contents_opacity += 24
  283.       if @input_number_window != nil
  284.         @input_number_window.contents_opacity += 24
  285.       end
  286.       if self.contents_opacity == 255
  287.         @fade_in = false
  288.       end
  289.       return
  290.     end
  291.     @now_text = nil if @now_text == ""
  292.    
  293.     if @now_text != nil and @mid_stop == false
  294.       if @write_wait > 0
  295.         @write_wait -= 1
  296.         return
  297.       end
  298.       text_not_skip = $game_system.typing
  299.       while true
  300.         @max_x = @x if @max_x < @x
  301.         @max_y = @y if @max_y < @y
  302.         if (c = @now_text.slice!(/./m)) != nil
  303.           if c == "\000"
  304.             c = "\\"
  305.           end
  306.           if c == "\001"
  307.             @now_text.sub!(/\[([0-9]+)\]/, "")
  308.             color = $1.to_i
  309.             if color >= 0 and color <= 7
  310.               self.contents.font.color = text_color(color)
  311.             end
  312.             c = ""
  313.           end
  314.           if c == "\002"
  315.             if @gold_window == nil and @popchar <= 0
  316.               @gold_window = Window_Gold.new
  317.               @gold_window.x = 560 - @gold_window.width
  318.               if $game_temp.in_battle
  319.                 @gold_window.y = 192
  320.               else
  321.                 @gold_window.y = self.y >= 128 ? 32 : 384
  322.               end
  323.               @gold_window.opacity = self.opacity
  324.               @gold_window.back_opacity = self.back_opacity
  325.             end
  326.             c = ""
  327.           end
  328.           if c == "\003"
  329.             @now_text.sub!(/\[([0-9]+)\]/, "")
  330.             speed = $1.to_i
  331.             if speed >= 0 and speed <= 19
  332.               @write_speed = speed
  333.             end
  334.             c = ""
  335.           end
  336.           if c == "\004"
  337.             @now_text.sub!(/\[(.*?)\]/, "")
  338.             buftxt = $1.dup.to_s
  339.             if buftxt.match(/\//) == nil and buftxt != "" then
  340.               $game_system.soundname_on_speak = "Audio/SE/" + buftxt
  341.             else
  342.               $game_system.soundname_on_speak = buftxt.dup
  343.             end
  344.             c = ""
  345.           elsif c == "\004"
  346.             c = ""
  347.           end
  348.           if c == "\005"
  349.             @write_wait += 5
  350.             c = ""
  351.           end
  352.           if c == "\006"
  353.             @write_wait += 20
  354.             c = ""
  355.           end
  356.           if c == "\016"
  357.             text_not_skip = false
  358.             c = ""
  359.           end
  360.           if c == "\017"
  361.             text_not_skip = true
  362.             c = ""
  363.           end
  364.           if c == "\020"
  365.             @mid_stop = true
  366.             c = ""
  367.           end
  368.           if c == "\021"
  369.             terminate_message
  370.             return
  371.           end
  372.           if c == "\023"
  373.             @indent = @x
  374.             c = ""
  375.           end
  376.           if c == "\024"
  377.             @now_text.sub!(/\[([0-9]+)\]/, "")
  378.             @opacity = $1.to_i
  379.             c = ""
  380.           end
  381.           if c == "\025"
  382.             @now_text.sub!(/\[([0-9]+)\]/, "")
  383.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  384.             c = ""
  385.           end
  386.           if c == "\026"
  387.             @now_text.sub!(/\[([0-9]+)\]/, "")
  388.             @x += $1.to_i
  389.             c = ""
  390.           end
  391.           if c == "\027"
  392.             @now_text.sub!(/\[(.*?)\]/, "")
  393.             @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  394.             if $game_system.soundname_on_speak != ""
  395.               Audio.se_play($game_system.soundname_on_speak)
  396.             end
  397.             c = ""
  398.           end
  399.           if c == "\030"
  400.             @now_text.sub!(/\[(.*?)\]/, "")
  401.             self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  402.            if $game_system.soundname_on_speak != ""
  403.               Audio.se_play($game_system.soundname_on_speak)
  404.             end
  405.             @x += 24
  406.             c = ""
  407.           end
  408.           if c == "\n"
  409.             if @lines >= $game_temp.choice_start
  410.               @cursor_width = [@cursor_width, @max_x - @face_indent].max
  411.             end
  412.             @lines += 1
  413.             @y += 1
  414.             @x = 0 + @indent + @face_indent
  415.             if @lines >= $game_temp.choice_start
  416.               @x = 8 + @indent + @face_indent
  417.             end
  418.             c = ""
  419.           end
  420.           if c != ""
  421.             # 文字描画
  422.             @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  423.             if $game_system.soundname_on_speak != "" then
  424.             Audio.se_play($game_system.soundname_on_speak)
  425.             end
  426.           end
  427.           if Input.press?(Input::B)
  428.             text_not_skip = false
  429.           end
  430.         else
  431.           text_not_skip = true
  432.           break
  433.         end
  434.         # 終了判定
  435.         if text_not_skip
  436.           break
  437.         end
  438.       end
  439.       @write_wait += @write_speed
  440.       return
  441.     end
  442.     if @input_number_window != nil
  443.       @input_number_window.update
  444.       # 決定
  445.       if Input.trigger?(Input::C)
  446.         $game_system.se_play($data_system.decision_se)
  447.         $game_variables[$game_temp.num_input_variable_id] =
  448.         @input_number_window.number
  449.         $game_map.need_refresh = true
  450.         @input_number_window.dispose
  451.         @input_number_window = nil
  452.         terminate_message
  453.       end
  454.       return
  455.     end
  456.     if @contents_showing
  457.       if $game_temp.choice_max == 0
  458.         self.pause = true
  459.       end
  460.       # 取消
  461.       if Input.trigger?(Input::B)
  462.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  463.           $game_system.se_play($data_system.cancel_se)
  464.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  465.           terminate_message
  466.         end
  467.       end
  468.       # 決定
  469.       if Input.trigger?(Input::C)
  470.         if $game_temp.choice_max > 0
  471.           $game_system.se_play($data_system.decision_se)
  472.           $game_temp.choice_proc.call(self.index)
  473.         end
  474.         if @mid_stop
  475.           @mid_stop = false
  476.           return
  477.         else
  478.           terminate_message
  479.         end
  480.       end
  481.       return
  482.     end
  483.     if @fade_out == false and $game_temp.message_text != nil
  484.       @contents_showing = true
  485.       $game_temp.message_window_showing = true
  486.       refresh
  487.       Graphics.frame_reset
  488.       self.visible = true
  489.       self.contents_opacity = 0
  490.     if @input_number_window != nil
  491.       @input_number_window.contents_opacity = 0
  492.     end
  493.       @fade_in = true
  494.       return
  495.     end
  496.     if self.visible
  497.       @fade_out = true
  498.       self.opacity -= 48
  499.       if self.opacity == 0
  500.         self.visible = false
  501.         @fade_out = false
  502.         $game_temp.message_window_showing = false
  503.       end
  504.       return
  505.     end
  506.   end
  507.   #--------------------------------------------------------------------------
  508.   # ● 获得字符
  509.   #--------------------------------------------------------------------------
  510.   def get_character(parameter)
  511.     case parameter
  512.     when 0
  513.       return $game_player
  514.     else
  515.       events = $game_map.events
  516.       return events == nil ? nil : events[parameter]
  517.     end
  518.   end
  519.   #--------------------------------------------------------------------------
  520.   # ● ウィンドウの位置と不透明度の設定
  521.   #--------------------------------------------------------------------------
  522.   def reset_window
  523.     # 判定
  524.     if @popchar >= 0
  525.       events = $game_map.events
  526.       if events != nil
  527.         character = get_character(@popchar)
  528.         x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  529.         y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  530.         self.x = x
  531.         self.y = y
  532.       end
  533.     elsif @popchar == -1
  534.       self.x = -4
  535.       self.y = -4
  536.       self.width = 648
  537.       self.height = 488
  538.     else
  539.       if $game_temp.in_battle
  540.         self.y = 16
  541.       else
  542.         case $game_system.message_position
  543.         when 0 # 上
  544.           self.y = 16
  545.         when 1 # 中
  546.           self.y = 160
  547.         when 2 # 下
  548.           self.y = 304
  549.         end
  550.         self.x = 80
  551.         if @face_file == nil
  552.           self.width = 480
  553.         else
  554.           self.width = 600
  555.           self.x -= 60
  556.         end
  557.         self.height = 160
  558.       end
  559.     end
  560.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  561.     if @face_file != nil
  562.       self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  563.     end
  564.     if @popchar == -1
  565.       self.opacity = 255
  566.       self.back_opacity = 0
  567.     elsif $game_system.message_frame == 0
  568.       self.opacity = 255
  569.       self.back_opacity = 200
  570.     else
  571.       self.opacity = 0
  572.       self.back_opacity = 200
  573.     end
  574.   end
  575.   #--------------------------------------------------------------------------
  576.   # ● line_height
  577.   #--------------------------------------------------------------------------
  578.   # 返回値:行高
  579.   #--------------------------------------------------------------------------
  580.   def line_height
  581.     return 32
  582.     if self.contents.font.size >= 20 and self.contents.font.size <= 24
  583.       return 32
  584.     else
  585.       return self.contents.font.size * 15 / 10
  586.     end
  587.   end
  588.   #--------------------------------------------------------------------------
  589.   # ● 透過文字描画
  590.   #--------------------------------------------------------------------------
  591.   # target :描画対象。Bitmapクラスを指定。
  592.   # x :x座標
  593.   # y :y座標
  594.   # str  :描画文字列
  595.   # opacity:透過率(0~255)
  596.   # 返回値 :文字幅(@x増加値)。
  597.   #--------------------------------------------------------------------------
  598.   def opacity_draw_text(target, x, y, str,opacity)
  599.     height = target.font.size
  600.     width = target.text_size(str).width
  601.     opacity = [[opacity, 0].max, 255].min
  602.     if opacity == 255
  603.       target.draw_text(x, y, width, height, str)
  604.       return width
  605.     else
  606.       if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  607.         @opacity_text_buf.dispose
  608.         @opacity_text_buf = Bitmap.new(width, height)
  609.       else
  610.         @opacity_text_buf.clear
  611.       end
  612.       @opacity_text_buf.font.size = target.font.size
  613.       @opacity_text_buf.draw_text(0, 0, width, height, str)
  614.       target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  615.     return width
  616.     end
  617.   end
  618.   def ruby_draw_text(target, x, y, str,opacity)
  619.     sizeback = target.font.size
  620.     target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  621.     rubysize = [rubysize, 6].max
  622.    
  623.     opacity = [[opacity, 0].max, 255].min
  624.     split_s = str.split(/,/)
  625.    
  626.     split_s[0] == nil ? split_s[0] = "" : nil
  627.     split_s[1] == nil ? split_s[1] = "" : nil
  628.    
  629.     height = sizeback + rubysize
  630.     width = target.text_size(split_s[0]).width
  631.    
  632.     target.font.size = rubysize
  633.     ruby_width = target.text_size(split_s[1]).width
  634.     target.font.size = sizeback
  635.    
  636.     buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  637.    
  638.     width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  639.    
  640.     if opacity == 255
  641.       target.font.size = rubysize
  642.       target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  643.       target.font.size = sizeback
  644.       target.draw_text(x, y, width, target.font.size, split_s[0])
  645.       return width
  646.     else
  647.       if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  648.         @opacity_text_buf.dispose
  649.         @opacity_text_buf = Bitmap.new(buf_width, height)
  650.       else
  651.         @opacity_text_buf.clear
  652.       end
  653.       @opacity_text_buf.font.size = rubysize
  654.       @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  655.       @opacity_text_buf.font.size = sizeback
  656.       @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  657.       if sub_x >= 0
  658.         target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  659.       else
  660.         target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  661.       end
  662.       return width
  663.     end
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # ● \V 变换
  667.   #--------------------------------------------------------------------------
  668.   def convart_value(option, index)
  669.     option == nil ? option = "" : nil
  670.     option.downcase!
  671.     case option
  672.       when "i"
  673.         unless $data_items[index].name == nil
  674.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  675.         end
  676.       when "w"
  677.         unless $data_weapons[index].name == nil
  678.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  679.         end
  680.       when "a"
  681.         unless $data_armors[index].name == nil
  682.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  683.         end
  684.       when "s"
  685.         unless $data_skills[index].name == nil
  686.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  687.         end
  688.       else
  689.       r = $game_variables[index]
  690.     end
  691.     r == nil ? r = "" : nil
  692.     return r
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● 解放
  696.   #--------------------------------------------------------------------------
  697.   def dispose
  698.     terminate_message
  699.     if @gaiji_cache != nil
  700.       unless @gaiji_cache.disposed?
  701.         @gaiji_cache.dispose
  702.       end
  703.     end
  704.     unless @opacity_text_buf.disposed?
  705.       @opacity_text_buf.dispose
  706.     end
  707.     $game_temp.message_window_showing = false
  708.     if @input_number_window != nil
  709.       @input_number_window.dispose
  710.     end
  711.     super
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ● 矩形更新
  715.   #--------------------------------------------------------------------------
  716.   def update_cursor_rect
  717.     if @index >= 0
  718.       n = $game_temp.choice_start + @index
  719.       self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  720.     else
  721.       self.cursor_rect.empty
  722.     end
  723.   end
  724. end
  725. #==============================================================================
  726. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  727. #==============================================================================
  728. class Window_Frame < Window_Base
  729.   #--------------------------------------------------------------------------
  730.   # ● オブジェクト初期化
  731.   #--------------------------------------------------------------------------
  732.   def initialize(x, y, width, height)
  733.     super(x, y, width, height)
  734.     self.contents = nil
  735.     self.back_opacity = 200
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # ● 解放
  739.   #--------------------------------------------------------------------------
  740.   def dispose
  741.     super
  742.     end
  743.   end
  744. #==============================================================================
  745. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  746. #==============================================================================
  747. class Air_Text < Window_Base
  748.   #--------------------------------------------------------------------------
  749.   # ● オブジェクト初期化
  750.   #--------------------------------------------------------------------------
  751.   def initialize(x, y, designate_text)
  752.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  753.     self.opacity = 0
  754.     self.back_opacity = 0
  755.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  756.     w = self.contents.width
  757.     h = self.contents.height
  758.     self.contents.draw_text(0, 0, w, h, designate_text)
  759.   end
  760.   #--------------------------------------------------------------------------
  761.   # ● 解放
  762.   #--------------------------------------------------------------------------
  763.   def dispose
  764.     self.contents.clear
  765.     super
  766.   end
  767. end
复制代码
----------------------------------------------------------------------------------------------------------

我只想要 格式:\name[名字] 這個窗口显視名字凸岀的效果那一段的脚本代馬.

那一段代馬是是显視名字凸岀的效果的的脚本.

[s:3]  [s:3]
真實的我沒有一個不『沖動』, 誰在阻擋我發言~『我憤怒』. 誰在發言辱罵我,請堅持『人的尊重』.
回复

使用道具 举报

845

主题

1万

帖子

214748万

积分

版主

脑残中……

Rank: 7Rank: 7Rank: 7

积分
2147483647

声命组金赏

发表于 2006-11-25 15:35:46 | 显示全部楼层
[s:5] 现把原来窗口去掉……自己去做一个图片来显示……
http://icv.cc声动音缘配音社
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2025-6-27 17:42 , Processed in 0.011038 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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