-
Notifications
You must be signed in to change notification settings - Fork 3
/
DP_DetectiveMode.js
133 lines (109 loc) · 4.52 KB
/
DP_DetectiveMode.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
//=============================================================================
// drowsepost Plugins - Detective Mode Plugin
// DP_DetectiveMode.js
// Version: 0.1
// canotun
//=============================================================================
var Imported = Imported || {};
Imported.DP_DetectiveMode = true;
//=============================================================================
/*:
* @plugindesc イベントをタップして直接実行できるようにします ver 0.1
* @author drowsepost
*
* @param Switch Number
* @desc このプラグインのオンオフを切り替えるスイッチID
* Default: 3
* @default 3
*
* @param Stop Trigger Input
* @desc 有効時ボタンデバイスによる隣接イベントの実行をストップするか
* Default: true
* @default true
*
* @param Stop Move Tap
* @desc 有効時タップ操作をストップするか
* Default: true
* @default true
*
* @param Stop Move
* @desc 有効時プレイヤーの移動をすべてキャンセルするか
* Default: false
* @default false
*
* @help
* 指定したスイッチID(Switch Number)がオンのとき、
* イベントをクリックすると移動できる出来ないに関わらず直接イベントを実行します。
* 「決定キー」をそのイベントに対して押したのと同じ振る舞いになります。
*
* ===
* このプラグインは試作品です。
* いくつかのプライベートプロパティーを参照しているため、
* 今後の本体アップデートで動作しなくなる可能性があります。
* ご利用によって生じたいかなる問題の責任も負いかねます。
* ===
*
* ライセンス: MIT
*
*/
(function() {
"use strict";
var parameters = PluginManager.parameters('DP_DetectiveMode');
var user_switch = Number(parameters['Switch Number'] || 3);
var user_stop = Boolean(parameters['Stop Move'] === 'true' || false);
var user_stop_tap_move = Boolean(parameters['Stop Move Tap'] === 'true' || false);
var user_stop_input = Boolean(parameters['Stop Trigger Input'] === 'true' || false);
var isDirectMode = (function(){
return $gameSwitches.value(user_switch);
});
var startEventOnMap = (function(x, y){
/*
指定座標のイベントを実行
*/
var isFind = false;
if (!$gamePlayer.canStartLocalEvents()) return;
if ($gameMap.isEventRunning()) return;
$gameMap.eventsXy(x, y).forEach(function(event) {
console.log('find event', event);
if (event.isTriggerIn([0])) {
//event.isNormalPriority();←「通常キャラクターと同じ」であるかどうかを返します。
event.start();
isFind = true;
}
});
return isFind;
});
var _Game_Player_moveByInput = Game_Player.prototype.moveByInput;
Game_Player.prototype.moveByInput = function() {
if(isDirectMode() && user_stop) return;
_Game_Player_moveByInput.call(this);
};
var _Game_Player_triggerButtonAction = Game_Player.prototype.triggerButtonAction;
Game_Player.prototype.triggerButtonAction = function() {
if(isDirectMode() && user_stop_input) return false;
return _Game_Player_triggerButtonAction.call(this);
};
var _Game_Player_triggerTouchAction = Game_Player.prototype.triggerTouchAction;
Game_Player.prototype.triggerTouchAction = function() {
if(isDirectMode() && user_stop_tap_move) return false;
return _Game_Player_triggerTouchAction.call(this);
};
var _Scene_Map_processMapTouch = Scene_Map.prototype.processMapTouch;
Scene_Map.prototype.processMapTouch = function() {
(function(_self){
/*
マップがタッチされたら座標を取り出してイベント実行
*/
if(!isDirectMode()) return;
if (!TouchInput.isTriggered() && _self._touchCount <= 0) return;
if (!TouchInput.isPressed()) return;
if (_self._touchCount !== 0 && _self._touchCount > 5) return;
var x = $gameMap.canvasToMapX(TouchInput.x);
var y = $gameMap.canvasToMapY(TouchInput.y);
startEventOnMap(x, y);
}(this));
if(!(isDirectMode() && user_stop_tap_move)) {
_Scene_Map_processMapTouch.call(this);
}
};
}());