舰R百科是靠无数自愿编辑者持续地建设更新完善的。编辑非常简单,请勇于更新页面!
编辑入门 | 资助百科 | 留言讨论页 | 微博@舰R百科 | 百科编辑讨论Q群:366818861

微件:Map:修订间差异

来自舰R百科
跳转到导航 跳转到搜索
(创建页面,内容为“<noinclude> {{#widget:sandbox|map=701}} </noinclude><includeonly><canvas id="map-<!--{$map|escape:'quotes'}-->" width='1024' height='576' style='background-image:url...”)
 
无编辑摘要
 
(未显示同一用户的10个中间版本)
第1行: 第1行:
<noinclude>
<noinclude>
{{#widget:sandbox|map=701}}
{{#widget:map|map=701|size=396}}
</noinclude><includeonly><canvas id="map-<!--{$map|escape:'quotes'}-->" width='1024' height='576' style='background-image:url(/wg_img/ccbResources/map/<!--{$map|escape:'url'}-->.jpg); background-position:center'></canvas><script src='https://cruiseliu.github.io/zjsnrwiki/data/pveData.js'></script><script>
</noinclude><includeonly><canvas id="map-<!--{$map|escape:'quotes'}-->" width='1024' height='576' style="width:<!--{$size|escape:'quotes'}-->px;background-image:url(/wg_img/ccbResources/map/<!--{$map|escape:'quotes'}-->.jpg); background-position:center; background-size:<!--{$size|escape:'quotes'}-->px auto;"></canvas><script src='https://zjsnrwiki.github.io/data/pveData.js'></script><script>(function() {
var mapId = "<!--{$map|escape:'quotes'}-->";
var mapId = "<!--{$map|escape:'quotes'}-->";


var nodes = [ ]
var w = parseInt("<!--{$size|escape:'quotes'}-->");
var paths = [ ]
var h = w * 576 / 1024;
var mapCanvas = document.getElementById('map-' + mapId);
mapCanvas.style.height = h + 'px';
mapCanvas.style.width = w + 'px';
 
var nodes = [ ];
var paths = [ ];


for (var node of data_pveData['pveNode'])
for (var node of data_pveData['pveNode'])
第51行: 第57行:


function drawNode(img) {
function drawNode(img) {
     var map = document.getElementById('map-' + mapId).getContext('2d');
     var map = mapCanvas.getContext('2d');
     for (var node of nodes)
     for (var node of nodes)
         if (node.type == img._type) {
         if (node.type == img._type) {
第78行: 第84行:
     ctx.putImageData(imgData, 0, 0);
     ctx.putImageData(imgData, 0, 0);


     var map = document.getElementById('map-' + mapId).getContext('2d');
     var map = mapCanvas.getContext('2d');
     map.save();
     map.save();
     var node1 = nodes[img._path.start];
     var node1 = nodes[img._path.start];
第99行: 第105行:
     if (drawnNodeCnt < nodeImgs.length || drawnPathCnt < paths.length) return;
     if (drawnNodeCnt < nodeImgs.length || drawnPathCnt < paths.length) return;


     var map = document.getElementById('map-' + mapId).getContext('2d');
     var map = mapCanvas.getContext('2d');
     map.font = 'bold 24px monospace';
     map.font = 'bold 2em "Noto Sans", sans-serif';
     map.textAlign = 'center';
     map.textAlign = 'center';
     map.fillStyle = 'white';
     map.fillStyle = 'white';
     map.strokeStype = 'black';
     map.strokeStype = 'black';
     map.lineWidth = 3;
     map.lineWidth = 5;
     var labels = '0ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     var labels = '0ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     for (var i = 1; i < nodes.length; ++i) {
     for (var i = 1; i < nodes.length; ++i) {
         var x = nodes[i].x * 384;
         var x = nodes[i].x * 384;
         var y = 576 - nodes[i].y * 384 - (nodes[i].type == 2 ? 35 : 25);
         var y = 576 - nodes[i].y * 384 - (nodes[i].type == 2 ? 40 : 30);
         map.strokeText(labels[i], x, y);
         map.strokeText(labels[i], x, y);
         map.fillText(labels[i], x, y);
         map.fillText(labels[i], x, y);
     }
     }
}
}
</script></includeonly>
}());</script></includeonly>

2016年10月8日 (六) 00:37的最新版本