This commit is contained in:
YouWei Zhao 2019-03-20 08:42:46 -04:00
parent 49d497b1a8
commit c14d1789e9
4 changed files with 177 additions and 115 deletions

View File

@ -575,7 +575,7 @@ editor.prototype.setSelectBoxFromInfo=function(thisevent){
dataSelection.style.height = ysize - 6 + 'px'; dataSelection.style.height = ysize - 6 + 'px';
setTimeout(function(){selectBox.isSelected(true);}); setTimeout(function(){selectBox.isSelected(true);});
editor.info = JSON.parse(JSON.stringify(thisevent)); editor.info = JSON.parse(JSON.stringify(thisevent));
tip.infos = JSON.parse(JSON.stringify(thisevent)); tip.infos(JSON.parse(JSON.stringify(thisevent)));
editor.pos=pos; editor.pos=pos;
editor_mode.onmode('nextChange'); editor_mode.onmode('nextChange');
editor_mode.onmode('enemyitem'); editor_mode.onmode('enemyitem');
@ -711,7 +711,7 @@ editor.prototype.listen = function () {
editor_mode.onmode('nextChange'); editor_mode.onmode('nextChange');
editor_mode.onmode('loc'); editor_mode.onmode('loc');
//editor_mode.loc(); //editor_mode.loc();
//tip.whichShow = 1; //tip.whichShow(1);
if(editor.isMobile)editor.showMidMenu(e.clientX,e.clientY); if(editor.isMobile)editor.showMidMenu(e.clientX,e.clientY);
return; return;
} }
@ -731,7 +731,7 @@ editor.prototype.listen = function () {
eui.onmousemove = function (e) { eui.onmousemove = function (e) {
if (!selectBox.isSelected()) { if (!selectBox.isSelected()) {
//tip.whichShow = 1; //tip.whichShow(1);
return; return;
} }
@ -762,7 +762,7 @@ editor.prototype.listen = function () {
eui.onmouseup = function (e) { eui.onmouseup = function (e) {
if (!selectBox.isSelected()) { if (!selectBox.isSelected()) {
//tip.whichShow = 1; //tip.whichShow(1);
return; return;
} }
holdingPath = 0; holdingPath = 0;
@ -1055,7 +1055,7 @@ editor.prototype.listen = function () {
} }
} }
} }
tip.infos = JSON.parse(JSON.stringify(editor.info)); tip.infos(JSON.parse(JSON.stringify(editor.info)));
editor_mode.onmode('nextChange'); editor_mode.onmode('nextChange');
editor_mode.onmode('enemyitem'); editor_mode.onmode('enemyitem');
//editor_mode.enemyitem(); //editor_mode.enemyitem();
@ -1132,7 +1132,7 @@ editor.prototype.listen = function () {
editor_mode.onmode('nextChange'); editor_mode.onmode('nextChange');
editor_mode.onmode('loc'); editor_mode.onmode('loc');
//editor_mode.loc(); //editor_mode.loc();
//tip.whichShow = 1; //tip.whichShow(1);
if(editor.isMobile)editor.showdataarea(false); if(editor.isMobile)editor.showdataarea(false);
} }

View File

