//=============================================================================
/*:
* @plugindesc 装备界面立绘纸娃娃
* @author Joritian
*
* @param 第一层装备类型ID
* @default 1
*
* @param 第二层装备类型ID
* @default 2
*
* @param 第三层装备类型ID
* @default 3
*
* @param 第四层装备类型ID
* @default 4
*
* @help 立绘图片位于"img/player""人物图片文件名为"player.png",若装备ID为 XXX 则对应的文件应命名为"clothes_XXX.png".
*/
//=============================================================================
var parameters = PluginManager.parameters('Scene_Equip');
var equipZ = [
Number(parameters['第四层装备类型ID'] || 4),
Number(parameters['第三层装备类型ID'] || 3),
Number(parameters['第二层装备类型ID'] || 2),
Number(parameters['第一层装备类型ID'] || 1),
];
Scene_Equip.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createPlayerPicture();
this.createHelpWindow();
this.createStatusWindow();
this.createCommandWindow();
this.createSlotWindow();
this.createItemWindow();
this.refreshActor();
};
Scene_Equip.prototype.createStatusWindow = function() {
this._statusWindow = new Window_EquipStatus(180, this._helpWindow.height);
this.addWindow(this._statusWindow);
};
Scene_Equip.prototype.createCommandWindow = function() {
var wx = this._statusWindow.width + 180;
var wy = this._helpWindow.height;
var ww = Graphics.boxWidth - this._statusWindow.width - 180;
this._commandWindow = new Window_EquipCommand(wx, wy, ww);
this._commandWindow.setHelpWindow(this._helpWindow);
this._commandWindow.setHandler('equip', this.commandEquip.bind(this));
this._commandWindow.setHandler('optimize', this.commandOptimize.bind(this));
this._commandWindow.setHandler('clear', this.commandClear.bind(this));
this._commandWindow.setHandler('cancel', this.popScene.bind(this));
this._commandWindow.setHandler('pagedown', this.nextActor.bind(this));
this._commandWindow.setHandler('pageup', this.previousActor.bind(this));
this.addWindow(this._commandWindow);
};
Scene_Equip.prototype.createSlotWindow = function() {
var wx = this._statusWindow.width + 180;
var wy = this._commandWindow.y + this._commandWindow.height;
var ww = Graphics.boxWidth - this._statusWindow.width - 180;
var wh = this._statusWindow.height - this._commandWindow.height;
this._slotWindow = new Window_EquipSlot(wx, wy, ww, wh);
this._slotWindow.setHelpWindow(this._helpWindow);
this._slotWindow.setStatusWindow(this._statusWindow);
this._slotWindow.setHandler('ok', this.onSlotOk.bind(this));
this._slotWindow.setHandler('cancel', this.onSlotCancel.bind(this));
this.addWindow(this._slotWindow);
};
Scene_Equip.prototype.createItemWindow = function() {
var wx = 180;
var wy = this._statusWindow.y + this._statusWindow.height;
var ww = Graphics.boxWidth - 180;
var wh = Graphics.boxHeight - wy;
this._itemWindow = new Window_EquipItem(wx, wy, ww, wh);
this._itemWindow.setHelpWindow(this._helpWindow);
this._itemWindow.setStatusWindow(this._statusWindow);
this._itemWindow.setHandler('ok', this.onItemOk.bind(this));
this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
this._slotWindow.setItemWindow(this._itemWindow);
this.addWindow(this._itemWindow);
};
Scene_Equip.prototype.commandOptimize = function() {
SoundManager.playEquip();
this.actor().optimizeEquipments();
this._statusWindow.refresh();
this._slotWindow.refresh();
this._commandWindow.activate();
this.updateEquipPictrues();
};
Scene_Equip.prototype.commandClear = function() {
SoundManager.playEquip();
this.actor().clearEquipments();
this._statusWindow.refresh();
this._slotWindow.refresh();
this._commandWindow.activate();
this.updateEquipPictrues();
};
Scene_Equip.prototype.onItemOk = function() {
SoundManager.playEquip();
this.actor().changeEquip(this._slotWindow.index(), this._itemWindow.item());
this._slotWindow.activate();
this._slotWindow.refresh();
this._itemWindow.deselect();
this._itemWindow.refresh();
this._statusWindow.refresh();
this.updateEquipPictrues();
};
// TO DO
Scene_Equip.prototype.createPlayerPicture = function() {
this._playerPicture = new Sprite(Bitmap.load("img/player/player.png"));
this._playerPicture.move(30, 150);
this._equipPictrues = new Array();
this.addChild(this._playerPicture);
for(var i = 0; i < 4; i++)
{
this._equipPictrues[i] = new Sprite();
this._equipPictrues[i].move(30, 150);
this.addChild(this._equipPictrues[i]);
}
this.updateEquipPictrues();
}
Scene_Equip.prototype.updateEquipPictrues = function() {
var playerEquips = $gameActors.actor(1).armors();
for(var t = 0; t < 4; t++) {
for(var i = 0; i < 4; i++) {
if (playerEquips[i]) {
if (equipZ[t] == playerEquips[i].etypeId) {
this._equipPictrues[t].bitmap = Bitmap.load("img/player/clothes_" + playerEquips[i].id + ".png");
break;
}
} else {
this._equipPictrues[t].bitmap = ImageManager.loadEmptyBitmap();
}
this._equipPictrues[t].update();
}
}
}