-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sbm_KeyPatchForBothLR.js
160 lines (155 loc) · 4.67 KB
/
Sbm_KeyPatchForBothLR.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
===============================================================================
RPG Maker MZ - Sbm KeyPatchForBothLR (1.0.0)
===============================================================================
Copyright (c) 2021 Suib
This software is released under the MIT License.
http://www.opensource.org/licenses/mit-license
===============================================================================
*/
/*:
* @target MZ
* @plugindesc this plugin provides key patch that For both left and right uses.
* @author Suib
* @url https://github.com/suibotsukuiki/RPGMakerMZ/blob/main/Sbm_KeyPatchForBothLR.js
*
* @help Sbm_KeyPatchForBothLR.js
*
* -- Summary --
* this plugin provides key patch that For both left and right uses.
*
* -- Usage --
* It is applied only by installing this plugin.
*
* -- Changes --
* <Keyboard>
* - W : pagedown -> up arrow
* - Alt : control -> alt
* <Numpad>
* - 0 : escape -> shift
* - 2 : down -> cancel
* - 4 : left -> pageup
* - 6 : right -> pagedown
* - 8 : up -> tab
*
* -- Additions --
* <Keyboard>
* - W/A/S/D : up/left/down/right *(arrow)
* - Q/E : pageup/pagedown
* - C : ok
* - R : escape
* - Ins/Del : escape/ok
* - Home/End : ok/escape
* <Numpad>
* - 0/. : shift/control
* - 1/2/3 : ok/cancel/menu
* - 4/6 : pageup/pagedown
* - 5 : escape
* - 8 : tab
* - + : tab
* - - : escape
* <Gamepad>
* - LT : tab
* - RT : control
* - back : escape
* - start : ok
*
* -- Terms of Use --
* Comply with the MIT license agreement.
* http://www.opensource.org/licenses/mit-license
*
*/
/*:ja
* @target MZ
* @plugindesc 左右兼用のキー配置を適用します。
* @author 水部
* @url https://github.com/suibotsukuiki/RPGMakerMZ/blob/main/Sbm_KeyPatchForBothLR.js
*
* @help Sbm_KeyPatchForBothLR.js
*
* 【概要】
* このプラグインは、左右兼用のキー配置を適用します。
* 「WASDキーによる移動」、「テンキーでの基本操作」などの追加改変を含みます。
* 左手で移動、右手で決定/キャンセル。もしくは左手のみでの操作が可能です。
*
* 【使用方法】
* 本プラグインを導入するだけで適用されます。
*
* 【改変内容】
* <キーボード>
* ・W :pagedown → up arrow
* ・Alt :control → alt
* <テンキー>
* ・0 :escape → shift
* ・2 :down → cancel
* ・4 :left → pageup
* ・6 :right → pagedown
* ・8 :up → tab
*
* 【追加内容】
* <キーボード>
* ・W/A/S/D :up/left/down/right *(arrow)
* ・Q/E :pageup/pagedown
* ・C :ok
* ・R :escape
* ・Ins/Del :escape/ok
* ・Home/End :ok/escape
* <テンキー>
* ・0/. :shift/control
* ・1/2/3 :ok/cancel/menu
* ・4/6 :pageup/pagedown
* ・5 :escape
* ・8 :tab
* ・+ :tab
* ・- :escape
* <ゲームパッド>
* ・LT :tab
* ・RT :control
* ・back :escape
* ・start :ok
*
* 【利用規約】
* MITライセンス規約に準じます。
* https://licenses.opensource.jp/MIT/MIT
*
*/
(() => {
'use strict';
// ==============================
// Input
// ==============================
const keyPatch = {
18: "alt", // alt
45: "escape", // insert
46: "ok", // delete
36: "ok", // home
35: "escape", // end
67: "ok", // C
81: "pageup", // Q
69: "pagedown", // E
82: "escape", // R
65: "left", // A
68: "right", // D
83: "down", // S
87: "up", // W
96: "shift", // numpad 0
97: "ok", // numpad 1
98: "cancel", // numpad 2
99: "menu", // numpad 3
100: "pageup", // numpad 4
101: "escape", // numpad 5
102: "pagedown", // numpad 6
104: "tab", // numpad 8
107: "tab", // numpad +
109: "escape", // numpad -
110: "control", // numpad .
}
Object.assign(Input.keyMapper, keyPatch);
const gamepadPatch = {
6: "tab", // LT
7: "control", // RT
8: "escape", // back
9: "ok", // start
}
Object.assign(Input.gamepadMapper, gamepadPatch);
})();