/*:
* @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();
};