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

Project1

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

[已经过期] 另外加入脚本後对话框的大小不能修改

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
8 小时
注册时间
2012-7-22
帖子
6
跳转到指定楼层
1
发表于 2013-3-23 06:32:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 hcm 于 2013-4-8 12:21 编辑

之前我曾经再WINDOWS_MESSANG的脚本里改过对话框的大小
後来我插入了这个脚本(请见下方)後我的对话框大小就变回原本预设的样子了
研究了一下也不知道该从那里改,想请论坛上的各位帮忙提点一下XDD 感谢!!
  1. # ▼▲▼ XRXS 9. メッセージ表示フルグレードアップ ver..11 ▼▲▼
  2. # by 桜雅 在土, 和希, RaTTiE
  3. #==============================================================================
  4. # ■ Window_Message
  5. #==============================================================================
  6. class Window_Message < Window_Selectable
  7.   # 一文字ずつ描写
  8.   DEFAULT_TYPING_ENABLE = true                # falseにすると瞬間表示
  9.   #--------------------------------------------------------------------------
  10.   # ● オブジェクト初期化
  11.   #--------------------------------------------------------------------------
  12.   alias xrxs9_initialize initialize
  13.   def initialize
  14.     xrxs9_initialize
  15.     # 再生サウンド名がない場合は""とする
  16.     if $soundname_on_speak == nil then
  17.       $soundname_on_speak = ""
  18.     end
  19.     # 外字ファイルパス設定
  20.     $gaiji_file = "./Graphics/Gaiji/sample.png"
  21.     # 外字データ読み込み
  22.     if FileTest.exist?($gaiji_file)
  23.       @gaiji_cache = Bitmap.new($gaiji_file)
  24.     else
  25.       @gaigi_cache = nil
  26.     end
  27.     # 文字透過転送用バッファ
  28.     @opacity_text_buf = Bitmap.new(32, 32)
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● メッセージ終了処理
  32.   #--------------------------------------------------------------------------
  33.   alias xrxs9_terminate_message terminate_message
  34.   def terminate_message
  35.     if @name_window_frame != nil
  36.       @name_window_frame.dispose
  37.       @name_window_frame = nil
  38.     end
  39.     if @name_window_text  != nil
  40.       @name_window_text.dispose
  41.       @name_window_text  = nil
  42.     end
  43.     xrxs9_terminate_message
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● リフレッシュ
  47.   #--------------------------------------------------------------------------
  48.   def refresh
  49.     # 初期化
  50.     self.contents.clear
  51.     self.contents.font.color = normal_color
  52.     self.contents.font.size  = Font.default_size
  53.     @x = @y = @max_x = @max_y = @indent = @lines = 0
  54.     @face_indent = 0
  55.     [url=home.php?mod=space&uid=316553]@opacity[/url] = 255
  56.     @cursor_width = 0
  57.     @write_speed = 0
  58.     @write_wait = 0
  59.     @mid_stop = false
  60.     @face_file = nil
  61.     # @popchar が -2 の場合、標準位置。-1の場合、文字センター。
  62.     # 0以上の場合 キャラポップ。0は主人公、1以降はイベント。
  63.     @popchar = -2
  64.     # 選択肢なら字下げを行う
  65.     if $game_temp.choice_start == 0
  66.       @x = 8
  67.     end
  68.     # 表示待ちのメッセージがある場合
  69.     if $game_temp.message_text != nil
  70.       @now_text = $game_temp.message_text
  71.       # 顔表示指定\Fがあるか?
  72.       if (/\A\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
  73.         # ファイルチェック
  74.         if FileTest.exist?("Graphics/Pictures/" + $1 + ".png")
  75.           # 顔グラを描画
  76.           @face_file = $1 + ".png"
  77.           self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  78.           # 全行 128ピクセルのインデントを入れる。
  79.           @x = @face_indent = 128
  80.         end
  81.         @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
  82.       end
  83.       # \nameがあるか?
  84.       name_window_set = false
  85.       if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
  86.         # 値を設定
  87.         name_window_set = true
  88.         name_text = $1
  89.         # \name[]部分を削除
  90.         @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  91.       end
  92.       # ウィンドウ位置判定
  93.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  94.         @popchar = $1.to_i
  95.         if @popchar == -1
  96.           @x = @indent = 48
  97.           @y = 4
  98.         end
  99.         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  100.       end
  101.       # 制御文字処理
  102.       begin
  103.       last_text = @now_text.clone
  104.       # \Vを独自ルーチンに変更(追加部分)
  105.       @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  106.       end until @now_text == last_text
  107.       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  108.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  109.       end
  110.       # 便宜上、"\\\\" を "\000" に変換
  111.       @now_text.gsub!(/\\\\/) { "\000" }
  112.       # "\\C" を "\001" に、"\\G" を "\002" に、
  113.       # "\\S" を "\003" に、"\\A" を "\004" に変換
  114.       @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  115.       @now_text.gsub!(/\\[Gg]/) { "\002" }
  116.       @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  117.       @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  118.       @now_text.gsub!(/\\[.]/) { "\005" }
  119.       @now_text.gsub!(/\\[|]/) { "\006" }
  120.       # 競合すると何かと気まずいので、\016以降を使用する
  121.       @now_text.gsub!(/\\[>]/) { "\016" }
  122.       @now_text.gsub!(/\\[<]/) { "\017" }
  123.       @now_text.gsub!(/\\[!]/) { "\020" }
  124.       @now_text.gsub!(/\\[~]/) { "\021" }
  125.       @now_text.gsub!(/\\[Ee]\[([0-9]+)\]/) { "\022[#{$1}]" }
  126.       # インデント設定(追加部分)
  127.       @now_text.gsub!(/\\[Ii]/) { "\023" }
  128.       # テキスト透過率指定(追加部分)
  129.       @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  130.       # テキストサイズ指定(追加部分)
  131.       @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  132.       # 空白挿入(追加部分)
  133.       @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  134.       # ルビ表示(追加部分)
  135.       @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "\027[#{$1}]" }
  136.       if @popchar >= 0
  137.         @text_save = @now_text.clone
  138.         @max_x = 0
  139.         @max_y = 4
  140.         for i in 0..3
  141.           line = @now_text.split(/\n/)[3-i]
  142.           @max_y -= 1 if line == nil and @max_y <= 4-i
  143.           next if line == nil
  144.           cx = contents.text_size(line).width
  145.           @max_x = cx if cx > @max_x
  146.         end
  147.         self.width = @max_x + 48 + @face_indent
  148.         self.height = (@max_y - 1) * 32 + 64
  149.       else
  150.         @max_x = self.width - 32 - @face_indent
  151.       end
  152.       # ここで一旦ウィンドウ位置更新
  153.       reset_window
  154.       # \nameがあるか?
  155.       if name_window_set
  156.         # オフセット位置
  157.         off_x =  0
  158.         off_y =  0
  159.         # 枠だけウィンドウの作成(余白を 2 に設定)
  160.         space = 2
  161.         x = self.x + off_x - space / 2
  162.         y = self.y + off_y - space / 2
  163.         w = self.contents.text_size(name_text).width + 8 + space
  164.         h = 26 + space
  165.         @name_window_frame = Window_Frame.new(x, y, w, h)
  166.         @name_window_frame.z = self.z + 1
  167.         # 擬似的な空中文字描写ウィンドウを作成
  168.         x = self.x + off_x + 4
  169.         y = self.y + off_y
  170.         @name_window_text  = Air_Text.new(x, y, name_text)
  171.         @name_window_text.z = self.z + 2
  172.       end
  173.     end
  174.     # ウィンドウを更新
  175.     reset_window
  176.     # 選択肢の場合
  177.     if $game_temp.choice_max > 0
  178.       @item_max = $game_temp.choice_max
  179.       self.active = true
  180.       self.index = 0
  181.     end
  182.     # 数値入力の場合
  183.     if $game_temp.num_input_variable_id > 0
  184.       digits_max = $game_temp.num_input_digits_max
  185.       number = $game_variables[$game_temp.num_input_variable_id]
  186.       @input_number_window = Window_InputNumber.new(digits_max)
  187.       @input_number_window.number = number
  188.       @input_number_window.x = self.x + 8
  189.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  190.     end
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ● フレーム更新
  194.   #--------------------------------------------------------------------------
  195.   def update
  196.     super
  197.     # フェードインの場合
  198.     if @fade_in
  199.       self.contents_opacity += 24
  200.       if @input_number_window != nil
  201.         @input_number_window.contents_opacity += 24
  202.       end
  203.       if self.contents_opacity == 255
  204.         @fade_in = false
  205.       end
  206.       return
  207.     end
  208.     @now_text = nil if @now_text == "" # 変換
  209.     # 表示待ちのメッセージがある場合
  210.     if @now_text != nil and @mid_stop == false
  211.       if @write_wait > 0
  212.         @write_wait -= 1
  213.         return
  214.       end
  215.       text_not_skip = DEFAULT_TYPING_ENABLE
  216.       while true
  217.         # 最大 x y の保存。
  218.         @max_x = @x if @max_x < @x
  219.         @max_y = @y if @max_y < @y
  220.         # c に 1 文字を取得 (文字が取得できなくなるまでループ)
  221.         if (c = @now_text.slice!(/./m)) != nil
  222.           # \\ の場合
  223.           if c == "\000"
  224.             # 本来の文字に戻す
  225.             c = "\\"
  226.           end
  227.           # \C[n] の場合
  228.           if c == "\001"
  229.             # 文字色を変更
  230.             @now_text.sub!(/\[([0-9]+)\]/, "")
  231.             color = $1.to_i
  232.             if color >= 0 and color <= 7
  233.               self.contents.font.color = text_color(color)
  234.             end
  235.             # 次の文字へ
  236.             c = ""
  237.           end
  238.           # \G の場合
  239.           if c == "\002"
  240.             # ゴールドウィンドウを作成
  241.             if @gold_window == nil and @popchar <= 0
  242.               @gold_window = Window_Gold.new
  243.               @gold_window.x = 560 - @gold_window.width
  244.               if $game_temp.in_battle
  245.                 @gold_window.y = 192
  246.               else
  247.                 @gold_window.y = self.y >= 128 ? 32 : 384
  248.               end
  249.               @gold_window.opacity = self.opacity
  250.               @gold_window.back_opacity = self.back_opacity
  251.             end
  252.             # 次の文字へ
  253.             c = ""
  254.           end
  255.           # \S[n] の場合
  256.           if c == "\003"
  257.             # 文字色を変更
  258.             @now_text.sub!(/\[([0-9]+)\]/, "")
  259.             speed = $1.to_i
  260.             if speed >= 0 and speed <= 19
  261.               @write_speed = speed
  262.             end
  263.             # 次の文字へ
  264.             c = ""
  265.           end
  266.           # \A[soundname] の場合
  267.           if c == "\004"
  268.             # 再生ファイルを変更するための準備
  269.             @now_text.sub!(/\[(.*?)\]/, "")
  270.             buftxt = $1.dup.to_s
  271.             # 再生ファイル名に"/"があるか?
  272.             if buftxt.match(/\//) == nil and buftxt != "" then
  273.               # なければ"Audio/SE/"を結合する
  274.               $soundname_on_speak = "Audio/SE/" + buftxt
  275.             else
  276.               # あればそのままコピー
  277.               $soundname_on_speak = buftxt.dup
  278.             end
  279.             # 次の文字へ
  280.             c = ""
  281.           elsif c == "\004"
  282.             # 次の文字へ
  283.             c = ""
  284.           end
  285.           # \. の場合
  286.           if c == "\005"
  287.             @write_wait += 5
  288.             c = ""
  289.           end
  290.           # \| の場合
  291.           if c == "\006"
  292.             @write_wait += 20
  293.             c = ""
  294.           end
  295.           # \> の場合
  296.           if c == "\016"
  297.             text_not_skip = false
  298.             c = ""
  299.           end
  300.           # \<の場合
  301.           if c == "\017"
  302.             text_not_skip = true
  303.             c = ""
  304.           end
  305.           # \!の場合
  306.           if c == "\020"
  307.             @mid_stop = true
  308.             c = ""
  309.           end
  310.           # \~の場合
  311.           if c == "\021"
  312.             terminate_message
  313.             return
  314.           end
  315.           # \Iの場合(追加部分)
  316.           if c == "\023"
  317.             # 今の@xをインデント位置に設定
  318.             @indent = @x
  319.             c = ""
  320.           end
  321.           # \Oの場合(追加部分)
  322.           if c == "\024"
  323.             @now_text.sub!(/\[([0-9]+)\]/, "")
  324.             @opacity = $1.to_i
  325.             c = ""
  326.           end
  327.           # \Hの場合(追加部分)
  328.           if c == "\025"
  329.             @now_text.sub!(/\[([0-9]+)\]/, "")
  330.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  331.             c = ""
  332.           end
  333.           # \Bの場合(追加部分)
  334.           if c == "\026"
  335.             @now_text.sub!(/\[([0-9]+)\]/, "")
  336.             @x += $1.to_i
  337.             c = ""
  338.           end
  339.           # \Rの場合(追加部分)
  340.           if c == "\027"
  341.             @now_text.sub!(/\[(.*?)\]/, "")
  342.             # 文字を描画
  343.             @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  344.             # 文字描写のSEを演奏
  345.             if $soundname_on_speak != ""
  346.               Audio.se_play($soundname_on_speak)
  347.             end
  348.             c = ""
  349.           end
  350.           # アイコン描画用シーケンスの場合(追加部分)
  351.           if c == "\030"
  352.             # アイコンファイル名を取得
  353.             @now_text.sub!(/\[(.*?)\]/, "")
  354.             # アイコンを描画
  355.             self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  356.             # 文字描写のSEを演奏
  357.             if $soundname_on_speak != ""
  358.               Audio.se_play($soundname_on_speak)
  359.             end
  360.             @x += 24
  361.             # 次の文字へ
  362.             c = ""
  363.           end
  364.           # 改行文字の場合
  365.           if c == "\n"
  366.             # 選択肢ならカーソルの幅を更新
  367.             if @lines >= $game_temp.choice_start
  368.               @cursor_width = [@cursor_width, @max_x - @face_indent].max
  369.             end
  370.             # y に 1 を加算
  371.             @lines += 1
  372.             @y += 1
  373.             @x = 0 + @indent + @face_indent
  374.             # 選択肢なら字下げを行う
  375.             if @lines >= $game_temp.choice_start
  376.               @x = 8 + @indent + @face_indent
  377.             end
  378.             # 次の文字へ
  379.             c = ""
  380.           end
  381.           # 外字表示の場合
  382.           if c == "\022"
  383.             # []部分の除去
  384.             @now_text.sub!(/\[([0-9]+)\]/, "")
  385.             # 外字を表示
  386.             @x += gaiji_draw(4 + @x, @y * line_height + (line_height - self.contents.font.size), $1.to_i)
  387.             # 次の文字へ
  388.             c = ""
  389.           end
  390.           if c != ""
  391.             # 文字を描画
  392.             @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  393.             # 文字描写のSEを演奏
  394.             if $soundname_on_speak != "" then
  395.               Audio.se_play($soundname_on_speak)
  396.             end
  397.           end
  398.           # Bボタンが押された場合
  399.           if Input.press?(Input::B)
  400.             text_not_skip = false
  401.           end
  402.         else
  403.           text_not_skip = true
  404.           break
  405.         end
  406.         # 終了判定
  407.         if text_not_skip
  408.           break
  409.         end
  410.       end
  411.       @write_wait += @write_speed
  412.       return
  413.     end
  414.     # 数値入力中の場合
  415.     if @input_number_window != nil
  416.       @input_number_window.update
  417.       # 決定
  418.       if Input.trigger?(Input::C)
  419.         $game_system.se_play($data_system.decision_se)
  420.         $game_variables[$game_temp.num_input_variable_id] =
  421.           @input_number_window.number
  422.         $game_map.need_refresh = true
  423.         # 数値入力ウィンドウを解放
  424.         @input_number_window.dispose
  425.         @input_number_window = nil
  426.         terminate_message
  427.       end
  428.       return
  429.     end
  430.     # メッセージ表示中の場合
  431.     if @contents_showing
  432.       # 選択肢の表示中でなければポーズサインを表示
  433.       if $game_temp.choice_max == 0
  434.         self.pause = true
  435.       end
  436.       # キャンセル
  437.       if Input.trigger?(Input::B)
  438.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  439.           $game_system.se_play($data_system.cancel_se)
  440.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  441.           terminate_message
  442.         end
  443.       end
  444.       # 決定
  445.       if Input.trigger?(Input::C)
  446.         if $game_temp.choice_max > 0
  447.           $game_system.se_play($data_system.decision_se)
  448.           $game_temp.choice_proc.call(self.index)
  449.         end
  450.         if @mid_stop
  451.           @mid_stop = false
  452.           return
  453.         else
  454.           terminate_message
  455.         end
  456.       end
  457.       return
  458.     end
  459.     # フェードアウト中以外で表示待ちのメッセージか選択肢がある場合
  460.     if @fade_out == false and $game_temp.message_text != nil
  461.       @contents_showing = true
  462.       $game_temp.message_window_showing = true
  463.       refresh
  464.       Graphics.frame_reset
  465.       self.visible = true
  466.       self.contents_opacity = 0
  467.       if @input_number_window != nil
  468.         @input_number_window.contents_opacity = 0
  469.       end
  470.       @fade_in = true
  471.       return
  472.     end
  473.     # 表示すべきメッセージがないが、ウィンドウが可視状態の場合
  474.     if self.visible
  475.       @fade_out = true
  476.       self.opacity -= 48
  477.       if self.opacity == 0
  478.         self.visible = false
  479.         @fade_out = false
  480.         $game_temp.message_window_showing = false
  481.       end
  482.       return
  483.     end
  484.   end
  485.   #--------------------------------------------------------------------------
  486.   # ● キャラクターの取得
  487.   #     parameter : パラメータ
  488.   #--------------------------------------------------------------------------
  489.   def get_character(parameter)
  490.     # パラメータで分岐
  491.     case parameter
  492.     when 0  # プレイヤー
  493.       return $game_player
  494.     else  # 特定のイベント
  495.       events = $game_map.events
  496.       return events == nil ? nil : events[parameter]
  497.     end
  498.   end
  499.   #--------------------------------------------------------------------------
  500.   # ● ウィンドウの位置と不透明度の設定
  501.   #--------------------------------------------------------------------------
  502.   def reset_window
  503.     # 判定
  504.     if @popchar >= 0
  505.       events = $game_map.events
  506.       if events != nil
  507.         character = get_character(@popchar)
  508.         x = [[character.screen_x -  0 - self.width / 2, 4].max, 636 - self.width].min
  509.         y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  510.         self.x = x
  511.         self.y = y
  512.       end
  513.     elsif @popchar == -1
  514.       self.x = -4
  515.       self.y = -4
  516.       self.width = 648
  517.       self.height = 488
  518.     else
  519.       if $game_temp.in_battle
  520.         self.y = 16
  521.       else
  522.         case $game_system.message_position
  523.         when 0  # 上
  524.           self.y = 16
  525.         when 1  # 中
  526.           self.y = 160
  527.         when 2  # 下
  528.           self.y = 304
  529.         end
  530.         self.x = 80
  531.         if @face_file == nil
  532.           self.width = 480
  533.         else
  534.           self.width = 600
  535.           self.x -= 60
  536.         end
  537.         self.height = 160
  538.       end
  539.     end
  540.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  541.     if @face_file != nil
  542.       self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  543.     end
  544.     if @popchar == -1
  545.       self.opacity = 255
  546.       self.back_opacity = 0
  547.     elsif $game_system.message_frame == 0
  548.       self.opacity = 255
  549.       self.back_opacity = 160
  550.     else
  551.       self.opacity = 0
  552.       self.back_opacity = 160
  553.     end
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ● 外字描画
  557.   #--------------------------------------------------------------------------
  558.   # x   :x座標
  559.   # y   :y座標
  560.   # num  :外字番号
  561.   # 返り値:外字幅(@x増加値)
  562.   #--------------------------------------------------------------------------
  563.   def gaiji_draw(x, y, num)
  564.     # 外字データが存在しない場合は何もしない
  565.     if @gaiji_cache == nil
  566.       return 0
  567.     else
  568.       # 指定した外字がキャッシュ範囲を超えている場合は何もしない
  569.       if @gaiji_cache.width < num * 24
  570.         return 0
  571.       end
  572.       # 文字サイズを計算
  573.       if self.contents.font.size >= 20 and self.contents.font.size <= 24
  574.         size = 24
  575.       else
  576.         size = self.contents.font.size * 100 * 24 / 2200
  577.       end
  578.       # 外字データをstretch_bltで転送
  579.       self.contents.stretch_blt(Rect.new(x, y, size, size), @gaiji_cache, Rect.new(num * 24, 0, 24, 24))
  580.       # 文字描写のSEを演奏
  581.       if $soundname_on_speak != "" then
  582.         Audio.se_play($soundname_on_speak)
  583.       end
  584.       # 文字サイズを返す
  585.       return size
  586.     end
  587.   end
  588.   #--------------------------------------------------------------------------
  589.   # ● line_height
  590.   #--------------------------------------------------------------------------
  591.   # 返り値:行の高さ(@y増加値)を返します。
  592.   #--------------------------------------------------------------------------
  593.   def line_height
  594.     # 現状、選択肢等に対応ができない為、自動的に32を返します。
  595.     return 32
  596.     # 文字サイズを計算
  597.     if self.contents.font.size >= 20 and self.contents.font.size <= 24
  598.       return 32
  599.     else
  600.       return self.contents.font.size * 15 / 10
  601.     end
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # ● 透過文字描画
  605.   #--------------------------------------------------------------------------
  606.   # target :描画対象。Bitmapクラスを指定。
  607.   # x      :x座標
  608.   # y      :y座標
  609.   # str   :描画文字列
  610.   # opacity:透過率(0~255)
  611.   # 返り値 :文字幅(@x増加値)。
  612.   #--------------------------------------------------------------------------
  613.   def opacity_draw_text(target, x, y, str,opacity)
  614.     # heightとwidthを計算
  615.     height = target.font.size
  616.     width = target.text_size(str).width
  617.     # opacityに規定値以上の値が入っている場合は修正。
  618.     opacity = [[opacity, 0].max, 255].min
  619.     # opacityが255(透過なし)の場合は通常描画
  620.     if opacity == 255
  621.       target.draw_text(x, y, width, height, str)
  622.       return width
  623.     else
  624.       # 表示テキストのheight、widthがバッファサイズを上回る場合は
  625.       # バッファを再生成する。
  626.       if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  627.         @opacity_text_buf.dispose
  628.         @opacity_text_buf = Bitmap.new(width, height)
  629.       # そうでない場合はバッファクリア。
  630.       else
  631.         @opacity_text_buf.clear
  632.       end
  633.       # バッファに現在の文字サイズを反映
  634.       @opacity_text_buf.font.size = target.font.size
  635.       # バッファにテキスト描画
  636.       @opacity_text_buf.draw_text(0, 0, width, height, str)
  637.       # バッファデータをtargetに転送
  638.       target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  639.       # 文字サイズを返す
  640.       return width
  641.     end
  642.   end
  643.   #--------------------------------------------------------------------------
  644.   # ● ルビ文字描画
  645.   #--------------------------------------------------------------------------
  646.   # target :描画対象。Bitmapクラスを指定。
  647.   # x      :x座標
  648.   # y      :y座標
  649.   # str   :描画文字列。本文,ルビの形式で入力。
  650.   #      ,区切りが2つ以上あった場合は自動的に無視される。
  651.   # opacity:透過率(0~255)
  652.   # 返り値 :文字幅(@x増加値)。
  653.   #--------------------------------------------------------------------------
  654.   def ruby_draw_text(target, x, y, str,opacity)
  655.     # フォントサイズをバックアップしておく
  656.     sizeback = target.font.size
  657.     # ルビサイズの計算
  658.     target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  659.     rubysize = [rubysize, 6].max
  660.    
  661.     # opacityに規定値以上の値が入っている場合は修正。
  662.     opacity = [[opacity, 0].max, 255].min
  663.     # strをsplitで分割し、split_sに格納
  664.     split_s = str.split(/,/)
  665.     # split_sがnilの場合は""にしておく(誤動作防止)
  666.     split_s[0] == nil ? split_s[0] = "" : nil
  667.     split_s[1] == nil ? split_s[1] = "" : nil
  668.     # heightとwidthを計算
  669.     height = sizeback + rubysize
  670.     width  = target.text_size(split_s[0]).width
  671.     # バッファ用の幅計算(ルビの幅が本文の幅を越える可能性がある為)
  672.     target.font.size = rubysize
  673.     ruby_width = target.text_size(split_s[1]).width
  674.     target.font.size = sizeback
  675.     buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  676.     # 本文の描画幅とルビの描画幅の差を1/2にして変数に格納(後で使用)
  677.     width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  678.     # opacityが255(透過なし)の場合は通常描画
  679.     if opacity == 255
  680.     # ルビの描画
  681.       target.font.size = rubysize
  682.       target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  683.       target.font.size = sizeback
  684.     # 本文の描画
  685.       target.draw_text(x, y, width, target.font.size, split_s[0])
  686.       return width
  687.     else
  688.       # 表示テキストのheight、widthがバッファサイズを上回る場合は
  689.       # バッファを再生成する。
  690.       if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  691.         @opacity_text_buf.dispose
  692.         @opacity_text_buf = Bitmap.new(buf_width, height)
  693.       # そうでない場合はバッファクリア。
  694.       else
  695.         @opacity_text_buf.clear
  696.       end
  697.       # バッファにテキスト描画
  698.       # ルビの描画
  699.       @opacity_text_buf.font.size = rubysize
  700.       @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  701.       @opacity_text_buf.font.size = sizeback
  702.       # 本文の描画
  703.       @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  704.       # ルビの幅が本文の幅を下回る場合
  705.       if sub_x >= 0
  706.         target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  707.       # ルビの幅が本文の幅を上回る場合
  708.       else
  709.         target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  710.       end
  711.       # 文字サイズを返す
  712.       return width
  713.     end
  714.   end
  715.   #--------------------------------------------------------------------------
  716.   # ● \V変換
  717.   #--------------------------------------------------------------------------
  718.   # option :オプション。無指定又は規定外の場合はindexのユーザ変数値を返す。
  719.   # index  :インデックス
  720.   # 返り値 :変換結果(アイコン表示用シーケンス込み)
  721.   #--------------------------------------------------------------------------
  722.   def convart_value(option, index)
  723.     # optionがnilの場合は""に直す(誤動作防止)
  724.     option == nil ? option = "" : nil
  725.     # optionはdowncaseしておく。
  726.     option.downcase!
  727.     # \030はアイコン表示用のシーケンス。\030[アイコンファイル名]で定義。
  728.     case option
  729.     when "i"
  730.       unless $data_items[index].name == nil
  731.         r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  732.       end
  733.     when "w"
  734.       unless $data_weapons[index].name == nil
  735.         r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  736.       end
  737.     when "a"
  738.       unless $data_armors[index].name == nil
  739.         r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  740.       end
  741.     when "s"
  742.       unless $data_skills[index].name == nil
  743.         r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  744.       end
  745.     else
  746.       r = $game_variables[index]
  747.     end
  748.     r == nil ? r = "" : nil
  749.     return r
  750.   end
  751.   #--------------------------------------------------------------------------
  752.   # ● 解放
  753.   #--------------------------------------------------------------------------
  754.   def dispose
  755.     terminate_message
  756.     # 外字キャッシュ開放
  757.     if @gaiji_cache != nil
  758.       unless @gaiji_cache.disposed?
  759.         @gaiji_cache.dispose
  760.       end
  761.     end
  762.     # 文字透過転送用バッファ開放
  763.     unless @opacity_text_buf.disposed?
  764.       @opacity_text_buf.dispose
  765.     end
  766.     $game_temp.message_window_showing = false
  767.     if @input_number_window != nil
  768.       @input_number_window.dispose
  769.     end
  770.     super
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # ● カーソルの矩形更新
  774.   #--------------------------------------------------------------------------
  775.   def update_cursor_rect
  776.     if @index >= 0
  777.       n = $game_temp.choice_start + @index
  778.       self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  779.     else
  780.       self.cursor_rect.empty
  781.     end
  782.   end
  783. end
  784. #==============================================================================
  785. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  786. #==============================================================================
  787. class Window_Frame < Window_Base
  788.   #--------------------------------------------------------------------------
  789.   # ● オブジェクト初期化
  790.   #--------------------------------------------------------------------------
  791.   def initialize(x, y, width, height)
  792.     super(x, y, width, height)
  793.     self.contents = nil
  794.     self.back_opacity = 160
  795.   end
  796.   #--------------------------------------------------------------------------
  797.   # ● 解放
  798.   #--------------------------------------------------------------------------
  799.   def dispose
  800.     super
  801.   end
  802. end
  803. #==============================================================================
  804. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  805. #==============================================================================
  806. class Air_Text < Window_Base
  807.   #--------------------------------------------------------------------------
  808.   # ● オブジェクト初期化
  809.   #--------------------------------------------------------------------------
  810.   def initialize(x, y, designate_text)
  811.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  812.     self.opacity      = 0
  813.     self.back_opacity = 0
  814.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  815.     w = self.contents.width
  816.     h = self.contents.height
  817.     self.contents.draw_text(0, 0, w, h, designate_text)
  818.   end
  819.   #--------------------------------------------------------------------------
  820.   # ● 解放
  821.   #--------------------------------------------------------------------------
  822.   def dispose
  823.     self.contents.clear
  824.     super
  825.   end
  826. end
复制代码

Lv1.梦旅人

梦石
0
星屑
50
在线时间
16 小时
注册时间
2012-9-26
帖子
61
2
发表于 2013-3-23 07:05:54 | 只看该作者
最简单的方法是
查找已经改好的位置前面的英文
直接改就行!

点评

所以是指前頭有SUPER的地方嗎 我改過了幾次都跳出了錯誤ORZ  发表于 2013-3-23 12:29
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
帖子
11485

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

3
发表于 2013-3-23 12:13:25 | 只看该作者
重定义了对话框的内容
所以楼主改大小的话就在这个脚本内修改

点评

我会继续尝试看看的^^ 谢谢你  发表于 2013-3-23 12:30
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
30 小时
注册时间
2013-6-10
帖子
17
4
发表于 2013-7-14 15:01:18 | 只看该作者
我想问一下楼主,最后你修改成功了没?因为我也碰到了一样的问题
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-23 06:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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