event.returnValue = false;
Info.value = BackRecord.join("");
iSelects(Count);
}
function document.oncontextmenu(){
event.returnValue = false;
}
window.focus();
Base.focus();
}
function ReadMap(level){
init();
Base.innerHTML = '';
var w=Map[level][0].length*MapW
var h=Map[level].length*MapW
Base.style.width = w;
Base.style.height = h;
Base.style.left = (w>document.body.clientWidth)?0:(document.body.offsetWidth-w)/2;
//Base.style.top = 10;
for(var y=0;y<Map[level].length;y++){
MainMap[y] = [];
for(var x=0;x<Map[level][y].length;x++){
MainMap[y][x] = Map[level][y].charAt(x);
if(MainMap[y][x]=='W') iHtml(x,y,'Wall');
else{
iHtml(x,y,'Ground');
switch(MainMap[y][x]){
case '0':iBox(x,y,0);break;
case '.':iHtml(x,y,'Aim');break;
case '@':iHtml(x,y,'Aim');iBox(x,y,1);BoxCompletes++;break;
case '*':iMan(x,y,0);break;
case '#':iHtml(x,y,'Aim');iMan(x,y,1);break;
}
}
}
}
}
function iHtml(x,y,k){
Base.insertAdjacentHTML("beforeEnd","<span style='position:absolute;left:"+x*MapW+";top:"+y*MapH+";width:"+MapW+";height:"+MapH+"' class='"+k+"' x="+x+" y="+y+">");
}
function iBox(x,y,k){
MainMap[y][x] = Base.appendChild(document.createElement("<span style='position:absolute;left:"+x*MapW+";top:"+y*MapH+";width:"+MapW+";height:"+MapH+"' class='Box' complete='"+k+"'>"));
TotalBox++;
}
文章来源于领测软件测试网 https://www.ltesting.net/