- Сообщений: 7
- Спасибо получено: 3
RPG MV. Весь экран в активных клавишах.
6 года 3 нед. назад #116295
от BisSorld
BisSorld создал тему: RPG MV. Весь экран в активных клавишах.
Здравствуйте
Вообщем проблема такая:
1) С помощью плагина YEP_PictureCommonEvents я сделал активную картинку для общего события.
2) От другого плагина идёт удар при нажатии на клавишу С на клавиатуре.
3) Как сделать, чтобы при нажатии картинки на экране происходило событие будто нажали на клавишу С на клавиатуре?
Очень буду благодарен за помощь, т.к. скорее всего это скрип, а в js я ноль
Вообщем проблема такая:1) С помощью плагина YEP_PictureCommonEvents я сделал активную картинку для общего события.
2) От другого плагина идёт удар при нажатии на клавишу С на клавиатуре.
3) Как сделать, чтобы при нажатии картинки на экране происходило событие будто нажали на клавишу С на клавиатуре?
Очень буду благодарен за помощь, т.к. скорее всего это скрип, а в js я ноль
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
6 года 3 нед. назад #116296
от BisSorld
BisSorld ответил в теме RPG MV. Весь экран в активных клавишах.
В YEP_PictureCommonEvents, есть описанные события через доп. модуль только для:
MovePlayer Down
MovePlayer Left
MovePlayer Right
MovePlayer Up
TriggerButton Ok
TriggerButton Cancel
TriggerButton Dash
TriggerButton PageUp
TriggerButton PageDown
TriggerButton Left
TriggerButton Up
TriggerButton Right
TriggerButton Down
А мне необходима клавиша "С", но как вызвать ее информации нет
TriggerButton С и TriggerButton 67, не работает
я разбирался как мог
MovePlayer Down
MovePlayer Left
MovePlayer Right
MovePlayer Up
TriggerButton Ok
TriggerButton Cancel
TriggerButton Dash
TriggerButton PageUp
TriggerButton PageDown
TriggerButton Left
TriggerButton Up
TriggerButton Right
TriggerButton Down
А мне необходима клавиша "С", но как вызвать ее информации нет

TriggerButton С и TriggerButton 67, не работает
я разбирался как мог
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
6 года 3 нед. назад #116297
от BisSorld
BisSorld ответил в теме RPG MV. Весь экран в активных клавишах.
Game_Interpreter.prototype.triggerButton = function(args) {
if (!args) return;
var button = args[0].toLowerCase();
if (button === 'cancel') button = 'escape';
if (button === 'dash') button = 'shift';
Input._latestButton = button;
Input._pressedTime = 0;
};
я так понимаю добавлять что-то надо здесь?
if (!args) return;
var button = args[0].toLowerCase();
if (button === 'cancel') button = 'escape';
if (button === 'dash') button = 'shift';
Input._latestButton = button;
Input._pressedTime = 0;
};
я так понимаю добавлять что-то надо здесь?
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
6 года 3 нед. назад #116299
от BisSorld
BisSorld ответил в теме RPG MV. Весь экран в активных клавишах.
Вот как то так

