幻想森林

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

[求助]谁可以帮我整合这两个脚本...

[复制链接]

90

主题

785

帖子

1278万

积分

版主

Rank: 7Rank: 7Rank: 7

积分
12786515
QQ
发表于 2006-10-4 17:55:32 | 显示全部楼层 |阅读模式
因为NewWindowMessage 与 允许多选择项 发生了冲突.......

(经作者允许传了上来)

脚本如下...(允许多选择项脚本)
  1. class Game_Temp
  2.   attr_accessor :need_show_more
  3.   attr_accessor :window_pos_y
  4.   attr_accessor :choices
  5.   
  6.   alias old_ini initialize
  7.   def initialize
  8.     old_ini
  9.     @need_show_more = false
  10.     @window_pos_y = 16
  11.     @choices = nil
  12.   end
  13. end
  14. class Window_Message < Window_Selectable
  15.   alias old_ref refresh
  16.   def refresh
  17.     if $game_temp.need_show_more
  18.       self.y = $game_temp.window_pos_y
  19.       self.height = 160 + 32 * ($game_temp.choice_max - 4)
  20.       self.contents = Bitmap.new(self.width - 32, self.height - 32)
  21.     else
  22.       self.height = 160
  23.       self.contents = Bitmap.new(self.width - 32, self.height - 32)
  24.     end
  25.     old_ref
  26.   end
  27.   #--------------------------------------------------------------------------
  28.   # ● 刷新画面
  29.   #--------------------------------------------------------------------------
  30.   def update
  31.     super
  32.     # 渐变的情况下
  33.     if @fade_in
  34.       self.contents_opacity += 24
  35.       if @input_number_window != nil
  36.         @input_number_window.contents_opacity += 24
  37.       end
  38.       if self.contents_opacity == 255
  39.         @fade_in = false
  40.       end
  41.       return
  42.     end
  43.     # 输入数值的情况下
  44.     if @input_number_window != nil
  45.       @input_number_window.update
  46.       # 确定
  47.       if Input.trigger?(Input::C)
  48.         $game_system.se_play($data_system.decision_se)
  49.         $game_variables[$game_temp.num_input_variable_id] =
  50.           @input_number_window.number
  51.         $game_map.need_refresh = true
  52.         # 释放输入数值窗口
  53.         @input_number_window.dispose
  54.         @input_number_window = nil
  55.         terminate_message
  56.       end
  57.       return
  58.     end
  59.     # 显示信息中的情况下
  60.     if @contents_showing
  61.       # 如果不是在显示选择项中就显示暂停标志
  62.       if $game_temp.choice_max == 0
  63.         self.pause = true
  64.       end
  65.       # 取消
  66.       if Input.trigger?(Input::B)
  67.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  68.           $game_system.se_play($data_system.cancel_se)
  69.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  70.           $game_variables[100] = $game_temp.choice_cancel_type - 1
  71.           $game_temp.need_show_more = false
  72.           terminate_message
  73.         end
  74.       end
  75.       # 确定
  76.       if Input.trigger?(Input::C)
  77.         if $game_temp.choice_max > 0
  78.           $game_system.se_play($data_system.decision_se)
  79.           $game_variables[100] = self.index
  80.           $game_temp.choice_proc.call(self.index)
  81.         end
  82.         $game_temp.need_show_more = false
  83.         terminate_message
  84.       end
  85.       return
  86.     end
  87.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  88.     if @fade_out == false and $game_temp.message_text != nil
  89.       @contents_showing = true
  90.       $game_temp.message_window_showing = true
  91.       reset_window
  92.       refresh
  93.       Graphics.frame_reset
  94.       self.visible = true
  95.       self.contents_opacity = 0
  96.       if @input_number_window != nil
  97.         @input_number_window.contents_opacity = 0
  98.       end
  99.       @fade_in = true
  100.       return
  101.     end
  102.     # 没有可以显示的信息、但是窗口为可见的情况下
  103.     if self.visible
  104.       @fade_out = true
  105.       self.opacity -= 48
  106.       if self.opacity == 0
  107.         self.visible = false
  108.         @fade_out = false
  109.         $game_temp.message_window_showing = false
  110.       end
  111.       return
  112.     end
  113.   end
  114. end
  115. class Interpreter
  116.   def command_102
  117.     # 文章已经设置过 message_text 的情况下
  118.     if $game_temp.message_text != nil
  119.       # 结束
  120.       return false
  121.     end
  122.     # 设置信息结束后待机和返回调用标志
  123.     @message_waiting = true
  124.     $game_temp.message_proc = Proc.new { @message_waiting = false }
  125.     # 设置选择项
  126.     $game_temp.message_text = ""
  127.     $game_temp.choice_start = 0
  128.     if $game_temp.need_show_more
  129.       @parameters = [$game_temp.choices, $game_temp.choice_cancel_type]
  130.     end
  131.     setup_choices(@parameters)
  132.     # 继续
  133.     return true
  134.   end
  135. end
复制代码









接着是NewMessage.

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


