幻想森林

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

[已解决] 新手问题

[复制链接]

3

主题

5

帖子

72

积分

②入门

积分
72
发表于 2010-1-3 18:43:41 | 显示全部楼层 |阅读模式
改成已解决。。字数太多。。。。
回复

使用道具 举报

550

主题

9116

帖子

214748万

积分

超级版主

如同神一般的存在,腿神!拖后腿的神~~

Rank: 8Rank: 8

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

使用道具 举报

3

主题

5

帖子

72

积分

②入门

积分
72
 楼主| 发表于 2010-1-3 19:47:32 | 显示全部楼层
嗯,谢谢你了,我复制的脚本不全就用上了,呵呵.
回复 支持 反对

使用道具 举报

550

主题

9116

帖子

214748万

积分

超级版主

如同神一般的存在,腿神!拖后腿的神~~

Rank: 8Rank: 8

积分
2147483647
发表于 2010-1-3 19:55:24 | 显示全部楼层
不客气,举手之劳而已。
我就是你们的神,庶民们,追随我吧!跟着我一起拖后腿!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-15 00:07 , Processed in 0.020780 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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