/*:
* @plugindesc Displays detailed statuses of enemies.
* @author Yoji Ojima
*
* @param Unknown Data
* @desc The index name for an unknown enemy.
* @default ??????
*
* @help
*
* Plugin Command:
* EnemyBook open # Open the enemy book screen
* EnemyBook add 3 # Add enemy #3 to the enemy book
* EnemyBook remove 4 # Remove enemy #4 from the enemy book
* EnemyBook complete # Complete the enemy book
* EnemyBook clear # Clear the enemy book
*
* Enemy Note:
* <desc1:foobar> # Description text in the enemy book, line 1
* <desc2:blahblah> # Description text in the enemy book, line 2
* <book:no> # This enemy does not appear in the enemy book
*/
Window_EnemyBookIndex.prototype.updateStatus = function() {
if (this._statusWindow) {
var enemy = this._list[this.index()];
this._statusWindow.setEnemy(enemy);
}
};
Window_EnemyBookIndex.prototype.drawItem = function(index) {
var enemy = this._list[index];
var rect = this.itemRectForText(index);
var name;
if ($gameSystem.isInEnemyBook(enemy)) {
name = enemy.name;
} else {
name = unknownData;
}
this.drawText(name, rect.x, rect.y, rect.width);
};
x = this.textPadding();
y = lineHeight + this.textPadding();
for (var i = 0; i < 8; i++) {
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(i), x, y, 160);
this.resetTextColor();
this.drawText(enemy.params, x + 160, y, 60, 'right');
y += lineHeight;
}
var rewardsWidth = 280;
x = this.contents.width - rewardsWidth;
y = lineHeight + this.textPadding();
this.resetTextColor();
this.drawText(enemy.exp, x, y);
x += this.textWidth(enemy.exp) + 6;
this.changeTextColor(this.systemColor());
this.drawText(TextManager.expA, x, y);
x += this.textWidth(TextManager.expA + ' ');
x = this.contents.width - rewardsWidth;
y += lineHeight;
for (var j = 0; j < enemy.dropItems.length; j++) {
var di = enemy.dropItems[j];
if (di.kind > 0) {
var item = Game_Enemy.prototype.itemObject(di.kind, di.dataId);
this.drawItemName(item, x, y, rewardsWidth);
y += lineHeight;
}
}
var descWidth = 480;
x = this.contents.width - descWidth;
y = this.textPadding() + lineHeight * 7;
this.drawTextEx(enemy.meta.desc1, x, y + lineHeight * 0, descWidth);
this.drawTextEx(enemy.meta.desc2, x, y + lineHeight * 1, descWidth);
};
这个与上面的Window_EnemyBookIndex比较类似,它的initialize是初始化了一些图片参数,refresh就是设定了一些显示信息时的格式,其中的clear会清空这个窗口,然后重新画新的信息,它本质上就是一个更新窗口的方法。作者又向update中添加了一些对显示的图片的参数,这样每次更新画面时都会让显示的图片大小合适。