#============================================================================== # ★ コンフィグ+ホームページ ver1.0 by USK #------------------------------------------------------------------------------ # ・タイトル画面にF1を押したときにでる設定ウィンドウを出すコマンドを表示 # ・タイトル画面にウェブサイトを開くコマンドを表示 # ・タイトル画面のウィンドウの座標の変更が可能 # ・イベントコマンドのスクリプトでconfigureと記述するとF1を押したことになります # ・イベントコマンドのスクリプトでopen_url("任意のurl")と記述するとそのページ #  を開きます #============================================================================== #============================================================================== # ■ Window_TitleCommand #============================================================================== class Window_TitleCommand < Window_Command #-------------------------------------------------------------------------- # ● 設定 #-------------------------------------------------------------------------- ShowWindow = false #タイトルのコマンドウィンドウを表示するか MoveWindow = true #ウィンドウの位置をデフォルトから変えるか WindowPos = {:x => 0, :y => 192} #ウィンドウのx、y座標 Configure ="コンフィグ" #コンフィググコマンド表示名 AddConfigure = true #コンフィグコマンドを表示するか Browser = "ホームページ" #ホームページコマンドの表示名 AddBrowser = true #ホームページコマンドを表示するか URL = "http://www.yahoo.co.jp/" #ホームページのURL #-------------------------------------------------------------------------- # ● ウィンドウ位置の更新 #-------------------------------------------------------------------------- alias usk_title_update_placement update_placement def update_placement self.opacity = 0 unless ShowWindow if AddConfigure set_handler(:configure, method(:command_configure)) end if AddBrowser set_handler(:browser, method(:command_browser)) end if MoveWindow self.x = WindowPos[:x] self.y = WindowPos[:y] else usk_title_update_placement end end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- alias usk_title_make_command_list make_command_list def make_command_list usk_title_make_command_list tmp = @list.pop if AddConfigure add_command(Configure, :configure) end if AddBrowser add_command(Browser, :browser) end @list << tmp end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def command_configure Keybd_Event.push(:F1) activate end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def command_browser open_url(URL) activate end end #============================================================================== # ■ #============================================================================== module Keybd_Event #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- API = Win32API.new("user32", "keybd_event", "i i i i", "v") Keys = { :F1 => 112, :ENTER => 13, :UP => 38, :DOWN => 40, :LEFT => 37, :RIGHT => 39, :SHIFT => 16, :CTRL => 17, :F2 => 113, :ALT => 18, :F9 => 120, :F11 => 122 } #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def self.push(key) code = Keys[key] || Keys[:ENTER] API.call(code, 0, 0, 0) API.call(code, 0, 2, 0) end end #============================================================================== # ■ Game_Interpreter #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def key_push(key) Keybd_Event.push(key) end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def configure Keybd_Event.push(:F1) end end def open_url(url) system "rundll32 url.dll, FileProtocolHandler #{url}" end