@ -14,11 +14,11 @@ exportMap.onclick=function(){
if ('idnum' in mapxy) mapxy = mapxy.idnum; if ('idnum' in mapxy) mapxy = mapxy.idnum;
else { else {
// mapxy='!!?'; // mapxy='!!?';
tip.whichShow = 3; tip.whichShow(3);
return; return;
} }
} else if (typeof(mapxy) == 'undefined') { } else if (typeof(mapxy) == 'undefined') {
tip.whichShow = 3; tip.whichShow(3);
return; return;
} }
mapxy = String(mapxy); mapxy = String(mapxy);
@ -32,7 +32,7 @@ exportMap.onclick=function(){
mapEditArea.mapArr(filestr); mapEditArea.mapArr(filestr);
exportMap.isExport = true; exportMap.isExport = true;
mapEditArea.error(0); mapEditArea.error(0);
tip.whichShow = 2; tip.whichShow(2);
} }
var mapEditArea = document.getElementById('mapEditArea') var mapEditArea = document.getElementById('mapEditArea')
mapEditArea.errors=[ // 编号1,2 mapEditArea.errors=[ // 编号1,2
@ -57,7 +57,7 @@ mapEditArea.mapArr=function(value){
setTimeout(function () { setTimeout(function () {
if (mapEditArea.formatArr())mapEditArea.mapArr(mapEditArea.formatArr()); if (mapEditArea.formatArr())mapEditArea.mapArr(mapEditArea.formatArr());
mapEditArea.drawMap(); mapEditArea.drawMap();
tip.whichShow = 8 tip.whichShow(8)
}, 1000); }, 1000);
clearTimeout(mapEditArea.formatTimer); clearTimeout(mapEditArea.formatTimer);
mapEditArea.formatTimer = setTimeout(function () { mapEditArea.formatTimer = setTimeout(function () {
@ -131,24 +131,24 @@ mapEditArea.formatArr= function () {
var copyMap=document.getElementById('copyMap') var copyMap=document.getElementById('copyMap')
copyMap.err='' copyMap.err=''
copyMap.onclick=function(){ copyMap.onclick=function(){
tip.whichShow = 0; tip.whichShow(0);
if (pout.value.trim() != '') { if (pout.value.trim() != '') {
if (mapEditArea.error()) { if (mapEditArea.error()) {
copyMap.err = mapEditArea.errors[mapEditArea.error() - 1]; copyMap.err = mapEditArea.errors[mapEditArea.error() - 1];
tip.whichShow = 5 tip.whichShow(5)
return; return;
} }
try { try {
pout.focus(); pout.focus();
pout.setSelectionRange(0, pout.value.length); pout.setSelectionRange(0, pout.value.length);
document.execCommand("Copy"); document.execCommand("Copy");
tip.whichShow = 6; tip.whichShow(6);
} catch (e) { } catch (e) {
copyMap.err = e; copyMap.err = e;
tip.whichShow = 5; tip.whichShow(5);
} }
} else { } else {
tip.whichShow = 7; tip.whichShow(7);
} }
} }
var clearMapButton=document.getElementById('clearMapButton') var clearMapButton=document.getElementById('clearMapButton')
@ -167,7 +167,7 @@ clearMapButton.onclick=function () {
clearTimeout(tip.timer); clearTimeout(tip.timer);
pout.value = ''; pout.value = '';
mapEditArea.mapArr(''); mapEditArea.mapArr('');
tip.whichShow = 4; tip.whichShow(4);
mapEditArea.error(0); mapEditArea.error(0);
} }
var deleteMap=document.getElementById('deleteMap') var deleteMap=document.getElementById('deleteMap')
@ -189,17 +189,17 @@ deleteMap.onclick=function () {
printf = function (str_, type) { printf = function (str_, type) {
selectBox.isSelected(false); selectBox.isSelected(false);
if (!type) { if (!type) {
tip.whichShow = 11; tip.whichShow(11);
} else { } else {
tip.whichShow = 12; tip.whichShow(12);
} }
setTimeout(function () { setTimeout(function () {
if (!type) { if (!type) {
tip.msgs[11] = String(str_); tip.msgs[11] = String(str_);
tip.whichShow = 12; tip.whichShow(12);
} else { } else {
tip.msgs[10] = String(str_); tip.msgs[10] = String(str_);
tip.whichShow = 11; tip.whichShow(11);
} }
}, 1); }, 1);
} }
@ -212,83 +212,155 @@ tip_in_showMode = [
'事件编辑器中的显示文本和自定义脚本的方块也可以双击', '事件编辑器中的显示文本和自定义脚本的方块也可以双击',
"画出的地图要点击\"保存地图\"才会写入到文件中", "画出的地图要点击\"保存地图\"才会写入到文件中",
]; ];
var tip = new Vue({ var tip=document.getElementById('tip')
el: '#tip', tip._infos= {}
data: { tip.infos=function(value){
infos: {}, if(value!=null){
hasId: true, var val=value
isAutotile: false, var oldval=tip._infos
isSelectedBlock: false,
isClearBlock: false,
isAirwall: false,
geneMapSuccess: false,
timer: null,
msgs: [ //分别编号1,2,3,4,5,6,7,8,9,10奇数警告偶数成功
"当前未选择任何图块,请先在右边选择要画的图块!",
"生成地图成功!可点击复制按钮复制地图数组到剪切板",
"生成失败! 地图中有未定义的图块,建议先用其他有效图块覆盖或点击清除地图!",
"地图清除成功!",
"复制失败!",
"复制成功!可直接粘贴到楼层文件的地图数组中。",
"复制失败!当前还没有数据",
"修改成功!可点击复制按钮复制地图数组到剪切板",
"选择背景图片失败!文件名格式错误或图片不存在!",
"更新背景图片成功!",
"11:警告",
"12:成功"
],
mapMsg: '',
whichShow: 0,
},
watch: {
infos: {
handler: function (val, oldval) {
this.isClearBlock = false;
this.isAirwall = false;
if (typeof(val) != 'undefined') {
if (val == 0) {
this.isClearBlock = true;
return;
}
if ('id' in val) {
if (val.idnum == 17) {
this.isAirwall = true;
return;
}
this.hasId = true;
} else {
this.hasId = false;
}
this.isAutotile = false;
if (val.images == "autotile" && this.hasId) this.isAutotile = true;
}
},
deep: true
},
whichShow: function () { tip.isClearBlock(false);
var that = this; tip.isAirwall(false);
that.mapMsg = ''; if (typeof(val) != 'undefined') {
that.msgs[4] = "复制失败!" + editTip.err; if (val == 0) {
clearTimeout(that.timer); tip.isClearBlock(true);
if (that.whichShow) { return;
that.mapMsg = that.msgs[that.whichShow - 1];
that.timer = setTimeout(function () {
if (!(that.whichShow % 2))
that.whichShow = 0;
}, 5000); //5秒后自动清除successwarn不清除
} }
if ('id' in val) {
if (val.idnum == 17) {
tip.isAirwall(true);
return;
}
tip.hasId = true;
} else {
tip.hasId = false;
}
tip.isAutotile = false;
if (val.images == "autotile" && tip.hasId) tip.isAutotile = true;
document.getElementById('isAirwall-else').innerHTML=(tip.hasId?`<p>图块编号:<span class="infoText">${ value['idnum'] }</span></p>
<p>图块ID<span class="infoText">${ value['id'] }</span></p>`:`
<p class="warnText">该图块无对应的数字或ID存在请先前往icons.js和maps.js中进行定义</p>`)+`
<p>图块所在素材<span class="infoText">${ value['images'] + (tip.isAutotile ? '( '+infos['id']+' )' : '') }</span>
</p>
<p>图块索引<span class="infoText">${ value['y'] }</span></p>`
} }
tip._infos=value
} }
}) return tip._infos
}
tip.hasId= true
tip.isAutotile= false
tip._isSelectedBlock= false
tip.isSelectedBlock=function(value){
if(value!=null){
var dshow=document.getElementById('isSelectedBlock-if')
var dhide=document.getElementById('isSelectedBlock-else')
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
dshow.style.display=''
dhide.style.display='none'
tip._isSelectedBlock=value
}
return tip._isSelectedBlock
}
tip._isClearBlock= false
tip.isClearBlock=function(value){
if(value!=null){
var dshow=document.getElementById('isClearBlock-if')
var dhide=document.getElementById('isClearBlock-else')
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
dshow.style.display=''
dhide.style.display='none'
tip._isClearBlock=value
}
return tip._isClearBlock
}
tip._isAirwall= false
tip.isAirwall=function(value){
if(value!=null){
var dshow=document.getElementById('isAirwall-if')
var dhide=document.getElementById('isAirwall-else')
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
dshow.style.display=''
dhide.style.display='none'
tip._isAirwall=value
}
return tip._isAirwall
}
tip.geneMapSuccess= false
tip.timer= null
tip.msgs= [ //分别编号1,2,3,4,5,6,7,8,9,10奇数警告偶数成功
"当前未选择任何图块,请先在右边选择要画的图块!",
"生成地图成功!可点击复制按钮复制地图数组到剪切板",
"生成失败! 地图中有未定义的图块,建议先用其他有效图块覆盖或点击清除地图!",
"地图清除成功!",
"复制失败!",
"复制成功!可直接粘贴到楼层文件的地图数组中。",
"复制失败!当前还没有数据",
"修改成功!可点击复制按钮复制地图数组到剪切板",
"选择背景图片失败!文件名格式错误或图片不存在!",
"更新背景图片成功!",
"11:警告",
"12:成功"
]
tip._mapMsg= ''
tip.mapMsg=function(value){
if(value!=null){
document.getElementById('whichShow-if').innerText=value
tip._mapMsg=value
}
return tip._mapMsg
}
tip._whichShow= 0
tip.whichShow=function(value){
if(value!=null){
var dshow=document.getElementById('whichShow-if')
var dhide=null
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
if(dshow)dshow.style.display=''
if(dhide)dhide.style.display='none'
if(dshow)dshow.setAttribute('class',(value%2) ? 'warnText' : 'successText')
tip.mapMsg('');
tip.msgs[4] = "复制失败!" + editTip.err;
clearTimeout(tip.timer);
if (value) {
tip.mapMsg(tip.msgs[value - 1]);
tip.timer = setTimeout(function () {
if (!(value % 2))
value = 0;
}, 5000); //5秒后自动清除successwarn不清除
}
tip._whichShow=value
}
return tip._whichShow
}
var selectBox=document.getElementById('selectBox') var selectBox=document.getElementById('selectBox')
var dataSelection=document.getElementById('dataSelection') var dataSelection=document.getElementById('dataSelection')
selectBox._isSelected=false selectBox._isSelected=false
selectBox.isSelected=function(value){ selectBox.isSelected=function(value){
if(value!=null){ if(value!=null){
selectBox._isSelected=value; selectBox._isSelected=value;
tip.isSelectedBlock = value; tip.isSelectedBlock(value);
tip.whichShow = 0; tip.whichShow(0);
clearTimeout(tip.timer); clearTimeout(tip.timer);
dataSelection.style.display=value?'':'none' dataSelection.style.display=value?'':'none'
} }

View File

@ -283,21 +283,16 @@
<div id="down"> <div id="down">
<div style="margin:0.5rem"> <div style="margin:0.5rem">
<div class="tools"> <div class="tools">
<div id="tip" v-cloak> <div id="tip">
<div v-if="isSelectedBlock"> <div id="isSelectedBlock-if" style="display:none">
<p v-if="isClearBlock" class="infoText">当前选择为清除块,可擦除地图上块</p> <p id="isClearBlock-if" style="display:none" class="infoText">当前选择为清除块,可擦除地图上块</p>
<p v-if="isAirwall" class="infoText">当前选择为空气墙, 在编辑器中可视, 在游戏中隐藏的墙, 用来配合前景/背景的贴图</p> <div id="isClearBlock-else"><p id="isAirwall-if" style="display:none" class="infoText">当前选择为空气墙, 在编辑器中可视, 在游戏中隐藏的墙, 用来配合前景/背景的贴图</p>
<div v-else> <div id="isAirwall-else">
<p v-if="hasId">图块编号:<span class="infoText">{{ infos['idnum'] }}</span></p>
<p v-if="hasId">图块ID<span class="infoText">{{ infos['id'] }}</span></p> </div></div>
<p v-else class="warnText">该图块无对应的数字或ID存在请先前往icons.js和maps.js中进行定义</p>
<p>图块所在素材:<span class="infoText">{{ infos['images'] + (isAutotile ? '( '+infos['id']+' )' : '') }}</span>
</p>
<p>图块索引:<span class="infoText">{{ infos['y'] }}</span></p>
</div>
</div> </div>
<div v-else> <div id="isSelectedBlock-else">
<p v-if="whichShow" v-bind:class="[ (whichShow%2) ? 'warnText' : 'successText']">{{ mapMsg }}</p> <p id="whichShow-if" style="display:none"></p>
</div> </div>
</div> </div>

View File

@ -267,21 +267,16 @@
<canvas class='egameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas> <canvas class='egameCanvas' id='eui' width='416' height='416' style='z-index:100'></canvas>
</div> </div>
<div class="tools"> <div class="tools">
<div id="tip" v-cloak> <div id="tip">
<div v-if="isSelectedBlock"> <div id="isSelectedBlock-if" style="display:none">
<p v-if="isClearBlock" class="infoText">当前选择为清除块,可擦除地图上块</p> <p id="isClearBlock-if" style="display:none" class="infoText">当前选择为清除块,可擦除地图上块</p>
<p v-else-if="isAirwall" class="infoText">当前选择为空气墙, 在编辑器中可视, 在游戏中隐藏的墙, 用来配合前景/背景的贴图</p> <div id="isClearBlock-else"><p id="isAirwall-if" style="display:none" class="infoText">当前选择为空气墙, 在编辑器中可视, 在游戏中隐藏的墙, 用来配合前景/背景的贴图</p>
<div v-else> <div id="isAirwall-else">
<p v-if="hasId">图块编号:<span class="infoText">{{ infos['idnum'] }}</span></p>
<p v-if="hasId">图块ID<span class="infoText">{{ infos['id'] }}</span></p> </div></div>
<p v-else class="warnText">该图块无对应的数字或ID存在请先前往icons.js和maps.js中进行定义</p>
<p>图块所在素材:<span class="infoText">{{ infos['images'] + (isAutotile ? '( '+infos['id']+' )' : '') }}</span>
</p>
<p>图块索引:<span class="infoText">{{ infos['y'] }}</span></p>
</div>
</div> </div>
<div v-else> <div id="isSelectedBlock-else">
<p v-if="whichShow" v-bind:class="[ (whichShow%2) ? 'warnText' : 'successText']">{{ mapMsg }}</p> <p id="whichShow-if" style="display:none"></p>
</div> </div>
</div> </div>