插件推荐(禁商用)
插件作者:(yang1zhi)
//取消键---------------------------------------------------------
/*:
* @plugindesc 取消键.
* @author 杨志(yang1zhi)
* @help 右上角多个鼠标右键的功能
*
* yangzhi40#hotmail.com
* yangzhi40@hotmail.com
*/
Scene_Map.prototype.isMapTouchOk = function() {
if (this.is_NOmove_window()) {return false}
return this.isActive() && $gamePlayer.canMove();
};
//点击后不会移动的窗口
Scene_Map.prototype.is_NOmove_window = function() {
//ESC窗口
if (SceneManager._scene._escWindow.containsPoint({x: TouchInput.x, y: TouchInput.y})) {return true}
return false
}
ESC_SELECTABLE_UPDATE = Window_Selectable.prototype.update
Window_Selectable.prototype.update = function() {
ESC_SELECTABLE_UPDATE.call(this);
this.CancelCancel(); //取消键
};
Window_Selectable.prototype.CancelCancel = function() {
//不活动的窗口跳过
if (!SceneManager._scene._escWindow) {return}
//不活动的窗口跳过
if (!this.isOpenAndActive()) {return}
//当按下鼠标左键
if (this.isCancelEnabled() && TouchInput.isTriggered('ok')) {
//当鼠标X在取消键范围内
if (SceneManager._scene._escWindow.containsPoint({x: TouchInput.x, y: TouchInput.y})) {
this.processCancel();
}
}
};
ESC_DISPLAYOBJECTS = Scene_Map.prototype.createDisplayObjects
Scene_Map.prototype.createDisplayObjects = function() {
ESC_DISPLAYOBJECTS.call(this);
this.createescWindow(); //ESC键
};
ESC_MENUBASE_SREATE = Scene_MenuBase.prototype.create
Scene_MenuBase.prototype.create = function() {
ESC_MENUBASE_SREATE.call(this);
this.createescWindow(); //ESC键
};
Scene_Base.prototype.createescWindow = function() {
this._escWindow = new Window_esc(779,5,32,32,this.constructor.name);
this.addChild(this._escWindow);
};
Scene_Base.prototype.onESCOk = function() {
//Scene_Map.isActive()
this._escWindow.activate();
if (this.constructor.name == 'Scene_Map') {SceneManager.push(Scene_Menu);}
};
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//显示特效图片----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function Window_esc() {
this.initialize.apply(this, arguments);
}
Window_esc.prototype = Object.create(Sprite.prototype);
Window_esc.prototype.constructor = Window_esc;
Window_esc.prototype.initialize = function(x, y,w,h,name) {
Sprite.prototype.initialize.call(this);
this._sc_name = name
var ww = w || 32
var hh = h || 32
this.move(x,y)
this.contents = new Sprite(new Bitmap(ww, hh));
this.addChild(this.contents);
this.bitmap = ImageManager.loadSystem('ESC');
};
Window_esc.prototype.update = function() {
Sprite.prototype.update.call(this);
//不在地图上跳过
if (this._sc_name != 'Scene_Map') {return}
//当按下鼠标左键
if (TouchInput.isTriggered('ok')) {
//当鼠标X在取消键范围内
if (this.containsPoint({x: TouchInput.x, y: TouchInput.y})) {
//演奏SE
SoundManager.playSystemSound(1);
SceneManager.push(Scene_Menu);
}
}
};
Window_esc.prototype.show = function() {
this.visible = this.contents.visible = true;
};
Window_esc.prototype.hide = function() {
this.visible = this.contents.visible = false;
};
Window_esc.prototype.setAnchor = function (ax, ay) {
this.anchor.x = this.contents.anchor = ax;
this.anchor.y = this.contents.anchor = ay;
};
Window_esc.prototype.clear = function() {
this.contents.bitmap.clear();
};
Window_esc.prototype.drawIcon = function(iconIndex, x, y) {
var bitmap = ImageManager.loadSystem('IconSet');
var sx = iconIndex % 16 * 32;
var sy = Math.floor(iconIndex / 16) * 32;
this.contents.bitmap.blt(bitmap, sx, sy, 32, 32, x, y);
};