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

Project1

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

怎么在用这个脚本情况下更改对话框坐标?

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
245
在线时间
33 小时
注册时间
2008-2-13
帖子
348
跳转到指定楼层
1
发表于 2008-8-21 00:01:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
怎么在用这个脚本情况下更改对话框坐标?





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


  4. #——说明

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  456.         @autoclosetime = $1.to_i

  457.         next

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



  819. #==============================================================================
  820. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  821. #==============================================================================




复制代码

版务信息:本贴由楼主自主结贴~

Lv1.梦旅人

殲滅天使·玲

梦石
0
星屑
121
在线时间
204 小时
注册时间
2008-2-20
帖子
2292

贵宾

2
发表于 2008-8-21 00:02:19 | 只看该作者
# \p[1]:对话框出现在1号事件的上方
# \p[0]:主人公上方出现对话框
#——————————————————使用\p功能后可以自动调整对话框大小

发帖前请看版规。进水区请到版规贴留名哦亲~chu~❤
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
245
在线时间
33 小时
注册时间
2008-2-13
帖子
348
3
 楼主| 发表于 2008-8-21 00:16:29 | 只看该作者
不是这个意思,我需要的是把对话框放在游戏框的右下角,固定在那,又能用上\name[李逍遥]这个功能,对话框左边我用来显示人物图片的啦
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
245
在线时间
33 小时
注册时间
2008-2-13
帖子
348
4
 楼主| 发表于 2008-8-21 00:32:48 | 只看该作者
帮帮忙
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
245
在线时间
33 小时
注册时间
2008-2-13
帖子
348
5
 楼主| 发表于 2008-8-21 01:30:50 | 只看该作者
为什么这么就都没人帮我?????
回复 支持 反对

使用道具 举报

Lv1.梦旅人

随缘

梦石
0
星屑
55
在线时间
12 小时
注册时间
2007-12-16
帖子
671
6
发表于 2008-8-21 02:40:07 | 只看该作者



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


  4. #——说明

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  456.         @autoclosetime = $1.to_i

  457.         next

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



  819. #==============================================================================
  820. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  821. #==============================================================================




复制代码


是这样吗
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
论坛:
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
245
在线时间
33 小时
注册时间
2008-2-13
帖子
348
7
 楼主| 发表于 2008-8-21 06:47:05 | 只看该作者
是这样的?你在哪里做改动了?教我吧
回复 支持 反对

使用道具 举报

Lv1.梦旅人

随缘

梦石
0
星屑
55
在线时间
12 小时
注册时间
2007-12-16
帖子
671
8
发表于 2008-8-21 16:13:43 | 只看该作者
以下引用805323854于2008-8-20 22:47:05的发言:

是这样的?你在哪里做改动了?教我吧

就改了坐标!!
else
      case $game_system.message_position
      when 0 # 上
        self.y = 16
      when 1 # 中
        self.y = 160
      when 2 # 下
        self.y = 308
      end
      self.x = 150
这里的数字....自己也试试
论坛:
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-25 23:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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