var _Scene_Menu_create = Scene_Menu.prototype.create;
Scene_Menu.prototype.create = function() {
_Scene_Menu_create.call(this);
//创建自定义窗口,并将它加入主菜单界面
this._tipsWindow = new Window_Tips(0, 0);
this._tipsWindow.y = this._commandWindow.y + this._commandWindow.height + 5; //设置自定义窗口的Y坐标,由左上部的菜单命令窗口的Y轴坐标及其高度来决定
this.addWindow(this._tipsWindow);
};
function Window_Tips() {
this.initialize.apply(this, arguments);
}
Window_Tips.prototype = Object.create(Window_Base.prototype);
Window_Tips.prototype.constructor = Window_Tips;
Window_Tips.prototype.initialize = function(x, y) {
var width = this.windowWidth();
var height = this.windowHeight();
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.refresh();
};
Window_Tips.prototype.windowWidth = function() {
return 240; //自定义窗口的宽度
};
Window_Tips.prototype.windowHeight = function() {
return this.fittingHeight(4); //自定义窗口的高度:通过设定窗口要容纳的行数来自动计算高度
};
Window_Tips.prototype.refresh = function() {
var x = this.textPadding();
var width = this.contents.width - this.textPadding() * 2;
this.contents.clear();
//在这里绘制需要显示的内容
this.drawIcon(191, 0, 0);
this.drawTextEx("新的任务", 40, 0);
this.drawTextEx("找到老王头,拿\n到红色宝箱。", 0, 40);
};
Window_Tips.prototype.open = function() {
this.refresh();
Window_Base.prototype.open.call(this);
};