showToolbox & force autoSave
This commit is contained in:
parent
86fbd7ae54
commit
e3f4f9dc68
@ -813,14 +813,16 @@ return code;
|
||||
*/;
|
||||
|
||||
hideStatusBar_s
|
||||
: '隐藏状态栏' Newline
|
||||
: '隐藏状态栏' '不隐藏竖屏工具栏' Bool Newline
|
||||
|
||||
|
||||
/* hideStatusBar_s
|
||||
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
|
||||
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;
|
||||
*/;
|
||||
|
||||
@ -2248,7 +2250,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
break;
|
||||
case "hideStatusBar":
|
||||
this.next = MotaActionBlocks['hideStatusBar_s'].xmlText([
|
||||
this.next]);
|
||||
this.toolbox||false,this.next]);
|
||||
break;
|
||||
case "updateEnemys":
|
||||
this.next = MotaActionBlocks['updateEnemys_s'].xmlText([
|
||||
|
||||
@ -750,7 +750,7 @@ name是可选的,代表目标行走图的文件名。
|
||||
|
||||
使用`{"type": "hideStatusBar"}`可以隐藏状态栏。读档或重新开始游戏时,状态栏会重新显示。
|
||||
|
||||
隐藏状态栏的状态下,将无法点击工具栏里面的按钮(如存读档怪物手册等)。建议仅在事件中使用,事件结束前显示。
|
||||
可以添加`"toolbox": true`来不隐藏竖屏模式下的工具栏。
|
||||
|
||||
### showStatusBar:显示状态栏
|
||||
|
||||
|
||||
@ -411,7 +411,7 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value
|
||||
|
||||
core.events.initGame();
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2214,17 +2214,23 @@ control.prototype.openSettings = function (need) {
|
||||
|
||||
////// 自动存档 //////
|
||||
control.prototype.autosave = function (removeLast) {
|
||||
if (core.status.event.id!=null)
|
||||
return;
|
||||
var addLast = true;
|
||||
if (core.status.event.id!=null) {
|
||||
// 检查是否是强制自动存档
|
||||
if (core.status.event.id=='action' && core.hasFlag("forceSave")) addLast = false;
|
||||
else return;
|
||||
}
|
||||
var x=null;
|
||||
if (removeLast)
|
||||
x=core.status.route.pop();
|
||||
// 加入当前方向
|
||||
core.status.route.push("turn:"+core.getHeroLoc('direction'));
|
||||
core.setLocalForage("autoSave", core.saveData())
|
||||
core.status.route.pop();
|
||||
if (addLast)
|
||||
core.status.route.push("turn:"+core.getHeroLoc('direction'));
|
||||
core.setLocalForage("autoSave", core.saveData());
|
||||
if (addLast)
|
||||
core.status.route.pop();
|
||||
if (removeLast && core.isset(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';
|
||||
var statusItems = core.dom.status;
|
||||
var toolItems = core.dom.tools;
|
||||
core.domStyle.showStatusBar = name == 'show';
|
||||
core.setFlag('hideStatusBar', core.domStyle.showStatusBar?null:true);
|
||||
core.setFlag('showToolbox', showToolbox);
|
||||
if (!core.domStyle.showStatusBar) {
|
||||
for (var i = 0; i < statusItems.length; ++i)
|
||||
statusItems[i].style.opacity = 0;
|
||||
for (var i = 0; i < toolItems.length; ++i)
|
||||
toolItems[i].style.display = 'none';
|
||||
if (!core.domStyle.isVertical || !showToolbox) {
|
||||
for (var i = 0; i < toolItems.length; ++i)
|
||||
toolItems[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < statusItems.length; ++i)
|
||||
@ -2861,7 +2870,16 @@ control.prototype.updateGlobalAttribute = function (name) {
|
||||
|
||||
////// 改变工具栏为按钮1-7 //////
|
||||
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.domStyle.isVertical) useButton = false;
|
||||
|
||||
@ -1119,7 +1119,7 @@ events.prototype.doAction = function() {
|
||||
this.doAction();
|
||||
break;
|
||||
case "hideStatusBar":
|
||||
core.control.triggerStatusBar("hide");
|
||||
core.control.triggerStatusBar("hide", data.toolbox);
|
||||
this.doAction();
|
||||
break;
|
||||
case "updateEnemys":
|
||||
|
||||
@ -2493,8 +2493,7 @@ ui.prototype.drawKeyBoard = function () {
|
||||
|
||||
////// 绘制状态栏 /////
|
||||
ui.prototype.drawStatusBar = function () {
|
||||
if (this.uidata.drawStatusBar)
|
||||
this.uidata.drawStatusBar();
|
||||
this.uidata.drawStatusBar();
|
||||
}
|
||||
|
||||
////// 绘制“数据统计”界面 //////
|
||||
|
||||
@ -89,7 +89,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// floorId是切换到的楼层;fromLoad若为true则代表是从读档行为造成的楼层切换
|
||||
|
||||
// 每次抵达楼层时执行的事件
|
||||
if (!fromLoad) {
|
||||
if (!fromLoad || core.hasFlag("forceSave")) {
|
||||
core.insertAction(core.floors[floorId].eachArrive);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user