New empty map & autosave map

This commit is contained in:
oc 2018-04-17 00:45:17 +08:00
parent 595141e83f
commit e38f131f53
7 changed files with 44 additions and 14 deletions

View File

@ -553,7 +553,7 @@ return code;
*/
showImage_0_s
: '显示图片' EvalString '起点像素位置' 'x' Int 'y' Int Newline
: '显示图片' EvalString '起点像素位置' 'x' Number 'y' Number Newline
;
/* showImage_0_s
@ -561,7 +561,7 @@ tooltip : showImage显示图片
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=showimage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%9b%be%e7%89%87
default : ["bg.jpg",0,0]
colour : this.printColor
var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+Int_0+','+Int_1+']},\n';
var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+Number_0+','+Number_1+']},\n';
return code;
*/

View File

@ -69,7 +69,10 @@ editor_file = function(editor, callback){
} */
var filename = 'project/floors/' + editor.currentFloorId + '.js';
var datastr = ['main.floors.' , editor.currentFloorId , '=\n{'];
editor.currentFloorData.map = editor.map.map(function(v){return v.map(function(v){return v.idnum||v||0})});
if (editor.currentFloorData.map == 'new')
editor.currentFloorData.map = editor.map.map(function(v){return v.map(function(){return 0})});
else
editor.currentFloorData.map = editor.map.map(function(v){return v.map(function(v){return v.idnum||v||0})});
for(var ii in editor.currentFloorData)
if (editor.currentFloorData.hasOwnProperty(ii)) {
if (ii=='map')
@ -84,16 +87,16 @@ editor_file = function(editor, callback){
});
}
//callback(err:String)
editor_file.saveFloorFileAs = function(saveAsFilename,callback){
editor_file.saveNewFile = function(saveFilename,callback){
//saveAsFilename不含'/'不含'.js'
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')};
if (!isset(editor.currentFloorData)) {
callback('无数据');
}
editor.currentFloorData.map = editor.map.map(function(v){return v.map(function(v){return v.idnum||v||0})});
editor.currentFloorData=JSON.parse(JSON.stringify(editor.currentFloorData));
editor.currentFloorData.floorId=saveAsFilename;
editor.currentFloorId=saveAsFilename;
editor.currentFloorData={floorId: saveFilename, title: "新建楼层", name: "0", canFlyTo: true, canUseQuickShop: true, images: [], item_ratio: 1,
firstArrive: [], events: {}, changeFloor: {}, afterBattle: {}, afterGetItem: {}, afterOpenDoor: {}, cannotMove: {}};
editor.currentFloorData.map = "new";
editor.currentFloorId=saveFilename;
editor_file.saveFloorFile(callback);
}
//callback(err:String)

View File

@ -363,10 +363,10 @@ editor_mode.prototype.listen = function(callback){
saveFloorAs.onclick = function(){
if (!saveAsName.value)return;
editor_mode.onmode('');
editor.file.saveFloorFileAs(saveAsName.value,function(err){
editor.file.saveNewFile(saveAsName.value,function(err){
if(err){printe(err);throw(err)}
core.floorIds.push(saveAsName.value);
editor.file.editTower([['change',"['main']['floorIds']",core.floorIds]],function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printe('另存为成功,请F5刷新编辑器生效');});
editor.file.editTower([['change',"['main']['floorIds']",core.floorIds]],function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printe('新建成功,请F5刷新编辑器生效');});
});
}

View File

@ -13,7 +13,13 @@ document.body.onmousedown = function(e){
});
//console.log(eid);
if(eid.indexOf('edit')===-1){
if(eid.indexOf('tip')===-1)selectBox.isSelected = false;
if(eid.indexOf('tip')===-1) {
if (selectBox.isSelected) {
editor_mode.onmode('');
editor.file.saveFloorFile(function(err){if(err){printe(err);throw(err)};printf('地图保存成功');});
}
selectBox.isSelected = false;
}
}
//editor.mode.onmode('');
editor.info = {};

View File

@ -20,7 +20,7 @@
</div>
<div id="editTip" v-cloak>
<br>
<input type="button" value="当前地图另存为" id='saveFloorAs'/>
<input type="button" value="新建空白地图" id='saveFloorAs'/>
<input id='saveAsName' placeholder="输入新楼层id"/>
<input class='btn' type="button" value="复制地图" v-on:click="copyMap"/>
</div>

View File

@ -2075,8 +2075,11 @@ control.prototype.updateStatusBar = function () {
var statusList = ['hpmax', 'hp', 'atk', 'def', 'mdef', 'money', 'experience'];
statusList.forEach(function (item) {
core.statusBar[item].innerHTML = core.getStatus(item);
var val = core.getStatus(item);
if (val>=10000000) val = parseInt(val/10000) + "W";
core.statusBar[item].innerHTML = val;
});
// 进阶
if (core.flags.enableLevelUp && core.status.hero.lv<core.firstData.levelUp.length) {
core.statusBar.up.innerHTML = core.firstData.levelUp[core.status.hero.lv].need || "&nbsp;";

View File

@ -1,4 +1,22 @@
HTML5魔塔样板V2.0.1
HTML5魔塔样板V2.0.2
编辑器添加“新建空白地图”按钮 √
编辑器的地图自动保存 √
APP端也能下载录像
图片显示增加淡入淡出效果
录像的倒退
地图临界显伤
单个存档清理
魔龙和章鱼添加到样板
大数据魔塔的显示 √
修改999999999的上界问题
修复有时候无法输入ID的问题
修复坐标等不能为负数的问题
其他细节优化
-----------------------------------------------------------------------
HTML5魔塔样板V2.0.1
道具使用效果的进一步分离
支持插件编写,用户可以根据需求来写插件了