安卓返回键脚本
rpgmakermv吧
全部回复
仅看楼主
level 1
有一个致命问题,用电脑测试的时候,解除按键触发事件会直接卡死。没用手机测试过,谁来解决下。感激不尽。脚本如下
2017年04月24日 05点04分 1
level 1
超过5000字,妈蛋
2017年04月24日 05点04分 2
兄弟,这个插件和yep战斗插件冲突,用了返回键就没yep的战斗动画了
2018年01月18日 12点01分
level 1
//高级菜单
//通过blubberblubb
//日期:12/19/2015
var Imported = Imported || {};
Imported.AdvancedMenus = "1.0.1";
// 许可证请阅读:
// ====================
//
// 版权(C)2015 blubberblubb(rpgmakerweb.com论坛)
//
// 这个软件是“按原样”提供的,没有任何明示或默示
// 保修。 在任何事件将作者承担任何赔偿
// 起源于这个软件的使用。
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgement in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//===========================================================================
2017年04月24日 05点04分 3
level 1
/*:
* @plugindesc 1.0.1高级菜单解决无数的细节与鼠标/触控导航 id:AdvancedMenus
*
* @param Add back buttons to common menus
* @desc Alter common menus to include "Back..." buttons. Disable if you use any plugin that does intrusive modifications to the ingame menu
* @default true
*
* @author blubberblubb
*/
(function() {
var parameters = $plugins.filter(function(p){return p.description.contains(
"id:AdvancedMenus")})[0].parameters;
var back_buttons = Boolean((parameters['Add back buttons to common menus']
=== 'true') || false);
AdvancedMenus = function() {
throw("this is a static class");
}
AdvancedMenus.menuSoundsMuted = false;
// ---- SPECIFIC MENUS EXPANDED TO HAVE A BACK BUTTON (IF ENABLED) ----
if (back_buttons) {
// Window_ItemCategory "Back..." button:
Window_ItemCategory.prototype._preAdvancedMenus_makeCommandList =
Window_ItemCategory.prototype.makeCommandList;
Window_ItemCategory.prototype.makeCommandList = function() {
// Detect if we are inside a shop. If yes, don't add "Back...":
var is_shop = false;
var windows = AdvancedMenus.listOfWindows();
for (var j = 0; j < windows.length; j++) {
if (Window_ShopCommand.prototype.isPrototypeOf(windows[j])) {
is_shop = true;
break;
}
}
// Add if not a shop:
if (!is_shop) {
this.addCommand("返回", 'cancel');
}
this._preAdvancedMenus_makeCommandList();
};
// Make room for back button in Window_ItemCategory:
Window_ItemCategory.prototype._preAdvancedMenus_maxCols =
Window_ItemCategory.prototype.maxCols;
Window_ItemCategory.prototype.maxCols = function() {
// Detect if we are inside a shop. If yes, nothing needs to be added:
var is_shop = false;
var windows = AdvancedMenus.listOfWindows();
for (var j = 0; j < windows.length; j++) {
if (Window_ShopCommand.prototype.isPrototypeOf(windows[j])) {
is_shop = true;
break;
}
}
if (is_shop) {
return this._preAdvancedMenus_maxCols();
} else {
return this._preAdvancedMenus_maxCols() + 1;
}
};
// Window_SkillType "Back..." button:
Window_SkillType.prototype._preAdvancedMenus_makeCommandList =
Window_SkillType.prototype.makeCommandList;
Window_SkillType.prototype.makeCommandList = function() {
if (this._actor) {
this.addCommand("返回", 'cancel');
}
this._preAdvancedMenus_makeCommandList();
};
2017年04月24日 05点04分 4
level 1
// Main command list "Back..." button:
Window_MenuCommand.prototype._preAdvancedMenus_makeCommandList =
Window_MenuCommand.prototype.makeCommandList;
Window_MenuCommand.prototype.makeCommandList = function() {
this.addCommand("返回", 'cancel', true);
this._preAdvancedMenus_makeCommandList();
};
// Window_EquipCommand "Back..." button:
Window_EquipCommand.prototype._preAdvancedMenus_makeCommandList =
Window_EquipCommand.prototype.makeCommandList;
Window_EquipCommand.prototype.makeCommandList = function() {
this.addCommand("返回", 'cancel');
this._preAdvancedMenus_makeCommandList();
};
// Note: no need to make room for back button in Window_EquipCommand,
// since we remove the "Equip" button later
// Make down/up go from Window_EquipCommand to Window_EquipSlot
Window_EquipCommand.prototype._preAdvancedMenus_cursorDown =
Window_EquipCommand.prototype.cursorDown;
Window_EquipCommand.prototype.cursorDown = function() {
this.select(-1);
SoundManager.playCursor();
this.updateInputData();
this.deactivate();
SceneManager._scene.commandEquip();
}
Window_EquipCommand.prototype._preAdvancedMenus_cursorUp =
Window_EquipCommand.prototype.cursorUp;
Window_EquipCommand.prototype.cursorUp = function() {
this.select(-1);
SoundManager.playCursor();
this.updateInputData();
this.deactivate();
SceneManager._scene.commandEquip();
// make sure last item is selected in Window_EquipSlot:
var windows = AdvancedMenus.listOfWindows();
for (var j = 0; j < windows.length; j++) {
if (Window_EquipSlot.prototype.isPrototypeOf(windows[j])) {
windows[j].select(windows[j].maxItems() - 1);
windows[j].refresh();
break;
}
}
}
2017年04月24日 05点04分 5
level 1
// SELL: if we find an active item category menu, back out and done
for (var j = 0; j < windows.length; j++) {
if (Window_ItemCategory.prototype.isPrototypeOf(windows[j]) &&
windows[j].active && windows[j].visible) {
windows[j].processCancel();
return true;
}
}
return false;
}
// Allow changing skill category while in the skill details list:
Window_SkillType.prototype._activateWhenOutOfFocus = function() {
// If skill list is open and Window_MenuActor is active, we are in the
// item use target selection -> back out
var windows = AdvancedMenus.listOfWindows();
var inSkillList = false;
for (var j = 0; j < windows.length; j++) {
if (Window_SkillList.prototype.isPrototypeOf(windows[j]) &&
windows[j].visible) {
inSkillList = true;
}
}
if (inSkillList) {
for (var j = 0; j < windows.length; j++) {
if (Window_MenuActor.prototype.isPrototypeOf(windows[j]) &&
windows[j].active && windows[j].visible) {
windows[j].processCancel();
windows[j].select(-1);
windows[j].deactivate();
break;
}
}
}
// Back out of SkillList when active:
var windows = AdvancedMenus.listOfWindows();
for (var j = 0; j < windows.length; j++) {
if (Window_SkillList.prototype.isPrototypeOf(windows[j]) &&
windows[j].active && windows[j].visible) {
windows[j].processCancel();
return true;
}
}
return false;
}
// Allow changing game menu category while Window_MenuStatus selection active:
Window_MenuCommand.prototype._activateWhenOutOfFocus = function() {
var windows = AdvancedMenus.listOfWindows();
for (var j = 0; j < windows.length; j++) {
if (Window_MenuStatus.prototype.isPrototypeOf(windows[j]) &&
windows[j].visible && windows[j].active) {
windows[j].processCancel();
return true;
}
}
return false;
}
// Allow changing ItemCategory while the ItemList is active:
Window_ItemCategory.prototype._activateWhenOutOfFocus = function() {
// If item list is open and Window_MenuActor is active, we are in the
// item use target selection -> back out, but only if clicking
// at the left-most button.
var x = this.canvasToLocalX(TouchInput.x);
var y = this.canvasToLocalY(TouchInput.y);
var hitIndex = this.hitTest(x, y);
if (hitIndex == 0) {
var windows = AdvancedMenus.listOfWindows();
var inItemList = false;
for (var j = 0; j < windows.length; j++) {
if (Window_ItemList.prototype.isPrototypeOf(windows[j]) &&
windows[j].visible) {
inItemList = true;
}
}
if (inItemList) {
for (var j = 0; j < windows.length; j++) {
if (Window_MenuActor.prototype.isPrototypeOf(windows[j]) &&
windows[j].active && windows[j].visible) {
windows[j].processCancel();
windows[j].select(-1);
windows[j].deactivate();
break;
}
}
}
}
// Make sure the item use target choice isn't open:
var windows = AdvancedMenus.listOfWindows();
for (var j = 0; j < windows.length; j++) {
if (Window_MenuActor.prototype.isPrototypeOf(windows[j]) &&
windows[j].visible) {
return false;
}
}
// Close item list so we can change category:
for (var j = 0; j < windows.length; j++) {
if (Window_ItemList.prototype.isPrototypeOf(windows[j])
&& windows[j].active && windows[j].visible) {
windows[j].processCancel();
return true;
}
}
return false;
}
// Fix the displayed item help sometimes getting surprised by our changes:
Window_ItemCategory.prototype.processTouch = function() {
Window_Selectable.prototype.processTouch.apply(this, []);
// make sure the item help display follows our changes:
var windows = AdvancedMenus.listOfWindows();
for (var j = 0; j < windows.length; j++) {
if (Window_ItemList.prototype.isPrototypeOf(windows[j])) {
windows[j].updateHelp();
}
}
}
// Fix the displayed menu help sometimes getting surprised by our changes:
Window_SkillType.prototype.processTouch = function() {
Window_Selectable.prototype.processTouch.apply(this, []);
// make sure the item help display follows our changes:
var windows = AdvancedMenus.listOfWindows();
for (var j = 0; j < windows.length; j++) {
if (Window_SkillList.prototype.isPrototypeOf(windows[j])
&& windows[j].visible && windows[j].active) {
windows[j].updateHelp();
}
}
}
// ---- GENERAL CODE FOR ONE-CLICK NAVIGATION AND INACTIVE INTERACTION ----
// Allow activating menus that aren't active if this._activateWhenOutOfFocus
// is defined on them:
Window_Selectable.prototype.processTouch = function() {
if (this.isOpenAndActive() ||
typeof(this._activateWhenOutOfFocus) != "undefined") {
if (TouchInput.isTriggered() && this.isTouchedInsideFrame()) {
this._touching = true;
this.onTouch(true);
} else if (TouchInput.isCancelled()) {
if (this.isCancelEnabled() && this.isOpenAndActive()) {
this.processCancel();
}
}
if (this._touching) {
if (TouchInput.isPressed()) {
this.onTouch(false);
} else {
this._touching = false;
}
}
} else {
this._touching = false;
}
};
// Allow confirming menus with just one mouse click and possibly to click
// when menu is inactive:
Window_Selectable.prototype.onTouch = function(triggered) {
var lastIndex = this.index();
var x = this.canvasToLocalX(TouchInput.x);
var y = this.canvasToLocalY(TouchInput.y);
var hitIndex = this.hitTest(x, y);
var self = this;
var menuHasSelectInfo = function() {
if (Window_EquipItem.prototype.isPrototypeOf(self)) {
return true;
}
if (Window_SkillList.prototype.isPrototypeOf(self)) {
return true;
}
if (Window_ItemList.prototype.isPrototypeOf(self)) {
return true;
}
return false;
}
var tryActivate = function() {
if (self.isOpenAndActive()) {
// console.log("tryActivate: ALLOW IN FOCUS");
return true;
}
AdvancedMenus.menuSoundsMuted = true;
if (typeof(self._activateWhenOutOfFocus) != "undefined"
&& self._activateWhenOutOfFocus()) {
AdvancedMenus.menuSoundsMuted = false;
// console.log("tryActivate: ALLOW OUT OF FOCUS");
return true;
}
AdvancedMenus.menuSoundsMuted = false;
// console.log("tryActivate: DISALLOW");
return false;
}
if (hitIndex >= 0) {
if (hitIndex === this.index()) {
if (triggered && this.isTouchOkEnabled()) {
if (tryActivate()) {
this.processOk();
return;
}
}
} else if (this.isCursorMovable() ||
typeof(this._activateWhenOutOfFocus) != "undefined") {
if (!tryActivate()) {
return;
}
this.select(hitIndex);
// Allow direct click unless it matches a few well-known menus
// with per-selection descriptions:
if (!menuHasSelectInfo()) {
if (triggered && this.isTouchOkEnabled()) {
this.processOk();
}
}
}
} else if (this._stayCount >= 10) {
if (y < this.padding) {
if (tryActivate()) {
this.cursorUp();
}
} else if (y >= this.height - this.padding) {
if (tryActivate()) {
this.cursorDown();
}
}
}
if (this.index() !== lastIndex) {
SoundManager.playCursor();
}
};
})();
2017年04月24日 05点04分 9
level 1
中间又被吃了
2017年04月24日 06点04分 10
level 1
链接: https://pan .baidu.com/s/1eSoXhAi 密码: kppi
2017年04月24日 06点04分 11
level 1
大佬,请问您写的rpgmakerMV返回菜单在游戏中与对话框冲突,如何用脚本指令关闭返回
2019年03月02日 05点03分 12
我也是在提问。。。。。。。。。。。
2019年03月02日 14点03分
1