//温馨提示:满足以下2个条件的商店开启仅出售: //1.商店处理列表不添加任何商品; //2.商店不勾选[只能购买]选项。 var _JCSWindow_ShopCommand_maxCols = Window_ShopCommand.prototype.maxCols; Window_ShopCommand.prototype.maxCols = function() { return SceneManager._scene.isJinChuShou()?1:_JCSWindow_ShopCommand_maxCols.call(this); }; var _JCSWindow_ShopCommand_makeCommandList = Window_ShopCommand.prototype.makeCommandList; Window_ShopCommand.prototype.makeCommandList = function() { if (SceneManager._scene.isJinChuShou()) { this.addCommand('本商店仅允许出售', 'sell'); } else { _JCSWindow_ShopCommand_makeCommandList.call(this); }; }; var _JCSScene_Shop_create = Scene_Shop.prototype.create; Scene_Shop.prototype.create = function() { _JCSScene_Shop_create.call(this); if (this.isJinChuShou()) { this._commandWindow.refresh(); this._commandWindow.deactivate(); this.commandSell(); } }; var _JCSScene_Shop_onCategoryCancel = Scene_Shop.prototype.onCategoryCancel; Scene_Shop.prototype.onCategoryCancel = function() { _JCSScene_Shop_onCategoryCancel.call(this); if (this.isJinChuShou()) this.popScene(); }; Scene_Shop.prototype.isJinChuShou = function() { var w = this._buyWindow; return !this._purchaseOnly && w && w.maxItems()<=1 && !w._data[0]; };
//温馨提示:满足以下2个条件的商店开启仅出售:
//1.商店处理列表不添加任何商品;
//2.商店不勾选[只能购买]选项。
var _JCSWindow_ShopCommand_maxCols = Window_ShopCommand.prototype.maxCols;
Window_ShopCommand.prototype.maxCols = function() {
return SceneManager._scene.isJinChuShou()?1:_JCSWindow_ShopCommand_maxCols.call(this);
};
var _JCSWindow_ShopCommand_makeCommandList = Window_ShopCommand.prototype.makeCommandList;
Window_ShopCommand.prototype.makeCommandList = function() {
if (SceneManager._scene.isJinChuShou()) {
this.addCommand('本商店仅允许出售', 'sell');
} else {
_JCSWindow_ShopCommand_makeCommandList.call(this);
};
};
var _JCSScene_Shop_create = Scene_Shop.prototype.create;
Scene_Shop.prototype.create = function() {
_JCSScene_Shop_create.call(this);
if (this.isJinChuShou()) {
this._commandWindow.refresh();
this._commandWindow.deactivate();
this.commandSell();
}
};
var _JCSScene_Shop_onCategoryCancel = Scene_Shop.prototype.onCategoryCancel;
Scene_Shop.prototype.onCategoryCancel = function() {
_JCSScene_Shop_onCategoryCancel.call(this);
if (this.isJinChuShou()) this.popScene();
};
Scene_Shop.prototype.isJinChuShou = function() {
var w = this._buyWindow;
return !this._purchaseOnly && w && w.maxItems()<=1 && !w._data[0];
};
【效果展示】
【使用说明】
·将上述代码复制粘贴至任意插件的最下面;
·使满足2个条件的商店仅允许出售。
????????随手写的,希望对你有所帮助。 |