你需要先写好脚本,将之前的3行代码插入自动换行的脚本后面,/*: * @plugindesc 使RPG Maker MV能够自动换行。 * @author 小优【66RPG:rpg-sheep】【百度贴吧:优加星爱兔子】 * * @help * 实现自动换行小功能。 */ Window_Selectable.prototype.processNormalCharacter = Window_Base.prototype.processNormalCharacter; Window_Base.prototype.processNormalCharacter = function(textState) { var c = textState.text[textState.index]; var w = this.textWidth(c); if (this.width - 2 * this.standardPadding() - textState.x >= w){ this.contents.drawText(c, textState.x, textState.y, w * 2, textState.height); textState.index++; textState.x += w; }else{ this.processNewLine(textState); textState.index--; this.processNormalCharacter(textState); } }; Window_Help.prototype.fittingHeight = function(numLines) { return 2.5*numLines * this.lineHeight() + this.standardPadding() * 2; };
/*:
* @plugindesc 使RPG Maker MV能够自动换行。
* @author 小优【66RPG:rpg-sheep】【百度贴吧:优加星爱兔子】
*
* @help
* 实现自动换行小功能。
*/
Window_Selectable.prototype.processNormalCharacter = Window_Base.prototype.processNormalCharacter;
Window_Base.prototype.processNormalCharacter = function(textState) {
var c = textState.text[textState.index];
var w = this.textWidth(c);
if (this.width - 2 * this.standardPadding() - textState.x >= w){
this.contents.drawText(c, textState.x, textState.y, w * 2, textState.height);
textState.index++;
textState.x += w;
}else{
this.processNewLine(textState);
textState.index--;
this.processNormalCharacter(textState);
}
};
Window_Help.prototype.fittingHeight = function(numLines) {
return 2.5*numLines * this.lineHeight() + this.standardPadding() * 2;
};
|