parent
e9af81317f
commit
9da455d750
After Width: | Height: | Size: 2.7 MiB |
After Width: | Height: | Size: 2.5 MiB |
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "Map Test",
|
||||||
|
"difficulty" : "easy",
|
||||||
|
"logiqueName": [
|
||||||
|
"logique1" ,
|
||||||
|
"logique2",
|
||||||
|
"logique3"
|
||||||
|
],
|
||||||
|
"logiqueType": [
|
||||||
|
"et" ,
|
||||||
|
"ou",
|
||||||
|
"et"
|
||||||
|
],
|
||||||
|
"logiquePosition": [
|
||||||
|
0 ,
|
||||||
|
0,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"logiqueLink": [
|
||||||
|
["logique1","logique3"],
|
||||||
|
["logique2","logique3"]
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,136 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/style.css">
|
||||||
|
<script src="https://unpkg.com/konva@6.0.0/konva.min.js"></script>
|
||||||
|
<script src="../js/const.js"></script>
|
||||||
|
<script src="../js/func.js"></script>
|
||||||
|
<script src="../js/logique.js"></script>
|
||||||
|
<script src="../js/init.js"></script>
|
||||||
|
<script src="../js/createElement.js"></script>
|
||||||
|
<script src="../js/creator.js"></script>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||||
|
<link href="https://use.fontawesome.com/releases/v5.0.4/css/all.css" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Bitter:wght@700&display=swap" rel="stylesheet">
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Make It True</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="header-container">
|
||||||
|
<h1 align=center>Niveau <a id="niveau">Perso</a></h1>
|
||||||
|
</div>
|
||||||
|
<div id="header-container">
|
||||||
|
<button id="driver" onclick="show();">Charger un niveau</button>
|
||||||
|
</div>
|
||||||
|
<div id="play-container"></div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var switchs = [], lineCount = [], logiques = [], lines = [], endLines = [], end, switchsInfo = [], switchsInfoCopy = [], lineRemove = [];
|
||||||
|
|
||||||
|
|
||||||
|
var mapName;
|
||||||
|
var logiqueNames;
|
||||||
|
var logiqueType;
|
||||||
|
var logiquePosition;
|
||||||
|
var logiqueLink;
|
||||||
|
|
||||||
|
var layer = new Konva.Layer();
|
||||||
|
let container = document.getElementById('play-container');
|
||||||
|
container.style.height = innerHeight /100*80 + "px";
|
||||||
|
var width = container.offsetWidth;
|
||||||
|
var stage = new Konva.Stage({
|
||||||
|
container: 'play-container',
|
||||||
|
/*rotation: -90,
|
||||||
|
x: 20,
|
||||||
|
y: 1000,*/
|
||||||
|
width: width,
|
||||||
|
height: window.innerHeight,
|
||||||
|
});
|
||||||
|
stage.add(layer);
|
||||||
|
|
||||||
|
function click() {
|
||||||
|
console.log("click");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function openJson() {
|
||||||
|
var isFinish = $.Deferred();
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
$.getJSON('niv.json', function (emp) {
|
||||||
|
mapName = emp.name;
|
||||||
|
logiqueNames = emp.logiqueName;
|
||||||
|
logiqueType = emp.logiqueType;
|
||||||
|
logiquePosition = emp.logiquePosition;
|
||||||
|
logiqueLink = emp.logiqueLink;
|
||||||
|
isFinish.resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return $.when(isFinish).done(function () {
|
||||||
|
}).promise();
|
||||||
|
}
|
||||||
|
function show() {
|
||||||
|
$(function () {
|
||||||
|
openJson().done(function () {
|
||||||
|
info();
|
||||||
|
generateTerrain();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function tranformation() {
|
||||||
|
colonneTot = 0;
|
||||||
|
for(let i = 0; i < logiquePosition.length;i++){
|
||||||
|
if(logiquePosition[i]+1 > colonneTot)
|
||||||
|
colonneTot = logiquePosition[i]+1;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < colonneTot; i++) {
|
||||||
|
liveColonneNumber.push([]);
|
||||||
|
}
|
||||||
|
for(let i = 0; i < logiquePosition.length; i++){
|
||||||
|
if(Number.isNaN(numberPerColonne[logiquePosition[i]])){
|
||||||
|
numberPerColonne[logiquePosition[i]] = 0;
|
||||||
|
}
|
||||||
|
numberPerColonne[logiquePosition[i]]++;
|
||||||
|
}
|
||||||
|
for(let i = 0; i < logiquePosition.length; i++){
|
||||||
|
insertLogiqueColonne(logiqueNames[i], logiqueType[i], logiquePosition[i]);
|
||||||
|
}
|
||||||
|
for(let i = 0;i < logiqueLink.length; i++){
|
||||||
|
createLink(findLogique(logiqueLink[i][0]), findLogique(logiqueLink[i][1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
calculNombreSwitch();
|
||||||
|
switchCreator(numberOfSwitch);
|
||||||
|
|
||||||
|
createAllLinkSwitch();
|
||||||
|
|
||||||
|
initAllSwitch();
|
||||||
|
createEnd();
|
||||||
|
initEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateTerrain() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
initLayer();
|
||||||
|
|
||||||
|
tranformation();
|
||||||
|
|
||||||
|
checkAllSortieLogique();
|
||||||
|
}
|
||||||
|
|
||||||
|
function info() {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</html>
|
Loading…
Reference in new issue