kill main.log
This commit is contained in:
parent
1ad1e12df6
commit
e5b04eadd5
@ -56,7 +56,7 @@
|
||||
callback(null, data);
|
||||
}
|
||||
}, function (e) {
|
||||
if (window.main != null && main.log) main.log(e);
|
||||
if (window.main != null) console.log(e);
|
||||
else console.log(e);
|
||||
callback(e + ":请检查启动服务是否处于正常运行状态。");
|
||||
}, "text/plain; charset=x-user-defined");
|
||||
|
||||
@ -107,7 +107,7 @@ actions.prototype.doRegisteredAction = function (action) {
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
main.log("ERROR in actions[" + actions[i].name + "].");
|
||||
console.error("ERROR in actions[" + actions[i].name + "].");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -89,7 +89,7 @@ control.prototype._setRequestAnimationFrame = function () {
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
main.log("ERROR in requestAnimationFrame[" + b.name + "]:已自动注销该项。");
|
||||
console.error("ERROR in requestAnimationFrame[" + b.name + "]:已自动注销该项。");
|
||||
core.unregisterAnimationFrame(b.name);
|
||||
}
|
||||
}
|
||||
@ -216,7 +216,7 @@ control.prototype._animationFrame_weather = function (timestamp) {
|
||||
core.doFunc(core.control.weathers[type].frameFunc, core.control, timestamp, core.animateFrame.weather.level);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
main.log("ERROR in weather[" + type + "]:已自动注销该项。");
|
||||
console.error("ERROR in weather[" + type + "]:已自动注销该项。");
|
||||
core.unregisterWeather(type);
|
||||
}
|
||||
}
|
||||
@ -1627,7 +1627,7 @@ control.prototype._doReplayAction = function (action) {
|
||||
if (core.doFunc(this.replayActions[i].func, this, action)) return true;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
main.log("ERROR in replayActions[" + this.replayActions[i].name + "]:已自动注销该项。");
|
||||
console.error("ERROR in replayActions[" + this.replayActions[i].name + "]:已自动注销该项。");
|
||||
core.unregisterReplayAction(this.replayActions[i].name);
|
||||
}
|
||||
}
|
||||
@ -1675,9 +1675,9 @@ control.prototype._replay_error = function (action, callback) {
|
||||
var len = core.status.replay.toReplay.length;
|
||||
var prevList = core.status.replay.totalList.slice(-len - 11, -len - 1);
|
||||
var nextList = core.status.replay.toReplay.slice(0, 10);
|
||||
main.log("录像文件出错,当前操作:" + action);
|
||||
main.log("之前的10个操作是:\n" + prevList.toString());
|
||||
main.log("接下来10个操作是:\n" + nextList.toString());
|
||||
console.log("录像文件出错,当前操作:" + action);
|
||||
console.log("之前的10个操作是:\n" + prevList.toString());
|
||||
console.log("接下来10个操作是:\n" + nextList.toString());
|
||||
core.ui.drawConfirmBox("录像文件出错,你想回到上个节点吗?", function () {
|
||||
core.status.replay.failed = false;
|
||||
core.ui.closePanel();
|
||||
@ -2023,7 +2023,7 @@ control.prototype._doSL_save = function (id) {
|
||||
core.playSound('存档');
|
||||
core.drawTip('存档成功!');
|
||||
}, function (err) {
|
||||
main.log(err);
|
||||
console.error(err);
|
||||
alert("存档失败,错误信息:\n" + err);
|
||||
});
|
||||
core.removeFlag("__events__");
|
||||
@ -2056,7 +2056,7 @@ control.prototype._doSL_load = function (id, callback) {
|
||||
}
|
||||
callback(id, data);
|
||||
}, function (err) {
|
||||
main.log(err);
|
||||
console.error(err);
|
||||
alert("无效的存档");
|
||||
})
|
||||
}
|
||||
@ -2295,7 +2295,7 @@ control.prototype.getSave = function (index, callback) {
|
||||
}
|
||||
callback(core.saves.autosave.data);
|
||||
}, function (err) {
|
||||
main.log(err);
|
||||
console.error(err);
|
||||
callback(null);
|
||||
});
|
||||
}
|
||||
@ -2304,7 +2304,7 @@ control.prototype.getSave = function (index, callback) {
|
||||
core.getLocalForage("save" + index, null, function (data) {
|
||||
if (callback) callback(data);
|
||||
}, function (err) {
|
||||
main.log(err);
|
||||
console.error(err);
|
||||
if (callback) callback(null);
|
||||
});
|
||||
}
|
||||
@ -2340,7 +2340,7 @@ control.prototype.getSaveIndexes = function (callback) {
|
||||
var indexes = {};
|
||||
core.keysLocalForage(function (err, keys) {
|
||||
if (err) {
|
||||
main.log(err);
|
||||
console.error(err);
|
||||
return callback(indexes);
|
||||
}
|
||||
keys.forEach(function (key) {
|
||||
@ -2678,7 +2678,7 @@ control.prototype.setWeather = function (type, level) {
|
||||
core.doFunc(this.weathers[type].initFunc, this, level);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
main.log("ERROR in weather[" + type + "]:已自动注销该项。");
|
||||
console.error("ERROR in weather[" + type + "]:已自动注销该项。");
|
||||
core.unregisterWeather(type);
|
||||
}
|
||||
}
|
||||
@ -2853,7 +2853,7 @@ control.prototype.playBgm = function (bgm, startTime) {
|
||||
}
|
||||
catch (e) {
|
||||
console.log("无法播放BGM " + bgm);
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
core.musicStatus.playingBgm = null;
|
||||
}
|
||||
}
|
||||
@ -2908,7 +2908,7 @@ control.prototype.pauseBgm = function () {
|
||||
}
|
||||
catch (e) {
|
||||
console.log("无法暂停BGM");
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
this.setMusicBtn();
|
||||
}
|
||||
@ -2927,7 +2927,7 @@ control.prototype.resumeBgm = function (resumeTime) {
|
||||
}
|
||||
catch (e) {
|
||||
console.log("无法恢复BGM");
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
this.setMusicBtn();
|
||||
}
|
||||
@ -2983,7 +2983,7 @@ control.prototype.playSound = function (sound, pitch, callback) {
|
||||
}
|
||||
catch (e) {
|
||||
console.log("无法播放SE " + sound);
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3254,7 +3254,7 @@ control.prototype._doResize = function (obj) {
|
||||
if (core.doFunc(this.resizes[i].func, this, obj)) return true;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
main.log("ERROR in resizes[" + this.resizes[i].name + "]:已自动注销该项。");
|
||||
console.error("ERROR in resizes[" + this.resizes[i].name + "]:已自动注销该项。");
|
||||
this.unregisterResize(this.resizes[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -487,7 +487,7 @@ core.prototype._init_plugins = function () {
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
main.log("无法初始化插件" + name);
|
||||
console.error("无法初始化插件" + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -522,7 +522,7 @@ core.prototype._forwardFunc = function (name, funcname) {
|
||||
// core[funcname] = new Function(parameters, "return core."+name+"."+funcname+"("+parameters+");");
|
||||
eval("core." + funcname + " = function (" + parameters + ") {\n\treturn core." + name + "." + funcname + "(" + parameters + ");\n}");
|
||||
if (name == 'plugin') {
|
||||
main.log("插件函数转发:core." + funcname + " = core.plugin." + funcname);
|
||||
console.error("插件函数转发:core." + funcname + " = core.plugin." + funcname);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -313,11 +313,11 @@ events.prototype.doSystemEvent = function (type, data, callback) {
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
main.log("ERROR in systemEvents[" + type + "]");
|
||||
console.error("ERROR in systemEvents[" + type + "]");
|
||||
}
|
||||
}
|
||||
if (this["_sys_" + type]) return this["_sys_" + type](data, callback);
|
||||
main.log("未知的系统事件: " + type + "!");
|
||||
console.error("未知的系统事件: " + type + "!");
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
@ -731,7 +731,7 @@ events.prototype._changeFloor_getInfo = function (floorId, stair, heroLoc, time)
|
||||
floorId = core.status.floorId;
|
||||
}
|
||||
if (!core.status.maps[floorId]) {
|
||||
main.log("不存在的楼层:" + floorId);
|
||||
console.error("不存在的楼层:" + floorId);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -953,7 +953,7 @@ events.prototype.doEvent = function (data, x, y, prefix) {
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
main.log("ERROR in actions[" + type + "]");
|
||||
console.error("ERROR in actions[" + type + "]");
|
||||
}
|
||||
}
|
||||
if (this["_action_" + type]) return this["_action_" + type](data, x, y, prefix);
|
||||
|
||||
@ -325,7 +325,7 @@ loader.prototype._loadAnimates_sync = function () {
|
||||
core.http('GET', 'project/animates/' + t + ".animate?v=" + main.version, null, function (content) {
|
||||
core.material.animates[t] = core.loader._loadAnimate(content);
|
||||
}, function (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
core.material.animates[t] = null;
|
||||
}, "text/plain; charset=x-user-defined")
|
||||
});
|
||||
@ -439,7 +439,7 @@ loader.prototype.loadOneSound = function (name) {
|
||||
core.http('GET', 'project/sounds/' + name + "?v=" + main.version, null, function (data) {
|
||||
core.loader._loadOneSound_decodeData(name, data);
|
||||
}, function (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
core.material.sounds[name] = null;
|
||||
}, null, 'arraybuffer');
|
||||
}
|
||||
@ -458,7 +458,7 @@ loader.prototype._loadOneSound_decodeData = function (name, data) {
|
||||
core.musicStatus.audioContext.decodeAudioData(data, function (buffer) {
|
||||
core.material.sounds[name] = buffer;
|
||||
}, function (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
core.material.sounds[name] = null;
|
||||
})
|
||||
}
|
||||
|
||||
@ -1270,7 +1270,7 @@ utils.prototype.same = function (a, b) {
|
||||
|
||||
utils.prototype.unzip = function (blobOrUrl, success, error, convertToText, onprogress) {
|
||||
var _error = function (msg) {
|
||||
main.log(msg);
|
||||
console.error(msg);
|
||||
if (error) error(msg);
|
||||
}
|
||||
|
||||
|
||||
2
main.js
2
main.js
@ -794,7 +794,7 @@ main.prototype.listen = function () {
|
||||
main.core.resize();
|
||||
}
|
||||
}
|
||||
} catch (e) { main.log(e) };
|
||||
} catch (e) { console.error(e) };
|
||||
}
|
||||
|
||||
window.onblur = function () {
|
||||
|
||||
1
runtime.d.ts
vendored
1
runtime.d.ts
vendored
@ -2926,6 +2926,7 @@ type core = {
|
||||
|
||||
declare class main {
|
||||
readonly core: core
|
||||
readonly dom = core.dom
|
||||
|
||||
/** 输出内容(极不好用,建议换成console)*/
|
||||
log(e: string | Error, error: boolean): void
|
||||
|
||||
Loading…
Reference in New Issue
Block a user