I have 2 windows: Window_EquipmentWeapon and Window_WeaponSlot in the same scene: Scene_Equipment.
How do i make something like this, when
Window_EquipmentWeapon.prototype.processOk function run, I want to refresh the Window_WeaponSlot too?
How do i make something like this, when
Window_EquipmentWeapon.prototype.processOk function run, I want to refresh the Window_WeaponSlot too?
JavaScript:
Scene_Equipment.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
const rect = new Rectangle(333,333,500,500);
this._windowEquipment = new Window_EquipmentWeapon(rect);
this.addWindow(this._windowEquipment)
this._windowEquipment.activate();
this._windowEquipment.setHandler("ok", this.command1.bind(this));
const rect2 = new Rectangle(111,111,110,110)
this._weaponSlot = new Window_WeaponSlot(rect2);
this.addWindow(this._weaponSlot);
this._weaponSlot.activate();
}
Window_EquipmentWeapon.prototype.initialize = function (rect) {
Window_Selectable.prototype.initialize.call(this, rect);
this.refresh();
}
Window_EquipmentWeapon.prototype.drawItem = function (index) {
var itemRect = this.itemRect(index);
if (!isNaN(index)&&index<=$gameParty.weapons().length-1)
{
let weapon = []
weapon[index] = ImageManager.loadPicture('equip/'+$gameParty.weapons()[index].meta.icon);
weapon[index].addLoadListener(() => {
this.contents.blt(weapon[index], 0, 0, 50, 50, itemRect.x - 4, itemRect.y);
})
}
}
Window_EquipmentWeapon.prototype.processOk = function() {
this.callOkHandler();
console.log(this._index);
$gameParty.members()[AzIndex].changeEquip(0, $dataWeapons[$gameParty.weapons()[this._index].id]);
this.refresh();
};
Window_WeaponSlot.prototype.initialize = function (rect) {
Window_Selectable.prototype.initialize.call(this, rect);
if ($gameParty.members()[AzIndex]._equips[0]._itemId != 0)
{
this.addChildAt(new Sprite(ImageManager.loadPicture('equip/'+$dataWeapons[$gameParty.members()[AzIndex]._equips[0]._itemId].meta.icon)), 4)
}
this.refresh();
}