Project1

标题: 使用对话框加强,要修改对话框的长宽应该去哪里改 [打印本页]

作者: 无忧谷主幻    时间: 2014-12-8 11:19
标题: 使用对话框加强,要修改对话框的长宽应该去哪里改
正常来说应该改新脚本吧(难道不是第95行吗?),但是根本没用。为了预防万一Window_Message的第12行我也试着改了一下,还是没有效果。明明坐标和优先级都可以改的

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

作者: 573932914    时间: 2014-12-8 20:28
95行?这是窗口位置的样子
作者: SailCat    时间: 2014-12-8 21:15
这个版本也太旧了,建议用我的新版本。
https://rpg.blue/thread-249914-1-1.html
作者: 丿伴吾老灬    时间: 2014-12-9 20:48
在646行end后 换行加入     
self.width = 宽度
self.height = 高度

作者: 无忧谷主幻    时间: 2014-12-10 13:16
SailCat 发表于 2014-12-8 21:15
这个版本也太旧了,建议用我的新版本。
https://rpg.blue/thread-249914-1-1.html

能否请问一下,你的脚本中,如何改对话框的X坐标与Y坐标




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1