showToolbox & force autoSave

This commit is contained in:
oc 2018-12-15 12:02:54 +08:00
parent 86fbd7ae54
commit e3f4f9dc68
6 changed files with 38 additions and 19 deletions

View File

@ -813,14 +813,16 @@ return code;
*/; */;
hideStatusBar_s hideStatusBar_s
: '隐藏状态栏' Newline : '隐藏状态栏' '不隐藏竖屏工具栏' Bool Newline
/* hideStatusBar_s /* hideStatusBar_s
tooltip : hideStatusBar: 隐藏状态栏 tooltip : hideStatusBar: 隐藏状态栏
helpUrl : https://h5mota.com/games/template/docs/#/event?id=hideStatusBar%ef%bc%9a%e9%9a%90%e8%97%8f%e7%8a%b6%e6%80%81%e6%a0%8f helpUrl : https://h5mota.com/games/template/docs/#/event?id=hideStatusBar%ef%bc%9a%e9%9a%90%e8%97%8f%e7%8a%b6%e6%80%81%e6%a0%8f
colour : this.soundColor colour : this.soundColor
var code = '{"type": "hideStatusBar"},\n'; default : [false]
Bool_0 = Bool_0?', "toolbox": true':'';
var code = '{"type": "hideStatusBar"'+Bool_0+'},\n';
return code; return code;
*/; */;
@ -2248,7 +2250,7 @@ ActionParser.prototype.parseAction = function() {
break; break;
case "hideStatusBar": case "hideStatusBar":
this.next = MotaActionBlocks['hideStatusBar_s'].xmlText([ this.next = MotaActionBlocks['hideStatusBar_s'].xmlText([
this.next]); this.toolbox||false,this.next]);
break; break;
case "updateEnemys": case "updateEnemys":
this.next = MotaActionBlocks['updateEnemys_s'].xmlText([ this.next = MotaActionBlocks['updateEnemys_s'].xmlText([

View File

@ -750,7 +750,7 @@ name是可选的代表目标行走图的文件名。
使用`{"type": "hideStatusBar"}`可以隐藏状态栏。读档或重新开始游戏时,状态栏会重新显示。 使用`{"type": "hideStatusBar"}`可以隐藏状态栏。读档或重新开始游戏时,状态栏会重新显示。
隐藏状态栏的状态下,将无法点击工具栏里面的按钮(如存读档怪物手册等)。建议仅在事件中使用,事件结束前显示 可以添加`"toolbox": true`来不隐藏竖屏模式下的工具栏
### showStatusBar显示状态栏 ### showStatusBar显示状态栏

View File

@ -411,7 +411,7 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value
core.events.initGame(); core.events.initGame();
this.updateGlobalAttribute(Object.keys(core.status.globalAttribute)); this.updateGlobalAttribute(Object.keys(core.status.globalAttribute));
this.triggerStatusBar(core.getFlag('hideStatusBar', false)?'hide':'show'); this.triggerStatusBar(core.getFlag('hideStatusBar', false)?'hide':'show', core.getFlag("showToolbox"));
core.status.played = true; core.status.played = true;
} }
@ -2214,17 +2214,23 @@ control.prototype.openSettings = function (need) {
////// 自动存档 ////// ////// 自动存档 //////
control.prototype.autosave = function (removeLast) { control.prototype.autosave = function (removeLast) {
if (core.status.event.id!=null) var addLast = true;
return; if (core.status.event.id!=null) {
// 检查是否是强制自动存档
if (core.status.event.id=='action' && core.hasFlag("forceSave")) addLast = false;
else return;
}
var x=null; var x=null;
if (removeLast) if (removeLast)
x=core.status.route.pop(); x=core.status.route.pop();
// 加入当前方向 if (addLast)
core.status.route.push("turn:"+core.getHeroLoc('direction')); core.status.route.push("turn:"+core.getHeroLoc('direction'));
core.setLocalForage("autoSave", core.saveData()) core.setLocalForage("autoSave", core.saveData());
core.status.route.pop(); if (addLast)
core.status.route.pop();
if (removeLast && core.isset(x)) if (removeLast && core.isset(x))
core.status.route.push(x); core.status.route.push(x);
core.removeFlag("forceSave");
} }
////// 实际进行存读档事件 ////// ////// 实际进行存读档事件 //////
@ -2762,17 +2768,20 @@ control.prototype.updateStatusBar = function () {
} }
} }
control.prototype.triggerStatusBar = function (name) { control.prototype.triggerStatusBar = function (name, showToolbox) {
if (name!='hide') name='show'; if (name!='hide') name='show';
var statusItems = core.dom.status; var statusItems = core.dom.status;
var toolItems = core.dom.tools; var toolItems = core.dom.tools;
core.domStyle.showStatusBar = name == 'show'; core.domStyle.showStatusBar = name == 'show';
core.setFlag('hideStatusBar', core.domStyle.showStatusBar?null:true); core.setFlag('hideStatusBar', core.domStyle.showStatusBar?null:true);
core.setFlag('showToolbox', showToolbox);
if (!core.domStyle.showStatusBar) { if (!core.domStyle.showStatusBar) {
for (var i = 0; i < statusItems.length; ++i) for (var i = 0; i < statusItems.length; ++i)
statusItems[i].style.opacity = 0; statusItems[i].style.opacity = 0;
for (var i = 0; i < toolItems.length; ++i) if (!core.domStyle.isVertical || !showToolbox) {
toolItems[i].style.display = 'none'; for (var i = 0; i < toolItems.length; ++i)
toolItems[i].style.display = 'none';
}
} }
else { else {
for (var i = 0; i < statusItems.length; ++i) for (var i = 0; i < statusItems.length; ++i)
@ -2861,7 +2870,16 @@ control.prototype.updateGlobalAttribute = function (name) {
////// 改变工具栏为按钮1-7 ////// ////// 改变工具栏为按钮1-7 //////
control.prototype.setToolbarButton = function (useButton) { control.prototype.setToolbarButton = function (useButton) {
if (!core.domStyle.showStatusBar) return; if (!core.domStyle.showStatusBar) {
// 隐藏状态栏时检查竖屏
if (!core.domStyle.isVertical) {
for (var i = 0; i < core.dom.tools.length; ++i)
core.dom.tools[i].style.display = 'none';
return;
}
if (!core.hasFlag('showToolbox')) return;
else core.dom.tools.hard.style.display = 'block';
}
if (!core.isset(useButton)) useButton = core.domStyle.toolbarBtn; if (!core.isset(useButton)) useButton = core.domStyle.toolbarBtn;
if (!core.domStyle.isVertical) useButton = false; if (!core.domStyle.isVertical) useButton = false;

View File

@ -1119,7 +1119,7 @@ events.prototype.doAction = function() {
this.doAction(); this.doAction();
break; break;
case "hideStatusBar": case "hideStatusBar":
core.control.triggerStatusBar("hide"); core.control.triggerStatusBar("hide", data.toolbox);
this.doAction(); this.doAction();
break; break;
case "updateEnemys": case "updateEnemys":

View File

@ -2493,8 +2493,7 @@ ui.prototype.drawKeyBoard = function () {
////// 绘制状态栏 ///// ////// 绘制状态栏 /////
ui.prototype.drawStatusBar = function () { ui.prototype.drawStatusBar = function () {
if (this.uidata.drawStatusBar) this.uidata.drawStatusBar();
this.uidata.drawStatusBar();
} }
////// 绘制“数据统计”界面 ////// ////// 绘制“数据统计”界面 //////

View File

@ -89,7 +89,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// floorId是切换到的楼层fromLoad若为true则代表是从读档行为造成的楼层切换 // floorId是切换到的楼层fromLoad若为true则代表是从读档行为造成的楼层切换
// 每次抵达楼层时执行的事件 // 每次抵达楼层时执行的事件
if (!fromLoad) { if (!fromLoad || core.hasFlag("forceSave")) {
core.insertAction(core.floors[floorId].eachArrive); core.insertAction(core.floors[floorId].eachArrive);
} }