ВНИМАНИЕ: Спойлер!
Yanfly.makePictureCommonEventSettings = function(a, b) {
Yanfly.PCE.Trigger = [null];
Yanfly.PCE.Repeated = [null];
Yanfly.PCE.Pressed = [null];
Yanfly.PCE.Released = [null];
for (var i = a; i < b + 1; ++i) {
var param = 'Picture ' + i + ' Click';
var value = Number(Yanfly.Parameters[param]);
Yanfly.PCE.Trigger.push(value);
var param = 'Picture ' + i + ' Repeat';
var value = Number(Yanfly.Parameters[param]);
Yanfly.PCE.Repeated.push(value);
var param = 'Picture ' + i + ' Hold';
var value = Number(Yanfly.Parameters[param]);
Yanfly.PCE.Pressed.push(value);
var param = 'Picture ' + i + ' Release';
var value = Number(Yanfly.Parameters[param]);
Yanfly.PCE.Released.push(value);
}
};
Yanfly.Parameters = PluginManager.parameters('YEP_PictureCommonEvents');
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.PCEMove = eval(String(Yanfly.Parameters));
Yanfly.Param.PCEHideMsg = eval(String(Yanfly.Parameters));
Yanfly.makePictureCommonEventSettings(1, 100);
//=============================================================================
// Game_System
//=============================================================================
Yanfly.PCE.Game_System_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
Yanfly.PCE.Game_System_initialize.call(this);
this.initPCESettings();
};
Game_System.prototype.initPCESettings = function() {
this._touchMovement = Yanfly.Param.PCEMove;
this._hidePceMsg = Yanfly.Param.PCEHideMsg;
this._hidePceAll = false;
};
Game_System.prototype.isTouchMoveEnabled = function() {
if (this._touchMovement === undefined) this.initPCESettings();
return this._touchMovement;
};
Game_System.prototype.setTouchMoveEnabled = function(value) {
if (this._touchMovement === undefined) this.initPCESettings();
this._touchMovement = value;
};
Game_System.prototype.isPictureHiddenDuringMessage = function() {
if (this._hidePceMsg === undefined) this.initPCESettings();
return this._hidePceMsg;
};
Game_System.prototype.setPictureHiddenDuringMessage = function(value) {
if (this._hidePceMsg === undefined) this.initPCESettings();
this._hidePceMsg = value;
};
Game_System.prototype.isPictureHidden = function() {
if (this._hidePceAll === undefined) this.initPCESettings();
return this._hidePceAll;
};
Game_System.prototype.setPictureHidden = function(value) {
if (this._hidePceAll === undefined) this.initPCESettings();
this._hidePceAll = value;
};
//=============================================================================
// Game_Interpreter
//=============================================================================
Yanfly.PCE.Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
Yanfly.PCE.Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'EnableTouchMove') {
$gameSystem.setTouchMoveEnabled(true);
} else if (command === 'DisableTouchMove') {
$gameSystem.setTouchMoveEnabled(false);
} else if (command === 'MovePlayer') {
this.pictureCommonEventsMove(args);
} else if (command === 'HidePictureCommonEvents') {
$gameSystem.setPictureHidden(true);
} else if (command === 'ShowPictureCommonEvents') {
$gameSystem.setPictureHidden(false);
} else if (command === 'TriggerButton') {
this.triggerButton(args)
}
};
Game_Interpreter.prototype.pictureCommonEventsMove = function(args) {
var dir = args[0];
if (dir.match(/down/i)) {
$gamePlayer.moveByPictureCommonEvent(2);
} else if (dir.match(/left/i)) {
$gamePlayer.moveByPictureCommonEvent(4);
} else if (dir.match(/right/i)) {
$gamePlayer.moveByPictureCommonEvent(6);
} else if (dir.match(/up/i)) {
$gamePlayer.moveByPictureCommonEvent(
;
}
};
Game_Interpreter.prototype.triggerButton = function(args) {
if (!args) return;
var button = args[0].toLowerCase();
if (button === 'cancel') button = 'escape';
if (button === 'dash') button = 'shift';
Input._latestButton = button;
Input._pressedTime = 0;
};
//=============================================================================
// Game_Player
//=============================================================================
Game_Player.prototype.moveByPictureCommonEvent = function(direction) {
if (!this.isMoving() && this.canMove() && direction > 0) {
Input._dir4 = direction;
}
};
Yanfly.PCE.Game_Player_canMove = Game_Player.prototype.canMove;
Game_Player.prototype.canMove = function() {
if ($gameMap.isEventRunning() && $gameMap.moveAfterCommonEvent()) {
return true;
}
return Yanfly.PCE.Game_Player_canMove.call(this);
};
//=============================================================================
// Game_Map
//=============================================================================
Yanfly.PCE.Game_Map_isEventRunning = Game_Map.prototype.isEventRunning;
Game_Map.prototype.isEventRunning = function() {
if ($gameTemp._commonEventId > 0) return true;
return Yanfly.PCE.Game_Map_isEventRunning.call(this);
};
Game_Map.prototype.moveAfterCommonEvent = function() {
var interpreter = $gameMap._interpreter;
if (!interpreter._list) return false;
if (interpreter.eventId() > 0) return false;
var list = interpreter._list;
if ($gameTemp.destinationX() === $gamePlayer.x &&
$gameTemp.destinationY() === $gamePlayer.y) {
$gameTemp.clearDestination();
}
for (var i = 0; i < list.length; ++i) {
var code = list.code;
if ([201, 205, 230, 232, 261, 301].contains(code)) return false;
}
return true;
};
//=============================================================================
// Game_Picture
//=============================================================================
Game_Picture.prototype.isTriggered = function() {
if (!SceneManager._scene instanceof Scene_Map) return false;
if (this.opacity() <= 0) return false;
var sp = SceneManager._scene.getPictureSprite(this);
if (!sp) return false;
var mx = this.getLocalTouchInputX();
var my = this.getLocalTouchInputY();
//console.log('click: ' + mx + ', ' + my);
var rect = this.getSpriteRect(sp);
return mx >= rect.x &&
my >= rect.y &&
mx < (rect.x + rect.width) &&
my < (rect.y + rect.height);
};
Game_Picture.prototype.pictureId = function() {
return $gameScreen._pictures.indexOf(this);
};
Game_Picture.prototype.getLocalTouchInputX = function() {
value = TouchInput.x;
return value;
};
Game_Picture.prototype.getLocalTouchInputY = function() {
value = TouchInput.y;
return value;
};
Game_Picture.prototype.getSpriteRect = function(sp) {
var width = sp.width * Math.abs(sp.scale.x);
var height = sp.height * Math.abs(sp.scale.y);
var x = sp.x - (sp.anchor.x * width);
var y = sp.y - (sp.anchor.y * height);
if (sp.anchor.x === 0 && sp.scale.x < 0) x += sp.width * sp.scale.x;
if (sp.anchor.y === 0 && sp.scale.y < 0) y += sp.height * sp.scale.y;
//console.log('rect: ' + x + ', ' + y + ', ' + width + ', ' + height);
return new Rectangle(x, y, width, height);
};
Game_Picture.prototype.isRelatedPictureCommonEvent = function() {
$gameTemp._pictureCommonEvents = $gameTemp._pictureCommonEvents || [];
if ($gameTemp._pictureCommonEvents[this.pictureId()]) {
return $gameTemp._pictureCommonEvents[this.pictureId()];
}
if (Yanfly.PCE.Trigger[this.pictureId()]) {
$gameTemp._pictureCommonEvents[this.pictureId()] = true;
} else if (Yanfly.PCE.Repeated[this.pictureId()]) {
$gameTemp._pictureCommonEvents[this.pictureId()] = true;
} else if (Yanfly.PCE.Pressed[this.pictureId()]) {
$gameTemp._pictureCommonEvents[this.pictureId()] = true;
} else if (Yanfly.PCE.Released[this.pictureId()]) {
$gameTemp._pictureCommonEvents[this.pictureId()] = true;
} else {
$gameTemp._pictureCommonEvents[this.pictureId()] = false;
}
return $gameTemp._pictureCommonEvents[this.pictureId()];
};
Yanfly.PCE.Game_Picture_opacity = Game_Picture.prototype.opacity;
Game_Picture.prototype.opacity = function() {
if ($gameSystem.isPictureHidden()) return 0;
if ($gameMessage.isBusy() && this.isRelatedPictureCommonEvent()) {
if ($gameSystem.isPictureHiddenDuringMessage()) return 0;
}
return Yanfly.PCE.Game_Picture_opacity.call(this);
};
//=============================================================================
// Spriteset_Base
//=============================================================================
Yanfly.PCE.Spriteset_Base_createPictures =
Spriteset_Base.prototype.createPictures;
Spriteset_Base.prototype.createPictures = function() {
var scene = SceneManager._scene;
if (scene instanceof Scene_Map) {
this.createSceneMapPictures();
} else {
Yanfly.PCE.Spriteset_Base_createPictures.call(this);
}
};
Spriteset_Base.prototype.createSceneMapPictures = function() {
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
var x = (Graphics.width - width) / 2;
var y = (Graphics.height - height) / 2;
this._pictureContainer = new Sprite();
this._pictureContainer.setFrame(x, y, width, height);
for (var i = 1; i <= $gameScreen.maxPictures(); i++) {
var picture = new Sprite_Picture(i);
if (picture.isRelatedPictureCommonEvent()) {
SceneManager._scene.addPictureCommonEvent(picture);
} else {
this._pictureContainer.addChild(picture);
}
}
this.addChild(this._pictureContainer);
};
//=============================================================================
// Sprite_Picture
//=============================================================================
Yanfly.PCE.Sprite_Picture_loadBitmap = Sprite_Picture.prototype.loadBitmap;
Sprite_Picture.prototype.loadBitmap = function() {
Yanfly.PCE.Sprite_Picture_loadBitmap.call(this);
SceneManager._scene.bindPictureSprite(this._pictureId, this);
};
Sprite_Picture.prototype.isRelatedPictureCommonEvent = function() {
if (Yanfly.PCE.Trigger[this._pictureId]) return true;
if (Yanfly.PCE.Repeated[this._pictureId]) return true;
if (Yanfly.PCE.Pressed[this._pictureId]) return true;
if (Yanfly.PCE.Released[this._pictureId]) return true;
return false;
};
//=============================================================================
// Scene_Base
//=============================================================================
Scene_Base.prototype.bindPictureSprite = function(picture, sprite) {
};
//=============================================================================
// Scene_Map
//=============================================================================
Yanfly.PCE.Scene_Map_createSpriteset = Scene_Map.prototype.createSpriteset;
Scene_Map.prototype.createSpriteset = function() {
this._pictureCommonEvents = [];
Yanfly.PCE.Scene_Map_createSpriteset.call(this);
this.addPictureCommonEventChildren();
};
Scene_Map.prototype.addPictureCommonEvent = function(picture) {
this._pictureCommonEvents.push(picture);
};
Scene_Map.prototype.addPictureCommonEventChildren = function() {
var length = this._pictureCommonEvents.length;
for (var i = 0; i < length; ++i) {
var picture = this._pictureCommonEvents;
this.addChild(picture);
}
};
Scene_Map.prototype.bindPictureSprite = function(picture, sprite) {
this._pictureCommonEventsBind = this._pictureCommonEventsBind || {};
this._pictureCommonEventsBind[picture] = sprite;
};
Scene_Map.prototype.getPictureSprite = function(picture) {
this._pictureCommonEventsBind = this._pictureCommonEventsBind || {};
return this._pictureCommonEventsBind[picture.pictureId()];
};
Yanfly.PCE.Scene_Map_processMapTouch = Scene_Map.prototype.processMapTouch;
Scene_Map.prototype.processMapTouch = function() {
this.updatePictureEvents();
if (this.allowProcessMapTouch()) {
Yanfly.PCE.Scene_Map_processMapTouch.call(this);
}
};
Scene_Map.prototype.allowProcessMapTouch = function() {
if (SceneManager.isSceneChanging()) return false;
if ($gameMap.isEventRunning()) return false;
if ($gameTemp.isCommonEventReserved()) return false;
return $gameSystem.isTouchMoveEnabled();
};
Scene_Map.prototype.updatePictureEvents = function() {
if (TouchInput.isTriggered()) {
this.updatePictureEventCheck(Yanfly.PCE.Trigger);
}
if (TouchInput.isRepeated()) {
this.updatePictureEventCheck(Yanfly.PCE.Repeated);
}
if (TouchInput.isPressed()) {
this.updatePictureEventCheck(Yanfly.PCE.Pressed);
}
if (TouchInput.isReleased()) {
this.updatePictureEventCheck(Yanfly.PCE.Released);
}
};
Scene_Map.prototype.updatePictureEventCheck = function(check) {
if (SceneManager.isSceneChanging()) return;
if ($gameMap.isEventRunning()) return;
var picture = this.getTriggeredPictureCommonEvent(check);
if (!picture) return;
$gameTemp.reserveCommonEvent(check[picture.pictureId()]);
$gameTemp.clearDestination();
};
Scene_Map.prototype.getTriggeredPictureCommonEvent = function(check) {
var length = check.length;
var lastpicture = null;
for (var i = 1; i < length; ++i) {
var picture = $gameScreen.picture(i);
if (!check) continue;
if (!picture) continue;
var rect = picture.getSpriteRect(this.getPictureSprite(picture));
lastpicture = picture;
if (picture.isTriggered()) return picture;
}
return null;
};
Yanfly.PCE.Scene_Map_isMenuCalled = Scene_Map.prototype.isMenuCalled;
Scene_Map.prototype.isMenuCalled = function() {
if ($gameSystem.isTouchMoveEnabled()) {
return Yanfly.PCE.Scene_Map_isMenuCalled.call(this);
} else {
return Input.isTriggered('menu');
}
};
Yanfly.PCE.Trigger = [null];
Yanfly.PCE.Repeated = [null];
Yanfly.PCE.Pressed = [null];
Yanfly.PCE.Released = [null];
for (var i = a; i < b + 1; ++i) {
var param = 'Picture ' + i + ' Click';
var value = Number(Yanfly.Parameters[param]);
Yanfly.PCE.Trigger.push(value);
var param = 'Picture ' + i + ' Repeat';
var value = Number(Yanfly.Parameters[param]);
Yanfly.PCE.Repeated.push(value);
var param = 'Picture ' + i + ' Hold';
var value = Number(Yanfly.Parameters[param]);
Yanfly.PCE.Pressed.push(value);
var param = 'Picture ' + i + ' Release';
var value = Number(Yanfly.Parameters[param]);
Yanfly.PCE.Released.push(value);
}
};
Yanfly.Parameters = PluginManager.parameters('YEP_PictureCommonEvents');
Yanfly.Param = Yanfly.Param || {};
Yanfly.Param.PCEMove = eval(String(Yanfly.Parameters));
Yanfly.Param.PCEHideMsg = eval(String(Yanfly.Parameters));
Yanfly.makePictureCommonEventSettings(1, 100);
//=============================================================================
// Game_System
//=============================================================================
Yanfly.PCE.Game_System_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
Yanfly.PCE.Game_System_initialize.call(this);
this.initPCESettings();
};
Game_System.prototype.initPCESettings = function() {
this._touchMovement = Yanfly.Param.PCEMove;
this._hidePceMsg = Yanfly.Param.PCEHideMsg;
this._hidePceAll = false;
};
Game_System.prototype.isTouchMoveEnabled = function() {
if (this._touchMovement === undefined) this.initPCESettings();
return this._touchMovement;
};
Game_System.prototype.setTouchMoveEnabled = function(value) {
if (this._touchMovement === undefined) this.initPCESettings();
this._touchMovement = value;
};
Game_System.prototype.isPictureHiddenDuringMessage = function() {
if (this._hidePceMsg === undefined) this.initPCESettings();
return this._hidePceMsg;
};
Game_System.prototype.setPictureHiddenDuringMessage = function(value) {
if (this._hidePceMsg === undefined) this.initPCESettings();
this._hidePceMsg = value;
};
Game_System.prototype.isPictureHidden = function() {
if (this._hidePceAll === undefined) this.initPCESettings();
return this._hidePceAll;
};
Game_System.prototype.setPictureHidden = function(value) {
if (this._hidePceAll === undefined) this.initPCESettings();
this._hidePceAll = value;
};
//=============================================================================
// Game_Interpreter
//=============================================================================
Yanfly.PCE.Game_Interpreter_pluginCommand =
Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
Yanfly.PCE.Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'EnableTouchMove') {
$gameSystem.setTouchMoveEnabled(true);
} else if (command === 'DisableTouchMove') {
$gameSystem.setTouchMoveEnabled(false);
} else if (command === 'MovePlayer') {
this.pictureCommonEventsMove(args);
} else if (command === 'HidePictureCommonEvents') {
$gameSystem.setPictureHidden(true);
} else if (command === 'ShowPictureCommonEvents') {
$gameSystem.setPictureHidden(false);
} else if (command === 'TriggerButton') {
this.triggerButton(args)
}
};
Game_Interpreter.prototype.pictureCommonEventsMove = function(args) {
var dir = args[0];
if (dir.match(/down/i)) {
$gamePlayer.moveByPictureCommonEvent(2);
} else if (dir.match(/left/i)) {
$gamePlayer.moveByPictureCommonEvent(4);
} else if (dir.match(/right/i)) {
$gamePlayer.moveByPictureCommonEvent(6);
} else if (dir.match(/up/i)) {
$gamePlayer.moveByPictureCommonEvent(
;}
};
Game_Interpreter.prototype.triggerButton = function(args) {
if (!args) return;
var button = args[0].toLowerCase();
if (button === 'cancel') button = 'escape';
if (button === 'dash') button = 'shift';
Input._latestButton = button;
Input._pressedTime = 0;
};
//=============================================================================
// Game_Player
//=============================================================================
Game_Player.prototype.moveByPictureCommonEvent = function(direction) {
if (!this.isMoving() && this.canMove() && direction > 0) {
Input._dir4 = direction;
}
};
Yanfly.PCE.Game_Player_canMove = Game_Player.prototype.canMove;
Game_Player.prototype.canMove = function() {
if ($gameMap.isEventRunning() && $gameMap.moveAfterCommonEvent()) {
return true;
}
return Yanfly.PCE.Game_Player_canMove.call(this);
};
//=============================================================================
// Game_Map
//=============================================================================
Yanfly.PCE.Game_Map_isEventRunning = Game_Map.prototype.isEventRunning;
Game_Map.prototype.isEventRunning = function() {
if ($gameTemp._commonEventId > 0) return true;
return Yanfly.PCE.Game_Map_isEventRunning.call(this);
};
Game_Map.prototype.moveAfterCommonEvent = function() {
var interpreter = $gameMap._interpreter;
if (!interpreter._list) return false;
if (interpreter.eventId() > 0) return false;
var list = interpreter._list;
if ($gameTemp.destinationX() === $gamePlayer.x &&
$gameTemp.destinationY() === $gamePlayer.y) {
$gameTemp.clearDestination();
}
for (var i = 0; i < list.length; ++i) {
var code = list.code;
if ([201, 205, 230, 232, 261, 301].contains(code)) return false;
}
return true;
};
//=============================================================================
// Game_Picture
//=============================================================================
Game_Picture.prototype.isTriggered = function() {
if (!SceneManager._scene instanceof Scene_Map) return false;
if (this.opacity() <= 0) return false;
var sp = SceneManager._scene.getPictureSprite(this);
if (!sp) return false;
var mx = this.getLocalTouchInputX();
var my = this.getLocalTouchInputY();
//console.log('click: ' + mx + ', ' + my);
var rect = this.getSpriteRect(sp);
return mx >= rect.x &&
my >= rect.y &&
mx < (rect.x + rect.width) &&
my < (rect.y + rect.height);
};
Game_Picture.prototype.pictureId = function() {
return $gameScreen._pictures.indexOf(this);
};
Game_Picture.prototype.getLocalTouchInputX = function() {
value = TouchInput.x;
return value;
};
Game_Picture.prototype.getLocalTouchInputY = function() {
value = TouchInput.y;
return value;
};
Game_Picture.prototype.getSpriteRect = function(sp) {
var width = sp.width * Math.abs(sp.scale.x);
var height = sp.height * Math.abs(sp.scale.y);
var x = sp.x - (sp.anchor.x * width);
var y = sp.y - (sp.anchor.y * height);
if (sp.anchor.x === 0 && sp.scale.x < 0) x += sp.width * sp.scale.x;
if (sp.anchor.y === 0 && sp.scale.y < 0) y += sp.height * sp.scale.y;
//console.log('rect: ' + x + ', ' + y + ', ' + width + ', ' + height);
return new Rectangle(x, y, width, height);
};
Game_Picture.prototype.isRelatedPictureCommonEvent = function() {
$gameTemp._pictureCommonEvents = $gameTemp._pictureCommonEvents || [];
if ($gameTemp._pictureCommonEvents[this.pictureId()]) {
return $gameTemp._pictureCommonEvents[this.pictureId()];
}
if (Yanfly.PCE.Trigger[this.pictureId()]) {
$gameTemp._pictureCommonEvents[this.pictureId()] = true;
} else if (Yanfly.PCE.Repeated[this.pictureId()]) {
$gameTemp._pictureCommonEvents[this.pictureId()] = true;
} else if (Yanfly.PCE.Pressed[this.pictureId()]) {
$gameTemp._pictureCommonEvents[this.pictureId()] = true;
} else if (Yanfly.PCE.Released[this.pictureId()]) {
$gameTemp._pictureCommonEvents[this.pictureId()] = true;
} else {
$gameTemp._pictureCommonEvents[this.pictureId()] = false;
}
return $gameTemp._pictureCommonEvents[this.pictureId()];
};
Yanfly.PCE.Game_Picture_opacity = Game_Picture.prototype.opacity;
Game_Picture.prototype.opacity = function() {
if ($gameSystem.isPictureHidden()) return 0;
if ($gameMessage.isBusy() && this.isRelatedPictureCommonEvent()) {
if ($gameSystem.isPictureHiddenDuringMessage()) return 0;
}
return Yanfly.PCE.Game_Picture_opacity.call(this);
};
//=============================================================================
// Spriteset_Base
//=============================================================================
Yanfly.PCE.Spriteset_Base_createPictures =
Spriteset_Base.prototype.createPictures;
Spriteset_Base.prototype.createPictures = function() {
var scene = SceneManager._scene;
if (scene instanceof Scene_Map) {
this.createSceneMapPictures();
} else {
Yanfly.PCE.Spriteset_Base_createPictures.call(this);
}
};
Spriteset_Base.prototype.createSceneMapPictures = function() {
var width = Graphics.boxWidth;
var height = Graphics.boxHeight;
var x = (Graphics.width - width) / 2;
var y = (Graphics.height - height) / 2;
this._pictureContainer = new Sprite();
this._pictureContainer.setFrame(x, y, width, height);
for (var i = 1; i <= $gameScreen.maxPictures(); i++) {
var picture = new Sprite_Picture(i);
if (picture.isRelatedPictureCommonEvent()) {
SceneManager._scene.addPictureCommonEvent(picture);
} else {
this._pictureContainer.addChild(picture);
}
}
this.addChild(this._pictureContainer);
};
//=============================================================================
// Sprite_Picture
//=============================================================================
Yanfly.PCE.Sprite_Picture_loadBitmap = Sprite_Picture.prototype.loadBitmap;
Sprite_Picture.prototype.loadBitmap = function() {
Yanfly.PCE.Sprite_Picture_loadBitmap.call(this);
SceneManager._scene.bindPictureSprite(this._pictureId, this);
};
Sprite_Picture.prototype.isRelatedPictureCommonEvent = function() {
if (Yanfly.PCE.Trigger[this._pictureId]) return true;
if (Yanfly.PCE.Repeated[this._pictureId]) return true;
if (Yanfly.PCE.Pressed[this._pictureId]) return true;
if (Yanfly.PCE.Released[this._pictureId]) return true;
return false;
};
//=============================================================================
// Scene_Base
//=============================================================================
Scene_Base.prototype.bindPictureSprite = function(picture, sprite) {
};
//=============================================================================
// Scene_Map
//=============================================================================
Yanfly.PCE.Scene_Map_createSpriteset = Scene_Map.prototype.createSpriteset;
Scene_Map.prototype.createSpriteset = function() {
this._pictureCommonEvents = [];
Yanfly.PCE.Scene_Map_createSpriteset.call(this);
this.addPictureCommonEventChildren();
};
Scene_Map.prototype.addPictureCommonEvent = function(picture) {
this._pictureCommonEvents.push(picture);
};
Scene_Map.prototype.addPictureCommonEventChildren = function() {
var length = this._pictureCommonEvents.length;
for (var i = 0; i < length; ++i) {
var picture = this._pictureCommonEvents;
this.addChild(picture);
}
};
Scene_Map.prototype.bindPictureSprite = function(picture, sprite) {
this._pictureCommonEventsBind = this._pictureCommonEventsBind || {};
this._pictureCommonEventsBind[picture] = sprite;
};
Scene_Map.prototype.getPictureSprite = function(picture) {
this._pictureCommonEventsBind = this._pictureCommonEventsBind || {};
return this._pictureCommonEventsBind[picture.pictureId()];
};
Yanfly.PCE.Scene_Map_processMapTouch = Scene_Map.prototype.processMapTouch;
Scene_Map.prototype.processMapTouch = function() {
this.updatePictureEvents();
if (this.allowProcessMapTouch()) {
Yanfly.PCE.Scene_Map_processMapTouch.call(this);
}
};
Scene_Map.prototype.allowProcessMapTouch = function() {
if (SceneManager.isSceneChanging()) return false;
if ($gameMap.isEventRunning()) return false;
if ($gameTemp.isCommonEventReserved()) return false;
return $gameSystem.isTouchMoveEnabled();
};
Scene_Map.prototype.updatePictureEvents = function() {
if (TouchInput.isTriggered()) {
this.updatePictureEventCheck(Yanfly.PCE.Trigger);
}
if (TouchInput.isRepeated()) {
this.updatePictureEventCheck(Yanfly.PCE.Repeated);
}
if (TouchInput.isPressed()) {
this.updatePictureEventCheck(Yanfly.PCE.Pressed);
}
if (TouchInput.isReleased()) {
this.updatePictureEventCheck(Yanfly.PCE.Released);
}
};
Scene_Map.prototype.updatePictureEventCheck = function(check) {
if (SceneManager.isSceneChanging()) return;
if ($gameMap.isEventRunning()) return;
var picture = this.getTriggeredPictureCommonEvent(check);
if (!picture) return;
$gameTemp.reserveCommonEvent(check[picture.pictureId()]);
$gameTemp.clearDestination();
};
Scene_Map.prototype.getTriggeredPictureCommonEvent = function(check) {
var length = check.length;
var lastpicture = null;
for (var i = 1; i < length; ++i) {
var picture = $gameScreen.picture(i);
if (!check) continue;
if (!picture) continue;
var rect = picture.getSpriteRect(this.getPictureSprite(picture));
lastpicture = picture;
if (picture.isTriggered()) return picture;
}
return null;
};
Yanfly.PCE.Scene_Map_isMenuCalled = Scene_Map.prototype.isMenuCalled;
Scene_Map.prototype.isMenuCalled = function() {
if ($gameSystem.isTouchMoveEnabled()) {
return Yanfly.PCE.Scene_Map_isMenuCalled.call(this);
} else {
return Input.isTriggered('menu');
}
};
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
6 года 3 нед. назад #116302
от BisSorld
BisSorld ответил в теме RPG MV. Весь экран в активных клавишах.
РЕШЕНИЕ ПРОБЛЕМЫ:
Ищем файл rpg_core.js, в нем добавляем в графе Input.keyMapper = {
свою кнопку в моем примере это англ. С, код ее 67 (узнать можно по запросу в гугле javascriptkeycode)
и вставляем далее код:
67: 'c', // tab
После этого в общих событиях к плагину YEP_PictureCommonEvents можно прописать доп.модуль:
TriggerButton C
и всё будет работать
Спасибо yuryol за помощь!
Ищем файл rpg_core.js, в нем добавляем в графе Input.keyMapper = {
свою кнопку в моем примере это англ. С, код ее 67 (узнать можно по запросу в гугле javascriptkeycode)
и вставляем далее код:
67: 'c', // tab
После этого в общих событиях к плагину YEP_PictureCommonEvents можно прописать доп.модуль:
TriggerButton C
и всё будет работать

Спасибо yuryol за помощь!
Спасибо сказали: yuryol, tvorimvsevmeste
Пожалуйста Войти или Регистрация, чтобы присоединиться к беседе.
Время создания страницы: 0.091 секунд
