Merge pull request #414 from ckcz123/v2.x

V2.x
This commit is contained in:
Zhang Chen 2019-11-02 10:11:27 +08:00 committed by GitHub
commit 394f0b123b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 153 additions and 119 deletions

View File

@ -52,7 +52,7 @@ level_m
: '等级提升' BGNL? Newline levelCase+ BEND
/* level_mexpression
/* level_m
tooltip : 升级事件
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=%e7%bb%8f%e9%aa%8c%e5%8d%87%e7%ba%a7%ef%bc%88%e8%bf%9b%e9%98%b6%2f%e5%a2%83%e7%95%8c%e5%a1%94%ef%bc%89
var code = '[\n'+levelCase_0+']\n';

View File

@ -298,23 +298,33 @@ editor_mappanel_wrapper = function (editor) {
// 检测是否是上下楼
var thisevent = editor.map[editor.pos.y][editor.pos.x];
var extraEvent = editor.dom.extraEvent, parent = extraEvent.parentElement;
if (thisevent == 0) {
parent.removeChild(extraEvent);
parent.appendChild(extraEvent);
editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '绑定出生点为此点';
}
else if (thisevent.id == 'upFloor') {
} else if (thisevent.id == 'upFloor') {
parent.removeChild(extraEvent);
parent.insertBefore(extraEvent, parent.firstChild);
editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '绑定上楼事件';
}
else if (thisevent.id == 'downFloor') {
parent.removeChild(extraEvent);
parent.insertBefore(extraEvent, parent.firstChild);
editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '绑定下楼事件';
}
else if (['leftPortal', 'rightPortal', 'downPortal', 'upPortal'].indexOf(thisevent.id) >= 0) {
parent.removeChild(extraEvent);
parent.insertBefore(extraEvent, parent.firstChild);
editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '绑定楼传事件';
}
else if (thisevent.id == 'specialDoor') {
parent.removeChild(extraEvent);
parent.insertBefore(extraEvent, parent.firstChild);
editor.dom.extraEvent.style.display = 'block';
editor.dom.extraEvent.children[0].innerHTML = '绑定机关门事件';
}

View File

@ -818,7 +818,7 @@ events.prototype.doEvent = function (data, x, y, prefix) {
}
if (this["_action_" + type]) return this["_action_" + type](data, x, y, prefix);
core.insertAction("未知的自定义事件: " + type + "");
setTimeout(core.doAction);
core.doAction();
}
events.prototype.setEvents = function (list, x, y, callback) {
@ -844,7 +844,7 @@ events.prototype.startEvents = function (list, x, y, callback) {
// 停止勇士
core.waitHeroToStop(function () {
core.lockControl();
setTimeout(core.doAction);
core.doAction();
});
}
@ -900,7 +900,7 @@ events.prototype._popEvents = function (current, prefix) {
else {
core.status.event.data.list.shift(); // remove stack
}
setTimeout(core.doAction);
core.doAction();
return true;
}
return false;
@ -945,7 +945,7 @@ events.prototype.recoverEvents = function (data) {
core.status.event.id = 'action';
core.status.event.data = data;
setTimeout(function () {
setTimeout(core.doAction);
core.doAction();
}, 30);
return true;
}
@ -1031,7 +1031,7 @@ events.prototype.popEventLoc = function () {
events.prototype.__action_checkReplaying = function () {
if (core.isReplaying()) {
setTimeout(core.doAction);
core.doAction();
return true;
}
return false;
@ -1059,7 +1059,7 @@ events.prototype.__action_doAsyncFunc = function (isAsync, func) {
var parameters = Array.prototype.slice.call(arguments, 2);
if (isAsync) {
func.apply(this, parameters);
setTimeout(core.doAction);
core.doAction();
}
else {
func.apply(this, parameters.concat(core.doAction));
@ -1083,7 +1083,7 @@ events.prototype._action_scrollText = function (data, x, y, prefix) {
}
events.prototype._action_comment = function (data, x, y, prefix) {
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_setText = function (data, x, y, prefix) {
@ -1104,12 +1104,12 @@ events.prototype._action_setText = function (data, x, y, prefix) {
}
});
core.setFlag('textAttribute', core.status.textAttribute);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_tip = function (data, x, y, prefix) {
core.drawTip(core.replaceText(data.text), data.icon);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_show = function (data, x, y, prefix) {
@ -1121,7 +1121,7 @@ events.prototype._action_show = function (data, x, y, prefix) {
data.loc.forEach(function (t) {
core.showBlock(t[0], t[1], data.floorId);
});
setTimeout(core.doAction);
core.doAction();
}
}
@ -1137,7 +1137,7 @@ events.prototype._action_hide = function (data, x, y, prefix) {
data.loc.forEach(function (t) {
core.removeBlock(t[0], t[1], data.floorId)
});
setTimeout(core.doAction);
core.doAction();
}
}
@ -1146,7 +1146,7 @@ events.prototype._action_setBlock = function (data, x, y, prefix) {
data.loc.forEach(function (t) {
core.setBlock(data.number, t[0], t[1], data.floorId);
});
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_showFloorImg = function (data, x, y, prefix) {
@ -1170,17 +1170,17 @@ events.prototype._action_setBgFgBlock = function (data, x, y, prefix) {
data.loc.forEach(function (t) {
core.setBgFgBlock(data.name, data.number, t[0], t[1], data.floorId);
});
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_follow = function (data, x, y, prefix) {
this.follow(data.name);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_unfollow = function (data, x, y, prefix) {
this.unfollow(data.name);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_animate = function (data, x, y, prefix) {
@ -1197,7 +1197,7 @@ events.prototype._action_setViewport = function (data, x, y, prefix) {
var loc = this.__action_getLoc(data.loc, x, y, prefix);
core.setViewport(32 * loc[0], 32 * loc[1]);
}
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_moveViewport = function (data, x, y, prefix) {
@ -1237,7 +1237,7 @@ events.prototype._action_changePos = function (data, x, y, prefix) {
core.setHeroLoc('y', loc[1]);
if (data.direction) core.setHeroLoc('direction', data.direction);
core.drawHero();
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_showImage = function (data, x, y, prefix) {
@ -1261,7 +1261,7 @@ events.prototype._action_hideImage = function (data, x, y, prefix) {
events.prototype._action_showGif = function (data, x, y, prefix) {
var loc = this.__action_getLoc(data.loc, 0, 0, prefix);
this.showGif(data.name, loc[0], loc[1]);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_moveImage = function (data, x, y, prefix) {
@ -1277,12 +1277,12 @@ events.prototype._action_setCurtain = function (data, x, y, prefix) {
if (data.async) {
core.setCurtain(data.color, data.time);
core.setFlag('__color__', data.color || null);
setTimeout(core.doAction);
core.doAction();
}
else {
core.setCurtain(data.color, data.time, function () {
core.setFlag('__color__', data.color || null);
setTimeout(core.doAction);
core.doAction();
});
}
}
@ -1296,7 +1296,7 @@ events.prototype._action_setWeather = function (data, x, y, prefix) {
if (data.name == 'rain' || data.name == 'snow' || data.name == 'fog')
core.setFlag('__weather__', [data.name, data.level]);
else core.removeFlag('__weather__');
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_openDoor = function (data, x, y, prefix) {
@ -1307,7 +1307,7 @@ events.prototype._action_openDoor = function (data, x, y, prefix) {
}
else {
core.removeBlock(loc[0], loc[1], floorId);
setTimeout(core.doAction);
core.doAction();
}
}
@ -1323,7 +1323,7 @@ events.prototype._action_useItem = function (data, x, y, prefix) {
}
else {
core.drawTip("当前无法使用" + ((core.material.items[data.id] || {}).name || "未知道具"));
setTimeout(core.doAction);
core.doAction();
}
}
@ -1333,12 +1333,12 @@ events.prototype._action_openShop = function (data, x, y, prefix) {
if (!core.isReplaying())
this.openShop(data.id);
if (core.status.event.id == 'action')
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_disableShop = function (data, x, y, prefix) {
this.disableQuickShop(data.id);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_battle = function (data, x, y, prefix) {
@ -1347,7 +1347,7 @@ events.prototype._action_battle = function (data, x, y, prefix) {
}
else {
if (data.floorId != core.status.floorId) {
setTimeout(core.doAction);
core.doAction();
return;
}
var loc = this.__action_getLoc(data.loc, x, y, prefix);
@ -1368,7 +1368,7 @@ events.prototype._action_trigger = function (data, x, y, prefix) {
return;
}
}
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_insert = function (data, x, y, prefix) {
@ -1393,44 +1393,44 @@ events.prototype._action_insert = function (data, x, y, prefix) {
var event = (core.floors[floorId][which]||[])[loc[0] + "," + loc[1]];
if (event) this.insertAction(event.data || event);
}
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_playBgm = function (data, x, y, prefix) {
core.playBgm(data.name);
core.setFlag("__bgm__", data.keep ? data.name : null);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_pauseBgm = function (data, x, y, prefix) {
core.pauseBgm();
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_resumeBgm = function (data, x, y, prefix) {
core.resumeBgm();
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_loadBgm = function (data, x, y, prefix) {
core.loadBgm(data.name);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_freeBgm = function (data, x, y, prefix) {
core.freeBgm(data.name);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_playSound = function (data, x, y, prefix) {
if (data.stop) core.stopSound();
core.playSound(data.name);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_stopSound = function (data, x, y, prefix) {
core.stopSound();
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_setVolume = function (data, x, y, prefix) {
@ -1441,7 +1441,7 @@ events.prototype._action_setVolume = function (data, x, y, prefix) {
events.prototype._action_setValue = function (data, x, y, prefix) {
this.setValue(data.name, data.value, prefix);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_setValue2 = function (data, x, y, prefix) {
@ -1450,32 +1450,32 @@ events.prototype._action_setValue2 = function (data, x, y, prefix) {
events.prototype._action_addValue = function (data, x, y, prefix) {
this.addValue(data.name, data.value, prefix);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_setFloor = function (data, x, y, prefix) {
this.setFloorInfo(data.name, data.value, data.floorId, prefix);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_setGlobalAttribute = function (data, x, y, prefix) {
this.setGlobalAttribute(data.name, data.value);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_setGlobalValue = function (data, x, y, prefix) {
core.values[data.name] = data.value;
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_setGlobalFlag = function (data, x, y, prefix) {
this.setGlobalFlag(data.name, data.value);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_setHeroIcon = function (data, x, y, prefix) {
this.setHeroIcon(data.name);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_input = function (data, x, y, prefix) {
@ -1483,7 +1483,7 @@ events.prototype._action_input = function (data, x, y, prefix) {
value = Math.abs(parseInt(value) || 0);
core.status.route.push("input:" + value);
core.setFlag("input", value);
setTimeout(core.doAction);
core.doAction();
});
}
@ -1492,7 +1492,7 @@ events.prototype._action_input2 = function (data, x, y, prefix) {
value = value || "";
core.status.route.push("input2:" + core.encodeBase64(value));
core.setFlag("input", value);
setTimeout(core.doAction);
core.doAction();
});
}
@ -1522,7 +1522,7 @@ events.prototype._action_if = function (data, x, y, prefix) {
core.events.insertAction(data["true"])
else
core.events.insertAction(data["false"])
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_switch = function (data, x, y, prefix) {
@ -1537,7 +1537,7 @@ events.prototype._action_switch = function (data, x, y, prefix) {
}
}
core.insertAction(list);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_choices = function (data, x, y, prefix) {
@ -1555,7 +1555,7 @@ events.prototype._action_choices = function (data, x, y, prefix) {
setTimeout(function () {
core.status.route.push("choices:" + index);
core.insertAction(data.choices[index].action);
setTimeout(core.doAction);
core.doAction();
}, core.status.replay.speed == 24 ? 1 : 750 / Math.max(1, core.status.replay.speed))
}
else {
@ -1578,7 +1578,7 @@ events.prototype._action_confirm = function (data, x, y, prefix) {
core.status.route.push("choices:" + index);
if (index == 0) core.insertAction(data.yes);
else core.insertAction(data.no);
setTimeout(core.doAction);
core.doAction();
}, core.status.replay.speed == 24 ? 1 : 750 / Math.max(1, core.status.replay.speed))
}
else {
@ -1598,19 +1598,19 @@ events.prototype._action_while = function (data, x, y, prefix) {
{"todo": core.clone(data.data), "total": core.clone(data.data), "condition": data.condition}
);
}
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_dowhile = function (data, x, y, prefix) {
core.unshift(core.status.event.data.list,
{"todo": core.clone(data.data), "total": core.clone(data.data), "condition": data.condition}
);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_break = function (data, x, y, prefix) {
core.status.event.data.list.shift();
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_continue = function (data, x, y, prefix) {
@ -1620,7 +1620,7 @@ events.prototype._action_continue = function (data, x, y, prefix) {
else {
core.status.event.data.list.shift();
}
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_win = function (data, x, y, prefix) {
@ -1645,40 +1645,40 @@ events.prototype._action_function = function (data, x, y, prefix) {
main.log(e);
}
if (!data.async)
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_update = function (data, x, y, prefix) {
core.updateStatusBar();
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_showStatusBar = function (data, x, y, prefix) {
core.showStatusBar();
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_hideStatusBar = function (data, x, y, prefix) {
core.hideStatusBar(data.toolbox);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_showHero = function (data, x, y, prefix) {
core.removeFlag('hideHero');
core.drawHero();
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_hideHero = function (data, x, y, prefix) {
core.setFlag('hideHero', true);
core.drawHero();
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_updateEnemys = function (data, x, y, prefix) {
core.enemys.updateEnemys();
core.updateStatusBar();
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_vibrate = function (data, x, y, prefix) {
@ -1688,7 +1688,7 @@ events.prototype._action_vibrate = function (data, x, y, prefix) {
events.prototype._action_sleep = function (data, x, y, prefix) {
core.timeout.sleepTimeout = setTimeout(function () {
core.timeout.sleepTimeout = null;
setTimeout(core.doAction);
core.doAction();
}, core.isReplaying() ? Math.min(data.time, 20) : data.time);
}
@ -1705,7 +1705,7 @@ events.prototype._action_wait = function (data, x, y, prefix) {
core.stopReplay();
core.insertAction(["录像文件出错,请在控制台查看报错信息。", {"type": "exit"}]);
}
setTimeout(core.doAction);
core.doAction();
return;
}
}
@ -1737,7 +1737,7 @@ events.prototype._action_waitAsync = function (data, x, y, prefix) {
var test = window.setInterval(function () {
if (!core.hasAsync()) {
clearInterval(test);
setTimeout(core.doAction);
core.doAction();
}
}, 50);
}
@ -1746,12 +1746,12 @@ events.prototype._action_revisit = function (data, x, y, prefix) {
var block = core.getBlock(x, y);
if (block != null && block.block.event.trigger == 'action')
this.setEvents(block.block.event.data);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_callBook = function (data, x, y, prefix) {
if (core.isReplaying() || !core.hasItem('book')) {
setTimeout(core.doAction);
core.doAction();
}
else {
var e = core.clone(core.status.event.data);
@ -1764,7 +1764,7 @@ events.prototype._action_callBook = function (data, x, y, prefix) {
events.prototype._action_callSave = function (data, x, y, prefix) {
if (core.isReplaying() || core.hasFlag("__events__")) {
core.removeFlag("__events__");
setTimeout(core.doAction);
core.doAction();
}
else {
var e = core.clone(core.status.event.data);
@ -1777,7 +1777,7 @@ events.prototype._action_callSave = function (data, x, y, prefix) {
events.prototype._action_autoSave = function (data, x, y, prefix) {
core.autosave();
if (!data.nohint) core.drawTip("已自动存档");
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_callLoad = function (data, x, y, prefix) {
@ -1790,97 +1790,100 @@ events.prototype._action_callLoad = function (data, x, y, prefix) {
events.prototype._action_exit = function (data, x, y, prefix) {
this.setEvents([]);
setTimeout(core.doAction);
core.doAction();
}
events.prototype._action_previewUI = function (data, x, y, prefix) {
this.insertAction(data.action);
setTimeout(core.doAction);
core.doAction();
}
events.prototype.__action_doUIEvent = function (data) {
this.__action_doUIEvent_doOne(data);
var current = core.status.event.data.list[0];
while (current.todo.length > 0) {
data = current.todo[0];
if (this.__action_doUIEvent_doOne(current.todo[0]))
current.todo.shift();
else break;
}
core.doAction();
}
events.prototype.__action_doUIEvent_doOne = function (data) {
if (core.ui['_uievent_' + data.type]) {
core.ui['_uievent_' + data.type](data);
return true;
}
return false;
}
events.prototype._action_clearMap = function (data, x, y, prefix) {
core.ui._uievent_clearMap(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_fillText = function (data, x, y, prefix) {
core.ui._uievent_fillText(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_fillBoldText = function (data, x, y, prefix) {
core.ui._uievent_fillBoldText(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_fillRect = function (data, x, y, prefix) {
core.ui._uievent_fillRect(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_fillPolygon = function (data, x, y, prefix) {
core.ui._uievent_fillPolygon(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_strokeRect = function (data, x, y, prefix) {
core.ui._uievent_strokeRect(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_strokePolygon = function (data, x, y, prefix) {
core.ui._uievent_strokePolygon(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_fillCircle = function (data, x, y, prefix) {
core.ui._uievent_fillCircle(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_strokeCircle = function (data, x, y, prefix) {
core.ui._uievent_strokeCircle(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_drawLine = function (data, x, y, prefix) {
core.ui._uievent_drawLine(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_drawArrow = function (data, x, y, prefix) {
core.ui._uievent_drawArrow(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_setAttribute = function (data, x, y, prefix) {
core.ui._uievent_setAttribute(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_drawImage = function (data, x, y, prefix) {
core.ui._uievent_drawImage(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_drawIcon = function (data, x, y, prefix) {
core.ui._uievent_drawIcon(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_drawSelector = function (data, x, y, prefix) {
core.ui._uievent_drawSelector(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_drawBackground = function (data, x, y, prefix) {
core.ui._uievent_drawBackground(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
events.prototype._action_drawTextContent = function (data, x, y, prefix) {
core.ui._uievent_drawTextContent(data);
setTimeout(core.doAction);
this.__action_doUIEvent(data);
}
// ------ 点击状态栏图标所进行的一些操作 ------ //

View File

@ -9,6 +9,7 @@ function extensions() {
}
extensions.prototype._load = function (callback) {
if (main.replayChecking) return callback();
if (!window.fs) {
this._loadJs('_server/fs.js', function () {
core.extensions._listExtensions(callback);

View File

@ -1604,7 +1604,8 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
}
if (floorId == core.status.floorId && !block.disable) {
core.drawBlock(block);
core.addGlobalAnimate(block);
if (block.event.cls != 'autotile')
core.addGlobalAnimate(block);
core.updateStatusBar();
}
}

View File

@ -487,6 +487,9 @@ ui.prototype.drawTip = function (text, id, clear) {
}
}
core.animateFrame.tips.list.push(one);
if (core.animateFrame.tips.list.length > 3) {
core.animateFrame.tips.list.shift();
}
}
ui.prototype._drawTip_drawOne = function (one, offset) {

View File

@ -70,11 +70,18 @@ utils.prototype.replaceText = function (text, need, times) {
utils.prototype.calValue = function (value, prefix, need, times) {
if (!core.isset(value)) return null;
if (typeof value === 'string') {
value = value.replace(/status:([a-zA-Z0-9_]+)/g, "core.getStatus('$1')");
value = value.replace(/item:([a-zA-Z0-9_]+)/g, "core.itemCount('$1')");
value = value.replace(/flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, "core.getFlag('$1', 0)");
value = value.replace(/switch:([a-zA-Z0-9_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)");
value = value.replace(/global:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, "core.getGlobal('$1', 0)");
if (value.indexOf(':') >= 0) {
if (value.indexOf('status:') >= 0)
value = value.replace(/status:([a-zA-Z0-9_]+)/g, "core.getStatus('$1')");
if (value.indexOf('item:') >= 0)
value = value.replace(/item:([a-zA-Z0-9_]+)/g, "core.itemCount('$1')");
if (value.indexOf('flag:') >= 0)
value = value.replace(/flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, "core.getFlag('$1', 0)");
if (value.indexOf('switch:' >= 0))
value = value.replace(/switch:([a-zA-Z0-9_]+)/g, "core.getFlag('" + (prefix || ":f@x@y") + "@$1', 0)");
if (value.indexOf('global:') >= 0)
value = value.replace(/global:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, "core.getGlobal('$1', 0)");
}
return eval(value);
}
if (value instanceof Function) {
@ -633,7 +640,11 @@ utils.prototype.getCookie = function (name) {
////// 设置statusBar的innerHTML会自动斜体和放缩也可以增加自定义css //////
utils.prototype.setStatusBarInnerHTML = function (name, value, css) {
if (!core.statusBar[name]) return;
if (typeof value == 'number') value = this.formatBigNumber(value);
var isNumber = false;
if (typeof value == 'number') {
value = this.formatBigNumber(value);
isNumber = true;
}
// 判定是否斜体
var italic = /^[-a-zA-Z0-9`~!@#$%^&*()_=+\[{\]}\\|;:'",<.>\/?]*$/.test(value);
var style = 'font-style: ' + (italic ? 'italic' : 'normal') + '; ';
@ -641,8 +652,12 @@ utils.prototype.setStatusBarInnerHTML = function (name, value, css) {
var length = this.strlen(value) || 1;
style += 'font-size: ' + Math.min(1, 7 / length) + 'em; ';
if (css) style += css;
core.statusBar[name].innerHTML = "<span class='_status' style='" + style + "'></span>";
core.statusBar[name].children[0].innerText = value;
if (isNumber) {
core.statusBar[name].innerHTML = "<span class='_status' style='" + style + "'>" + value + "</span>";
} else {
core.statusBar[name].innerHTML = "<span class='_status' style='" + style + "'></span>";
core.statusBar[name].children[0].innerText = value;
}
}
utils.prototype.strlen = function (str) {

View File

@ -87,6 +87,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
},
"itemShop": function () {
// 道具商店相关的插件
// 可在全塔属性-全局商店中使用「道具商店」事件块进行编辑(如果找不到可以在入口方块中找)
var shopId = null; // 当前商店ID
var type = 0; // 当前正在选中的类型0买入1卖出
@ -111,11 +112,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.setTextAlign('uievent', 'left');
core.setTextBaseline('uievent', 'top');
core.fillRect('uievent', 0, 0, 416, 416, 'black');
core.ui._uievent_drawBackground({ x: 0, y: 0, width: 416, height: 56 });
core.ui._uievent_drawBackground({ x: 0, y: 56, width: 312, height: 56 });
core.ui._uievent_drawBackground({ x: 0, y: 112, width: 312, height: 304 });
core.ui._uievent_drawBackground({ x: 312, y: 56, width: 104, height: 56 });
core.ui._uievent_drawBackground({ x: 312, y: 112, width: 104, height: 304 });
core.ui._uievent_drawBackground({ background: 'winskin.png', x: 0, y: 0, width: 416, height: 56 });
core.ui._uievent_drawBackground({ background: 'winskin.png', x: 0, y: 56, width: 312, height: 56 });
core.ui._uievent_drawBackground({ background: 'winskin.png', x: 0, y: 112, width: 312, height: 304 });
core.ui._uievent_drawBackground({ background: 'winskin.png', x: 312, y: 56, width: 104, height: 56 });
core.ui._uievent_drawBackground({ background: 'winskin.png', x: 312, y: 112, width: 104, height: 304 });
core.setFillStyle('uievent', 'white');
core.setStrokeStyle('uievent', 'white');
core.fillText("uievent", "购买", 32, 74, 'white', bigFont);