#============================================================================== # ■ Window_Message_Fit Ver.1.0.5(2014/05/28) #------------------------------------------------------------------------------ #  顔グラフィックなしの文章を顔グラフィックありの場合と同じ領域にします。 #============================================================================== =begin ◆ 使用方法 * 以下の設定で 文章領域調整用スイッチとウィンドウ幅調整用変数 を設定します。 =end #============================================================================== # ◎ ユーザー設定 #============================================================================== =begin ◆ 以下、定数と明記された内容を設定することができます。 ○ 定数(文章領域調整用スイッチ) ここで指定したスイッチが ON の時、顔グラフィックなしの文章が顔グラフィック ありの場合と同じ領域になります。 ○ 定数(ウィンドウ幅調整用変数) ここで指定した変数が 1 の時、ウィンドウを表示領域に合わせた幅に調節します。 調節しない場合は 0 を、調節する場合は 1 を代入して下さい。 =end #-------------------------------------------------------------------------- # ○ 定数(文章領域調整用スイッチ) #-------------------------------------------------------------------------- WINMSG_SWITCH = 8 #-------------------------------------------------------------------------- # ○ 定数(ウィンドウ幅調整用変数) #-------------------------------------------------------------------------- WINMSG_VARIABLE = 8 #/////////////////////////////////////////////////////////////////////////////# # # # 下記のスクリプトを変更する必要はありません。 # # # #/////////////////////////////////////////////////////////////////////////////# #============================================================================== # ■ Window_Message #------------------------------------------------------------------------------ #  文章表示に使うメッセージウィンドウです。 #============================================================================== class Window_Message < Window_Base alias dsmsgfit_initialize initialize #-------------------------------------------------------------------------- # ○ オブジェクト初期化(追加定義) #-------------------------------------------------------------------------- def initialize dsmsgfit_initialize self.x = 0 self.width = Graphics.width self.arrows_visible = false end #-------------------------------------------------------------------------- # ● ウィンドウ幅の調整が必要か判定(新規定義) #-------------------------------------------------------------------------- def need_window_fit? return false if $game_party.in_battle if $game_switches[WINMSG_SWITCH] && $game_variables[WINMSG_VARIABLE] == 1 return true end return false end #-------------------------------------------------------------------------- # ● 文章領域の調整が必要か判定(新規定義) #-------------------------------------------------------------------------- def need_winmsg_fit? return false if $game_party.in_battle if $game_switches[WINMSG_SWITCH] && $game_message.face_name.empty? return true end return false end alias dsmsgfit_window_width window_width #-------------------------------------------------------------------------- # ○ ウィンドウ幅の取得(追加定義) #-------------------------------------------------------------------------- def window_width if need_window_fit? $game_message.face_name.empty? ? 544 - 112 : 544 else dsmsgfit_window_width end end alias dsmsgfit_update_placement update_placement #-------------------------------------------------------------------------- # ○ ウィンドウ位置の更新(追加定義) #-------------------------------------------------------------------------- def update_placement dsmsgfit_update_placement if need_window_fit? self.x = $game_message.face_name.empty? ? 56 : 0 self.width = $game_message.face_name.empty? ? 544 - 112 : 544 else self.x = 0 self.width = Graphics.width end end alias dsmsgfit_contents_width contents_width #-------------------------------------------------------------------------- # ○ ウィンドウ内容の幅を計算(追加定義 < Window_Base) #-------------------------------------------------------------------------- def contents_width if $game_variables[WINMSG_VARIABLE] == 1 return Graphics.width - standard_padding * 2 else dsmsgfit_contents_width end end alias dsmsgfit_create_back_bitmap create_back_bitmap #-------------------------------------------------------------------------- # ○ 背景ビットマップの作成(追加定義) #-------------------------------------------------------------------------- def create_back_bitmap if $game_variables[WINMSG_VARIABLE] == 1 width = Graphics.width @back_bitmap = Bitmap.new(width, height) rect1 = Rect.new(0, 0, width, 12) rect2 = Rect.new(0, 12, width, height - 24) rect3 = Rect.new(0, height - 12, width, 12) @back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true) @back_bitmap.fill_rect(rect2, back_color1) @back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true) else dsmsgfit_create_back_bitmap end end alias dsmsgfit_settings_changed? settings_changed? #-------------------------------------------------------------------------- # ○ 背景と位置の変更判定(追加定義) #-------------------------------------------------------------------------- def settings_changed? if need_window_fit? dsmsgfit_settings_changed? || self.width != window_width # ウィンドウ幅の変更がある場合 を追加 else dsmsgfit_settings_changed? end end alias dsmsgfit_new_line_x new_line_x #-------------------------------------------------------------------------- # ○ 改行位置の取得(追加定義) #-------------------------------------------------------------------------- def new_line_x return dsmsgfit_new_line_x if $game_party.in_battle if need_winmsg_fit? $game_variables[WINMSG_VARIABLE] == 1 ? 0 : 56 else dsmsgfit_new_line_x end end end #/////////////////////////////////////////////////////////////////////////////# #  製作者:SOLA@DEEP SEASONS # #  配布元:http://deepseasons.seesaa.net/ # #  作成日:2012/02/15 # #  更新日:2014/05/28 # #/////////////////////////////////////////////////////////////////////////////#