Window_ItemStatus.prototype.drawLargeIcon = function() {
/*
获取物品索引
加载IconSet.png
改为加载,如果需要新的道具也有新的图像,就把
代码index -= this._item.iconIndex > Yanfly.Param.ItemStartingId ?3000 : 0;去掉
img/system/ItemIcon/ I1.png
img/system/ItemIcon/ W1.png
img/system/ItemIcon/ A1.png
原文件地址:var bitmap = ImageManager.loadSystem('IconSet');
*/
var bitmap;
var sx = 0;
var sy = 0;
var index = this._item.id;
var url = 'img/system/ItemIcon/';
var iconIndex = this._item.iconIndex;
var pw = Window_Base._iconWidth;
var ph = Window_Base._iconHeight;
var woaini = 1;
index -= this._item.id > Yanfly.Param.ItemStartingId ? Yanfly.Param.ItemStartingId : 0;
if (DataManager.isItem(this._item)) {
var img = new Image();
img.src= url + 'I' + index +'.png';
img.onload = function() {
bitmap = ImageManager.loadSystemItemIcon('I' + index);
this.aliasDrawLargeIcon(bitmap, sx, sy, pw, ph);
}.bind(this);
img.onerror = function() {
sx = iconIndex % 16 * pw;
sy = Math.floor(iconIndex / 16) * ph;
bitmap = ImageManager.loadSystem('IconSet');
this.aliasDrawLargeIcon(bitmap, sx, sy, pw, ph);
}.bind(this);
}
if (DataManager.isWeapon(this._item)) {
var img = new Image();
img.src= url + 'W' + index +'.png';
img.onload = function() {
bitmap = ImageManager.loadSystemItemIcon('W' + index);
this.aliasDrawLargeIcon(bitmap, sx, sy, pw, ph);
}.bind(this);
img.onerror = function() {
bitmap = ImageManager.loadSystem('IconSet');
sx = iconIndex % 16 * pw;
sy = Math.floor(iconIndex / 16) * ph;
this.aliasDrawLargeIcon(bitmap, sx, sy, pw, ph);
}.bind(this);
}
if (DataManager.isArmor(this._item)) {
var img = new Image();
img.src= url + 'A' + index +'.png';
img.onload = function() {
bitmap = ImageManager.loadSystemItemIcon('A' + index);
this.aliasDrawLargeIcon(bitmap, sx, sy, pw, ph);
}.bind(this);
img.onerror = function() {
bitmap = ImageManager.loadSystem('IconSet');
sx = iconIndex % 16 * pw;
sy = Math.floor(iconIndex / 16) * ph;
this.aliasDrawLargeIcon(bitmap, sx, sy, pw, ph);
}.bind(this);
}
if (DataManager.isSkill(this._item)) {
var img = new Image();
img.src= url + 'S' + index +'.png';
img.onload = function() {
bitmap = ImageManager.loadSystemItemIcon('S' + index);
this.aliasDrawLargeIcon(bitmap, sx, sy, pw, ph);
}.bind(this);
img.onerror = function() {
bitmap = ImageManager.loadSystem('IconSet');
sx = iconIndex % 16 * pw;
sy = Math.floor(iconIndex / 16) * ph;
this.aliasDrawLargeIcon(bitmap, sx, sy, pw, ph);
}.bind(this);
}
};
Window_ItemStatus.prototype.aliasDrawLargeIcon = function(bitmap, sx, sy, pw, ph) {
var dw = Yanfly.Param.ItemIconSize;
var dh = Yanfly.Param.ItemIconSize;
var dx = (Window_Base._faceWidth - dw) / 2;
var dy = (Window_Base._faceHeight - dh) / 2;
this.contents._context.imageSmoothingEnabled = false;
if (!bitmap.isReady()){
bitmap.addLoadListener(function() {
this.contents.blt(bitmap, sx, sy, pw, ph, dx, dy, dw, dh);
}.bind(this));
} else {
this.contents.blt(bitmap, sx, sy, pw, ph, dx, dy, dw, dh);
}
this.contents._context.imageSmoothingEnabled = true;
}