Project1

标题: 请教下关于用对话框增强时出现的一个问题 [打印本页]

作者: mapmap89    时间: 2013-9-13 06:16
标题: 请教下关于用对话框增强时出现的一个问题
本帖最后由 mapmap89 于 2013-9-13 06:18 编辑

在论坛里找到很多华丽的对话框脚本也参考了教程,不过最后还是选了一种比较低调的脚本
但是在用时候,在对话选项那里有办法让选中条跟文字对齐么?
刚接触脚本不太懂~~求指导!


下面是我用的脚本

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

作者: mapmap89    时间: 2013-9-13 17:52
看来这边人不多阿。。。
我改了改图片高度算是遮住将就用了。。
图片高135
@left_picture.y = 470-@left_picture.bitmap.height
@left_picture.x = 25
新手只能用这种笨方法了。。

作者: 紫英晓狼1130    时间: 2013-9-13 18:10
人不算少了…修改选项矩形的大小就可以了
作者: mapmap89    时间: 2013-9-13 19:00
紫英晓狼1130 发表于 2013-9-13 18:10
人不算少了…修改选项矩形的大小就可以了

谢谢回复~~^ ^
那个选项矩形大小在哪里找呢?




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