顺便附上一句!~
     如果看不清楚可以点下面的附件~~~~~~~~

再说一次哦~
NewWindowMessage 發生 NomentedError.....(后悔没学英语)
與MoreChoice腳本 衝突.....

請求Bunny神派遣500万人馬幫我整合腳本。。。。。

ps:絕對需要.....

本帖子中包含更多资源

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

x
回复

使用道具 举报

91

主题

3188

帖子

83986万

积分

荣誉群

传说中的Bunny大神~!

积分
839861514
QQ
发表于 2006-10-4 18:02:08 | 显示全部楼层
今天手头上没有RM,明天帮你。。。
其他所有的Bunny神都素我的部下XD~ 小教程范例收集 Orz感谢邪恶萝卜联盟!!!(原因自己去猜)
回复 支持 反对

使用道具 举报

90

主题

785

帖子

1278万

积分

版主

Rank: 7Rank: 7Rank: 7

积分
12786515
QQ
 楼主| 发表于 2006-10-4 22:02:02 | 显示全部楼层
多谢传说中的Bunny风神........ [s:5]


....ps:成功召唤了.... [s:5]
回复 支持 反对

使用道具 举报

90

主题

785

帖子

1278万

积分

版主

Rank: 7Rank: 7Rank: 7

积分
12786515
QQ
 楼主| 发表于 2006-10-5 16:21:21 | 显示全部楼层
瓜哥快点拉。。。我等不及了啊。。。。

      [s:5]  [s:5]

ps:我做的游戏都快软软硬硬稀稀熔熔烂烂了 [s:8] 怎么冲突这么多啊。。。
回复 支持 反对

使用道具 举报

91

主题

3188

帖子

83986万

积分

荣誉群

传说中的Bunny大神~!

积分
839861514
QQ
发表于 2006-10-5 20:32:05 | 显示全部楼层
引用第3楼form-ei2006-10-05 16:21发表的“”:
瓜哥快点拉。。。我等不及了啊。。。。

      [s:5]  [s:5]

ps:我做的游戏都快软软硬硬稀稀熔熔烂烂了 [s:8] 怎么冲突这么多啊。。。

就快了,我很快就可以拿到RM了。。。游戏里不应该加入太多插入式脚本啊。。。
其他所有的Bunny神都素我的部下XD~ 小教程范例收集 Orz感谢邪恶萝卜联盟!!!(原因自己去猜)
回复 支持 反对

使用道具 举报

91

主题

3188

帖子

83986万

积分

荣誉群

传说中的Bunny大神~!

积分
839861514
QQ
发表于 2006-10-5 21:54:42 | 显示全部楼层
据调查发现。。。这个NewMessage脚本本身就有问题。。。即使不加入那个MoreChoice脚本,仍然会出错。出错原因:那个出错的语句为$game_system.soundname_on_speak,为什么出错?因为game_system里根本就没有那个soundname_on_speak。。。你这个脚本可能不完全哦。
其他所有的Bunny神都素我的部下XD~ 小教程范例收集 Orz感谢邪恶萝卜联盟!!!(原因自己去猜)
回复 支持 反对

使用道具 举报

90

主题

785

帖子

1278万

积分

版主

Rank: 7Rank: 7Rank: 7

积分
12786515
QQ
 楼主| 发表于 2006-10-6 09:39:01 | 显示全部楼层
不怕。。。。我在Game_System里已经定义了

即使整合后也不会出现问题

或者把Speak的那个删了也不会影响到什么的 [s:5]
回复 支持 反对

使用道具 举报

90

主题

785

帖子

1278万

积分

版主

Rank: 7Rank: 7Rank: 7

积分
12786515
QQ
 楼主| 发表于 2006-10-6 20:22:44 | 显示全部楼层
再补上一个
。。。在Game_system里写
attr:soundname_on_speak


在定义中。。。。
soundname_on_speak = nil  [s:5]
回复 支持 反对

使用道具 举报

91

主题

3188

帖子

83986万

积分

荣誉群

传说中的Bunny大神~!

积分
839861514
QQ
发表于 2006-10-6 22:16:42 | 显示全部楼层
先把你的潜水搞定再来帮你改。 [s:4]
其他所有的Bunny神都素我的部下XD~ 小教程范例收集 Orz感谢邪恶萝卜联盟!!!(原因自己去猜)
回复 支持 反对

使用道具 举报

90

主题

785

帖子

1278万

积分

版主

Rank: 7Rank: 7Rank: 7

积分
12786515
QQ
 楼主| 发表于 2006-10-9 16:45:54 | 显示全部楼层
[s:5] 其实潜水是我朋友要的。。。经过修改。。。 [s:5] (范例都传上了)

      上面的脚本只是做“死亡禁断之巅(ARPG模式)”的华丽修饰而已。。。。。 [s:5]

           再根据上次的自定义菜单(仿制塞尔达传说)进行系统制作而已。。。 [s:5]

ps:以上“灌水”可以54````` [s:6]
不过潜水在公元200年的海底王国好象需要吧。。。。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-28 22:00 , Processed in 0.013996 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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