diff --git a/editor-mobile.html b/editor-mobile.html index 3a05e8e2..e4116e16 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -442,6 +442,7 @@ + @@ -452,6 +453,7 @@ +

diff --git a/editor.html b/editor.html index b841eaaa..e67d5fe3 100644 --- a/editor.html +++ b/editor.html @@ -425,6 +425,7 @@ + @@ -435,6 +436,7 @@ +

diff --git a/index.html b/index.html index 98997cb2..8dde6626 100644 --- a/index.html +++ b/index.html @@ -119,6 +119,7 @@ + @@ -129,6 +130,7 @@ +

diff --git a/libs/actions.js b/libs/actions.js index cd1d3d3c..a1011943 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -2746,6 +2746,7 @@ actions.prototype.exitPaint = function () { core.deleteCanvas('paint'); core.ui.closePanel(); core.statusBar.image.keyboard.style.opacity = 1; + core.statusBar.image.shop.style.opacity = 1; core.updateStatusBar(); core.drawTip("退出绘图模式"); } diff --git a/libs/control.js b/libs/control.js index 4baeb3c4..b0c76fd2 100644 --- a/libs/control.js +++ b/libs/control.js @@ -44,12 +44,17 @@ control.prototype.setRequestAnimationFrame = function () { } }()); + core.animateFrame.totalTime = Math.max(core.animateFrame.totalTime, core.getLocalStorage('totalTime', 0)); + var draw = function(timestamp) { + core.animateFrame.totalTime += timestamp - core.animateFrame.totalTimeStart; + core.animateFrame.totalTimeStart = timestamp; + // move time if (core.isPlaying() && core.isset(core.status) && core.isset(core.status.hero) && core.isset(core.status.hero.statistics)) { - core.status.hero.statistics.totalTime += timestamp-(core.status.hero.statistics.start||timestamp); + core.status.hero.statistics.totalTime = core.animateFrame.totalTime; core.status.hero.statistics.currTime += timestamp-(core.status.hero.statistics.start||timestamp); core.status.hero.statistics.start=timestamp; } @@ -380,11 +385,7 @@ control.prototype.clearStatus = function() { ////// 重置游戏状态和初始数据 ////// control.prototype.resetStatus = function(hero, hard, floorId, route, maps, values) { - var totalTime=0; - if (core.isset(core.status) && core.isset(core.status.hero) - && core.isset(core.status.hero.statistics) && core.isset(route)) { - totalTime=core.status.hero.statistics.totalTime; - } + var totalTime = core.animateFrame.totalTime; // 清除游戏数据 core.clearStatus(); @@ -417,7 +418,8 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value 'moveDirectly': 0, 'ignoreSteps': 0, } - core.status.hero.statistics.totalTime = Math.max(core.status.hero.statistics.totalTime, totalTime); + core.status.hero.statistics.totalTime = core.animateFrame.totalTime = + Math.max(core.status.hero.statistics.totalTime, core.animateFrame.totalTime); core.status.hero.statistics.start = null; core.status.hard = hard; @@ -2054,16 +2056,9 @@ control.prototype.openQuickShop = function (need) { control.prototype.openKeyBoard = function (need) { if (core.isReplaying()) return; - if (core.platform.extendKeyboard) { - if (!core.checkStatus('keyBoard', need)) - return; - core.ui.drawKeyBoard(); - } - else { - if (!core.checkStatus('selectShop', need)) - return; - core.ui.drawQuickShop(); - } + if (!core.checkStatus('keyBoard', need)) + return; + core.ui.drawKeyBoard(); } ////// 点击保存按钮时的打开操作 ////// @@ -2139,6 +2134,8 @@ control.prototype.autosave = function (removeLast) { /////// 实际进行自动存档 ////// control.prototype.checkAutosave = function () { + core.setLocalStorage('totalTime', core.animateFrame.totalTime); + if (core.saves.autosave.data == null || !core.saves.autosave.updated) return; core.saves.autosave.updated = false; core.setLocalForage("autoSave", core.saves.autosave.data); @@ -2725,6 +2722,7 @@ control.prototype.updateStatusBar = function () { core.statusBar.image.toolbox.src = core.statusBar.icons.rewind.src; core.statusBar.image.keyboard.src = core.statusBar.icons.book.src; + core.statusBar.image.shop.style.opacity = 0; core.statusBar.image.save.src = core.statusBar.icons.speedDown.src; @@ -2748,8 +2746,8 @@ control.prototype.updateStatusBar = function () { core.statusBar.image.toolbox.src = core.statusBar.icons.toolbox.src; - core.statusBar.image.keyboard.src = - core.platform.extendKeyboard ? core.statusBar.icons.keyboard.src : core.statusBar.icons.shop.src; + core.statusBar.image.keyboard.src = core.statusBar.icons.keyboard.src; + core.statusBar.image.shop.style.opacity = 1; core.statusBar.image.save.src = core.statusBar.icons.save.src; @@ -2886,21 +2884,23 @@ control.prototype.setToolbarButton = function (useButton) { core.domStyle.toolbarBtn = useButton; if (useButton) { - ["book","fly","toolbox","keyboard","save","load","settings"].forEach(function (t) { + ["book","fly","toolbox","keyboard","shop","save","load","settings"].forEach(function (t) { core.statusBar.image[t].style.display = 'none'; }); - ["btn1","btn2","btn3","btn4","btn5","btn6","btn7"].forEach(function (t) { + ["btn1","btn2","btn3","btn4","btn5","btn6","btn7","btn8"].forEach(function (t) { core.statusBar.image[t].style.display = 'block'; }) } else { - ["btn1","btn2","btn3","btn4","btn5","btn6","btn7"].forEach(function (t) { + ["btn1","btn2","btn3","btn4","btn5","btn6","btn7","btn8"].forEach(function (t) { core.statusBar.image[t].style.display = 'none'; }); - ["book","fly","toolbox","keyboard","save","load","settings"].forEach(function (t) { + ["book","fly","toolbox","save","load","settings"].forEach(function (t) { core.statusBar.image[t].style.display = 'block'; }); - core.statusBar.image.keyboard.style.display = core.domStyle.isVertical ? "block":"none"; + core.statusBar.image.keyboard.style.display + = core.statusBar.image.shop.style.display + = core.domStyle.isVertical ? "block":"none"; } } @@ -3029,13 +3029,13 @@ control.prototype.resize = function(clientWidth, clientHeight) { toolBarTop = statusBarHeight + canvasWidth; toolBarBorder = '3px '+borderColor+' solid'; - toolsHeight = scale * BASE_LINEHEIGHT; + toolsHeight = scale * BASE_LINEHEIGHT * 0.95; toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH * .4; toolsBackground = (core.status.globalAttribute||core.initStatus.globalAttribute).toolsBackground; borderRight = '3px '+borderColor+' solid'; margin = scale * SPACE * 2; - toolsMargin = scale * SPACE * 4; + toolsMargin = scale * SPACE * 3; fontSize = DEFAULT_FONT_SIZE * scale; toolbarFontSize = DEFAULT_FONT_SIZE * scale; musicBtnRight = 3; diff --git a/libs/core.js b/libs/core.js index 3e67bfff..8e7a03ec 100644 --- a/libs/core.js +++ b/libs/core.js @@ -28,6 +28,8 @@ function core() { 'onDownInterval': null, } this.animateFrame = { + 'totalTime': 0, + 'totalTimeStart': 0, 'globalAnimate': false, 'globalTime': 0, 'selectorTime': 0, diff --git a/libs/ui.js b/libs/ui.js index d569b42b..09eac7cc 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -2044,7 +2044,7 @@ ui.prototype.drawToolbox = function(index) { var text = item.text||"该道具暂无描述。"; try { // 检查能否eval - text = eval(text); + text = core.replaceText(text); } catch (e) {} var lines = core.splitLines('ui', text, 406, '17px '+globalFont); @@ -2195,6 +2195,9 @@ ui.prototype.drawEquipbox = function(index) { core.fillText('ui', equip.name + "(" + equipString + ")", 10, 32, '#FFD700', "bold 20px "+globalFont) var text = equip.text||"该装备暂无描述。"; + try { + text = core.replaceText(text); + } catch (e) {} var lines = core.splitLines('ui', text, 406, '17px '+globalFont); core.fillText('ui', lines[0], 10, 62, '#FFFFFF', '17px '+globalFont); @@ -2833,6 +2836,7 @@ ui.prototype.drawPaint = function () { core.setStrokeStyle('paint', '#FF0000'); core.statusBar.image.keyboard.style.opacity = 0; + core.statusBar.image.shop.style.opacity = 0; core.statusBar.image.book.src = core.statusBar.icons.paint.src; core.statusBar.image.fly.src = core.statusBar.icons.erase.src; diff --git a/libs/utils.js b/libs/utils.js index 0ae37eef..3c65d624 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -226,22 +226,22 @@ utils.prototype.getLocalForage = function (key, defaultValue, successCallback, e if (core.isset(errorCallback)) errorCallback(err); } else { + if (!core.isset(successCallback)) return; if (core.isset(value)) { - var output = LZString.decompress(value); - if (core.isset(output) && output.length>0) { - try { - if (core.isset(successCallback)) + try { + var output = LZString.decompress(value); + if (core.isset(output) && output.length>0) { + try { successCallback(JSON.parse(output)); - return; + return; + } catch (ee) {main.log(ee);} } - catch (ee) {main.log(ee);} - } - if (core.isset(successCallback)) successCallback(JSON.parse(value)); - return; + return; + } + catch (e) {main.log(e);} } - if (core.isset(successCallback)) - successCallback(defaultValue); + successCallback(defaultValue); } }) } diff --git a/main.js b/main.js index 1765b335..0f6da394 100644 --- a/main.js +++ b/main.js @@ -100,6 +100,7 @@ function main() { 'fly': document.getElementById("img-fly"), 'toolbox': document.getElementById("img-toolbox"), 'keyboard': document.getElementById("img-keyboard"), + 'shop': document.getElementById('img-shop'), 'save': document.getElementById("img-save"), 'load': document.getElementById("img-load"), 'settings': document.getElementById("img-settings"), @@ -109,7 +110,8 @@ function main() { 'btn4': document.getElementById("img-btn4"), 'btn5': document.getElementById("img-btn5"), 'btn6': document.getElementById("img-btn6"), - 'btn7': document.getElementById("img-btn7") + 'btn7': document.getElementById("img-btn7"), + 'btn8': document.getElementById("img-btn8"), }, 'icons': { 'floor': 0, @@ -127,30 +129,31 @@ function main() { 'fly': 11, 'toolbox': 12, 'keyboard': 13, - 'save': 14, - 'load': 15, - 'settings': 16, - 'play': 17, - 'pause': 18, - 'stop': 19, - 'speedDown': 20, - 'speedUp': 21, - 'rewind': 22, - 'equipbox': 23, - 'mana': 24, - 'skill': 25, - 'paint': 26, - 'erase': 27, - 'empty': 28, - 'exit': 29, - 'btn1': 30, - 'btn2': 31, - 'btn3': 32, - 'btn4': 33, - 'btn5': 34, - 'btn6': 35, - 'btn7': 36, - 'shop': 37 + 'shop': 14, + 'save': 15, + 'load': 16, + 'settings': 17, + 'play': 18, + 'pause': 19, + 'stop': 20, + 'speedDown': 21, + 'speedUp': 22, + 'rewind': 23, + 'equipbox': 24, + 'mana': 25, + 'skill': 26, + 'paint': 27, + 'erase': 28, + 'empty': 29, + 'exit': 30, + 'btn1': 31, + 'btn2': 32, + 'btn3': 33, + 'btn4': 34, + 'btn5': 35, + 'btn6': 36, + 'btn7': 37, + 'btn8': 38 }, 'floor': document.getElementById('floor'), 'name': document.getElementById('name'), @@ -509,6 +512,14 @@ main.statusBar.image.keyboard.onclick = function (e) { main.core.openKeyBoard(true); } +////// 点击状态栏中的快捷商店键盘时 ////// +main.statusBar.image.shop.onclick = function (e) { + e.stopPropagation(); + + if (main.core.isPlaying()) + main.core.openQuickShop(true); +} + ////// 点击状态栏中的存档按钮时 ////// main.statusBar.image.save.onclick = function (e) { e.stopPropagation(); @@ -606,6 +617,11 @@ main.statusBar.image.btn7.onclick = function (e) { main.core.onkeyUp({"keyCode": 55}); }; +main.statusBar.image.btn8.onclick = function (e) { + e.stopPropagation(); + main.core.onkeyUp({"keyCode": 56}); +}; + ////// 点击“开始游戏”时 ////// main.dom.playGame.onclick = function () { main.dom.startButtons.style.display='none'; diff --git a/project/functions.js b/project/functions.js index be20a5d8..b625a2c6 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1181,7 +1181,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = 'yellowKey', 'blueKey', 'redKey', 'greenKey', 'steelKey', 'redJewel', 'blueJewel', 'greenJewel', 'yellowJewel', 'redPotion', 'bluePotion', 'greenPotion', 'yellowPotion', 'superPotion', - 'pickaxe', 'bomb', 'centerFly', + 'pickaxe', 'bomb', 'centerFly', 'icePickaxe', 'snow', + 'earthquake', 'upFly', 'downFly', 'jumpShoes', 'lifeWand', 'poisonWine', 'weakWine', 'curseWine', 'superWine', 'sword1', 'sword2', 'sword3', 'sword4', 'sword5', 'shield1', 'shield2', 'shield3', 'shield4', 'shield5', diff --git a/project/images/icons.png b/project/images/icons.png index 44ae162f..557b4808 100644 Binary files a/project/images/icons.png and b/project/images/icons.png differ