加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 kula1900 于 2017-3-8 15:13 编辑
事件中插入脚本 Scene_Map.prototype.DbgPrint("message", 1);
调用出现问题
如果不调用脚本
窗口会显示,人物也可以移动,会出现 debug 字样,可就是需要输出调试信息时报错。
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'); }
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');
}
|