加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
我尝试在RMMV中默认的菜单界面中将【整队】选项改成了【笔记】,之后写了一个简单的笔记界面(目前该界面只有一个框体和测试用的文本),并且可以通过在菜单中点击该选项进入到笔记界面,但是进入该界面之后点击返回键无法回到菜单。
想请问各位大佬如何解决返回键没有用的问题,我在场景之中加入了setHandler的cancel设置,不过依旧不行,下面是代码
function Window_NoteList() { this.initialize.apply(this, arguments); } Window_NoteList.prototype = Object.create(Window_Selectable.prototype); //创建构造器 Window_NoteList.prototype.constructor = Window_NoteList; //初始化 Window_NoteList.prototype.initialize = function(x, y, width, height) { Window_Selectable.prototype.initialize.call(this, x, y, width, height); this.refresh(); }; //*窗体的字体设置 Window_NoteList.prototype.standardFontSize = function() { return 36; } //刷新 Window_NoteList.prototype.refresh = function() { this.contents.clear(); this.drawText("测试文字1", 48, 0); this.drawText("测试文字2", 48, 48); };
function Window_NoteList()
{
this.initialize.apply(this, arguments);
}
Window_NoteList.prototype = Object.create(Window_Selectable.prototype);
//创建构造器
Window_NoteList.prototype.constructor = Window_NoteList;
//初始化
Window_NoteList.prototype.initialize = function(x, y, width, height)
{
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
this.refresh();
};
//*窗体的字体设置
Window_NoteList.prototype.standardFontSize = function() { return 36; }
//刷新
Window_NoteList.prototype.refresh = function()
{
this.contents.clear();
this.drawText("测试文字1", 48, 0);
this.drawText("测试文字2", 48, 48);
};
//============================================================================= // 绘制场景 //============================================================================= function Scene_CakeNote() { this.initialize.apply(this, arguments); } Scene_CakeNote.prototype = Object.create(Scene_MenuBase.prototype); //------------------------------------------------------------- //构造器 Scene_CakeNote.prototype.constructor = Scene_CakeNote; //初始化 Scene_CakeNote.prototype.initialize = function() { Scene_MenuBase.prototype.initialize.call(this); }; Scene_CakeNote.prototype.create = function() { //在这个界面创建这个场景中的各种窗口 Scene_MenuBase.prototype.create.call(this); this.createNoteListWindow(); }; Scene_CakeNote.prototype.exitScene = function() { alert("cancel!"); this.popScene(); }; Scene_CakeNote.prototype.createNoteListWindow = function() { //创建场景中左上方显示笔记列表文字的窗口 this._NoteListWindow = new Window_NoteList(0, 0, Graphics.boxWidth, Graphics.boxHeight); this.addWindow(this._NoteListWindow); this._NoteListWindow.setHandler('cancel', this.exitScene.bind(this)); }; //============================================================================= // Scene_Menu //============================================================================= Scene_Menu.prototype.Scene_Old_CreateCommandWindow = Scene_Menu.prototype.createCommandWindow; Scene_Menu.prototype.createCommandWindow = function() { this.Scene_Old_CreateCommandWindow(); this._commandWindow.setHandler('note', this.commandNote.bind(this)); }; Scene_Menu.prototype.commandNote = function() { SceneManager.push(Scene_CakeNote); }; //============================================================================= // Window_MenuCommand //============================================================================= Window_MenuCommand.prototype.Window_old_Cake_addOriginalCommands = Window_MenuCommand.prototype.addOriginalCommands; Window_MenuCommand.prototype.addOriginalCommands = function() { this.Window_old_Cake_addOriginalCommands(); this.addCommand("笔记", 'note', true); }
//=============================================================================
// 绘制场景
//=============================================================================
function Scene_CakeNote()
{
this.initialize.apply(this, arguments);
}
Scene_CakeNote.prototype = Object.create(Scene_MenuBase.prototype);
//-------------------------------------------------------------
//构造器
Scene_CakeNote.prototype.constructor = Scene_CakeNote;
//初始化
Scene_CakeNote.prototype.initialize = function()
{
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_CakeNote.prototype.create = function()
{
//在这个界面创建这个场景中的各种窗口
Scene_MenuBase.prototype.create.call(this);
this.createNoteListWindow();
};
Scene_CakeNote.prototype.exitScene = function()
{
alert("cancel!");
this.popScene();
};
Scene_CakeNote.prototype.createNoteListWindow = function()
{
//创建场景中左上方显示笔记列表文字的窗口
this._NoteListWindow = new Window_NoteList(0, 0, Graphics.boxWidth, Graphics.boxHeight);
this.addWindow(this._NoteListWindow);
this._NoteListWindow.setHandler('cancel', this.exitScene.bind(this));
};
//=============================================================================
// Scene_Menu
//=============================================================================
Scene_Menu.prototype.Scene_Old_CreateCommandWindow = Scene_Menu.prototype.createCommandWindow;
Scene_Menu.prototype.createCommandWindow = function()
{
this.Scene_Old_CreateCommandWindow();
this._commandWindow.setHandler('note', this.commandNote.bind(this));
};
Scene_Menu.prototype.commandNote = function()
{
SceneManager.push(Scene_CakeNote);
};
//=============================================================================
// Window_MenuCommand
//=============================================================================
Window_MenuCommand.prototype.Window_old_Cake_addOriginalCommands = Window_MenuCommand.prototype.addOriginalCommands;
Window_MenuCommand.prototype.addOriginalCommands = function()
{
this.Window_old_Cake_addOriginalCommands();
this.addCommand("笔记", 'note', true);
}
|