#=========================================================================== # ◆ A1 Scripts ◆ # 見出し付き横コマンド(RGSS3) # # バージョン : 1.00 (2011/12/15) # 作者 : A1 # URL     : http://a1tktk.web.fc2.com/ #--------------------------------------------------------------------------- # 機能: # ・見出し付きの横コマンドを表示します #--------------------------------------------------------------------------- # 更新履歴   :2011/12/15 Ver1.00 リリース #--------------------------------------------------------------------------- # 設置場所 #  特になし # # 必要スクリプト # 特になし #--------------------------------------------------------------------------- # 使い方 # このクラスのインスタンス.caption = "見出し" #============================================================================== # ■ Window_HorzCommandCaption #============================================================================== class Window_HorzCommandCaption < Window_HorzCommand #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, commands, symbols) @window_width = 240 @commands = commands @symbols = symbols super(x, y) self.openness = 0 end #-------------------------------------------------------------------------- # ○ 表示行数の取得 #-------------------------------------------------------------------------- def visible_line_number return 2 end #-------------------------------------------------------------------------- # ○ ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width @window_width end #-------------------------------------------------------------------------- # ○ 桁数の取得 #-------------------------------------------------------------------------- def col_max return @commands.size end #-------------------------------------------------------------------------- # ○ コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list for i in 0...@commands.size add_command(@commands[i], @symbols[i]) end end #-------------------------------------------------------------------------- # ○ 見出しのセット #-------------------------------------------------------------------------- def caption=(caption) @caption = caption end #-------------------------------------------------------------------------- # ○ ウィンドウ内容の高さを計算 #-------------------------------------------------------------------------- def contents_height line_height * 2 end #-------------------------------------------------------------------------- # ○ 項目を描画する矩形の取得 #-------------------------------------------------------------------------- def item_rect(index) rect = super rect.y += line_height return rect end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh super draw_text(0, 0, contents_width, line_height, @caption, 1) end end