ayuda:rgss:biblioteca:ajustarmensaje
no way to compare when less than two revisions
Diferencias
Muestra las diferencias entre dos versiones de la página.
— | ayuda:rgss:biblioteca:ajustarmensaje [2019/09/23 04:01] (actual) – creado - editor externo 127.0.0.1 | ||
---|---|---|---|
Línea 1: | Línea 1: | ||
+ | ====== Ajustar el mensaje al texto ====== | ||
+ | ===== Ficha técnica ===== | ||
+ | * **Nombre original:** Desconocido | ||
+ | * **Nombre del autor:** KGC | ||
+ | * **Utilidad: | ||
+ | * **Dependencia de otros scripts:** [[ayuda: | ||
+ | * **Incompatibilidades: | ||
+ | ===== Instalación ===== | ||
+ | Crear un nuevo script por encima de " | ||
+ | |||
+ | <code ruby> | ||
+ | # | ||
+ | #_/ ◆メッセージウィンドウ改造 - KGC_MessageAlter◆ | ||
+ | # | ||
+ | #_/ メッセージウィンドウを改造し、微妙な機能を追加します。 | ||
+ | # | ||
+ | |||
+ | # | ||
+ | # ★ カスタマイズ項目 ★ | ||
+ | # | ||
+ | |||
+ | module KGC | ||
+ | # ◆ウィンドウサイズ自動調整初期設定 | ||
+ | | ||
+ | # ◆スクロール機能初期設定 | ||
+ | | ||
+ | |||
+ | # ◆スクロール速度【単位:px】 | ||
+ | | ||
+ | # ◆最下部到達必須 | ||
+ | # | ||
+ | | ||
+ | |||
+ | # ◆顔グラフィック専用ウィンドウを使用 | ||
+ | | ||
+ | # ◆名前ウィンドウの縦幅 | ||
+ | # | ||
+ | | ||
+ | end | ||
+ | |||
+ | # | ||
+ | |||
+ | $imported = {} if $imported == nil | ||
+ | $imported[" | ||
+ | |||
+ | # | ||
+ | # ■ Game_System | ||
+ | # | ||
+ | |||
+ | class Game_System | ||
+ | # | ||
+ | # ● 公開インスタンス変数 | ||
+ | # | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | # | ||
+ | # ● オブジェクト初期化 | ||
+ | # | ||
+ | alias initialize_KGC_MessageAlter initialize | ||
+ | def initialize | ||
+ | # 元の処理を実行 | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | |||
+ | # | ||
+ | # ■ Window_Message | ||
+ | # | ||
+ | |||
+ | class Window_Message < Window_Selectable | ||
+ | # | ||
+ | # ● オブジェクト初期化 | ||
+ | # | ||
+ | alias initialize_KGC_MessageAlter initialize | ||
+ | def initialize | ||
+ | # 元の処理を実行 | ||
+ | | ||
+ | |||
+ | # 名前用小型ウィンドウ作成 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | # 顔グラフィック専用ウィンドウ作成 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # | ||
+ | # ● 解放 | ||
+ | # | ||
+ | alias dispose_KGC_MessageAlter dispose | ||
+ | def dispose | ||
+ | # ウィンドウ解放 | ||
+ | | ||
+ | | ||
+ | |||
+ | # 元の処理を実行 | ||
+ | | ||
+ | end | ||
+ | # | ||
+ | # ● リフレッシュ | ||
+ | # | ||
+ | def refresh | ||
+ | | ||
+ | # ウィンドウ初期化 | ||
+ | | ||
+ | # 文字列バッファ作成 | ||
+ | | ||
+ | # メッセージウィンドウ自動サイズ調整がオフの場合 | ||
+ | | ||
+ | | ||
+ | end | ||
+ | | ||
+ | x = y = max_x = 0 | ||
+ | | ||
+ | # 選択肢なら字下げを行う | ||
+ | x = 8 if $game_temp.choice_start == 0 | ||
+ | # 表示待ちのメッセージがある場合 | ||
+ | if $game_temp.message_text != nil | ||
+ | text = $game_temp.message_text | ||
+ | # 制御文字処理 | ||
+ | begin | ||
+ | | ||
+ | | ||
+ | | ||
+ | "" | ||
+ | | ||
+ | "" | ||
+ | | ||
+ | "" | ||
+ | end until text == last_text | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # 便宜上、" | ||
+ | | ||
+ | # " | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | # c に 1 文字を取得 (文字が取得できなくなるまでループ) | ||
+ | while ((c = text.slice!(/ | ||
+ | # \\ の場合 | ||
+ | if c == " | ||
+ | # 本来の文字に戻す | ||
+ | c = " | ||
+ | end | ||
+ | # \C[n] の場合 | ||
+ | if c == " | ||
+ | # 文字色を変更 | ||
+ | | ||
+ | color = $1.to_i | ||
+ | if color >= 0 && color <= 7 | ||
+ | | ||
+ | end | ||
+ | # 次の文字へ | ||
+ | next | ||
+ | end | ||
+ | # \G の場合 | ||
+ | if c == " | ||
+ | # ゴールドウィンドウを作成 | ||
+ | if @gold_window == nil | ||
+ | | ||
+ | | ||
+ | if $game_temp.in_battle | ||
+ | | ||
+ | else | ||
+ | | ||
+ | end | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # 次の文字へ | ||
+ | next | ||
+ | end | ||
+ | # \AL[n] の場合 | ||
+ | if c == " | ||
+ | # アラインタイプを変更 | ||
+ | | ||
+ | align = $1.to_i | ||
+ | # 次の文字へ | ||
+ | next | ||
+ | end | ||
+ | # 改行文字の場合 | ||
+ | if c == " | ||
+ | # 選択肢ならカーソルの幅を更新 | ||
+ | if y >= $game_temp.choice_start | ||
+ | | ||
+ | end | ||
+ | # y に 1 を加算 | ||
+ | y += 1 | ||
+ | # 新しい文字列バッファを作成 | ||
+ | | ||
+ | | ||
+ | # x の最大値更新判定 | ||
+ | max_x = [x, max_x].max | ||
+ | # x を初期化 | ||
+ | x = 0 | ||
+ | # 選択肢なら字下げを行う | ||
+ | x = 8 if y >= $game_temp.choice_start | ||
+ | # 次の文字へ | ||
+ | next | ||
+ | end | ||
+ | # \IT[n] の場合 | ||
+ | if c == " | ||
+ | | ||
+ | item = $data_items[$1.to_i] | ||
+ | if item != nil | ||
+ | # アイテム名をアイコン付きで描画 | ||
+ | icon = RPG:: | ||
+ | | ||
+ | x += icon.width + 8 | ||
+ | cx = text_buf[y].text_size(item.name).width + 8 | ||
+ | | ||
+ | x += cx - 8 | ||
+ | end | ||
+ | next | ||
+ | end | ||
+ | # \WP[n] の場合 | ||
+ | if c == " | ||
+ | | ||
+ | item = $data_weapons[$1.to_i] | ||
+ | if item != nil | ||
+ | # 武器名をアイコン付きで描画 | ||
+ | icon = RPG:: | ||
+ | | ||
+ | x += icon.width + 8 | ||
+ | cx = text_buf[y].text_size(item.name).width + 8 | ||
+ | | ||
+ | x += cx - 8 | ||
+ | end | ||
+ | next | ||
+ | end | ||
+ | # \AR[n] の場合 | ||
+ | if c == " | ||
+ | | ||
+ | item = $data_armors[$1.to_i] | ||
+ | if item != nil | ||
+ | # 武器名をアイコン付きで描画 | ||
+ | icon = RPG:: | ||
+ | | ||
+ | x += icon.width + 8 | ||
+ | cx = text_buf[y].text_size(item.name).width + 8 | ||
+ | | ||
+ | x += cx - 8 | ||
+ | end | ||
+ | next | ||
+ | end | ||
+ | # 文字を描画 | ||
+ | | ||
+ | # x に描画した文字の幅を加算 | ||
+ | x += text_buf[y].text_size(c).width | ||
+ | # 転送用X座標保存 | ||
+ | | ||
+ | # 選択肢の場合はインデント分戻す | ||
+ | | ||
+ | end | ||
+ | end | ||
+ | # メッセージウィンドウ自動サイズ調整がオンの場合 | ||
+ | if $game_system.message_auto_adjust | ||
+ | # 数値入力の場合は1行余分に追加 | ||
+ | y += 1 if $game_temp.num_input_variable_id > 0 | ||
+ | # ウィンドウサイズを調整 | ||
+ | | ||
+ | | ||
+ | # 顔グラフィックが存在する場合 | ||
+ | if @face_bitmap != nil && !KGC:: | ||
+ | # ウィンドウの幅を加算 | ||
+ | | ||
+ | # ウィンドウの高さが顔グラフィックよりも小さい場合 | ||
+ | if @face_bitmap.height + 32 > self.height | ||
+ | # 顔グラフィックより大きいサイズに設定 | ||
+ | | ||
+ | end | ||
+ | | ||
+ | | ||
+ | # 顔グラフィックが左側表示の場合 | ||
+ | if $msg_face[1] == 0 | ||
+ | | ||
+ | | ||
+ | | ||
+ | else | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | else | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # メッセージウィンドウ自動サイズ調整がオフの場合 | ||
+ | else | ||
+ | # 顔グラフィックが存在する場合 | ||
+ | if @face_bitmap != nil && !KGC:: | ||
+ | # ウィンドウの高さが顔グラフィックよりも小さい場合 | ||
+ | if @face_bitmap.height + 32 > self.height | ||
+ | # 顔グラフィックより大きいサイズに設定 | ||
+ | | ||
+ | end | ||
+ | | ||
+ | # 顔グラフィックが左側表示の場合 | ||
+ | if $msg_face[1] == 0 | ||
+ | | ||
+ | | ||
+ | | ||
+ | else | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | else | ||
+ | | ||
+ | end | ||
+ | end | ||
+ | # ウィンドウ内容を描画 | ||
+ | for i in 0...text_buf.size | ||
+ | next if text_buf[i] == nil | ||
+ | | ||
+ | # 転送用X座標設定 | ||
+ | align = $game_system.message_align if align == nil | ||
+ | case align | ||
+ | when 0, nil # 左側 | ||
+ | tx = @text_x | ||
+ | when 1 # 中央 | ||
+ | if $msg_face != nil && $msg_face[1] == 1 | ||
+ | tx = (self.contents.width - trans_x[i] - @face_bitmap.width - 16) / 2 | ||
+ | else | ||
+ | tx = (self.contents.width - trans_x[i] + @text_x) / 2 | ||
+ | end | ||
+ | when 2 # 右側 | ||
+ | if $msg_face != nil && $msg_face[1] == 0 | ||
+ | tx = self.contents.width - trans_x[i] - 8 | ||
+ | elsif $msg_face != nil && $msg_face[1] == 1 | ||
+ | tx = self.contents.width - trans_x[i] - @face_bitmap.width - 24 | ||
+ | else | ||
+ | tx = self.contents.width - trans_x[i] + @text_x - 8 | ||
+ | end | ||
+ | end | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # 選択肢の場合 | ||
+ | if $game_temp.choice_max > 0 | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # 数値入力の場合 | ||
+ | if $game_temp.num_input_variable_id > 0 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | # メッセージウィンドウ自動サイズ調整がオンの場合 | ||
+ | if $game_system.message_auto_adjust | ||
+ | # ウィンドウの幅を調整 | ||
+ | | ||
+ | # ウィンドウを中央へ移動 | ||
+ | | ||
+ | # 数値入力ウィンドウ位置を調整 | ||
+ | | ||
+ | end | ||
+ | end | ||
+ | # 名前が設定されている場合、名前表示 | ||
+ | if $msg_name != nil | ||
+ | fs = [[22 - (64 - KGC:: | ||
+ | | ||
+ | | ||
+ | cx = bitmap.text_size($msg_name).width | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | if $game_system.name_window_skin != nil | ||
+ | | ||
+ | else | ||
+ | | ||
+ | end | ||
+ | # 名前が設定されていない場合、ウィンドウ消去 | ||
+ | else | ||
+ | | ||
+ | end | ||
+ | # 顔グラフィック専用ウィンドウ表示 | ||
+ | if $msg_face != nil && KGC:: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | if $game_system.face_window_skin != nil | ||
+ | | ||
+ | else | ||
+ | | ||
+ | end | ||
+ | | ||
+ | else | ||
+ | | ||
+ | end | ||
+ | # 中央に移動 | ||
+ | | ||
+ | end | ||
+ | # | ||
+ | # ● ウィンドウ設定初期化 | ||
+ | # | ||
+ | def initialize_window | ||
+ | if $msg_face == nil || $msg_face[0] == nil || $msg_face[1] == nil | ||
+ | | ||
+ | | ||
+ | | ||
+ | else | ||
+ | | ||
+ | | ||
+ | end | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # | ||
+ | # ● ウィンドウを中央に移動 | ||
+ | # | ||
+ | def centering_window | ||
+ | if @face_window.visible && $msg_face != nil | ||
+ | cx = 640 - self.width - @face_window.width | ||
+ | case $msg_face[1] | ||
+ | when 1 # 右 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | else | ||
+ | cx = 640 - self.width | ||
+ | | ||
+ | | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ● ウィンドウの位置と不透明度の設定 | ||
+ | # | ||
+ | def reset_window | ||
+ | if $game_temp.in_battle | ||
+ | | ||
+ | else | ||
+ | case $game_system.message_position | ||
+ | when 0 # 上 | ||
+ | | ||
+ | when 1 # 中 | ||
+ | | ||
+ | when 2 # 下 | ||
+ | | ||
+ | end | ||
+ | end | ||
+ | if $game_system.message_frame == 0 | ||
+ | | ||
+ | else | ||
+ | | ||
+ | end | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # | ||
+ | # ● フレーム更新 | ||
+ | # | ||
+ | def update | ||
+ | super | ||
+ | # ウィンドウを更新 | ||
+ | | ||
+ | | ||
+ | # フェードインの場合 | ||
+ | if @fade_in | ||
+ | | ||
+ | | ||
+ | | ||
+ | if @input_number_window != nil | ||
+ | | ||
+ | end | ||
+ | if self.contents_opacity == 255 | ||
+ | | ||
+ | end | ||
+ | | ||
+ | end | ||
+ | # 数値入力中の場合 | ||
+ | if @input_number_window != nil | ||
+ | | ||
+ | # 決定 | ||
+ | if Input.trigger? | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | # 数値入力ウィンドウを解放 | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | | ||
+ | end | ||
+ | # メッセージ表示中の場合 | ||
+ | if @contents_showing | ||
+ | # スクロール最大位置を計算 | ||
+ | | ||
+ | # 選択肢の表示中でなければポーズサインを表示 | ||
+ | if $game_temp.choice_max == 0 | ||
+ | | ||
+ | end | ||
+ | # キャンセル | ||
+ | if Input.trigger? | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # 決定 | ||
+ | if Input.trigger? | ||
+ | if $game_temp.choice_max > 0 | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # スクロール機能がオン、かつ選択肢でない場合 | ||
+ | if $game_system.message_scroll && $game_temp.choice_max == 0 | ||
+ | # 最下部到達判定 | ||
+ | if KGC:: | ||
+ | | ||
+ | else | ||
+ | | ||
+ | end | ||
+ | else | ||
+ | | ||
+ | end | ||
+ | end | ||
+ | # スクロール機能がオン、かつ選択肢でない場合 | ||
+ | if $game_system.message_scroll && $game_temp.choice_max == 0 | ||
+ | # 方向ボタンの上が押されている場合 | ||
+ | if Input.press? | ||
+ | | ||
+ | # 方向ボタンの下が押されている場合 | ||
+ | elsif Input.press? | ||
+ | | ||
+ | # R ボタンが押された場合 | ||
+ | elsif Input.repeat? | ||
+ | | ||
+ | # L ボタンが押された場合 | ||
+ | elsif Input.repeat? | ||
+ | | ||
+ | end | ||
+ | # ウィンドウ最下部に達した場合 | ||
+ | if $game_temp.choice_max == 0 && self.oy == scroll_max | ||
+ | # ポーズサインを表示 | ||
+ | | ||
+ | else | ||
+ | # ポーズサインを消去 | ||
+ | | ||
+ | end | ||
+ | end | ||
+ | | ||
+ | end | ||
+ | # フェードアウト中以外で表示待ちのメッセージか選択肢がある場合 | ||
+ | if !@fade_out && $game_temp.message_text != nil | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | if @input_number_window != nil | ||
+ | | ||
+ | end | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # 表示すべきメッセージがないが、ウィンドウが可視状態の場合 | ||
+ | if self.visible | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | if self.opacity == 0 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | | ||
+ | end | ||
+ | end | ||
+ | # | ||
+ | # ● カーソルの矩形更新 | ||
+ | # | ||
+ | def update_cursor_rect | ||
+ | if @index >= 0 | ||
+ | n = $game_temp.choice_start + @index | ||
+ | | ||
+ | else | ||
+ | | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | |||
+ | # | ||
+ | |||
+ | # | ||
+ | # ■ Interpreter (分割定義 3) | ||
+ | # | ||
+ | |||
+ | class Interpreter | ||
+ | # | ||
+ | # ● 文章の表示 | ||
+ | # | ||
+ | def command_101 | ||
+ | # ほかの文章が message_text に設定済み、かつスクロール機能がオフの場合 | ||
+ | if $game_temp.message_text != nil && !$game_system.message_scroll | ||
+ | # 終了 | ||
+ | | ||
+ | end | ||
+ | # メッセージ終了待機中フラグおよびコールバックを設定 | ||
+ | | ||
+ | | ||
+ | # message_text に 1 行目を設定 | ||
+ | | ||
+ | | ||
+ | # ループ | ||
+ | loop { | ||
+ | # 次のイベントコマンドが文章 2 行目以降の場合 | ||
+ | if @list[@index+1].code == 401 | ||
+ | # message_text に 2 行目以降を追加 | ||
+ | | ||
+ | | ||
+ | # イベントコマンドが文章 2 行目以降ではない場合 | ||
+ | else | ||
+ | # 次のイベントコマンドが文章表示、かつスクロール機能がオンの場合 | ||
+ | if @list[@index+1].code == 101 && $game_system.message_scroll | ||
+ | # message_text に次の文章を追加 | ||
+ | | ||
+ | | ||
+ | # インデックスを進める | ||
+ | | ||
+ | next | ||
+ | # 次のイベントコマンドが選択肢の表示の場合 | ||
+ | elsif @list[@index+1].code == 102 | ||
+ | # 選択肢が画面に収まる場合 | ||
+ | if @list[@index+1].parameters[0].size <= 4 - line_count | ||
+ | # インデックスを進める | ||
+ | | ||
+ | # 選択肢のセットアップ | ||
+ | | ||
+ | | ||
+ | end | ||
+ | # 次のイベントコマンドが数値入力の処理の場合 | ||
+ | elsif @list[@index+1].code == 103 | ||
+ | # 数値入力ウィンドウが画面に収まる場合 | ||
+ | if line_count < 4 | ||
+ | # インデックスを進める | ||
+ | | ||
+ | # 数値入力のセットアップ | ||
+ | | ||
+ | | ||
+ | | ||
+ | end | ||
+ | end | ||
+ | # 継続 | ||
+ | | ||
+ | end | ||
+ | # インデックスを進める | ||
+ | | ||
+ | } | ||
+ | end | ||
+ | end | ||
+ | </ |
ayuda/rgss/biblioteca/ajustarmensaje.txt · Última modificación: 2019/09/23 04:01 por 127.0.0.1