| 赞 | 2 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2024-3-18 |
| 在线时间 | 54 小时 |
- 梦石
- 0
- 星屑
- 81
- 在线时间
- 54 小时
- 注册时间
- 2008-12-24
- 回帖
- 188
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 kula1900 于 2017-3-8 15:13 编辑
事件中插入脚本 Scene_Map.prototype.DbgPrint("message", 1);
调用出现问题
如果不调用脚本
窗口会显示,人物也可以移动,会出现 debug 字样,可就是需要输出调试信息时报错。
[pre lang="javascript"]function Window_Debug()
{
this.initialize.apply(this, arguments);
}
Window_Debug.prototype = Object.create(Window_Selectable.prototype);
Window_Debug.prototype.initialize = function(x, y, width, height) {
Window_Selectable.prototype.initialize.call(this, x, y, width, height); // 调用基类 Window_Selectable initialize
}
// 覆盖 SceneMap
var pfnOldSceneMapCreate = Scene_Map.prototype.create;
Scene_Map.prototype.create = function() {
pfnOldSceneMapCreate.call(this);
this.debugWnd = new Window_Debug(0, 0, 400, 200);
// this.addWindow(this.debugWnd);
};
var pfnOldSceneMaponMapLoaded = Scene_Map.prototype.onMapLoaded;
Scene_Map.prototype.onMapLoaded = function() {
pfnOldSceneMaponMapLoaded.call(this);
this.addWindow(this.debugWnd);
alert(this.debugWnd);
this.ClearDebug();
};
Scene_Map.prototype.DbgPrint = function(str, row) {
alert(this.debugWnd);
this.debugWnd.drawText(str, 0, row * 40, 400, 'left');
};
Scene_Map.prototype.ClearDebug = function(){
this.debugWnd.contents.clear();
this.debugWnd.drawText("debug", 0, 0, 400, 'left');
}[/pre] |
|