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

Project1

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

[已经解决] 如何控制臉圖(立繪)大小

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
158 小时
注册时间
2016-1-7
帖子
129
跳转到指定楼层
1
发表于 2016-3-3 02:25:19 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
本帖最后由 RyanBern 于 2016-3-3 23:10 编辑

關於臉圖顯示在對話中,我使用的是"文字顯示強化"這個腳本,來源為 [已经解决] 立繪顯示在對話框前 5樓

關於臉圖的部分,照我參考使用的帖子說明,在腳本的86~91行
RUBY 代码复制
  1. @face = Sprite.new
  2.           @face.bitmap = RPG::Cache.picture(@face_file)
  3.           @face.opacity = 255
  4.           @face.x = self.x
  5.           @face.y = self.y + self.height - @face.bitmap.height
  6.           @face.z = 9999


我現在的問題是,我的用來當臉圖的立繪太大張,且不希望用圖片編輯軟體一個個改,所以想請教
作為Sprite物件的face是不是有可以控制大小的屬性/方法?
我參考了   [RMXP发布] 【脚本】显示人物立绘
裡面有提到 zoom_x, zoom_y (被稱為放大率),於是我google加腦洞開了下

我是不是可以根據上面
RUBY 代码复制
  1. @face.x = self.x
這種寫法,往下增加x,y放大率:
RUBY 代码复制
  1. @face.zoom_x = ?????
  2. @face.zoom_y = ?????

(那個?????我不知道要寫什麼)

如果我的腦洞是錯的,那到底有沒有除了重製圖片大小外的方法能達成我的目的?

(私心最後放置還沒有被解答的相關的另一個問題: [有事请教] 立繪顯示的問題(\f[檔名]))  

评分

参与人数 1星屑 +35 收起 理由
RyanBern + 35 手动认可奖励

查看全部评分

Lv1.梦旅人

梦石
0
星屑
50
在线时间
158 小时
注册时间
2016-1-7
帖子
129
6
 楼主| 发表于 2016-3-5 22:42:13 | 只看该作者
RyanBern 发表于 2016-3-5 09:01
这个脚本有两个地方更改了脸图的设置,一个就是初始化那里(92行),另一个是刷新部分(562行),这两个地 ...

好的,他們起作用了。{:2_273:}
這表示我應該在有關圖片的地方都要注意初始化和刷新的地方都是成對的要一起改嗎?

点评

initialize和update不是會成雙成對出現,不代表initialize有的update都必須有嗎?  发表于 2016-3-7 17:45
按道理来讲,是的。不过不太清楚为什么这个脚本要把同样的语句写两遍。  发表于 2016-3-5 23:56
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

梦石
0
星屑
9532
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

5
发表于 2016-3-5 09:01:00 | 只看该作者
这个脚本有两个地方更改了脸图的设置,一个就是初始化那里(92行),另一个是刷新部分(562行),这两个地方都有相似的脚本
RUBY 代码复制
  1. @face = Sprite.new
  2.           @face.bitmap = RPG::Cache.picture(@face_file)
  3.           @face.opacity = 255
  4.           @face.x = self.x
  5.           @face.y = self.y + self.height - @face.bitmap.height
  6.           @face.z = 9999
  7. #          self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  8.           @x = @face_indent = @face.bitmap.width
  9.           # 全行 128ピクセルのインデントを入れる。

将它们都改成下面这样:
RUBY 代码复制
  1. @face = Sprite.new
  2.           @face.bitmap = RPG::Cache.picture(@face_file)
  3.           @face.opacity = 255
  4.           @face.zoom_x = 0.5 # 要使用小数,2倍要写作2.0
  5.           @face.zoom_y = 0.5 # 要使用小数,2倍要写作2.0
  6.           @face.x = self.x
  7.           @face.y = self.y + self.height - @face.bitmap.height * @face.zoom_y
  8.           @face.z = 9999
  9. #          self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  10.           @x = @face_indent = @face.bitmap.width * @face.zoom_x
  11.           # 全行 128ピクセルのインデントを入れる。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
158 小时
注册时间
2016-1-7
帖子
129
3
 楼主| 发表于 2016-3-4 00:30:43 | 只看该作者
RyanBern 发表于 2016-3-3 23:11
没问题。zoom_x和zoom_y就是指的放大倍数。
@face.zoom_x = 2.0 # 横向放大为原来的两倍
@face.zoom_y = 2. ...

但我在對話中使用立繪完全沒有任何的改變
我用 \f[圖片名稱] 會顯示,然而不管我放大2倍或縮小成0.5都對圖形沒有任何的影響

点评

可能需要额外改别的地方,请上传你使用的完整脚本。  发表于 2016-3-4 12:34
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

梦石
0
星屑
9532
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

2
发表于 2016-3-3 23:11:59 | 只看该作者
没问题。zoom_x和zoom_y就是指的放大倍数。
RUBY 代码复制
  1. @face.zoom_x = 2.0 # 横向放大为原来的两倍
  2. @face.zoom_y = 2.0 # 纵向放大为原来的两倍
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 17:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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