#=========================================================================== # ◆ A1 Scripts ◆ # ゲームオプション:ウィンドウカラー(RGSS3) # # バージョン : 1.00 (2011/12/15) # 作者 : A1 # URL     : http://a1tktk.web.fc2.com/ #--------------------------------------------------------------------------- # 機能: # ・オプション設定でウィンドウカラーを設定します #--------------------------------------------------------------------------- # 更新履歴   :2011/12/15 Ver1.00 リリース #--------------------------------------------------------------------------- # 設置場所 #  RGSS3用A1共通スクリプトより下 # ゲームオプション:設定項目 より下 # ゲームオプション:本体 より下 # # 必要スクリプト # RGSS3用A1共通スクリプト # ゲームオプション:設定項目 # ゲームオプション:本体 #--------------------------------------------------------------------------- # 使い方 # このスクリプトを導入することで適用されます #--------------------------------------------------------------------------- # 備考 # ※オプション設定の追加スクリプトのサンプルです #============================================================================== $imported ||= {} $imported["A1_GameOptionWindowColor"] = true if $imported["A1_Common_Script"] and $imported["A1_GameOption"] and $imported["A1_GameOptionMain"] #============================================================================== # ■ Scene_Option #============================================================================== class Scene_Option < Scene_MenuBase #-------------------------------------------------------------------------- # ○ ウィンドウカラー設定 #-------------------------------------------------------------------------- def set_window_color close_option_window color = $game_option.get_option("window_color").clone @color_window = Window_ColorSelect.new(color) @color_window.set_handler(:ok, method(:color_ok)) @color_window.set_handler(:cancel, method(:color_cancel)) create_command_window @color_window.open end #-------------------------------------------------------------------------- # ○ カラー設定画面でOK #-------------------------------------------------------------------------- def color_ok return end_color unless @color_window.chk_change @mode = 0 @color_command_window.caption = "変更しますか?" call_command_window end #-------------------------------------------------------------------------- # ○ 確認画面に遷移 #-------------------------------------------------------------------------- def call_command_window @color_command_window.refresh @color_command_window.open @color_window.active = false @color_command_window.active = true end #-------------------------------------------------------------------------- # ○ カラー設定画面でキャンセル #-------------------------------------------------------------------------- def color_cancel return end_color unless @color_window.chk_change @mode = 1 @color_command_window.caption = "変更をキャンセル?" call_command_window end #-------------------------------------------------------------------------- # ○ コマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_command_window x = @color_window.x y = @color_window.y + @color_window.height commands = ["はい", "いいえ"] symbols = [:ok, :cancel] @color_command_window = Window_HorzCommandCaption.new(x, y, commands, symbols) @color_command_window.set_handler(:ok, method(:set_color)) @color_command_window.set_handler(:cancel, method(:reset_color)) end #-------------------------------------------------------------------------- # ○ カラー設定確認画面でOK #-------------------------------------------------------------------------- def set_color case @mode when 0 color = @color_window.color tone = Tone.new(color[0], color[1], color[2]) $game_option.set_option("window_color", tone) when 1 color = @color_window.change_cancel $game_system.window_tone = Tone.new(color[0], color[1], color[2]) end end_color end #-------------------------------------------------------------------------- # ○ カラー設定確認画面でキャンセル #-------------------------------------------------------------------------- def reset_color @color_command_window.close @color_window.active = true end #-------------------------------------------------------------------------- # ○ ウィンドウカラー設定終了 #-------------------------------------------------------------------------- def end_color @color_window.close @color_command_window.close open_option_window end end #============================================================================== # ■ Window_ColorSelect #============================================================================== class Window_ColorSelect < Window_Selectable #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(now_color) width = Graphics.width - 300 height = fitting_height(4) x = (Graphics.width - width) / 2 y = (Graphics.height - height) / 2 @color = [now_color.red, now_color.green, now_color.blue] @now_color = @color.clone gauge_red = [Color.new(255,0,0), Color.new(255,128,0)] gauge_green = [Color.new(0,255,0), Color.new(128,255,0)] gauge_blue = [Color.new(0,0,255), Color.new(0,128,255)] @gauge_color = [gauge_red, gauge_green, gauge_blue] super(x, y, width, height) self.openness = 0 self.index = 0 self.active = true refresh end #-------------------------------------------------------------------------- # ○ 決定やキャンセルなどのハンドリング処理 #-------------------------------------------------------------------------- def process_handling super return unless open? && active change_color([@color[self.index] + 1, 255].min) if Input.repeat?(:RIGHT) change_color([@color[self.index] - 1, -255].max) if Input.repeat?(:LEFT) change_color([@color[self.index] + 10, 255].min) if Input.repeat?(:R) change_color([@color[self.index] - 10, -255].max) if Input.repeat?(:L) end #-------------------------------------------------------------------------- # ○ ウィンドウカラーの変更 #-------------------------------------------------------------------------- def change_color(color) @color[self.index] = color $game_system.window_tone = Tone.new(@color[0], @color[1], @color[2]) refresh end #-------------------------------------------------------------------------- # ○ 変更確認 #-------------------------------------------------------------------------- def chk_change return @now_color != @color end #-------------------------------------------------------------------------- # ○ 変更するカラーの取得 #-------------------------------------------------------------------------- def color return @color end #-------------------------------------------------------------------------- # ○ カラー変更をキャンセル #-------------------------------------------------------------------------- def change_cancel @color = @now_color.clone return @now_color end #-------------------------------------------------------------------------- # ○ 項目数の取得 #-------------------------------------------------------------------------- def item_max return 3 end #-------------------------------------------------------------------------- # ○ 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) case index when 0; text = "R" when 1; text = "G" when 2; text = "B" end rect = item_rect(index) gauge_color = @gauge_color[index] draw_text(4, rect.y, rect.width, line_height, text) draw_gauge(20, rect.y - 6, 250, (@color[index] + 255) / 512.0, gauge_color[0], gauge_color[1]) draw_text(0, rect.y, rect.width, line_height, @color[index], 2) end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh super draw_text(0, 0, contents_width, line_height, "ウィンドウカラーの設定", 1) end #-------------------------------------------------------------------------- # ○ 項目を描画する矩形の取得 #-------------------------------------------------------------------------- def item_rect(index) rect = super rect.y += line_height return rect end end end