#============================================================================== # 縦型メッセージウィンドウ ver1.00 #------------------------------------------------------------------------------ #[特徴] # マップ画面でのメッセージウィンドウを縦にします。 # #[使用上の注意] # 無論、縦は横より短いので、1行あたりの文字数は減ります。 # 顔グラなしで19文字、ありで13文字が目安です。 # # 作成:ぶちょー # ホム:http://nyannyannyan.bake-neko.net/ # 著作:自分で作ったとか言わないで>< # 改造はご自由にどうぞ。 # リードミーとかに私の名前の載せたりするのは任意で。 #============================================================================== #============================================================================== # バージョンアップ情報 # ver1.00 公開 #============================================================================== #============================================================================== # 設定項目 #============================================================================== module Kazari module VERTICAL # このIDのスイッチが ON のとき、縦型のウィンドウになります。 SWITCH_ID = 10 end end #============================================================================== # ここまで #============================================================================== #============================================================================== # ■ Window_Message #============================================================================== class Window_Message < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias vertical_initialize initialize def initialize unless vertical? vertical_initialize else super(0, 0, 128, 416) self.z = 200 self.active = false self.index = -1 self.openness = 0 @opening = false # ウィンドウのオープン中フラグ @closing = false # ウィンドウのクローズ中フラグ @text = nil # 表示すべき残りの文章 @contents_x = 0 # 次の文字を描画する X 座標 @contents_y = 0 # 次の文字を描画する Y 座標 @line_count = 0 # 現在までに描画した行数 @wait_count = 0 # ウェイトカウント @background = 0 # 背景タイプ @position = 2 # 表示位置 @show_fast = false # 早送りフラグ @line_show_fast = false # 行単位早送りフラグ @pause_skip = false # 入力待ち省略フラグ create_gold_window create_number_input_window create_back_sprite end end #-------------------------------------------------------------------------- # ● 改ページ処理 #-------------------------------------------------------------------------- alias vertical_new_page new_page def new_page unless vertical? vertical_new_page else contents.clear if $game_message.face_name.empty? @contents_y = 0 else name = $game_message.face_name index = $game_message.face_index draw_face(name, index, 0, 0) @contents_y = 112 end @contents_x = contents.width - WLH @line_count = 0 @show_fast = false @line_show_fast = false @pause_skip = false contents.font.color = text_color(0) end end #-------------------------------------------------------------------------- # ● 改行処理 #-------------------------------------------------------------------------- alias vertical_new_line new_line def new_line unless vertical? vertical_new_line else if $game_message.face_name.empty? @contents_y = 0 else @contents_y = 112 end @contents_x -= WLH @line_count += 1 @line_show_fast = false end end #-------------------------------------------------------------------------- # ● ウィンドウの背景と位置の設定 #-------------------------------------------------------------------------- alias vertical_reset_window reset_window def reset_window unless vertical? vertical_reset_window else @background = $game_message.background @position = $game_message.position if @background == 0 # 通常ウィンドウ self.opacity = 255 else # 背景を暗くする、透明にする self.opacity = 0 end case @position when 0 # 右 self.x = 544 - self.width @gold_window.x = 0 when 1 # 中 self.x = (544 - self.width) / 2 @gold_window.x = 544 - @gold_window.width when 2 # 左 self.x = 0 @gold_window.x = 544 - @gold_window.width end end end #-------------------------------------------------------------------------- # ● メッセージの更新 #-------------------------------------------------------------------------- alias vertical_update_message update_message def update_message unless vertical? vertical_update_message else loop do c = @text.slice!(/./m) # 次の文字を取得 case c when nil # 描画すべき文字がない finish_message # 更新終了 break when "\x00" # 改行 new_line if @line_count >= MAX_LINE # 行数が最大のとき unless @text.empty? # さらに続きがあるなら self.pause = true # 入力待ちを入れる break end end when "\x01" # \C[n] (文字色変更) @text.sub!(/\[([0-9]+)\]/, "") contents.font.color = text_color($1.to_i) next when "\x02" # \G (所持金表示) @gold_window.refresh @gold_window.open when "\x03" # \. (ウェイト 1/4 秒) @wait_count = 15 break when "\x04" # \| (ウェイト 1 秒) @wait_count = 60 break when "\x05" # \! (入力待ち) self.pause = true break when "\x06" # \> (瞬間表示 ON) @line_show_fast = true when "\x07" # \< (瞬間表示 OFF) @line_show_fast = false when "\x08" # \^ (入力待ちなし) @pause_skip = true else # 普通の文字 c_height = contents.text_size(c).height contents.draw_text(@contents_x, @contents_y, WLH, c_height, c, 2) @contents_y += c_height end break unless @show_fast or @line_show_fast end end end #-------------------------------------------------------------------------- # ● 数値入力の開始 #-------------------------------------------------------------------------- alias vertical_start_number_input start_number_input def start_number_input unless vertical? vertical_start_number_input else digits_max = $game_message.num_input_digits_max number = $game_variables[$game_message.num_input_variable_id] @number_input_window.digits_max = digits_max @number_input_window.number = number if $game_message.face_name.empty? @number_input_window.y = y else @number_input_window.y = y + 112 end @number_input_window.x = @contents_x - WLH - digits_max * 10 @number_input_window.active = true @number_input_window.visible = true @number_input_window.update end end #-------------------------------------------------------------------------- # ● カーソルの更新 #-------------------------------------------------------------------------- alias vertical_update_cursor update_cursor def update_cursor unless vertical? vertical_update_cursor else if @index >= 0 x = (MAX_LINE - ($game_message.choice_start + @index + 1)) * WLH + 4 y = $game_message.face_name.empty? ? 36 : 148 text = $game_message.texts[$game_message.choice_start + @index] height = contents.font.size * text.scan(/./).size + 8 self.cursor_rect.set(x, y, WLH, height) else self.cursor_rect.empty end end end #-------------------------------------------------------------------------- # ● カーソルを下に移動 #-------------------------------------------------------------------------- def cursor_down(wrap = false, cansel = true) unless vertical? super(wrap) else if (@index < @item_max - @column_max) or (wrap and @column_max == 1) @index = (@index + @column_max) % @item_max end end end #-------------------------------------------------------------------------- # ● カーソルを上に移動 #-------------------------------------------------------------------------- def cursor_up(wrap = false, cansel = true) unless vertical? super(wrap) else if (@index >= @column_max) or (wrap and @column_max == 1) @index = (@index - @column_max + @item_max) % @item_max end end end #-------------------------------------------------------------------------- # ● カーソルを右に移動 #-------------------------------------------------------------------------- alias vertical_cursor_right cursor_right def cursor_right(wrap = false) unless vertical? vertical_cursor_right(wrap) else cursor_up(wrap, false) end end #-------------------------------------------------------------------------- # ● カーソルを左に移動 #-------------------------------------------------------------------------- alias vertical_cursor_left cursor_left def cursor_left(wrap = false) unless vertical? vertical_cursor_left(wrap) else cursor_down(wrap, false) end end #-------------------------------------------------------------------------- # ● 縦型メッセージウィンドウにするかどうか #-------------------------------------------------------------------------- def vertical? if $game_temp.in_battle || ! $game_switches[Kazari::VERTICAL::SWITCH_ID] return false else return true end end end #============================================================================== # ■ Scene_Map #============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias vertical_update update def update if $game_temp.need_window_refresh @message_window.dispose @message_window = Window_Message.new $game_temp.need_window_refresh = false end vertical_update end end #============================================================================== # ■ Game_Temp #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :need_window_refresh #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias vertical_initialize initialize def initialize vertical_initialize @need_window_refresh = false end end #============================================================================== # ■ Game_Interpreter #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ● スイッチの操作 #-------------------------------------------------------------------------- alias vertical_command_121 command_121 def command_121 for i in @params[0] .. @params[1] $game_temp.need_window_refresh = true if i == Kazari::VERTICAL::SWITCH_ID end vertical_command_121 end end