From 4f41b1f05a7f2f7a7ab2de6ddd6f5249be5626cb Mon Sep 17 00:00:00 2001 From: Vinesh Kannan Date: Fri, 16 Feb 2018 12:30:49 -0500 Subject: [PATCH] Add dialog for starting simulation --- js/main.js | 2 +- js/maps/main.js.map | 2 +- src/main.js | 22 +++++++++++++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/js/main.js b/js/main.js index 2bbf186..48a6c2e 100644 --- a/js/main.js +++ b/js/main.js @@ -1,2 +1,2 @@ -!function e(t,n,r){function a(o,s){if(!n[o]){if(!t[o]){var c="function"==typeof require&&require;if(!s&&c)return c(o,!0);if(i)return i(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[o]={exports:{}};t[o][0].call(d.exports,function(e){var n=t[o][1][e];return a(n||e)},d,d.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o reference\n\n\t\t\t// re-position camera: camera must be already present when html loads\n\t\t\tvar camera = document.getElementById('camera');\n\t\t\t//camera.setAttribute('position', m_ocean.x + \" \" + m_ocean.y + \" \" + m_ocean.z);\n\t\t\tcamera.setAttribute('position', m_ocean.x + \" \" + m_ocean.y + \" \" + (m_ocean.z + 1.5 * m_ocean.x));\n\t\t\tcamera.setAttribute('camera', 'userHeight: ' + m_Constants.CameraYOffset);\n\t\t\t//camera.setAttribute('rotation', -Math.atan(m_Constants.CameraYOffset/(m_ocean.z+m_ocean.x))); // TODO: check if the string is a vec3\n\t\t\tcamera.setAttribute('rotation', '-50 0 0');\n\n\t\t\t// Generate Map\n\t\t\t// TODO: Possible edge cases with the map edge not being big enough\n\t\t\tvar map = document.createElement('a-ocean');\n\n\t\t\tmap.setAttribute('position', m_ocean.x + \" \" + m_ocean.y + \" \" + m_ocean.z);\n\t\t\tmap.setAttribute('width', String(m_ocean.width));\n\t\t\tmap.setAttribute('depth', String(m_ocean.depth));\n\t\t\tmap.setAttribute('density', String(m_ocean.density));\n\t\t\tdoc.appendChild(map);\n\n\t\t\tvar spawnShip = function spawnShip(entry) {\n\t\t\t\tvar ship = document.createElement('a-entity');\n\n\t\t\t\tship.dataset.id = entry.id;\n\t\t\t\tship.dataset.name = entry.name;\n\t\t\t\tship.dataset.owner = entry.owner;\n\t\t\t\tship.dataset.x = entry.x;\n\t\t\t\tship.dataset.y = entry.y;\n\t\t\t\tship.dataset.z = entry.z;\n\t\t\t\tship.dataset.health = entry.hull;\n\t\t\t\tship.dataset.hull = entry.hull;\n\t\t\t\tship.dataset.firepower = entry.firepower;\n\t\t\t\tship.dataset.speed = entry.speed;\n\t\t\t\tship.dataset.range = entry.range;\n\n\t\t\t\tvar heart = \"\";\n\t\t\t\tfor (var i = 0; i < parseInt(entry.hull); i++) {\n\t\t\t\t\theart += \" •\";\n\t\t\t\t}\n\n\t\t\t\tship.setAttribute('position', entry.x + \" \" + entry.y + \" \" + entry.z);\n\n\t\t\t\tif (entry.color === \"rgb(255, 255, 0)\") {\n\t\t\t\t\tship.setAttribute('template', 'src: #submarine-template');\n\t\t\t\t\tship.setAttribute('class', 'submarine');\n\t\t\t\t} else {\n\t\t\t\t\tship.setAttribute('template', 'src: #boat-template');\n\t\t\t\t\tship.setAttribute('class', 'boat');\n\t\t\t\t}\n\n\t\t\t\t// ${variable} <- variable name be lower case\n\t\t\t\tship.setAttribute('data-ship_color', 'color: ' + entry.color + '; metalness: 0.4;');\n\t\t\t\tship.setAttribute('data-ship_name', 'value: ' + entry.name + '; font: #play;');\n\t\t\t\tship.setAttribute('data-ship_health', 'value: ' + heart + ';');\n\n\t\t\t\tvar shipInstance = doc.appendChild(ship);\n\t\t\t\tm_entity[entry.id] = shipInstance;\n\t\t\t};\n\t\t\t// spawn the ships!\n\t\t\tshipData.forEach(function (entry) {\n\t\t\t\tspawnShip(entry);\n\t\t\t});\n\t\t},\n\n\t\tsinkShip: function sinkShip(data) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar doc = document.getElementById('scene');\n\t\t\t\tvar track = document.getElementById('track');\n\t\t\t\tvar shipDom = m_entity[data[0].id];\n\n\t\t\t\tvar debug = document.createElement('a-draw-curve');\n\t\t\t\tdebug.setAttribute('curveref', '#track');\n\t\t\t\tdebug.setAttribute('material', 'shader: line; color: black;');\n\t\t\t\tdoc.appendChild(debug);\n\n\t\t\t\tvar point1 = document.createElement('a-curve-point');\n\t\t\t\tvar point2 = document.createElement('a-curve-point');\n\t\t\t\tpoint1.setAttribute('position', data[0].x + \" \" + data[0].y + \" \" + data[0].z);\n\t\t\t\tpoint2.setAttribute('position', data[0].x + \" \" + (data[0].y - m_Constants.SinkDistance) + \" \" + data[0].z);\n\t\t\t\ttrack.appendChild(point1);\n\t\t\t\ttrack.appendChild(point2);\n\n\t\t\t\tshipDom.setAttribute('alongpath', 'curve: #track; rotate: false; delay: ' + m_Constants.WaitTimeBetweenAction + '; dur: 1000;');\n\n\t\t\t\tvar done = function done(event) {\n\t\t\t\t\tshipDom.removeAttribute('alongpath');\n\t\t\t\t\tif (debug.parentNode) {\n\t\t\t\t\t\tdoc.removeChild(debug);\n\t\t\t\t\t}\n\n\t\t\t\t\twhile (track.hasChildNodes()) {\n\t\t\t\t\t\ttrack.removeChild(track.childNodes[0]);\n\t\t\t\t\t}\n\n\t\t\t\t\t//shipDom.removeEventListener('movingended', done);\n\n\t\t\t\t\tif (shipDom.parentNode) {\n\t\t\t\t\t\tdoc.removeChild(shipDom);\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve(event);\n\t\t\t\t};\n\n\t\t\t\tshipDom.addEventListener('movingended', done);\n\t\t\t\t// resolve();\n\t\t\t});\n\t\t},\n\n\t\t// Data passed in are one ships action of firing at one and only one coordinate\n\t\tfireShip: function fireShip(data) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar doc = document.getElementById('scene');\n\t\t\t\tvar track = document.getElementById('track');\n\t\t\t\tvar ship = m_entity[data[0].id];\n\n\t\t\t\tvar bullet = document.createElement('a-sphere');\n\t\t\t\tvar source = document.createElement('a-curve-point');\n\t\t\t\tvar arc = document.createElement('a-curve-point');\n\t\t\t\tvar target = document.createElement('a-curve-point');\n\n\t\t\t\t// var saves = null;\n\t\t\t\t// if (ship.className === \"submarine\") {\n\t\t\t\t// \tfor (var i = 0; i < ship.childNodes.length; i++) {\n\t\t\t\t// \t\tif (ship.childNodes[i].className === \"submarineMissile\") {\n\t\t\t\t// \t\t\tbullet = ship.childNodes[i]\n\t\t\t\t// \t\t\tsaves = bullet.getAttribute('position');\n\t\t\t\t// \t\t\tbreak;\n\t\t\t\t// \t\t}\n\t\t\t\t// \t}\n\t\t\t\t// \tconsole.log('missile start', saves);\n\t\t\t\t// \tsource.setAttribute('position', (data[0].x+saves.x) + \" \" + (data[0].y+saves.y) + \" \" + (data[0].z+saves.z));\n\t\t\t\t// \tarc.setAttribute('position', (data[0].x+saves.x) + \" \" + (data[0].y+saves.y+5) + \" \" + (data[0].z+saves.z));\n\t\t\t\t// \ttarget.setAttribute('position', data[0].atX + \" \" + data[0].atY + \" \" + data[0].atZ);\n\t\t\t\t// \ttrack.appendChild(source);\n\t\t\t\t// \ttrack.appendChild(arc);\n\t\t\t\t// \ttrack.appendChild(target);\n\t\t\t\t// }\n\t\t\t\t// else {\n\t\t\t\tbullet.setAttribute('color', 'gray');\n\t\t\t\tbullet.setAttribute('radius', '0.2');\n\t\t\t\tbullet.setAttribute('position', data[0].x + \" \" + data[0].y + \" \" + data[0].z);\n\t\t\t\tsource.setAttribute('position', data[0].x + \" \" + data[0].y + \" \" + data[0].z);\n\t\t\t\tarc.setAttribute('position', (data[0].atX + data[0].x) / 2 + \" \" + ((data[0].atY + data[0].y) / 2 + m_Constants.BulletArc) + \" \" + (data[0].atZ + data[0].z) / 2);\n\t\t\t\ttarget.setAttribute('position', data[0].atX + \" \" + data[0].atY + \" \" + data[0].atZ);\n\t\t\t\ttrack.appendChild(source);\n\t\t\t\ttrack.appendChild(arc);\n\t\t\t\ttrack.appendChild(target);\n\t\t\t\t// }\n\n\t\t\t\tvar debug = document.createElement('a-draw-curve');\n\t\t\t\tdebug.setAttribute('curveref', '#track');\n\t\t\t\tdebug.setAttribute('material', 'shader: line; color: red;');\n\t\t\t\tdoc.appendChild(debug);\n\n\t\t\t\tvar tmp = doc.appendChild(bullet);\n\t\t\t\tvar distance = Math.sqrt((data[0].atX - data[0].x) * (data[0].atX - data[0].x) + (data[0].atZ - data[0].z) * (data[0].atZ - data[0].z)) + m_Constants.BulletArc * m_Constants.BulletArc;\n\t\t\t\t//console.log(\"distance: \", distance);\n\t\t\t\ttmp.setAttribute('alongpath', 'curve: #track; rotate: true; constant: 0 -1 0; delay: 100; dur: ' + 25 * distance);\n\n\t\t\t\tvar done = function done(event) {\n\t\t\t\t\ttmp.removeAttribute('alongpath');\n\t\t\t\t\tif (debug.parentNode) {\n\t\t\t\t\t\tdoc.removeChild(debug);\n\t\t\t\t\t}\n\t\t\t\t\twhile (track.hasChildNodes()) {\n\t\t\t\t\t\ttrack.removeChild(track.childNodes[0]);\n\t\t\t\t\t}\n\n\t\t\t\t\t//tmp.removeEventListener('movingended', done);\n\t\t\t\t\tif (tmp.parentNode) {\n\t\t\t\t\t\tdoc.removeChild(tmp);\n\t\t\t\t\t}\n\t\t\t\t\t// if (ship.className === \"submarine\") {\n\t\t\t\t\t// \tvar reload = document.createElement('a-entity');\n\t\t\t\t\t// \treload.setAttribute('class', 'submarineMissile');\n\t\t\t\t\t// \treload.setAttribute('obj-model', 'obj: #submarineMissile');\n\t\t\t\t\t// \treload.setAttribute('position', saves);\n\t\t\t\t\t// \tship.appendChild(reload);\n\t\t\t\t\t// }\n\n\t\t\t\t\tresolve(event);\n\t\t\t\t};\n\n\t\t\t\ttmp.addEventListener('movingended', done);\n\t\t\t\t//resolve();\n\t\t\t});\n\t\t},\n\n\t\taimShip: function aimShip(data) {\n\t\t\tvar rotateVector = function rotateVector(vec2, deg) {\n\t\t\t\tvar rad = -deg * Math.PI / 180;\n\t\t\t\tvar cos = Math.cos(rad);\n\t\t\t\tvar sin = Math.sin(rad);\n\t\t\t\t//console.log(\"vector: \", vec2);\n\t\t\t\t//console.log(\"degree: \", deg);\n\t\t\t\t// round the numbers\n\t\t\t\treturn {\n\t\t\t\t\t\"x\": Math.round(100000 * ((vec2.x - vec2.atX) * cos - (vec2.z - vec2.atZ) * sin)) / 100000,\n\t\t\t\t\t\"y\": vec2.y - vec2.atY,\n\t\t\t\t\t\"z\": Math.round(100000 * ((vec2.x - vec2.atX) * sin + (vec2.z - vec2.atZ) * cos)) / 100000\n\t\t\t\t};\n\t\t\t};\n\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\t//console.log('aim info: ', data);\n\t\t\t\tvar doc = document.getElementById('scene');\n\t\t\t\tvar track = document.getElementById('track');\n\t\t\t\tvar ship = m_entity[data[0].id];\n\n\t\t\t\tvar shipRot = ship.getAttribute('rotation');\n\t\t\t\t//console.log(\"rot info: \", shipRot);\n\n\t\t\t\t// var action = null;\n\t\t\t\t// if (ship.className == \"boat\") {\n\t\t\t\t// \tfor(var i = 0; i < ship.childNodes.length; i++) {\n\t\t\t\t// \t\tif (ship.childNodes[i].className === \"aimShip\") {\n\t\t\t\t// \t\t\taction = ship.childNodes[i];\n\t\t\t\t// \t\t\tbreak;\n\t\t\t\t// \t\t}\n\t\t\t\t// \t}\n\t\t\t\t// \tif (action) {\n\t\t\t\t// \t\tvar shipY = ship.getAttribute('rotation').y;\n\t\t\t\t// \t\tvar current = action.getAttribute(\"rotation\").y;\n\t\t\t\t// \t\tvar radian = Math.atan((data[0].atZ-data[0].z)/(data[0].atX-data[0].x));\n\t\t\t\t// \t\tvar degree = -radian * 180 / Math.PI;\n\t\t\t\t// \t\tconsole.log(\"ship r: \", degree, current);\n\t\t\t\t// \t\tconsole.log(\"ship current rotation\", shipY);\n\t\t\t\t// \t\tvar rotated = rotateVector(data[0], shipY);\n\t\t\t\t// \t\tconsole.log(\"aim r: \", rotated);\n\t\t\t\t// \t\t//action.setAttribute('look-at', rotated);\n\t\t\t\t// \t\taction.setAttribute('rotation', '0 ' + (degree-shipY) + ' 0');\n\t\t\t\t// \t\t//action.removeAttribute('look-at');\n\t\t\t\t// \t}\n\t\t\t\t// }\n\n\t\t\t\tresolve();\n\t\t\t});\n\t\t},\n\n\t\thitShip: function hitShip(data) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar ship = m_entity[data[0].id];\n\t\t\t\tvar heart = \"\";\n\n\t\t\t\tfor (var i = 0; i < data[0].health; i++) {\n\t\t\t\t\theart += \" •\";\n\t\t\t\t}\n\n\t\t\t\tfor (var i = 0; i < ship.childNodes.length; i++) {\n\t\t\t\t\tif (ship.childNodes[i].className == \"ship-health\") {\n\t\t\t\t\t\tship.childNodes[i].setAttribute('text-geometry', 'value: ' + heart + ';');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tresolve();\n\t\t\t});\n\t\t},\n\n\t\t// Data passed in must be for movement of one ship\n\t\tmoveShip: function moveShip(data) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar shipDom = m_entity[data[0].id]; // html element\n\t\t\t\t// if statement is not working\n\t\t\t\t// if (data.length === 1 && data[0].x === shipDom.dataset.x && data[0].z === shipDom.dataset.z) {\n\t\t\t\t// // if shipDom tries to move against edge or occupied place\n\t\t\t\t// alert(\"Skipped\");\n\t\t\t\t// resolve(\"Skipped\");\n\t\t\t\t// }\n\n\t\t\t\tvar doc = document.getElementById('scene'); // reference\n\t\t\t\tvar track = document.getElementById('track');\n\t\t\t\t//var startCoord = {\"x\": data[0].x};\n\n\t\t\t\tvar debug = document.createElement('a-draw-curve');\n\t\t\t\tdebug.setAttribute('curveref', '#track');\n\t\t\t\tdebug.setAttribute('material', 'shader: line; color: blue;');\n\t\t\t\tdoc.appendChild(debug);\n\n\t\t\t\t// add current location as a starting point of the curve\n\t\t\t\tvar point = document.createElement('a-curve-point');\n\t\t\t\tpoint.setAttribute('position', String(shipDom.dataset.x + \" \" + shipDom.dataset.y + \" \" + shipDom.dataset.z));\n\t\t\t\ttrack.appendChild(point);\n\t\t\t\t// add chain-able goal locations to the curve\n\n\t\t\t\t//previous is used to check for movement against walls, e.g. previous location same as current and next\n\t\t\t\t//previous can also be used to get the last action which determines the final rotation where the ship should point\n\t\t\t\tvar previous = { 'x': shipDom.dataset.x, 'z': shipDom.dataset.z };\n\t\t\t\tvar xDistance = 0;\n\t\t\t\tvar zDistance = 0;\n\t\t\t\t//console.log(\"Moving: \", data);\n\t\t\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\t\t\tpoint = document.createElement('a-curve-point');\n\t\t\t\t\tpoint.setAttribute('position', data[i].x + \" \" + data[i].y + \" \" + data[i].z);\n\t\t\t\t\txDistance += Math.abs(data[i].x - previous.x);\n\t\t\t\t\tzDistance += Math.abs(data[i].z - previous.z);\n\t\t\t\t\tif (i + 1 < data.length && data[i].x === data[i + 1].x && data[i].z === data[i + 1].z) {\n\t\t\t\t\t\ti++;\n\t\t\t\t\t}\n\t\t\t\t\ttrack.appendChild(point);\n\t\t\t\t\tprevious = { 'x': data[i].x, 'z': data[i].z, 'direction': data[i].direction };\n\t\t\t\t}\n\n\t\t\t\tvar dur = (xDistance + zDistance) * m_Constants.WaitTimePerTileMoved; // determines the length in time of the movement \n\t\t\t\tshipDom.setAttribute('alongpath', 'curve: #track; rotate: true; constraint: 0 0 -1; delay: ' + m_Constants.WaitTimeBetweenAction + '; dur: ' + dur + ';');\n\n\t\t\t\tvar done = function done(event) {\n\t\t\t\t\t// var list = document.getElementByTagName('a-draw-curve');\n\t\t\t\t\t// for (var i = 0; i < list.length; i++) {\n\t\t\t\t\t// list[0].parentNode.removeChild(list[0]);\n\t\t\t\t\t// }\n\t\t\t\t\tif (debug.parentNode) {\n\t\t\t\t\t\tdoc.removeChild(debug);\n\t\t\t\t\t}\n\n\t\t\t\t\twhile (track.hasChildNodes()) {\n\t\t\t\t\t\ttrack.removeChild(track.childNodes[0]);\n\t\t\t\t\t}\n\n\t\t\t\t\tshipDom.removeAttribute('alongpath');\n\t\t\t\t\tshipDom.dataset.x = data[data.length - 1].x;\n\t\t\t\t\tshipDom.dataset.z = data[data.length - 1].z;\n\t\t\t\t\tshipDom.dataset.y = data[data.length - 1].y;\n\n\t\t\t\t\t//shipDom.removeEventListener('movingended', done);\n\t\t\t\t\tresolve(event);\n\t\t\t\t};\n\n\t\t\t\tshipDom.addEventListener('movingended', done);\n\t\t\t});\n\t\t},\n\n\t\tsimulate: function simulate() {\n\t\t\t//console.log(\"chain: \", m_chain);\n\t\t\tvar notStop = true;\n\t\t\tif (m_chain.length == 0) {\n\t\t\t\tnotStop = false;\n\t\t\t}\n\t\t\tvar current = m_chain.shift(); // don't shift when length is zero\n\t\t\tif (current && notStop) {\n\t\t\t\t//console.log(\"current: \", current);\n\t\t\t\tswitch (current.type) {\n\t\t\t\t\tcase \"MOVE\":\n\t\t\t\t\t\tapp.moveShip(current.actions).then(function (done) {\n\t\t\t\t\t\t\t//alert(\"Moved \" + m_chain.length + \" actions left\");\n\t\t\t\t\t\t\tapp.simulate();\n\t\t\t\t\t\t}).catch(function (err) {\n\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"FIRE\":\n\t\t\t\t\t\t/*** Exclusive Or functions ***/\n\n\t\t\t\t\t\t/* Fire without aiming */\n\t\t\t\t\t\tapp.fireShip(current.actions).then(function (done) {\n\t\t\t\t\t\t\tapp.simulate();\n\t\t\t\t\t\t}).catch(function (err) {\n\t\t\t\t\t\t\tconsole.error(\"error: \", err);\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// /* Aim then fire (currently buggy)*/\n\t\t\t\t\t\t// app.aimShip(current.actions).then((done) => {\n\t\t\t\t\t\t// \tapp.fireShip(current.actions).then((done) => {\n\t\t\t\t\t\t// \t\tapp.simulate();\n\t\t\t\t\t\t// \t}).catch((err) => {\n\t\t\t\t\t\t// \t\tconsole.error(\"error: \", err);\t\n\t\t\t\t\t\t// \t});\n\t\t\t\t\t\t// }).catch((err) => {\n\t\t\t\t\t\t// \tconsole.error(\"error: \", err);\n\t\t\t\t\t\t// });\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"HIT\":\n\t\t\t\t\t\tapp.hitShip(current.actions).then(function (done) {\n\t\t\t\t\t\t\tapp.simulate();\n\t\t\t\t\t\t}).catch(function (err) {\n\t\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"SINK\":\n\t\t\t\t\t\tapp.sinkShip(current.actions).then(function (done) {\n\t\t\t\t\t\t\t//alert(\"Sunk \"+ m_chain.length + \" actions left\");\n\t\t\t\t\t\t\tapp.simulate();\n\t\t\t\t\t\t}).catch(function (err) {\n\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tconsole.warn(\"Unknown Action Type \" + current.type + \" in simulate function, skipping.\");\n\t\t\t\t\t\tapp.simulate();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t//alert(\"Simulation Done\");\n\t\t\t\t\tvex.dialog.alert(\"Simulation Completed.\");\n\t\t\t\t}, 10000);\n\t\t\t}\n\t\t},\n\n\t\t/** translates the coordinate in the java game to this scene's coordinate\n \tJava Game: Each ship spans one (x, y) unit\n \tJava Game: Coordinate system has (0, 0) at top left corner (without negatives)\n \tAFrame Scene: Each ship model is a 4x4 box\n \tAFrame Scene: Coordinate system is (0, 0) at the center (with negatives)\n */\n\t\tgetStrCoord: function getStrCoord(coord, offsetY) {\n\t\t\treturn (m_ocean.x - coord.x) * 4 + \" \" + offsetY + \" \" + (m_ocean.y - coord.y) * 4;\n\t\t},\n\n\t\tgetShips: function getShips() {\n\t\t\treturn m_ships;\n\t\t},\n\n\t\tgetOcean: function getOcean() {\n\t\t\treturn m_ocean;\n\t\t}\n\n\t};\n\n\treturn app;\n}\n\nvar app = battleship();\nvar params = getQueryParams(document.location.search);\n\nvar getDataFromCode = function getDataFromCode(code) {\n\tdb.ref('davy-jones-locker/' + code).once('value', function (snapshot) {\n\t\tvar gameData = snapshot.val();\n\t\tif (gameData) {\n\t\t\tinput = gameData;\n\t\t\tapp.init();\n\t\t} else {\n\t\t\tgetCode(\"No data for code \" + code + \". Enter another code:\");\n\t\t\t//app.init();\n\t\t}\n\t}).catch(function (err) {\n\t\tgetCode(\"There was an error. Enter another code:\");\n\t\t//app.init();\n\t});\n};\n\nvar getCode = function getCode(message) {\n\tvex.dialog.prompt({\n\t\tmessage: message,\n\t\tcallback: function callback(value) {\n\t\t\tif (value) {\n\t\t\t\tvar code = value;\n\t\t\t\tgetDataFromCode(code);\n\t\t\t} else {\n\t\t\t\tgetCode(\"No code entered. Enter your code:\");\n\t\t\t}\n\t\t}\n\t});\n};\n\nif (params.code) {\n\tgetDataFromCode(params.code);\n} else {\n\tgetCode(\"Enter Your Code\");\n}\n\n// var BATTLE_SERVER_URL = 'https://battleship-vingkan.c9users.io/1v1?p1=esi17.cs.DestroyerShip&p2=esi17.hli109.Floater';// + Math.ceil(Math.random() * 100);\n\n// $.get(BATTLE_SERVER_URL).then(data => {\n// \tinput = data;\n// \tapp.init();\n// }).done(() => {\n// \tconsole.log(\"Data successfully retrieved from server\");\n// }).fail(() => {\n// \tconsole.log(\"Unable to retrieve data, starting with local data\");\n// \tapp.init();\n// });\n\n},{}]},{},[1])\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJzcmMvbWFpbi5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O0FDQUE7QUFDQSxJQUFJLFNBQVM7QUFDWixTQUFRLHlDQURJO0FBRVosYUFBWSwwQkF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wgPSAnaHR0cHM6Ly9iYXR0bGVzaGlwLXZpbmdrYW4uYzl1c2Vycy5pby8xdjE/cDE9ZXNpMTcuY3MuRGVzdHJveWVyU2hpcCZwMj1lc2kxNy5obGkxMDkuRmxvYXRlcic7Ly8gKyBNYXRoLmNlaWwoTWF0aC5yYW5kb20oKSAqIDEwMCk7XG5cbi8vICQuZ2V0KEJBVFRMRV9TRVJWRVJfVVJMKS50aGVuKGRhdGEgPT4ge1xuLy8gXHRpbnB1dCA9IGRhdGE7XG4vLyBcdGFwcC5pbml0KCk7XG4vLyB9KS5kb25lKCgpID0+IHtcbi8vIFx0Y29uc29sZS5sb2coXCJEYXRhIHN1Y2Nlc3NmdWxseSByZXRyaWV2ZWQgZnJvbSBzZXJ2ZXJcIik7XG4vLyB9KS5mYWlsKCgpID0+IHtcbi8vIFx0Y29uc29sZS5sb2coXCJVbmFibGUgdG8gcmV0cmlldmUgZGF0YSwgc3RhcnRpbmcgd2l0aCBsb2NhbCBkYXRhXCIpO1xuLy8gXHRhcHAuaW5pdCgpO1xuLy8gfSk7XG5cblxuXG4iXX0=\n"]} \ No newline at end of file +{"version":3,"sources":["main.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length","1","module","config","apiKey","authDomain","databaseURL","projectId","storageBucket","messagingSenderId","db","firebase","initializeApp","database","app","m_ocean","m_Constants","CameraYOffset","OceanYOffset","OceanPadding","ShipYOffset","SinkDistance","BulletArc","WaitTimePerTileMoved","WaitTimeBetweenAction","m_input","m_ships","m_chain","m_entity","init","ships","input","turns","ocean","map","preprocess","doc","document","getElementById","track","createElement","setAttribute","appendChild","render","vex","dialog","confirm","message","buttons","$","extend","YES","className","text","callback","doIt","setTimeout","simulate","data","translate","d","res","hasOwnProperty","atX","atY","x","z","y","actions","index","Math","floor","width","depth","density","forEach","entry","push","chain","id","type","shipData","camera","String","spawnShip","ship","dataset","name","owner","health","hull","firepower","speed","range","heart","parseInt","color","shipInstance","sinkShip","Promise","resolve","reject","shipDom","debug","point1","point2","addEventListener","event","removeAttribute","parentNode","removeChild","hasChildNodes","childNodes","fireShip","bullet","source","arc","target","atZ","tmp","distance","sqrt","aimShip","getAttribute","hitShip","moveShip","point","previous","xDistance","zDistance","abs","direction","dur","notStop","current","shift","then","done","catch","err","console","error","log","warn","alert","getStrCoord","coord","offsetY","getShips","getOcean","battleship","params","qs","split","join","tokens","re","exec","decodeURIComponent","getQueryParams","location","search","getDataFromCode","ref","once","snapshot","gameData","val","getCode","prompt","value"],"mappings":"CAAA,SAAUA,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIE,EAAkB,mBAATC,SAAqBA,QAAQ,IAAIF,GAAGC,EAAE,OAAOA,EAAEF,GAAE,GAAI,GAAGI,EAAE,OAAOA,EAAEJ,GAAE,GAAI,IAAIK,EAAE,IAAIC,MAAM,uBAAuBN,EAAE,KAAK,MAAMK,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEX,EAAEG,IAAIS,YAAYb,EAAEI,GAAG,GAAGU,KAAKF,EAAEC,QAAQ,SAASd,GAAG,IAAIE,EAAED,EAAEI,GAAG,GAAGL,GAAG,OAAOI,EAAEF,GAAIF,IAAIa,EAAEA,EAAEC,QAAQd,EAAEC,EAAEC,EAAEC,GAAG,OAAOD,EAAEG,GAAGS,QAAkD,IAAI,IAA1CL,EAAkB,mBAATD,SAAqBA,QAAgBH,EAAE,EAAEA,EAAEF,EAAEa,OAAOX,IAAID,EAAED,EAAEE,IAAI,OAAOD,EAAvb,EAA4ba,GAAG,SAAST,EAAQU,EAAOJ,GACvd,aAGA,IAAIK,GACHC,OAAQ,0CACRC,WAAY,2BACZC,YAAa,kCACbC,UAAW,WACXC,cAAe,uBACfC,kBAAmB,gBAIhBC,EAFmBC,SAASC,cAAcT,EAAQ,sBAE5BU,WA4jBtBC,EA/iBJ,WAGC,IAmBIC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AO3J,KACVsK,EAAgBX,EAAO3J,MAEvB4K,EAAQ,6BAeE","file":"../main.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o {\n \tapp.simulate();\n }, 10000);*/\n\t\t\tvex.dialog.confirm({\n\t\t\t\tmessage: 'Ready to view the battle?',\n\t\t\t\tbuttons: [$.extend({}, vex.dialog.buttons.YES, {\n\t\t\t\t\tclassName: 'vex-dialog-button-primary',\n\t\t\t\t\ttext: 'Play'\n\t\t\t\t})],\n\t\t\t\tcallback: function callback(doIt) {\n\t\t\t\t\tif (doIt) {\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tapp.simulate();\n\t\t\t\t\t\t}, 1000);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\t// call function to wait a bit before starting simulation\n\t\t\t//app.simulate();\n\t\t},\n\n\t\tpreprocess: function preprocess(data) {\n\t\t\tvar translate = function translate(d) {\n\t\t\t\tvar res = d;\n\t\t\t\tif (res.hasOwnProperty(\"atX\") && res.hasOwnProperty(\"atY\")) {\n\t\t\t\t\tres['atX'] = 4 * d.atX;\n\t\t\t\t\tres['atZ'] = 4 * d.atY; // make sure to move the y property before overriding it\n\t\t\t\t\tres['atY'] = m_Constants.ShipYOffset;\n\t\t\t\t}\n\t\t\t\tres.x = 4 * d.x;\n\t\t\t\tres.z = 4 * d.y; // make sure to move the y property before overriding it\n\t\t\t\tres.y = m_Constants.ShipYOffset;\n\t\t\t\treturn res;\n\t\t\t};\n\t\t\tvar actions = [];\n\t\t\tvar index = 0;\n\n\t\t\t// preprocess initial map information\n\t\t\t// m_ocean = { \"x\": ((4*Math.floor(data.ocean.x/2))-2) + (m_Constants.OceanPadding/2),\n\t\t\t// \"y\": m_Constants.OceanYOffset, \n\t\t\t// \"z\": ((4*Math.floor(data.ocean.y/2))) + (m_Constants.OceanPadding/2), \n\t\t\t// \"width\": (4*data.ocean.x)+m_Constants.OceanPadding, \n\t\t\t// \"depth\": (4*data.ocean.y)+m_Constants.OceanPadding, \n\t\t\t// \"density\": Math.min(3*data.ocean.x, 3*data.ocean.y)+m_Constants.OceanPadding\n\t\t\t// };\n\t\t\tm_ocean = { \"x\": 4 * Math.floor(data.ocean.x / 2) - 2,\n\t\t\t\t\"y\": m_Constants.OceanYOffset,\n\t\t\t\t\"z\": 4 * Math.floor(data.ocean.y / 2),\n\t\t\t\t\"width\": 400,\n\t\t\t\t\"depth\": 400,\n\t\t\t\t\"density\": 240\n\t\t\t};\n\n\t\t\t// preprocess initial ship information\n\t\t\tdata.ships.forEach(function (entry) {\n\t\t\t\tm_ships.push(translate(entry));\n\t\t\t});\n\n\t\t\t// preprocess actions and turns information\n\t\t\twhile (index < data.turns.length) {\n\t\t\t\tvar chain = true;\n\t\t\t\twhile (chain) {\n\t\t\t\t\tif (index === data.turns.length) break;\n\n\t\t\t\t\tif (actions.length === 0) {\n\t\t\t\t\t\tactions.push(translate(data.turns[index]));\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t}\n\t\t\t\t\t// Ship id and action type has to be the same to be considered a chain-able action\n\t\t\t\t\telse if (actions[0].id === data.turns[index].id && actions[0].type === data.turns[index].type) {\n\t\t\t\t\t\t\tif (actions[0].type === \"MOVE\") {\n\t\t\t\t\t\t\t\tactions.push(translate(data.turns[index]));\n\t\t\t\t\t\t\t\tindex++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Firing must be at the same coordinates to be considered a chain-able action\n\t\t\t\t\t\t\telse if (actions[0].type === \"FIRE\" && actions[0].atX === 4 * data.turns[index].atX && actions[0].atY === 4 * data.turns[index].atY) {\n\t\t\t\t\t\t\t\t\tactions.push(translate(data.turns[index]));\n\t\t\t\t\t\t\t\t\tindex++;\n\t\t\t\t\t\t\t\t} else if (actions[0].type === \"SINK\") {\n\t\t\t\t\t\t\t\t\tactions.push(translate(data.turns[index]));\n\t\t\t\t\t\t\t\t\tindex++;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tchain = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchain = false;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// add action chain to variable\n\t\t\t\tm_chain.push({ \"type\": actions[0].type, \"actions\": actions });\n\t\t\t\t// reset chain actions\n\t\t\t\tactions = [];\n\t\t\t}\n\t\t},\n\n\t\t// Displays the ocean, and ships\n\t\t// TODO: check the edge cases with the map edges/sizes\n\t\trender: function render(shipData) {\n\t\t\tvar doc = document.getElementById('scene'); // reference\n\n\t\t\t// re-position camera: camera must be already present when html loads\n\t\t\tvar camera = document.getElementById('camera');\n\t\t\t//camera.setAttribute('position', m_ocean.x + \" \" + m_ocean.y + \" \" + m_ocean.z);\n\t\t\tcamera.setAttribute('position', m_ocean.x + \" \" + m_ocean.y + \" \" + (m_ocean.z + 1.5 * m_ocean.x));\n\t\t\tcamera.setAttribute('camera', 'userHeight: ' + m_Constants.CameraYOffset);\n\t\t\t//camera.setAttribute('rotation', -Math.atan(m_Constants.CameraYOffset/(m_ocean.z+m_ocean.x))); // TODO: check if the string is a vec3\n\t\t\tcamera.setAttribute('rotation', '-50 0 0');\n\n\t\t\t// Generate Map\n\t\t\t// TODO: Possible edge cases with the map edge not being big enough\n\t\t\tvar map = document.createElement('a-ocean');\n\n\t\t\tmap.setAttribute('position', m_ocean.x + \" \" + m_ocean.y + \" \" + m_ocean.z);\n\t\t\tmap.setAttribute('width', String(m_ocean.width));\n\t\t\tmap.setAttribute('depth', String(m_ocean.depth));\n\t\t\tmap.setAttribute('density', String(m_ocean.density));\n\t\t\tdoc.appendChild(map);\n\n\t\t\tvar spawnShip = function spawnShip(entry) {\n\t\t\t\tvar ship = document.createElement('a-entity');\n\n\t\t\t\tship.dataset.id = entry.id;\n\t\t\t\tship.dataset.name = entry.name;\n\t\t\t\tship.dataset.owner = entry.owner;\n\t\t\t\tship.dataset.x = entry.x;\n\t\t\t\tship.dataset.y = entry.y;\n\t\t\t\tship.dataset.z = entry.z;\n\t\t\t\tship.dataset.health = entry.hull;\n\t\t\t\tship.dataset.hull = entry.hull;\n\t\t\t\tship.dataset.firepower = entry.firepower;\n\t\t\t\tship.dataset.speed = entry.speed;\n\t\t\t\tship.dataset.range = entry.range;\n\n\t\t\t\tvar heart = \"\";\n\t\t\t\tfor (var i = 0; i < parseInt(entry.hull); i++) {\n\t\t\t\t\theart += \" •\";\n\t\t\t\t}\n\n\t\t\t\tship.setAttribute('position', entry.x + \" \" + entry.y + \" \" + entry.z);\n\n\t\t\t\tif (entry.color === \"rgb(255, 255, 0)\") {\n\t\t\t\t\tship.setAttribute('template', 'src: #submarine-template');\n\t\t\t\t\tship.setAttribute('class', 'submarine');\n\t\t\t\t} else {\n\t\t\t\t\tship.setAttribute('template', 'src: #boat-template');\n\t\t\t\t\tship.setAttribute('class', 'boat');\n\t\t\t\t}\n\n\t\t\t\t// ${variable} <- variable name be lower case\n\t\t\t\tship.setAttribute('data-ship_color', 'color: ' + entry.color + '; metalness: 0.4;');\n\t\t\t\tship.setAttribute('data-ship_name', 'value: ' + entry.name + '; font: #play;');\n\t\t\t\tship.setAttribute('data-ship_health', 'value: ' + heart + ';');\n\n\t\t\t\tvar shipInstance = doc.appendChild(ship);\n\t\t\t\tm_entity[entry.id] = shipInstance;\n\t\t\t};\n\t\t\t// spawn the ships!\n\t\t\tshipData.forEach(function (entry) {\n\t\t\t\tspawnShip(entry);\n\t\t\t});\n\t\t},\n\n\t\tsinkShip: function sinkShip(data) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar doc = document.getElementById('scene');\n\t\t\t\tvar track = document.getElementById('track');\n\t\t\t\tvar shipDom = m_entity[data[0].id];\n\n\t\t\t\tvar debug = document.createElement('a-draw-curve');\n\t\t\t\tdebug.setAttribute('curveref', '#track');\n\t\t\t\tdebug.setAttribute('material', 'shader: line; color: black;');\n\t\t\t\tdoc.appendChild(debug);\n\n\t\t\t\tvar point1 = document.createElement('a-curve-point');\n\t\t\t\tvar point2 = document.createElement('a-curve-point');\n\t\t\t\tpoint1.setAttribute('position', data[0].x + \" \" + data[0].y + \" \" + data[0].z);\n\t\t\t\tpoint2.setAttribute('position', data[0].x + \" \" + (data[0].y - m_Constants.SinkDistance) + \" \" + data[0].z);\n\t\t\t\ttrack.appendChild(point1);\n\t\t\t\ttrack.appendChild(point2);\n\n\t\t\t\tshipDom.setAttribute('alongpath', 'curve: #track; rotate: false; delay: ' + m_Constants.WaitTimeBetweenAction + '; dur: 1000;');\n\n\t\t\t\tvar done = function done(event) {\n\t\t\t\t\tshipDom.removeAttribute('alongpath');\n\t\t\t\t\tif (debug.parentNode) {\n\t\t\t\t\t\tdoc.removeChild(debug);\n\t\t\t\t\t}\n\n\t\t\t\t\twhile (track.hasChildNodes()) {\n\t\t\t\t\t\ttrack.removeChild(track.childNodes[0]);\n\t\t\t\t\t}\n\n\t\t\t\t\t//shipDom.removeEventListener('movingended', done);\n\n\t\t\t\t\tif (shipDom.parentNode) {\n\t\t\t\t\t\tdoc.removeChild(shipDom);\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve(event);\n\t\t\t\t};\n\n\t\t\t\tshipDom.addEventListener('movingended', done);\n\t\t\t\t// resolve();\n\t\t\t});\n\t\t},\n\n\t\t// Data passed in are one ships action of firing at one and only one coordinate\n\t\tfireShip: function fireShip(data) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar doc = document.getElementById('scene');\n\t\t\t\tvar track = document.getElementById('track');\n\t\t\t\tvar ship = m_entity[data[0].id];\n\n\t\t\t\tvar bullet = document.createElement('a-sphere');\n\t\t\t\tvar source = document.createElement('a-curve-point');\n\t\t\t\tvar arc = document.createElement('a-curve-point');\n\t\t\t\tvar target = document.createElement('a-curve-point');\n\n\t\t\t\t// var saves = null;\n\t\t\t\t// if (ship.className === \"submarine\") {\n\t\t\t\t// \tfor (var i = 0; i < ship.childNodes.length; i++) {\n\t\t\t\t// \t\tif (ship.childNodes[i].className === \"submarineMissile\") {\n\t\t\t\t// \t\t\tbullet = ship.childNodes[i]\n\t\t\t\t// \t\t\tsaves = bullet.getAttribute('position');\n\t\t\t\t// \t\t\tbreak;\n\t\t\t\t// \t\t}\n\t\t\t\t// \t}\n\t\t\t\t// \tconsole.log('missile start', saves);\n\t\t\t\t// \tsource.setAttribute('position', (data[0].x+saves.x) + \" \" + (data[0].y+saves.y) + \" \" + (data[0].z+saves.z));\n\t\t\t\t// \tarc.setAttribute('position', (data[0].x+saves.x) + \" \" + (data[0].y+saves.y+5) + \" \" + (data[0].z+saves.z));\n\t\t\t\t// \ttarget.setAttribute('position', data[0].atX + \" \" + data[0].atY + \" \" + data[0].atZ);\n\t\t\t\t// \ttrack.appendChild(source);\n\t\t\t\t// \ttrack.appendChild(arc);\n\t\t\t\t// \ttrack.appendChild(target);\n\t\t\t\t// }\n\t\t\t\t// else {\n\t\t\t\tbullet.setAttribute('color', 'gray');\n\t\t\t\tbullet.setAttribute('radius', '0.2');\n\t\t\t\tbullet.setAttribute('position', data[0].x + \" \" + data[0].y + \" \" + data[0].z);\n\t\t\t\tsource.setAttribute('position', data[0].x + \" \" + data[0].y + \" \" + data[0].z);\n\t\t\t\tarc.setAttribute('position', (data[0].atX + data[0].x) / 2 + \" \" + ((data[0].atY + data[0].y) / 2 + m_Constants.BulletArc) + \" \" + (data[0].atZ + data[0].z) / 2);\n\t\t\t\ttarget.setAttribute('position', data[0].atX + \" \" + data[0].atY + \" \" + data[0].atZ);\n\t\t\t\ttrack.appendChild(source);\n\t\t\t\ttrack.appendChild(arc);\n\t\t\t\ttrack.appendChild(target);\n\t\t\t\t// }\n\n\t\t\t\tvar debug = document.createElement('a-draw-curve');\n\t\t\t\tdebug.setAttribute('curveref', '#track');\n\t\t\t\tdebug.setAttribute('material', 'shader: line; color: red;');\n\t\t\t\tdoc.appendChild(debug);\n\n\t\t\t\tvar tmp = doc.appendChild(bullet);\n\t\t\t\tvar distance = Math.sqrt((data[0].atX - data[0].x) * (data[0].atX - data[0].x) + (data[0].atZ - data[0].z) * (data[0].atZ - data[0].z)) + m_Constants.BulletArc * m_Constants.BulletArc;\n\t\t\t\t//console.log(\"distance: \", distance);\n\t\t\t\ttmp.setAttribute('alongpath', 'curve: #track; rotate: true; constant: 0 -1 0; delay: 100; dur: ' + 25 * distance);\n\n\t\t\t\tvar done = function done(event) {\n\t\t\t\t\ttmp.removeAttribute('alongpath');\n\t\t\t\t\tif (debug.parentNode) {\n\t\t\t\t\t\tdoc.removeChild(debug);\n\t\t\t\t\t}\n\t\t\t\t\twhile (track.hasChildNodes()) {\n\t\t\t\t\t\ttrack.removeChild(track.childNodes[0]);\n\t\t\t\t\t}\n\n\t\t\t\t\t//tmp.removeEventListener('movingended', done);\n\t\t\t\t\tif (tmp.parentNode) {\n\t\t\t\t\t\tdoc.removeChild(tmp);\n\t\t\t\t\t}\n\t\t\t\t\t// if (ship.className === \"submarine\") {\n\t\t\t\t\t// \tvar reload = document.createElement('a-entity');\n\t\t\t\t\t// \treload.setAttribute('class', 'submarineMissile');\n\t\t\t\t\t// \treload.setAttribute('obj-model', 'obj: #submarineMissile');\n\t\t\t\t\t// \treload.setAttribute('position', saves);\n\t\t\t\t\t// \tship.appendChild(reload);\n\t\t\t\t\t// }\n\n\t\t\t\t\tresolve(event);\n\t\t\t\t};\n\n\t\t\t\ttmp.addEventListener('movingended', done);\n\t\t\t\t//resolve();\n\t\t\t});\n\t\t},\n\n\t\taimShip: function aimShip(data) {\n\t\t\tvar rotateVector = function rotateVector(vec2, deg) {\n\t\t\t\tvar rad = -deg * Math.PI / 180;\n\t\t\t\tvar cos = Math.cos(rad);\n\t\t\t\tvar sin = Math.sin(rad);\n\t\t\t\t//console.log(\"vector: \", vec2);\n\t\t\t\t//console.log(\"degree: \", deg);\n\t\t\t\t// round the numbers\n\t\t\t\treturn {\n\t\t\t\t\t\"x\": Math.round(100000 * ((vec2.x - vec2.atX) * cos - (vec2.z - vec2.atZ) * sin)) / 100000,\n\t\t\t\t\t\"y\": vec2.y - vec2.atY,\n\t\t\t\t\t\"z\": Math.round(100000 * ((vec2.x - vec2.atX) * sin + (vec2.z - vec2.atZ) * cos)) / 100000\n\t\t\t\t};\n\t\t\t};\n\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\t//console.log('aim info: ', data);\n\t\t\t\tvar doc = document.getElementById('scene');\n\t\t\t\tvar track = document.getElementById('track');\n\t\t\t\tvar ship = m_entity[data[0].id];\n\n\t\t\t\tvar shipRot = ship.getAttribute('rotation');\n\t\t\t\t//console.log(\"rot info: \", shipRot);\n\n\t\t\t\t// var action = null;\n\t\t\t\t// if (ship.className == \"boat\") {\n\t\t\t\t// \tfor(var i = 0; i < ship.childNodes.length; i++) {\n\t\t\t\t// \t\tif (ship.childNodes[i].className === \"aimShip\") {\n\t\t\t\t// \t\t\taction = ship.childNodes[i];\n\t\t\t\t// \t\t\tbreak;\n\t\t\t\t// \t\t}\n\t\t\t\t// \t}\n\t\t\t\t// \tif (action) {\n\t\t\t\t// \t\tvar shipY = ship.getAttribute('rotation').y;\n\t\t\t\t// \t\tvar current = action.getAttribute(\"rotation\").y;\n\t\t\t\t// \t\tvar radian = Math.atan((data[0].atZ-data[0].z)/(data[0].atX-data[0].x));\n\t\t\t\t// \t\tvar degree = -radian * 180 / Math.PI;\n\t\t\t\t// \t\tconsole.log(\"ship r: \", degree, current);\n\t\t\t\t// \t\tconsole.log(\"ship current rotation\", shipY);\n\t\t\t\t// \t\tvar rotated = rotateVector(data[0], shipY);\n\t\t\t\t// \t\tconsole.log(\"aim r: \", rotated);\n\t\t\t\t// \t\t//action.setAttribute('look-at', rotated);\n\t\t\t\t// \t\taction.setAttribute('rotation', '0 ' + (degree-shipY) + ' 0');\n\t\t\t\t// \t\t//action.removeAttribute('look-at');\n\t\t\t\t// \t}\n\t\t\t\t// }\n\n\t\t\t\tresolve();\n\t\t\t});\n\t\t},\n\n\t\thitShip: function hitShip(data) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar ship = m_entity[data[0].id];\n\t\t\t\tvar heart = \"\";\n\n\t\t\t\tfor (var i = 0; i < data[0].health; i++) {\n\t\t\t\t\theart += \" •\";\n\t\t\t\t}\n\n\t\t\t\tfor (var i = 0; i < ship.childNodes.length; i++) {\n\t\t\t\t\tif (ship.childNodes[i].className == \"ship-health\") {\n\t\t\t\t\t\tship.childNodes[i].setAttribute('text-geometry', 'value: ' + heart + ';');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tresolve();\n\t\t\t});\n\t\t},\n\n\t\t// Data passed in must be for movement of one ship\n\t\tmoveShip: function moveShip(data) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar shipDom = m_entity[data[0].id]; // html element\n\t\t\t\t// if statement is not working\n\t\t\t\t// if (data.length === 1 && data[0].x === shipDom.dataset.x && data[0].z === shipDom.dataset.z) {\n\t\t\t\t// // if shipDom tries to move against edge or occupied place\n\t\t\t\t// alert(\"Skipped\");\n\t\t\t\t// resolve(\"Skipped\");\n\t\t\t\t// }\n\n\t\t\t\tvar doc = document.getElementById('scene'); // reference\n\t\t\t\tvar track = document.getElementById('track');\n\t\t\t\t//var startCoord = {\"x\": data[0].x};\n\n\t\t\t\tvar debug = document.createElement('a-draw-curve');\n\t\t\t\tdebug.setAttribute('curveref', '#track');\n\t\t\t\tdebug.setAttribute('material', 'shader: line; color: blue;');\n\t\t\t\tdoc.appendChild(debug);\n\n\t\t\t\t// add current location as a starting point of the curve\n\t\t\t\tvar point = document.createElement('a-curve-point');\n\t\t\t\tpoint.setAttribute('position', String(shipDom.dataset.x + \" \" + shipDom.dataset.y + \" \" + shipDom.dataset.z));\n\t\t\t\ttrack.appendChild(point);\n\t\t\t\t// add chain-able goal locations to the curve\n\n\t\t\t\t//previous is used to check for movement against walls, e.g. previous location same as current and next\n\t\t\t\t//previous can also be used to get the last action which determines the final rotation where the ship should point\n\t\t\t\tvar previous = { 'x': shipDom.dataset.x, 'z': shipDom.dataset.z };\n\t\t\t\tvar xDistance = 0;\n\t\t\t\tvar zDistance = 0;\n\t\t\t\t//console.log(\"Moving: \", data);\n\t\t\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\t\t\tpoint = document.createElement('a-curve-point');\n\t\t\t\t\tpoint.setAttribute('position', data[i].x + \" \" + data[i].y + \" \" + data[i].z);\n\t\t\t\t\txDistance += Math.abs(data[i].x - previous.x);\n\t\t\t\t\tzDistance += Math.abs(data[i].z - previous.z);\n\t\t\t\t\tif (i + 1 < data.length && data[i].x === data[i + 1].x && data[i].z === data[i + 1].z) {\n\t\t\t\t\t\ti++;\n\t\t\t\t\t}\n\t\t\t\t\ttrack.appendChild(point);\n\t\t\t\t\tprevious = { 'x': data[i].x, 'z': data[i].z, 'direction': data[i].direction };\n\t\t\t\t}\n\n\t\t\t\tvar dur = (xDistance + zDistance) * m_Constants.WaitTimePerTileMoved; // determines the length in time of the movement \n\t\t\t\tshipDom.setAttribute('alongpath', 'curve: #track; rotate: true; constraint: 0 0 -1; delay: ' + m_Constants.WaitTimeBetweenAction + '; dur: ' + dur + ';');\n\n\t\t\t\tvar done = function done(event) {\n\t\t\t\t\t// var list = document.getElementByTagName('a-draw-curve');\n\t\t\t\t\t// for (var i = 0; i < list.length; i++) {\n\t\t\t\t\t// list[0].parentNode.removeChild(list[0]);\n\t\t\t\t\t// }\n\t\t\t\t\tif (debug.parentNode) {\n\t\t\t\t\t\tdoc.removeChild(debug);\n\t\t\t\t\t}\n\n\t\t\t\t\twhile (track.hasChildNodes()) {\n\t\t\t\t\t\ttrack.removeChild(track.childNodes[0]);\n\t\t\t\t\t}\n\n\t\t\t\t\tshipDom.removeAttribute('alongpath');\n\t\t\t\t\tshipDom.dataset.x = data[data.length - 1].x;\n\t\t\t\t\tshipDom.dataset.z = data[data.length - 1].z;\n\t\t\t\t\tshipDom.dataset.y = data[data.length - 1].y;\n\n\t\t\t\t\t//shipDom.removeEventListener('movingended', done);\n\t\t\t\t\tresolve(event);\n\t\t\t\t};\n\n\t\t\t\tshipDom.addEventListener('movingended', done);\n\t\t\t});\n\t\t},\n\n\t\tsimulate: function simulate() {\n\t\t\t//console.log(\"chain: \", m_chain);\n\t\t\tvar notStop = true;\n\t\t\tif (m_chain.length == 0) {\n\t\t\t\tnotStop = false;\n\t\t\t}\n\t\t\tvar current = m_chain.shift(); // don't shift when length is zero\n\t\t\tif (current && notStop) {\n\t\t\t\t//console.log(\"current: \", current);\n\t\t\t\tswitch (current.type) {\n\t\t\t\t\tcase \"MOVE\":\n\t\t\t\t\t\tapp.moveShip(current.actions).then(function (done) {\n\t\t\t\t\t\t\t//alert(\"Moved \" + m_chain.length + \" actions left\");\n\t\t\t\t\t\t\tapp.simulate();\n\t\t\t\t\t\t}).catch(function (err) {\n\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"FIRE\":\n\t\t\t\t\t\t/*** Exclusive Or functions ***/\n\n\t\t\t\t\t\t/* Fire without aiming */\n\t\t\t\t\t\tapp.fireShip(current.actions).then(function (done) {\n\t\t\t\t\t\t\tapp.simulate();\n\t\t\t\t\t\t}).catch(function (err) {\n\t\t\t\t\t\t\tconsole.error(\"error: \", err);\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// /* Aim then fire (currently buggy)*/\n\t\t\t\t\t\t// app.aimShip(current.actions).then((done) => {\n\t\t\t\t\t\t// \tapp.fireShip(current.actions).then((done) => {\n\t\t\t\t\t\t// \t\tapp.simulate();\n\t\t\t\t\t\t// \t}).catch((err) => {\n\t\t\t\t\t\t// \t\tconsole.error(\"error: \", err);\t\n\t\t\t\t\t\t// \t});\n\t\t\t\t\t\t// }).catch((err) => {\n\t\t\t\t\t\t// \tconsole.error(\"error: \", err);\n\t\t\t\t\t\t// });\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"HIT\":\n\t\t\t\t\t\tapp.hitShip(current.actions).then(function (done) {\n\t\t\t\t\t\t\tapp.simulate();\n\t\t\t\t\t\t}).catch(function (err) {\n\t\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"SINK\":\n\t\t\t\t\t\tapp.sinkShip(current.actions).then(function (done) {\n\t\t\t\t\t\t\t//alert(\"Sunk \"+ m_chain.length + \" actions left\");\n\t\t\t\t\t\t\tapp.simulate();\n\t\t\t\t\t\t}).catch(function (err) {\n\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tconsole.warn(\"Unknown Action Type \" + current.type + \" in simulate function, skipping.\");\n\t\t\t\t\t\tapp.simulate();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t//alert(\"Simulation Done\");\n\t\t\t\t\tvex.dialog.alert(\"Simulation Completed.\");\n\t\t\t\t}, 1000);\n\t\t\t}\n\t\t},\n\n\t\t/** translates the coordinate in the java game to this scene's coordinate\n \tJava Game: Each ship spans one (x, y) unit\n \tJava Game: Coordinate system has (0, 0) at top left corner (without negatives)\n \tAFrame Scene: Each ship model is a 4x4 box\n \tAFrame Scene: Coordinate system is (0, 0) at the center (with negatives)\n */\n\t\tgetStrCoord: function getStrCoord(coord, offsetY) {\n\t\t\treturn (m_ocean.x - coord.x) * 4 + \" \" + offsetY + \" \" + (m_ocean.y - coord.y) * 4;\n\t\t},\n\n\t\tgetShips: function getShips() {\n\t\t\treturn m_ships;\n\t\t},\n\n\t\tgetOcean: function getOcean() {\n\t\t\treturn m_ocean;\n\t\t}\n\n\t};\n\n\treturn app;\n}\n\nvar app = battleship();\nvar params = getQueryParams(document.location.search);\n\nvar getDataFromCode = function getDataFromCode(code) {\n\tdb.ref('davy-jones-locker/' + code).once('value', function (snapshot) {\n\t\tvar gameData = snapshot.val();\n\t\tif (gameData) {\n\t\t\tinput = gameData;\n\t\t\tapp.init();\n\t\t} else {\n\t\t\tgetCode(\"No data for code \" + code + \". Enter another code:\");\n\t\t\t//app.init();\n\t\t}\n\t}).catch(function (err) {\n\t\tgetCode(\"There was an error. Enter another code:\");\n\t\t//app.init();\n\t});\n};\n\nvar getCode = function getCode(message) {\n\tvex.dialog.prompt({\n\t\tmessage: message,\n\t\tcallback: function callback(value) {\n\t\t\tif (value) {\n\t\t\t\tvar code = value;\n\t\t\t\tgetDataFromCode(code);\n\t\t\t} else {\n\t\t\t\tgetCode(\"No code entered. Enter your code:\");\n\t\t\t}\n\t\t}\n\t});\n};\n\nif (params.code) {\n\tgetDataFromCode(params.code);\n} else {\n\tgetCode(\"Enter Your Code\");\n}\n\n// var BATTLE_SERVER_URL = 'https://battleship-vingkan.c9users.io/1v1?p1=esi17.cs.DestroyerShip&p2=esi17.hli109.Floater';// + Math.ceil(Math.random() * 100);\n\n// $.get(BATTLE_SERVER_URL).then(data => {\n// \tinput = data;\n// \tapp.init();\n// }).done(() => {\n// \tconsole.log(\"Data successfully retrieved from server\");\n// }).fail(() => {\n// \tconsole.log(\"Unable to retrieve data, starting with local data\");\n// \tapp.init();\n// });\n\n},{}]},{},[1])\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJzcmMvbWFpbi5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O0FDQUE7QUFDQSxJQUFJLFNBQVM7QUFDWixTQUFRLHlDQURJO0FBR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ryb3llclNoaXAmcDI9ZXNpMTcuaGxpMTA5LkZsb2F0ZXInOy8vICsgTWF0aC5jZWlsKE1hdGgucmFuZG9tKCkgKiAxMDApO1xuXG4vLyAkLmdldChCQVRUTEVfU0VSVkVSX1VSTCkudGhlbihkYXRhID0+IHtcbi8vIFx0aW5wdXQgPSBkYXRhO1xuLy8gXHRhcHAuaW5pdCgpO1xuLy8gfSkuZG9uZSgoKSA9PiB7XG4vLyBcdGNvbnNvbGUubG9nKFwiRGF0YSBzdWNjZXNzZnVsbHkgcmV0cmlldmVkIGZyb20gc2VydmVyXCIpO1xuLy8gfSkuZmFpbCgoKSA9PiB7XG4vLyBcdGNvbnNvbGUubG9nKFwiVW5hYmxlIHRvIHJldHJpZXZlIGRhdGEsIHN0YXJ0aW5nIHdpdGggbG9jYWwgZGF0YVwiKTtcbi8vIFx0YXBwLmluaXQoKTtcbi8vIH0pO1xuXG5cblxuIl19\n"]} \ No newline at end of file diff --git a/src/main.js b/src/main.js index 20ddbf9..b94adda 100644 --- a/src/main.js +++ b/src/main.js @@ -62,9 +62,25 @@ function battleship() { app.render(m_ships); - setTimeout(() => { + /*setTimeout(() => { app.simulate(); - }, 10000); + }, 10000);*/ + vex.dialog.confirm({ + message: 'Ready to view the battle?', + buttons: [ + $.extend({}, vex.dialog.buttons.YES, { + className: 'vex-dialog-button-primary', + text: 'Play' + }) + ], + callback: (doIt) => { + if (doIt) { + setTimeout(() => { + app.simulate(); + }, 1000); + } + } + }); // call function to wait a bit before starting simulation //app.simulate(); }, @@ -550,7 +566,7 @@ function battleship() { setTimeout(() => { //alert("Simulation Done"); vex.dialog.alert("Simulation Completed."); - }, 10000); + }, 1000); } },