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
| //=============================================================================
// ManageGamePad.js
//=============================================================================
/*:
* @plugindesc Activate and desactivate the gamepad during the game !
* @author Oniromancie "rpg-maker.fr"
*
* @help Ce plugin detecte l'entrée et la sortie d'une map pour activer et désactiver le gamepad
*/
// ---------------------------------------------------------------------------------------------
// overload the stop method to manage the gamepad
Scene_Map.prototype.oldStart = Scene_Map.prototype.start;
Scene_Map.prototype.start = function() {
window.alert("start");
// show the gamepad
showGamePad();
// Launch command module 'EnableTouchMove'
var myInterpreter = new Game_Interpreter()
myInterpreter.pluginCommand('EnableTouchMove', [])
// call the correct start methode
this.oldStart();
};
// ---------------------------------------------------------------------------------------------
// overload the stop method to manage the gamepad
Scene_Map.prototype.oldStop = Scene_Map.prototype.stop;
Scene_Map.prototype.stop = function() {
window.alert("stop");
// hide the gamepad
hideGamePad();
// Launch command module 'DisableTouchMove'
var myInterpreter = new Game_Interpreter()
myInterpreter.pluginCommand('DisableTouchMove', [])
// call the correct stop methode
this.oldStop();
};
// ---------------------------------------------------------------------------------------------
// function which show a set of picture
function showGamePad() {
window.alert("on affiche le gamepad");
// set of picture to manipulate
var picIdList = [1, 2, 3, 4, 5, 6, 7];
// loop through picture and hide them
for (var i = 0; i < picIdList.length; i++) {
var pidId = picIdList[i];
var picture = $gameScreen.picture(pidId);
if (picture) {
// special treatment for the picture 6 (dashing control)
if (ConfigManager.alwaysDash && pidId == 6) {
picture._opacity = 180;
} else {
picture._opacity = 130;
}
}
}
};
// ---------------------------------------------------------------------------------------------
// function which hide a set of picture
function hideGamePad() {
window.alert("on cache le gamepad");
// set of picture to manipulate
var picIdList = [1, 2, 3, 4, 5, 6, 7];
// loop through picture and hide them
for (let i = 0; i < picIdList.length; i++) {
var pidId = picIdList[i];
var picture = $gameScreen.picture(pidId);
if (picture) {
picture._opacity = 0;
}
}
}; |