diff options
-rw-r--r-- | data.js | 2 | ||||
-rw-r--r-- | play.html | 84 | ||||
-rw-r--r-- | play.js | 24 | ||||
-rw-r--r-- | tools/gendata.js | 63 |
4 files changed, 155 insertions, 18 deletions
@@ -0,0 +1,2 @@ +const data = {"areas":[{"name":"Oran","type":1,"zone":"V","x":430.6,"y":588.8},{"name":"Algiers","type":1,"zone":"IV","x":1185.6,"y":346.8},{"name":"Constantine","type":1,"zone":"II","x":2066.6,"y":315.8},{"name":"France","type":3,"zone":null,"x":1605,"y":185.3,"w":266,"h":212.4},{"name":"Morocco","type":3,"zone":null,"x":109,"y":1765,"w":94,"h":94},{"name":"Tunisia","type":3,"zone":null,"x":2499.9,"y":1667.6,"w":94,"h":94},{"name":"Barika","type":0,"zone":"I","x":1708.1,"y":1117.9},{"name":"Batna","type":2,"zone":"I","x":2185.6,"y":1390.9},{"name":"Biskra","type":2,"zone":"I","x":1853.6,"y":1620.9},{"name":"Tebessa","type":0,"zone":"I","x":2299.6,"y":1120.9},{"name":"Setif","type":0,"zone":"II","x":1917.6,"y":800.8},{"name":"Souk Ahras","type":0,"zone":"II","x":2347.6,"y":848.9},{"name":"Phillippeville","type":0,"zone":"II","x":2200.6,"y":584.9},{"name":"Tizi Ouzou","type":0,"zone":"III","x":1473.6,"y":578.9},{"name":"Bordj Bou Arreridj","type":0,"zone":"III","x":1465.6,"y":832.9},{"name":"Bougie","type":0,"zone":"III","x":1703.6,"y":616.9},{"name":"Medea","type":0,"zone":"IV","x":1212,"y":727},{"name":"Orleansville","type":0,"zone":"IV","x":982,"y":780.2},{"name":"Mecheria","type":2,"zone":"V","x":234,"y":1485.7},{"name":"Tlemcen","type":0,"zone":"V","x":173,"y":1140.9},{"name":"Sidi Bel Abbes","type":0,"zone":"V","x":476,"y":1038},{"name":"Mostaganem","type":0,"zone":"V","x":741,"y":863.9},{"name":"Saida","type":2,"zone":"V","x":501,"y":1419.1},{"name":"Mascara","type":2,"zone":"V","x":785,"y":1302.9},{"name":"Ain Sefra","type":2,"zone":"V","x":752,"y":1670.9},{"name":"Laghouat","type":2,"zone":"V","x":1191,"y":1615.6}],"zones":{"V":["Oran","Mecheria","Tlemcen","Sidi Bel Abbes","Mostaganem","Saida","Mascara","Ain Sefra","Laghouat"],"IV":["Algiers","Medea","Orleansville"],"II":["Constantine","Setif","Souk Ahras","Phillippeville"],"I":["Barika","Batna","Biskra","Tebessa"],"III":["Tizi Ouzou","Bordj Bou Arreridj","Bougie"]}} +if (typeof module !== 'undefined') module.exports = data @@ -8,6 +8,7 @@ <link rel="stylesheet" href="/fonts/fonts.css"> <link rel="stylesheet" href="/common/play.css"> <script defer src="/common/play.js"></script> +<script defer src="data.js"></script> <script defer src="play.js"></script> <style> @@ -39,6 +40,22 @@ main { background-color: dimgray } transition-timing-function: ease; } +#boxes { position: absolute; } +#cities { position: absolute; } +#units { position: absolute; } + +/* SPACES */ + +.box{position:absolute;box-sizing:border-box;border:4px solid transparent} +.box.city{border-radius:50%} +.box.loc{border-radius:50%} +.box.action{border-color:lemonchiffon;} +.box.city.action{background-color:#6495ed55;border-color:deepskyblue;} +.box.loc.action{background-color:#fff5;border-color:white;} +.box.selected{border-color:yellow;} +.box.tip { border-color: white; } + + /* COUNTERS */ #map .counter { @@ -205,28 +222,50 @@ main { background-color: dimgray } <!-- scale 1.80333333333333333333 --> -<div class="counter turn_now" style="left:3px;top:4px;"></div> -<div class="counter fln_psl" style="left:53px;top:4px;"></div> -<div class="counter fln_ap" style="left:103px;top:4px;"></div> -<div class="counter gov_psl" style="left:153px;top:4px;"></div> -<div class="counter fln_control" style="left:203px;top:4px;"></div> -<div class="counter gov_control" style="left:253px;top:4px;"></div> -<div class="counter oas_active" style="left:303px;top:4px;"></div> -<div class="counter remote" style="left:353px;top:4px;"></div> -<div class="counter terror" style="left:403px;top:4px;"></div> +<!-- <div id="cities"> +<div id="Bogota" class="box city" style="top:1266px;left:684px;width:141px;height:140px"></div> +<div id="Cali" class="box city" style="top:1434px;left:328px;width:126px;height:126px"></div> +<div id="Medellin" class="box city" style="top:1003px;left:450px;width:126px;height:125px"></div> +<div id="Bucaramanga" class="box city" style="top:920px;left:779px;width:120px;height:120px"></div> +<div id="Cartagena" class="box city" style="top:457px;left:445px;width:110px;height:110px"></div> +<div id="Cucuta" class="box city" style="top:809px;left:896px;width:110px;height:110px"></div> +<div id="Ibague" class="box city" style="top:1219px;left:447px;width:120px;height:119px"></div> +<div id="Neiva" class="box city" style="top:1488px;left:534px;width:110px;height:109px"></div> +<div id="Pasto" class="box city" style="top:1728px;left:219px;width:110px;height:110px"></div> +<div id="Santa Marta" class="box city" style="top:376px;left:622px;width:120px;height:119px"></div> +<div id="Sincelejo" class="box city" style="top:653px;left:459px;width:110px;height:110px"></div> +</div> --> + +<div id="boxes"> +</div> -<!-- top right --> -<div class="counter turn_now" style="left:1450px;top:4px;"></div> +<div id="markers"> + <div class="counter turn_now" style="left:3px;top:4px;"></div> + <div class="counter fln_psl" style="left:53px;top:4px;"></div> + <div class="counter fln_ap" style="left:103px;top:4px;"></div> + <div class="counter gov_psl" style="left:153px;top:4px;"></div> + <div class="counter fln_control" style="left:203px;top:4px;"></div> + <div class="counter gov_control" style="left:253px;top:4px;"></div> + <div class="counter oas_active" style="left:303px;top:4px;"></div> + <div class="counter remote" style="left:353px;top:4px;"></div> + <div class="counter terror" style="left:403px;top:4px;"></div> -<!-- bottom right --> -<div class="counter turn_now" style="left:1450px;top:1051px;"></div> -<!-- bottom left --> -<div class="counter turn_now" style="left:3px;top:1051px;"></div> + <!-- top right --> + <div class="counter turn_now" style="left:1450px;top:4px;"></div> -<div class="counter turn_now" style="left:242px;top:330px;"></div> + <!-- bottom right --> + <div class="counter turn_now" style="left:1450px;top:1051px;"></div> + + <!-- bottom left --> + <div class="counter turn_now" style="left:3px;top:1051px;"></div> + + <div class="counter turn_now" style="left:242px;top:330px;"></div> + + <div class="counter border_zone" style="left:163px;top:223px;"></div> +</div> -<div class="counter border_zone" style="left:163px;top:223px;"></div> +<div id="units"></div> </div> </div> @@ -250,7 +289,7 @@ main { background-color: dimgray } <div class="counter fr_xx_5 neutralized"></div> <div class="counter fr_xx_7 action"></div> <div class="counter fr_xx_dispersed"></div> -<div class="counter fr_x selected"></div> +<div class="counter fr_x"></div> <div class="counter fr_x_airmobile"></div> <div class="counter fr_elite_x_para"></div> <div class="counter fr_elite_x_inf neutralized"></div> @@ -259,6 +298,15 @@ main { background-color: dimgray } <div class="counter alg_x"></div> <div class="counter alg_x_airmobile neutralized"></div> <div class="counter alg_police neutralized"></div> +<div class="counter alg_police"></div> +<div class="counter alg_police"></div> +<div class="counter alg_police"></div> +<div class="counter alg_police"></div> +<div class="counter alg_police"></div> +<div class="counter alg_police"></div> +<div class="counter alg_police"></div> +<div class="counter alg_police"></div> +<div class="counter alg_police"></div> </div> </div> @@ -2,6 +2,13 @@ /* global view, player, send_action, action_button, scroll_with_middle_mouse */ +const SCALE = 1.80333333333333333333 + +const RURAL = 0 +const URBAN = 1 +const REMOTE = 2 +const COUNTRY = 3 + let ui = { board: document.getElementById("map"), } @@ -48,6 +55,23 @@ function on_init() { if (on_init_once) return on_init_once = true + + for (let i = 0; i < data.areas.length; ++i) { + let name = data.areas[i].name + let type = data.areas[i].type + let e = document.createElement("div") + e.className = "box" + e.style.left = data.areas[i].x / SCALE + "px" + e.style.top = data.areas[i].y / SCALE + "px" + if (type !== COUNTRY) { + e.style.width = 193 / SCALE + "px" + e.style.height = 193 / SCALE+ "px" + } else { + e.style.width = data.areas[i].w / SCALE + "px" + e.style.height = data.areas[i].h / SCALE + "px" + } + document.getElementById("boxes").appendChild(e) + } } function on_update() { diff --git a/tools/gendata.js b/tools/gendata.js new file mode 100644 index 0000000..072c48d --- /dev/null +++ b/tools/gendata.js @@ -0,0 +1,63 @@ +"use strict" + +const fs = require("fs") + +let data = {} + +const RURAL = 0 +const URBAN = 1 +const REMOTE = 2 +const COUNTRY = 3 + + +let areas = [] +let zones = {} + +function def_area(name, type, zone, x, y, w, h) { + areas.push({name, type, zone, x, y, w, h}) + if (zone) { + if (!(zone in zones)) { + zones[zone] = [] + } + zones[zone].push(name) + } +} + +def_area("Oran", URBAN, "V", 430.6, 588.8) +def_area("Algiers", URBAN, "IV", 1185.6, 346.8) +def_area("Constantine", URBAN, "II", 2066.6, 315.8) + +def_area("France", COUNTRY, null, 1605, 185.3, 266, 212.4) +def_area("Morocco", COUNTRY, null, 109, 1765, 94, 94) +def_area("Tunisia", COUNTRY, null, 2499.9, 1667.6, 94, 94) + +def_area("Barika", RURAL, "I", 1708.1, 1117.9) +def_area("Batna", REMOTE, "I", 2185.6, 1390.9) +def_area("Biskra", REMOTE, "I", 1853.6, 1620.9) +def_area("Tebessa", RURAL, "I", 2299.6, 1120.9) + +def_area("Setif", RURAL, "II", 1917.6, 800.8) +def_area("Souk Ahras", RURAL, "II", 2347.6, 848.9) +def_area("Phillippeville", RURAL, "II", 2200.6, 584.9) + +def_area("Tizi Ouzou", RURAL, "III", 1473.6, 578.9) +def_area("Bordj Bou Arreridj", RURAL, "III", 1465.6, 832.9) +def_area("Bougie", RURAL, "III", 1703.6, 616.9) + +def_area("Medea", RURAL, "IV", 1212, 727) +def_area("Orleansville", RURAL, "IV", 982, 780.2) + +def_area("Mecheria", REMOTE, "V", 234, 1485.7) +def_area("Tlemcen", RURAL, "V", 173, 1140.9) +def_area("Sidi Bel Abbes", RURAL, "V", 476, 1038) +def_area("Mostaganem", RURAL, "V", 741, 863.9) +def_area("Saida", REMOTE, "V", 501, 1419.1) +def_area("Mascara", REMOTE, "V", 785, 1302.9) +def_area("Ain Sefra", REMOTE, "V", 752, 1670.9) +def_area("Laghouat", REMOTE, "V", 1191, 1615.6) + + +data.areas = areas +data.zones = zones + +fs.writeFileSync("data.js", "const data = " + JSON.stringify(data, 0, 0) + "\nif (typeof module !== 'undefined') module.exports = data\n") |