当サイトの運営者です。ゲーム制作とプラグイン開発が好きで、コミュニティに貢献したいと考えています。
RPGツクールMZでゲームを制作中です。
※プログラマ・エンジニアではありません。
Mano 入力コンフィグ - Mano_InputConfig.js
シェア用テキスト:
▼Mano 入力コンフィグ(しぐれん様作) - Mano_InputConfig.js
https://plugin-mz.fungamemake.com/archives/741
コントローラ(ゲームパッド)・キーボードの設定を変更できます。ユーザーが入力を拡張する場合の補助も行います。
ふりがな:にゅうりょくこんふぃぐ
機能概要: コントローラ(ゲームパッド)・キーボードの設定を変更できます。ユーザーが入力を拡張する場合の補助も行います。
利用規約(ライセンス): MITライセンス
作者:しぐれん
作者サイト:https://siguren400.booth.pm/
ダウンロードページ:https://raw.githubusercontent.com/Sigureya/RPGmakerMZ/m…
ファイル名:Mano_InputConfig.js
プラグインのヘルプ:
//=============================================================================
// Mano_InputConfig.js
// ----------------------------------------------------------------------------
// Copyright (c) 2017-2017 Sigureya
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
// Version
// ver 4.0 2020/08/23
// ----------------------------------------------------------------------------
// [Twitter]: https://twitter.com/Sigureya/
//=============================================================================
/*:ja
* @plugindesc コントローラ(ゲームパッド)・キーボードの設定を変更できます。
* ユーザーが入力を拡張する場合の補助も行います。
* @author しぐれん(https://github.com/Sigureya/RPGmakerMV)
* @url https://raw.githubusercontent.com/Sigureya/RPGmakerMZ/master/Mano_InputConfig.js
*
* @target MZ
*
* @param debugMode
* @text デバッグモード
* @desc 一部のデバッグ用の情報をコンソールへ出します。
* 起動時に出力されます。
* @type boolean
* @default true
*
* @param unknowSymbolAutoImport
* @text 不明なシンボルの自動取り込み
* @desc キーボード・ゲームパッドのシンボルを全て読み込み、一覧に入れます。
* シンボルの細かい意味が分からないなら、ONにした方がいいです。
* @type boolean
* @default true
*
* @param overwriteWarning
* @text 上書き警告
* @desc このプラグインで割り当てたボタン設定が、既存の入力に対して上書きしている場合にconsoleへ警告を出します
* @type boolean
* @default true
*
*
* @param GamepadIsNotConnected
* @desc ゲームパッドが接続されていない場合の文章です。
* @type note
* @default "ゲームパッドが接続されていません\nボタンを押して再度試してください"
*
* @param needButtonDetouch
* @text ボタンから手を放すように促すメッセージ
* @desc キーコンフィグはボタンから手を離さない限り終了しません。
* 手を放すように促すメッセージを設定します。
* @type note
* @default "コンフィグを終了するためには\nボタンから手を放してください。"
*
* @param text
* @param CommandWidth
*
* @param textApply
* @desc 設定を適用するコマンドです。
* 選択するとコンフィグが終了します。
* @default 設定を保存
* @parent text
*
* @param textRollback
* @desc コンフィグ開始前の状態に戻すコマンドです。
* @default 変更前に戻す
* @parent text
*
* @param textDefault
* @desc 初期設定に戻すコマンドです。
* @default 初期設定に戻す
* @parent text
*
* @param textChangeLayout
* @desc JIS/USでキー配置を切り替えるコマンドです。
* @default JIS/US
* @parent text
*
* @param textExit
* @desc コンフィグを終了するときのコマンドです。
* @default やめる
* @parent text
*
* @param textEmpty
* @desc 何も割り当てられていない時の説明
* Explanation when no function is assigned
* @default 設定を消去
* @parent text
*
* @param textOK
* @desc okの機能の説明
* Description of ok's function
* @default 決定
* @parent text
*
* @param textCancel
* @desc cancelの機能の説明
* Description of cancel function
* @default 取り消し
* @parent text
*
* @param textShift
* @desc shiftの機能の説明
* Description of shift function
* @default ダッシュ
* @parent text
*
* @param textMenu
* @desc menuの機能の説明
* @default メニュー
* @parent text
*
* @param textPageup
* @desc pageupの機能の説明
* @default 前
* @parent text
*
* @param textPagedown
* @desc pagedownの機能の説明
* @default 次
* @parent text
*
* @param textEscape
* @desc escapeの機能の説明(キャンセルとメニューを兼ねたキー)
* @default キャンセル/メニュー
* @parent text
*
* @param textSymbol6
* @desc ユーザー拡張アクション6の説明
* ※6なのは、既存の機能を0から数えているためです。
* @default アクション6
*
* @param extendSymbol6
* @desc ユーザー拡張アクション6です。
* Input.pressed('ここで設定した文字')で入力を取得できます。
* @parent textSymbol6
*
* @param textSymbol7
* @desc ユーザー拡張アクション7の説明
* @default アクション7
*
* @param extendSymbol7
* @desc ユーザー拡張アクション7です。
* Input.pressed('ここで設定した文字')で入力を取得できます。
* @parent textSymbol7
*
* @param textSymbol8
* @desc ユーザー拡張アクション8の説明
* @default アクション8
* @param extendSymbol8
* @desc ユーザー拡張アクション8です。
* Input.pressed('ここで設定した文字')で入力を取得できます。
* @parent textSymbol8
*
*
* @param symbols
* @desc コンフィグでの変更先の一覧です。
* ユーザー定義のコマンドも混ぜることができます。
* @default ["ok","cancel","shift","menu","pageup","pagedown","escape"]
* @type combo[]
* @option ok
* @option cancel
* @option shift
* @option menu
* @option pageup
* @option pagedown
* @option escape
*
* @param mandatorySymbols
* @desc 必須シンボルです。
* これらのシンボル全てがある場合のみ、変更を保存できます。
* @type combo[]
* @option ok
* @option cancel
* @option shift
* @option menu
* @option pageup
* @option pagedown
* @default ["ok","cancel","menu"]
*
* @param buttons
* @text ボタン及びキーボードの初期設定
* @desc 使用できるゲームパッドボタンの一覧です。
* 並び順の制御を兼ねています。
* @type number[]
* @default ["1","0","3","2","4","5","6","7","8","9","10","11","16"]
*
* @param button0
* @desc PS2コントローラ:×
* @default {"buttonName":"B","action":""}
* @type struct<ButtonInfo>
* @parent buttons
*
* @param button1
* @desc PS2コントローラ:〇
* @type struct<ButtonInfo>
* @default {"buttonName":"A","action":""}
* @parent buttons
*
* @param button2
* @desc PS2コントローラ:□
* @type struct<ButtonInfo>
* @default {"buttonName":"Y","action":""}
* @parent buttons
*
* @param button3
* @desc PS2コントローラ:△
* @type struct<ButtonInfo>
* @default {"buttonName":"X","action":""}
* @parent buttons
*
* @param button4
* @desc PS2コントローラ:L1
* @type struct<ButtonInfo>
* @default {"buttonName":"L1","action":""}
* @parent buttons
*
* @param button5
* @desc PS2コントローラ:R1
* @type struct<ButtonInfo>
* @default {"buttonName":"R1","action":""}
* @parent buttons
*
* @param button6
* @desc PS2コントローラ:L2
* @type struct<ButtonInfo>
* @default {"buttonName":"L2","action":""}
* @parent buttons
*
* @param button7
* @desc PS2コントローラ:R2
* @type struct<ButtonInfo>
* @default {"buttonName":"R2","action":""}
* @parent buttons
*
* @param button8
* @desc PS2コントローラ:select
* @type struct<ButtonInfo>
* @default {"buttonName":"select","action":""}
* @parent buttons
*
* @param button9
* @desc PS2コントローラ:start
* @type struct<ButtonInfo>
* @default {"buttonName":"start","action":""}
* @parent buttons
*
* @param button10
* @desc PS2コントローラ:左スティック押し込み
* @type struct<ButtonInfo>
* @default {"buttonName":"L push","action":""}
* @parent buttons
*
* @param button11
* @desc PS2コントローラ:右スティック押し込み
* @type struct<ButtonInfo>
* @default {"buttonName":"R push","action":""}
* @parent buttons
*
* @param moveButtons
* @desc 十字キーをコンフィグ範囲に含めます。
* 自動的に上下左右が必須ボタンに追加されます。
* @type boolean
* @default false
*
* @param button12
* @desc 上キー/UP_BUTTON
* @type struct<ButtonInfo>
* @default {"buttonName":"UP","action":""}
* @parent moveButtons
*
* @param textUp
* @desc 上ボタンの説明
* @default ↑
* @parent moveButtons
*
* @param button13
* @desc 下キー/DOWN_BUTTON
* @type struct<ButtonInfo>
* @default {"buttonName":"DOWN","action":""}
* @parent moveButtons
*
* @param textDown
* @desc 下ボタンの説明
* Description of ok's function
* @default ↓
* @parent moveButtons
*
* @param button14
* @desc 左キー/LEFT_BUTTON
* @type struct<ButtonInfo>
* @default {"buttonName":"LEFT","action":""}
* @parent moveButtons
*
* @param textLeft
* @desc 左の説明
* @default ←
* @parent moveButtons
*
* @param button15
* @desc 右キー/RIGHT_BUTTON
* @type struct<ButtonInfo>
* @default {"buttonName":"RIGHT","action":""}
* @parent moveButtons
*
* @param textRight
* @desc 右の説明
* @default →
* @parent moveButtons
*
* @param button16
* @desc PS2コントローラ:
* @type struct<ButtonInfo>
* @default {"buttonName":"button16","action":""}
* @parent buttons
* @param button_unknow
*
* @param CommandDefaultWidth
* @type number
* @min 1
* @default 4
* @parent CommandWidth
*
* @param CommandApplyWidth
* @type number
* @min 1
* @default 4
* @parent CommandWidth
*
* @param CommandLayoutWidth
* @type number
* @min 1
* @default 3
* @parent CommandWidth
*
* @param CommandExitWidth
* @type number
* @min 1
* @default 3
* @parent CommandWidth
*
* @param CommandWASD_Width
* @type number
* @min 1
* @default 4
* @parent CommandWidth
*
* @param gamepadConfigPositionMode
* @text ゲームパッドコンフィグの位置
* @desc ウィンドウの位置
* @type select
* @option 中央
* @value center
* @option 数値指定
* @value custom
* @default center
*
* @param gamepadConfigPositionX
* @desc ウィンドウのX座標です。
* @type number
* @default 100
* @parent gamepadConfigPositionMode
*
* @param gamepadConfigPositionY
* @desc ウィンドウのY座標です。
* @type number
* @default 100
* @parent gamepadConfigPositionMode
*
* @param gamepadSymbolPositionMode
* @text シンボルリストの位置
* @desc ウィンドウの位置
* @option 右
* @value right
* @type select
* @option 中央
* @value center
* @default right
*
* @param gamepadWindowItemWitdh
* @desc 描画領域です。
* ウィンドウのサイズはこれ*cols+paddingになります。
* @type number
* @default 260
*
* @param numVisibleRows
* @desc 表示する縦方向の要素数です
* @type number
* @default 16
*
* @param cols
* @desc ゲームパッドコンフィグの横方向の要素数です
* @type number
* @min 1
* @default 2
*
* @param textKeyUp
* @desc キーコンフィグの上キーの表示名です
* @default ↑
*
* @param textKeyDown
* @desc キーコンフィグの下キーの表示名です
* @default ↓
*
* @param textKeyRight
* @desc キーコンフィグの右キーの表示名です
* @default →
*
* @param textKeyLeft
* @desc キーコンフィグの左キーの表示名です
* @default ←
*
* @param symbolWindowWidth
* @desc シンボルの種類を選択するウィンドウの幅
* @type number
* @default 148
*
* @param symbolAutoSelect
* @desc キーに対応するシンボルを切り替えるときに、
* そのキーに設定されているシンボルへ自動でカーソルを合わせます。
* @type boolean
* @on シンボルに合わせる
* @off 先頭に合わせる
* @default true
*
* @param gamepadConfigEnabled
* @desc ゲームパッドコンフィグの有効化設定です
* @type boolean
* @default true
*
* @param keyboardConfigEnabled
* @desc キーボードコンフィグの有効化設定です
* @type boolean
* @default true
*
* @param commandName
* @desc ゲームパッドコンフィグを開くコマンドの名前です
* @type string
* @default ゲームパッドコンフィグ
*
* @param keyconfigCommandName
* @desc キーコンフィグを開くコマンドの名前です
* @type string
* @default キーコンフィグ
*
*
*
* @help
* ゲームの起動時の設定をデフォルト値として読み込みます。
* プラグインの導入位置に関わらず、入力の変更を検知します。
* 他のプラグインでボタンが改造されていてもOKです。
*
* このプラグインで設定したコンフィグデータは、ファイルに記録されます。
* 新しいプラグインを入れた場合、
* ゲーム起動後にコンフィグを「初期設定に戻す」でリセットしてください。
*
* ■extendSymbols
* 定義することで、新たなアクションを定義できます。
* ここにKeyと入力した場合、Input.isPressed('Key')で入力を取得できます。
* symbolsに登録するのを忘れないようにしてください。
* 他のプラグインによって追加された入力(アクション・Symbol)を調べる場合、
* キーコンフィグを開いて、そこにある小さい文字を見てコピーしてください。
* (大文字・小文字を間違えないように)
*
* ■symbolsについて
* ボタン選択画面で決定を押した後の一覧で表示する順番を定義します。
* 「不明なシンボルの自動取り込み」を有効にしておくと、プラグイン側が適当に一覧に追加します。
* 表示が仮の物になりますので、書き換えて調整してください。
* unknow:xxxのような表示になります。
*
* ■mandatorySymbolsについて
* ゲームを操作するうえで、必須となるボタンの一覧です。
* 決定や取り消しの設定を変更してゲームが動かなくなると困るので、
* 一部のボタンが欠けている状態では設定の保存ができません。
* 初期設定では決定・取り消し・メニューの3つが割り当てられています。
*
* ゲームパッドでは比較的問題が少ないのですが、
* キーボードだと問題が発生します。
* insertキーは、一部のPCでは機能しづらいです。
*
* ■ボタンの第2パラメータ・actionについて
* 本来はsymbolになるはずだったデータです。
* デフォルトの設定に加えて、
* ここに設定した内容を上書きで追加した物が初期設定になります。
*
* ■新規シンボルの設定について
* ゲーム固有の操作を設定する場合、ここで行います。
* たとえば弾を発射するshotというシンボルを新たに設定したいとします。
* この場合textSymbol6で「シンボルの説明」を設定します。
* 次にextendSymbol6に「shot」と入力します。
* 次にsymbolsにshotを追加します。
* ゲーム中常に使うのであれば、mandatorySymbolsにも追加します。
* これをすべて終えれば、input.pressed('shot')などで
* 入力状態を取得できるようになります。
*
* シンボルの大文字・小文字が間違っていると動かないので注意。
* シンボルを調べる場合、プラグインを開いてCTRL+Fで「input」を検索すると見つかります。
*
* ■スクリプトで遷移を制御したい場合
* 他のプラグインを改造したり、スクリプトで直接シーンを切り替える時に使います。
* SceneManager.push(Mano_InputConfig.Scene_GamepadConfig ); //ゲームパッドコンフィグ
* SceneManager.push(Mano_InputConfig.Scene_KeyConfig ); // キーボードコンフィグ
* これで、指定されたシーンに移動できます。
*
* 更新履歴
* 2020/08/23 ver4.0
* ツクールMZに対応。
* 基本システムはMZ向けに最適化し、MVはラッパーで調整
*
* 2020/05/25 ver 3.2
* YEP_OptionCoreと競合するので、対策処理を追加。
*
* 2020/04/01 ver 3.1
* 英語対応につきヘルプを追加。
*
* 2020/03/14 ver3.0
* WASD移動を設定できる機能を追加。
* キーコンフィグの内部実装を大幅改造。
*
* 2020/02/26 ver2.9
* コンフィグから抜けた際にボタンが連打されてしまう問題を対策。
* RPGアツマールにおいて、他のゲームとコンフィグ設定が混ざる問題を修正。
* 別プラグインとの競合があったので対策
* symbolAutoSelectがキーコンフィグで機能していなかったのを修正。
*
* 2019/07/12 ver2.81
* ゲームパッドのハードごとの識別情報を表示する機能を追加。
*
* 2019/07/06 ver2.8
* 外部プラグインによって追加されたmapperのsymbolを強制的に取り込む機能。
* プラグインパラメータで無効化できます。
*
* 2019/03/19 ver2.7
* キーボードに任意の初期設定を割り当てる機能を追加。
*
* 2018/09/28 ver2.6
* ゲームパッドコンフィグを改造すると誤作動があったので、誤作動を減らす改造。
* また、プラグインの位置に関わらず入力の変更を捕まえられるように。
*
* 2018/06/25 ver 2.5
* 色々あった細かいバグ修正を重ねた最新版。
*
* 2017/10/21 ver 2.2 更新
* 外部から追加したシンボルがsymbolsと重複していた場合、追加しないようにした。
* USキー配列に仮対応。
*
* 2017/10/18 ver 2.1 更新
* キーボードで目立ったバグの報告がなかったため、2.0に。
* 外部からコンフィグを改造できる機能を導入。
*
* 2017/10/13 ver 1.9 更新
* キーボードのコンフィグにも対応。
* 仕様が固まっていないので、1.9とします。
* 2017/10/05 ver 1.0 公開
*
*/