kill main.log
This commit is contained in:
parent
f7f3e66cd6
commit
1ad1e12df6
@ -326,17 +326,21 @@ editor_blockly = function () {
|
||||
alert('已成功设置此属性为显示文章的预览属性!')
|
||||
break;
|
||||
case 'waitContext_2': // 等待用户操作坐标预览
|
||||
editor.uievent.previewUI([{"type": "fillRect", "x": obj.px[0], "y": obj.py[0],
|
||||
editor.uievent.previewUI([{
|
||||
"type": "fillRect", "x": obj.px[0], "y": obj.py[0],
|
||||
"width": "(" + obj.px[1] + ")-(" + obj.px[0] + ")", "height": "(" + obj.py[1] + ")-(" + obj.py[0] + ")",
|
||||
"style": "rgba(255,0,0,0.5)"}]);
|
||||
"style": "rgba(255,0,0,0.5)"
|
||||
}]);
|
||||
break;
|
||||
case 'showImage_s': // 显示图片
|
||||
case 'showImage_1_s':
|
||||
if (obj.sloc) {
|
||||
editor.uievent.previewUI([
|
||||
{ type: "setAttribute", alpha: obj.opacity },
|
||||
{type: "drawImage", image: obj.image, x: obj.sloc[0], y: obj.sloc[1], w: obj.sloc[2], h: obj.sloc[3],
|
||||
x1: obj.loc[0], y1: obj.loc[1], w1: obj.loc[2], h1: obj.loc[3], reverse: obj.reverse}
|
||||
{
|
||||
type: "drawImage", image: obj.image, x: obj.sloc[0], y: obj.sloc[1], w: obj.sloc[2], h: obj.sloc[3],
|
||||
x1: obj.loc[0], y1: obj.loc[1], w1: obj.loc[2], h1: obj.loc[3], reverse: obj.reverse
|
||||
}
|
||||
]);
|
||||
} else {
|
||||
editor.uievent.previewUI([
|
||||
@ -358,8 +362,10 @@ editor_blockly = function () {
|
||||
case 'floorOneImage': // 楼层贴图
|
||||
obj.w = obj.w / (obj.frame || 1);
|
||||
editor.uievent.previewUI([
|
||||
{type: "drawImage", image: obj.name, x: obj.sx || 0, y: obj.sy || 0, w: obj.w, h: obj.h,
|
||||
x1: obj.x, y1: obj.y, w1: obj.w, h1: obj.h, reverse: obj.reverse}
|
||||
{
|
||||
type: "drawImage", image: obj.name, x: obj.sx || 0, y: obj.sy || 0, w: obj.w, h: obj.h,
|
||||
x1: obj.x, y1: obj.y, w1: obj.w, h1: obj.h, reverse: obj.reverse
|
||||
}
|
||||
]);
|
||||
break;
|
||||
case 'previewUI_s': // 预览
|
||||
@ -370,7 +376,7 @@ editor_blockly = function () {
|
||||
editor.uievent.previewUI([obj]);
|
||||
}
|
||||
}
|
||||
} catch (e) {main.log(e);}
|
||||
} catch (ee) { console.error(ee) }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -431,8 +431,8 @@ editor_mappanel_wrapper = function (editor) {
|
||||
else if (e.detail)
|
||||
wheel(Math.sign(e.detail));
|
||||
}
|
||||
catch (ee) {
|
||||
console.log(ee);
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ editor_uievent_wrapper = function (editor) {
|
||||
index += Math.sign(e.wheelDelta);
|
||||
else if (e.detail)
|
||||
index += Math.sign(e.detail);
|
||||
} catch (ee) { main.log(ee); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
index = core.clamp(index, 0, core.floorIds.length - 1);
|
||||
uievent.values.multipoints = [];
|
||||
uievent.setPoint(core.floorIds[index]);
|
||||
|
||||
@ -106,7 +106,7 @@ actions.prototype.doRegisteredAction = function (action) {
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
main.log("ERROR in actions[" + actions[i].name + "].");
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ control.prototype._setRequestAnimationFrame = function () {
|
||||
core.doFunc(b.func, core.control, timestamp);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
main.log("ERROR in requestAnimationFrame[" + b.name + "]:已自动注销该项。");
|
||||
core.unregisterAnimationFrame(b.name);
|
||||
}
|
||||
@ -215,7 +215,7 @@ control.prototype._animationFrame_weather = function (timestamp) {
|
||||
try {
|
||||
core.doFunc(core.control.weathers[type].frameFunc, core.control, timestamp, core.animateFrame.weather.level);
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
main.log("ERROR in weather[" + type + "]:已自动注销该项。");
|
||||
core.unregisterWeather(type);
|
||||
}
|
||||
@ -1626,7 +1626,7 @@ control.prototype._doReplayAction = function (action) {
|
||||
try {
|
||||
if (core.doFunc(this.replayActions[i].func, this, action)) return true;
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
main.log("ERROR in replayActions[" + this.replayActions[i].name + "]:已自动注销该项。");
|
||||
core.unregisterReplayAction(this.replayActions[i].name);
|
||||
}
|
||||
@ -2677,7 +2677,7 @@ control.prototype.setWeather = function (type, level) {
|
||||
try {
|
||||
core.doFunc(this.weathers[type].initFunc, this, level);
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
main.log("ERROR in weather[" + type + "]:已自动注销该项。");
|
||||
core.unregisterWeather(type);
|
||||
}
|
||||
@ -2842,7 +2842,7 @@ control.prototype.playBgm = function (bgm, startTime) {
|
||||
core.material.bgms[bgm].pause();
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -3002,7 +3002,7 @@ control.prototype.stopSound = function (id) {
|
||||
else if (source.noteOff) source.noteOff();
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
delete core.musicStatus.playingSounds[id];
|
||||
}
|
||||
@ -3060,7 +3060,7 @@ control.prototype.updateStatusBar_update = function () {
|
||||
if (!core.control.noAutoEvents) core.checkAutoEvents();
|
||||
core.control._updateStatusBar_setToolboxIcon();
|
||||
core.clearRouteFolding();
|
||||
});
|
||||
})
|
||||
core.control.needUpdate = false;
|
||||
core.control.noAutoEvents = true;
|
||||
}
|
||||
@ -3253,7 +3253,7 @@ control.prototype._doResize = function (obj) {
|
||||
try {
|
||||
if (core.doFunc(this.resizes[i].func, this, obj)) return true;
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
main.log("ERROR in resizes[" + this.resizes[i].name + "]:已自动注销该项。");
|
||||
this.unregisterResize(this.resizes[i].name);
|
||||
}
|
||||
|
||||
@ -486,7 +486,7 @@ core.prototype._init_plugins = function () {
|
||||
plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1[name].apply(core.plugin);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
main.log("无法初始化插件" + name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,7 +312,7 @@ events.prototype.doSystemEvent = function (type, data, callback) {
|
||||
return core.doFunc(this.systemEvents[type], this, data, callback);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
main.log("ERROR in systemEvents[" + type + "]");
|
||||
}
|
||||
}
|
||||
@ -347,7 +347,7 @@ events.prototype.trigger = function (x, y, callback) {
|
||||
core.clearRouteFolding();
|
||||
try {
|
||||
eval(block.event.script);
|
||||
} catch (e) { main.log(e); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
|
||||
// 碰触事件
|
||||
@ -380,7 +380,7 @@ events.prototype._trigger_inAction = function (x, y) {
|
||||
// 执行该点的脚本
|
||||
try {
|
||||
eval(block.event.script);
|
||||
} catch (e) { main.log(e); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
|
||||
// 碰触事件
|
||||
if (block.event.event) {
|
||||
@ -952,7 +952,7 @@ events.prototype.doEvent = function (data, x, y, prefix) {
|
||||
return core.doFunc(this.actions[type], this, data, x, y, prefix);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
main.log("ERROR in actions[" + type + "]");
|
||||
}
|
||||
}
|
||||
@ -1104,7 +1104,7 @@ events.prototype.insertCommonEvent = function (name, args, x, y, callback, addTo
|
||||
try {
|
||||
if (args[i] != null)
|
||||
core.setFlag('arg' + (i + 1), args[i]);
|
||||
} catch (e) { main.log(e); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1826,7 +1826,7 @@ events.prototype._action_insert = function (data, x, y, prefix) {
|
||||
try {
|
||||
if (data.args[i] != null)
|
||||
core.setFlag('arg' + (i + 1), data.args[i]);
|
||||
} catch (e) { main.log(e); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
}
|
||||
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
||||
@ -2363,7 +2363,7 @@ events.prototype._action_function = function (data, x, y, prefix) {
|
||||
eval('(' + func + ')()');
|
||||
}
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
if (!data.async)
|
||||
core.doAction();
|
||||
|
||||
@ -39,7 +39,7 @@ items.prototype.getItemEffect = function (itemId, itemNum) {
|
||||
eval(itemEffect);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
core.status.hero.statistics.hp += core.status.hero.hp - curr_hp;
|
||||
@ -50,7 +50,7 @@ items.prototype.getItemEffect = function (itemId, itemNum) {
|
||||
core.insertAction(useItemEvent);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
core.updateStatusBar();
|
||||
@ -70,7 +70,7 @@ items.prototype.getItemEffectTip = function (itemId) {
|
||||
try {
|
||||
return core.replaceText(itemEffectTip) || "";
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@ -100,7 +100,7 @@ items.prototype._useItemEffect = function (itemId) {
|
||||
eval(useItemEffect);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
var useItemEvent = core.material.items[itemId].useItemEvent;
|
||||
@ -109,7 +109,7 @@ items.prototype._useItemEffect = function (itemId) {
|
||||
core.insertAction(useItemEvent);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -135,7 +135,7 @@ items.prototype.canUseItem = function (itemId) {
|
||||
return eval(canUseItemEffect);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -269,7 +269,7 @@ items.prototype.canEquip = function (equipId, hint) {
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
console.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,7 +263,7 @@ loader.prototype.loadImage = function (dir, imgName, callback) {
|
||||
callback(imgName, null);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ loader.prototype._loadAnimate = function (content) {
|
||||
image.src = t2;
|
||||
data.images.push(image);
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
data.images.push(null);
|
||||
}
|
||||
}
|
||||
@ -387,7 +387,7 @@ loader.prototype._loadAnimate = function (content) {
|
||||
return data;
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -463,7 +463,7 @@ loader.prototype._loadOneSound_decodeData = function (name, data) {
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
core.material.sounds[name] = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ utils.prototype.decompress = function (value) {
|
||||
return JSON.parse(value);
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -222,7 +222,7 @@ utils.prototype.setLocalStorage = function (key, value) {
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1035,7 +1035,7 @@ utils.prototype.readFileContent = function (content) {
|
||||
try {
|
||||
obj = JSON.parse(content);
|
||||
} catch (e) {
|
||||
main.log(e)
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
27
main.js
27
main.js
@ -331,8 +331,9 @@ main.prototype.setMainTipsText = function (text) {
|
||||
main.dom.mainTips.innerHTML = text;
|
||||
}
|
||||
|
||||
main.prototype.log = function (e) {
|
||||
main.prototype.log = function (e, error) {
|
||||
if (e) {
|
||||
if (error) return console.error(e);
|
||||
if (main.core && main.core.platform && !main.core.platform.isPC) {
|
||||
console.log((e.stack || e.toString()));
|
||||
}
|
||||
@ -405,7 +406,7 @@ main.prototype.listen = function () {
|
||||
window.onresize = function () {
|
||||
try {
|
||||
main.core.resize();
|
||||
}catch (e) { main.log(e); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
|
||||
////// 在界面上按下某按键时 //////
|
||||
@ -414,7 +415,7 @@ main.dom.body.onkeydown = function(e) {
|
||||
if (main.dom.inputDiv.style.display == 'block') return;
|
||||
if (main.core && (main.core.isPlaying() || main.core.status.lockControl))
|
||||
main.core.onkeyDown(e);
|
||||
} catch (ee) { main.log(ee); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
|
||||
////// 在界面上放开某按键时 //////
|
||||
@ -450,7 +451,7 @@ main.dom.body.onkeyup = function(e) {
|
||||
if (main.core && main.core.isPlaying && main.core.status &&
|
||||
(main.core.isPlaying() || main.core.status.lockControl))
|
||||
main.core.onkeyUp(e);
|
||||
} catch (ee) { main.log(ee); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
};
|
||||
|
||||
[main.dom.startButtons, main.dom.levelChooseButtons].forEach(function (dom) {
|
||||
@ -475,7 +476,7 @@ main.dom.data.onmousedown = function (e) {
|
||||
var loc = main.core.actions._getClickLoc(e.clientX, e.clientY);
|
||||
if (loc == null) return;
|
||||
main.core.ondown(loc);
|
||||
} catch (ee) { main.log(ee); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
|
||||
////// 鼠标移动时 //////
|
||||
@ -485,7 +486,7 @@ main.dom.data.onmousemove = function (e) {
|
||||
var loc = main.core.actions._getClickLoc(e.clientX, e.clientY);
|
||||
if (loc == null) return;
|
||||
main.core.onmove(loc);
|
||||
}catch (ee) { main.log(ee); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
|
||||
////// 鼠标放开时 //////
|
||||
@ -495,7 +496,7 @@ main.dom.data.onmouseup = function (e) {
|
||||
var loc = main.core.actions._getClickLoc(e.clientX, e.clientY);
|
||||
if (loc == null) return;
|
||||
main.core.onup(loc);
|
||||
}catch (e) { main.log(e); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
|
||||
////// 鼠标滑轮滚动时 //////
|
||||
@ -505,7 +506,7 @@ main.dom.data.onmousewheel = function(e) {
|
||||
main.core.onmousewheel(Math.sign(e.wheelDelta))
|
||||
else if (e.detail)
|
||||
main.core.onmousewheel(Math.sign(e.detail));
|
||||
} catch (ee) { main.log(ee); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
|
||||
////// 手指在触摸屏开始触摸时 //////
|
||||
@ -516,7 +517,7 @@ main.dom.data.ontouchstart = function (e) {
|
||||
if (loc == null) return;
|
||||
main.lastTouchLoc = loc;
|
||||
main.core.ondown(loc);
|
||||
}catch (ee) { main.log(ee); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
|
||||
////// 手指在触摸屏上移动时 //////
|
||||
@ -527,7 +528,7 @@ main.dom.data.ontouchmove = function (e) {
|
||||
if (loc == null) return;
|
||||
main.lastTouchLoc = loc;
|
||||
main.core.onmove(loc);
|
||||
}catch (ee) { main.log(ee); }
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
|
||||
////// 手指离开触摸屏时 //////
|
||||
@ -539,7 +540,7 @@ main.dom.data.ontouchend = function (e) {
|
||||
delete main.lastTouchLoc;
|
||||
main.core.onup(loc);
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -548,7 +549,7 @@ main.dom.statusCanvas.onclick = function (e) {
|
||||
e.preventDefault();
|
||||
main.core.onStatusBarClick(e);
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -781,7 +782,7 @@ main.dom.musicBtn.onclick = function () {
|
||||
try {
|
||||
if (main.core)
|
||||
main.core.triggerBgm();
|
||||
} catch (e) {main.log(e);}
|
||||
} catch (ee) { console.error(ee) }
|
||||
}
|
||||
|
||||
main.dom.enlargeBtn.onclick = function () {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/// <reference path="../runtime.d.ts" />
|
||||
var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
{
|
||||
"events": {
|
||||
@ -1571,7 +1572,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
try {
|
||||
eval(core.floors[core.status.floorId].parallelDo);
|
||||
} catch (e) {
|
||||
main.log(e);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/// <reference path="../runtime.d.ts" />
|
||||
var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
{
|
||||
"init": function () {
|
||||
@ -1324,7 +1325,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
this._resetTitleCanvas = function () {
|
||||
if (!_isTitleCanvasEnabled) return;
|
||||
_isTitleCanvasEnabled = false;
|
||||
window.onresize = function () { try { main.core.resize(); } catch (e) { main.log(e); } }
|
||||
window.onresize = function () { try { main.core.resize(); } catch (ee) { console.error(ee) } }
|
||||
core.resize = function () { return core.control.resize(); }
|
||||
core.resize();
|
||||
core.actions._getClickLoc = _getClickLoc;
|
||||
|
||||
7
runtime.d.ts
vendored
7
runtime.d.ts
vendored
@ -2924,6 +2924,13 @@ type core = {
|
||||
|
||||
} & control & events & loader & enemys & items & maps & ui & utils & icons & actions & plugins
|
||||
|
||||
declare class main {
|
||||
readonly core: core
|
||||
|
||||
/** 输出内容(极不好用,建议换成console)*/
|
||||
log(e: string | Error, error: boolean): void
|
||||
}
|
||||
|
||||
declare let core: core
|
||||
declare let flags: { [x: string]: any }
|
||||
declare let hero = core.status.hero
|
||||
Loading…
Reference in New Issue
Block a user