| 
本帖最后由 雷影 于 2023-4-13 10:41 编辑
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  
 在网上找到的一个教学的代码?想进一步修改一下显示文字的内容.
 想法1:显示队伍角色的简介内容(用来显示人物基本背景信息)
 想法2:关联到公共事件中,显示公共事件里的文本(公共事件里倒是可以自己写用变量+条件分支来显示当前游戏进度的对话文本以及接下来的目标什么的文字)
 
 
 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);};
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); 
}; 
   |