From 914f7358182d7f4d92068fdb98ca940a75768c74 Mon Sep 17 00:00:00 2001 From: Ryo Unemoto Date: Sun, 7 Apr 2024 19:14:49 +0900 Subject: [PATCH] Maze: change kit number --- helper/scoreCalculatorRules/2024.js | 6 +- helper/scoreSheetPDFMazeRules/2024.js | 12 +- public/javascripts/judge/maze_2024.js | 60 +- public/javascripts/judge/maze_2024E.js | 1022 ++++++++++++++++++++++++ public/javascripts/manual/maze_2024.js | 6 +- public/javascripts/sign/maze_2024.js | 54 +- public/javascripts/sign/maze_2024E.js | 881 ++++++++++++++++++++ views/judge/maze_2024E.pug | 2 +- views/sign/maze_2024E.pug | 4 +- views/view/common/maze_2024.pug | 8 - views/view/common/maze_2024E.pug | 302 +++++++ views/view/maze_2024E.pug | 4 +- views/view_iframe/maze_2024E.pug | 2 +- 13 files changed, 2249 insertions(+), 114 deletions(-) create mode 100644 public/javascripts/judge/maze_2024E.js create mode 100644 public/javascripts/sign/maze_2024E.js create mode 100755 views/view/common/maze_2024E.pug diff --git a/helper/scoreCalculatorRules/2024.js b/helper/scoreCalculatorRules/2024.js index c3025349..740f9926 100644 --- a/helper/scoreCalculatorRules/2024.js +++ b/helper/scoreCalculatorRules/2024.js @@ -131,10 +131,10 @@ module.exports.calculateMazeScore = function (run) { } const maxKits = { - H: 3, - S: 2, + H: 2, + S: 1, U: 0, - Red: 1, + Red: 2, Yellow: 1, Green: 0, }; diff --git a/helper/scoreSheetPDFMazeRules/2024.js b/helper/scoreSheetPDFMazeRules/2024.js index c0741e7f..ce25cf31 100644 --- a/helper/scoreSheetPDFMazeRules/2024.js +++ b/helper/scoreSheetPDFMazeRules/2024.js @@ -335,7 +335,7 @@ function drawRun(doc, config, scoringRun) { doc, x, y, - 'scoresheet_generation/maze/l3.png', + 'scoresheet_generation/maze/l2.png', base_size_x, 50, 'center' @@ -372,7 +372,7 @@ function drawRun(doc, config, scoringRun) { doc, x, y, - 'scoresheet_generation/maze/f3.png', + 'scoresheet_generation/maze/f2.png', base_size_x, 50, 'center' @@ -412,7 +412,7 @@ function drawRun(doc, config, scoringRun) { doc, x, y, - 'scoresheet_generation/maze/l2.png', + 'scoresheet_generation/maze/l1.png', base_size_x, 50, 'center' @@ -449,7 +449,7 @@ function drawRun(doc, config, scoringRun) { doc, x, y, - 'scoresheet_generation/maze/f2.png', + 'scoresheet_generation/maze/f1.png', base_size_x, 50, 'center' @@ -566,7 +566,7 @@ function drawRun(doc, config, scoringRun) { doc, x, y, - 'scoresheet_generation/maze/l1.png', + 'scoresheet_generation/maze/l2.png', base_size_x, 50, 'center' @@ -603,7 +603,7 @@ function drawRun(doc, config, scoringRun) { doc, x, y, - 'scoresheet_generation/maze/f1.png', + 'scoresheet_generation/maze/f2.png', base_size_x, 50, 'center' diff --git a/public/javascripts/judge/maze_2024.js b/public/javascripts/judge/maze_2024.js index bd6075dd..5c6279c9 100644 --- a/public/javascripts/judge/maze_2024.js +++ b/public/javascripts/judge/maze_2024.js @@ -240,22 +240,15 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt $scope.length = response.data.length; $scope.duration = response.data.duration || 480; $scope.leagueType = response.data.leagueType; - if (response.data.leagueType == "entry") { - // Identification bonus - maxKit={ - 'Red': 1, - 'Green': 1 - }; - } else { - maxKit={ - 'H': 3, - 'S': 2, - 'U': 0, - 'Red': 1, - 'Yellow': 1, - 'Green': 0 - }; - } + + maxKit={ + 'H': 2, + 'S': 1, + 'U': 0, + 'Red': 2, + 'Yellow': 1, + 'Green': 0 + }; if(response.data.parent){ if(!$scope.dice){ @@ -496,15 +489,13 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt top: false, right: false, left: false, - bottom: false, - floor: false + bottom: false }, rescueKits: { top: 0, right: 0, bottom: 0, - left: 0, - floor: 0 + left: 0 } } }; @@ -565,15 +556,6 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt possible += maxKit[cell.tile.victims.bottom]; current += Math.min(tile.scoredItems.rescueKits.bottom,maxKit[cell.tile.victims.bottom]); } - if(cell.tile.victims.floor != "None"){ - possible++; - current += tile.scoredItems.victims.floor; - console.log(current) - possible += maxKit[cell.tile.victims.floor]; - current += Math.min(tile.scoredItems.rescueKits.floor,maxKit[cell.tile.victims.floor]); - } - - if (tile.processing) return "processing"; @@ -607,15 +589,13 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt top: false, right: false, left: false, - bottom: false, - floor: false + bottom: false }, rescueKits: { top: 0, right: 0, bottom: 0, - left: 0, - floor: 0 + left: 0 } } }; @@ -625,8 +605,7 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt var hasVictims = (cell.tile.victims.top != "None") || (cell.tile.victims.right != "None") || (cell.tile.victims.bottom != "None") || - (cell.tile.victims.left != "None") || - (cell.tile.victims.floor != "None"); + (cell.tile.victims.left != "None"); // Total number of scorable things on this tile var total = !!cell.tile.speedbump + !!cell.tile.checkpoint + !!cell.tile.steps + !!cell.tile.ramp + hasVictims; @@ -871,8 +850,7 @@ app.controller('ModalInstanceCtrl', ['$scope','$uibModalInstance','cell','tile', $scope.hasVictims = (cell.tile.victims.top != "None") || (cell.tile.victims.right != "None") || (cell.tile.victims.bottom != "None") || - (cell.tile.victims.left != "None") || - (cell.tile.victims.floor != "None"); + (cell.tile.victims.left != "None"); $scope.clickSound = function(){ playSound(sClick); }; @@ -910,14 +888,6 @@ app.controller('ModalInstanceCtrl', ['$scope','$uibModalInstance','cell','tile', $scope.tile.scoredItems.steps = !$scope.tile.scoredItems.steps; }; - $scope.applyEntryVictimRestriction= function(direction) { - playSound(sClick); - if (!$scope.tile.scoredItems.victims[direction]) { - $scope.tile.scoredItems.rescueKits[direction] = 0; - } - } - - $scope.lightStatus = function(light, kit){ if(light) return true; return false; diff --git a/public/javascripts/judge/maze_2024E.js b/public/javascripts/judge/maze_2024E.js new file mode 100644 index 00000000..bd6075dd --- /dev/null +++ b/public/javascripts/judge/maze_2024E.js @@ -0,0 +1,1022 @@ +// register the directive with your app module +var app = angular.module('ddApp', ['ngTouch','ngAnimate', 'ui.bootstrap', 'pascalprecht.translate', 'ngCookies']); +let maxKit={}; + +// function referenced by the drop target +app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$http','$translate', '$cookies',function ($scope, $uibModal, $log, $timeout, $http, $translate, $cookies) { + + var txt_timeup,txt_timeup_mes; + + $translate('maze.judge.js.timeup.title').then(function (val) { + txt_timeup = val; + }, function (translationId) { + // = translationId; + }); + $translate('maze.judge.js.timeup.content').then(function (val) { + txt_timeup_mes = val; + }, function (translationId) { + // = translationId; + }); + + $scope.runIds = runId.split(','); + $scope.runNum = $scope.runIds.length; + $scope.nowRun = 0; + + function setRunId(index){ + $scope.runId = $scope.runIds[index]; + runId = $scope.runIds[index]; + $scope.nowRun = index; + + $scope.sync = 0; + $scope.z = 0; + $scope.startedTime = false; + $scope.time = 0; + $scope.startUnixTime = 0; + $scope.cells = {}; + $scope.tiles = {}; + $scope.leagueType = null; + loadNewRun(); + $(window).scrollTop(0); + } + setRunId(0); + + if(movie){ + $scope.movie = movie; + $scope.token = token; + $http.get("/api/document/files/" + teamId + '/' + token).then(function (response) { + $scope.uploaded = response.data; + }) + + $scope.checkUploaded = function(name){ + return($scope.uploaded.some((n) => new RegExp('^' + name + '\\.*').test(n))); + } + + $scope.getVideoLink = function(path){ + return("/api/document/files/" + teamId + "/" + token + "/" + path); + } + + $scope.getVideoList = function(name){ + let res = $scope.uploaded.filter(function(value) { + return new RegExp('^' + name + '\\.*').test(value); + }); + res.sort(function(first, second){ + if ( first.match(/.mp4/)) { + return -1; + } + if ( second.match(/.mp4/)) { + return -1; + } + }); + return res; + } + } + + + var date = new Date(); + var prevTime = 0; + + $scope.checkTeam = $scope.checkRound = $scope.checkMember = $scope.checkMachine = false; + $scope.toggleCheckTeam = function(){ + $scope.checkTeam = !$scope.checkTeam; + playSound(sClick); + } + $scope.toggleCheckRound = function(){ + $scope.checkRound = !$scope.checkRound; + playSound(sClick); + } + $scope.toggleCheckMember = function(){ + $scope.checkMember = !$scope.checkMember; + playSound(sClick); + } + $scope.toggleCheckMachine = function(){ + $scope.checkMachine = !$scope.checkMachine; + playSound(sClick); + } + + $scope.checks = function(){ + return ($scope.checkTeam & $scope.checkRound & $scope.checkMember & $scope.checkMachine) + } + + + + + const http_config = { + timeout: 10000 + }; + + function upload_run(data) { + if ($scope.networkError) { + $scope.saveEverything(); + return; + } + + $scope.sync++; + $http.put("/api/runs/maze/" + runId, Object.assign(data, { + time: { + minutes: Math.floor($scope.time / 60000), + seconds: Math.floor(($scope.time % 60000) / 1000) + } + }), http_config).then(function (response) { + console.log(response); + $scope.score = response.data.score; + $scope.sync--; + }, function (response) { + if (response.status == 401) { + $scope.go('/home/access_denied'); + } + $scope.networkError = true; + }); + } + + $scope.lopProcessing = false; + + if($cookies.get('sRotate')){ + $scope.sRotate = Number($cookies.get('sRotate')); + } + else $scope.sRotate = 0; + + $scope.cells = {}; + $scope.tiles = {}; + + $scope.startedScoring = false; + + var db_cells; + + function loadNewRun(){ + $http.get("/api/runs/maze/" + runId + + "?populate=true").then(function (response) { + $scope.exitBonus = response.data.exitBonus; + $scope.field = response.data.field.name; + $scope.round = response.data.round.name; + $scope.score = response.data.score; + $scope.team = response.data.team; + $scope.league = response.data.team.league; + $scope.competition = response.data.competition; + $scope.LoPs = response.data.LoPs; + $scope.MisIdent = response.data.misidentification; + $scope.diceSelect = response.data.diceNumber; + + // Verified time by timekeeper + $scope.minutes = response.data.time.minutes; + $scope.seconds = response.data.time.seconds; + $scope.time = ($scope.minutes * 60 + $scope.seconds)*1000; + prevTime = $scope.time; + + // Scoring elements of the tiles + for (let i = 0; i < response.data.tiles.length; i++) { + $scope.tiles[response.data.tiles[i].x + ',' + + response.data.tiles[i].y + ',' + + response.data.tiles[i].z] = response.data.tiles[i]; + } + + + $scope.loadMap(response.data.map); + + if (document.referrer.indexOf('sign') != -1) { + $scope.checked = true; + $timeout($scope.tile_size, 10); + $timeout($scope.tile_size, 200); + }else{ + } + + + + }, function (response) { + console.log("Error: " + response.statusText); + if (response.status == 401) { + $scope.go('/home/access_denied'); + } + }); + } + + + $scope.randomDice = function(){ + playSound(sClick); + var a = Math.floor( Math.random() * 6 ) + 5; + $scope.diceSelect = 0; + //Animation + setTimeout(diceAnimation, 100, a) + } + + function diceAnimation(num){ + $scope.diceSelect += 1; + if($scope.diceSelect > 5) $scope.diceSelect -= 6; + $scope.$apply(); + if(num > 0){ + setTimeout(diceAnimation,100,num-1); + }else{ + //Set selected map + $scope.changeMap($scope.diceSelect); + } + } + + $scope.changeMap = function(n){ + $scope.sync++; + $http.put("/api/runs/maze/map/" + runId, { + map: $scope.dice[n], + diceNumber: n + }).then(function (response) { + $scope.loadMap(response.data.map._id); + $scope.sync--; + $scope.diceSelect = n; + }, function (response) { + console.log("Error: " + response.statusText); + if (response.status == 401) { + $scope.go('/home/access_denied'); + } + $scope.networkError = true; + }); + } + + $scope.loadMap = function(mapId){ + // Get the map + $http.get("/api/maps/maze/" + mapId + + "?populate=true").then(function (response) { + console.log(response.data); + $scope.startTile = response.data.startTile; + $scope.height = response.data.height; + + $scope.width = response.data.width; + $scope.length = response.data.length; + $scope.duration = response.data.duration || 480; + $scope.leagueType = response.data.leagueType; + if (response.data.leagueType == "entry") { + // Identification bonus + maxKit={ + 'Red': 1, + 'Green': 1 + }; + } else { + maxKit={ + 'H': 3, + 'S': 2, + 'U': 0, + 'Red': 1, + 'Yellow': 1, + 'Green': 0 + }; + } + + if(response.data.parent){ + if(!$scope.dice){ + $http.get("/api/maps/maze/" + response.data.parent).then(function (response) { + $scope.dice = response.data.dice; + }, function (response) { + console.log("Error: " + response.statusText); + }); + } + + }else{ + $scope.dice = response.data.dice; + } + + for (let i = 0; i < response.data.cells.length; i++) { + $scope.cells[response.data.cells[i].x + ',' + + response.data.cells[i].y + ',' + + response.data.cells[i].z] = response.data.cells[i]; + } + + db_cells = response.data.cells; + + width = response.data.width; + length = response.data.length; + $timeout($scope.tile_size, 100); + + }, function (response) { + console.log("Error: " + response.statusText); + }); + } + + $scope.range = function (n) { + arr = []; + for (let i = 0; i < n; i++) { + arr.push(i); + } + return arr; + } + + $scope.timeReset = function () { + playSound(sClick); + prevTime = 0; + $scope.time = 0; + $scope.saveEverything(); + } + + $scope.infochecked = function () { + playSound(sClick); + $scope.checked = true; + //$timeout($scope.tile_size, 10); + $timeout($scope.tile_size, 200); + $timeout($scope.tile_size, 2000); + scrollTo( 0, 0 ) ; + } + $scope.decrement = function () { + playSound(sClick); + $scope.LoPs--; + if ($scope.LoPs < 0) + $scope.LoPs = 0; + + upload_run({ + LoPs: $scope.LoPs + }); + + } + $scope.increment = function () { + playSound(sClick); + $scope.LoPs++; + + upload_run({ + LoPs: $scope.LoPs + }); + } + + $scope.decrementMis = function () { + playSound(sClick); + $scope.MisIdent--; + if ($scope.MisIdent < 0) + $scope.MisIdent = 0; + + upload_run({ + misidentification: $scope.MisIdent + }); + + } + $scope.incrementMis = function () { + playSound(sClick); + $scope.MisIdent++; + + upload_run({ + misidentification: $scope.MisIdent + }); + } + + $scope.changeFloor = function (z){ + playSound(sClick); + $scope.z = z; + } + + $scope.tileRot = function (r){ + playSound(sClick); + $scope.sRotate += r; + if($scope.sRotate >= 360)$scope.sRotate -= 360; + else if($scope.sRotate < 0) $scope.sRotate+= 360; + $timeout($scope.tile_size, 50); + + $cookies.put('sRotate', $scope.sRotate, { + path: '/' + }); + } + + $scope.wallColor = function(x,y,z,rotate=0){ + let cell = $scope.cells[x+','+y+','+z]; + if(!cell) return {}; + if(cell.isWall) return cell.isLinear?{'background-color': 'black'}:{'background-color': 'navy'}; + + if(cell.halfWall > 0){ + let direction = 180*(cell.halfWall-1)+(y%2==1?0:90); + + //Wall color + let color = 'navy'; + switch (direction) { + case 0: + if(wallCheck($scope.cells[(x-1)+','+(y+1)+','+z])) color = 'black'; + if(wallCheck($scope.cells[(x+1)+','+(y+1)+','+z])) color = 'black'; + if(wallCheck($scope.cells[(x)+','+(y+2)+','+z])) color = 'black'; + break; + case 90: + if(wallCheck($scope.cells[(x-1)+','+(y+1)+','+z])) color = 'black'; + if(wallCheck($scope.cells[(x-1)+','+(y-1)+','+z])) color = 'black'; + if(wallCheck($scope.cells[(x-2)+','+(y)+','+z])) color = 'black'; + break; + case 180: + if(wallCheck($scope.cells[(x-1)+','+(y-1)+','+z])) color = 'black'; + if(wallCheck($scope.cells[(x+1)+','+(y-1)+','+z])) color = 'black'; + if(wallCheck($scope.cells[(x)+','+(y-2)+','+z])) color = 'black'; + break; + case 270: + if(wallCheck($scope.cells[(x+1)+','+(y+1)+','+z])) color = 'black'; + if(wallCheck($scope.cells[(x+1)+','+(y-1)+','+z])) color = 'black'; + if(wallCheck($scope.cells[(x+2)+','+(y)+','+z])) color = 'black'; + break; + } + + direction += rotate; + if(direction>=360) direction-=360; + + let gradient = String(direction) + "deg," + color + " 0%," + color + " 50%,white 50%,white 100%"; + return {'background': 'linear-gradient(' + gradient + ')'}; + + } + + }; + + function wallCheck(cell){ + if(!cell) return false; + return cell.isWall && cell.isLinear; + } + + var tick = function () { + if ($scope.startedTime) { + date = new Date(); + $scope.time = prevTime + (date.getTime() - $scope.startUnixTime); + $scope.minutes = Math.floor($scope.time / 60000); + $scope.seconds = Math.floor(($scope.time % 60000) / 1000); + if ($scope.time >= $scope.duration*1000) { + playSound(sTimeup); + $scope.startedTime = !$scope.startedTime; + $scope.time = $scope.duration*1000; + $scope.saveEverything(); + swal(txt_timeup, '', "info"); + } + $timeout(tick, 1000); + } + } + + $scope.toggleScoring = function(){ + playSound(sClick); + $scope.startedScoring = !$scope.startedScoring; + } + + $scope.toggleTime = function () { + playSound(sClick); + // Start/stop timer + $scope.startedTime = !$scope.startedTime; + if ($scope.startedTime) { + // Start the timer + $timeout(tick, 0); + date = new Date(); + $scope.startUnixTime = date.getTime(); + + upload_run({ + status: 2 + }); + } else { + // Save everything when you stop the time + date = new Date(); + $scope.time = prevTime + (date.getTime() - $scope.startUnixTime); + prevTime = $scope.time; + $scope.saveEverything(); + } + } + + $scope.changeExitBonus = function () { + playSound(sClick); + $scope.exitBonus = ! $scope.exitBonus + if ($scope.exitBonus && $scope.startedTime) { + $scope.startedTime = false; + date = new Date(); + $scope.time = prevTime + (date.getTime() - $scope.startUnixTime); + prevTime = $scope.time; + $scope.minutes = Math.floor($scope.time / 60000); + $scope.seconds = Math.floor(($scope.time % 60000) / 1000) + } + $scope.saveEverything(); + } + + $scope.isUndefined = function (thing) { + return (typeof thing === "undefined"); + } + + $scope.tileStatus = function (x, y, z, isTile) { + // If this is a non-existent tile + var cell = $scope.cells[x + ',' + y + ',' + z]; + if (!cell) + return; + if (!isTile) + return; + + if (!$scope.tiles[x + ',' + y + ',' + z]) { + $scope.tiles[x + ',' + y + ',' + z] = { + scoredItems: { + speedbump: false, + checkpoint: false, + ramp: false, + steps: false, + victims: { + top: false, + right: false, + left: false, + bottom: false, + floor: false + }, + rescueKits: { + top: 0, + right: 0, + bottom: 0, + left: 0, + floor: 0 + } + } + }; + } + var tile = $scope.tiles[x + ',' + y + ',' + z]; + + // Current "score" for this tile + var current = 0; + // Max "score" for this tile. Score is added 1 for every passed mission + var possible = 0; + + + if (cell.tile.speedbump) { + possible++; + if (tile.scoredItems.speedbump) { + current++; + } + } + if (cell.tile.checkpoint) { + possible++; + if (tile.scoredItems.checkpoint) { + current++; + } + } + if (cell.tile.ramp) { + possible+=1; + if (tile.scoredItems.ramp) { + current++; + } + } + if (cell.tile.steps) { + possible++; + if (tile.scoredItems.steps) { + current++; + } + } + if(cell.tile.victims.top != "None"){ + possible++; + current += tile.scoredItems.victims.top; + possible += maxKit[cell.tile.victims.top]; + current += Math.min(tile.scoredItems.rescueKits.top,maxKit[cell.tile.victims.top]); + } + if(cell.tile.victims.left != "None"){ + possible++; + current += tile.scoredItems.victims.left; + possible += maxKit[cell.tile.victims.left]; + current += Math.min(tile.scoredItems.rescueKits.left,maxKit[cell.tile.victims.left]); + } + if(cell.tile.victims.right != "None"){ + possible++; + current += tile.scoredItems.victims.right; + possible += maxKit[cell.tile.victims.right]; + current += Math.min(tile.scoredItems.rescueKits.right,maxKit[cell.tile.victims.right]); + } + if(cell.tile.victims.bottom != "None"){ + possible++; + current += tile.scoredItems.victims.bottom; + possible += maxKit[cell.tile.victims.bottom]; + current += Math.min(tile.scoredItems.rescueKits.bottom,maxKit[cell.tile.victims.bottom]); + } + if(cell.tile.victims.floor != "None"){ + possible++; + current += tile.scoredItems.victims.floor; + console.log(current) + possible += maxKit[cell.tile.victims.floor]; + current += Math.min(tile.scoredItems.rescueKits.floor,maxKit[cell.tile.victims.floor]); + } + + + + if (tile.processing) + return "processing"; + else if (current > 0 && current == possible) + return "done"; + else if (current > 0) + return "halfdone"; + else if (possible > 0) + return "undone"; + else + return ""; + } + + + $scope.cellClick = function (x, y, z, isWall, isTile) { + var cell = $scope.cells[x + ',' + y + ',' + z]; + if (!cell) + return; + if (!isTile) + return; + playSound(sClick); + + if (!$scope.tiles[x + ',' + y + ',' + z]) { + $scope.tiles[x + ',' + y + ',' + z] = { + scoredItems: { + speedbump: false, + checkpoint: false, + ramp: false, + steps: false, + victims: { + top: false, + right: false, + left: false, + bottom: false, + floor: false + }, + rescueKits: { + top: 0, + right: 0, + bottom: 0, + left: 0, + floor: 0 + } + } + }; + } + var tile = $scope.tiles[x + ',' + y + ',' + z]; + + var hasVictims = (cell.tile.victims.top != "None") || + (cell.tile.victims.right != "None") || + (cell.tile.victims.bottom != "None") || + (cell.tile.victims.left != "None") || + (cell.tile.victims.floor != "None"); + + // Total number of scorable things on this tile + var total = !!cell.tile.speedbump + !!cell.tile.checkpoint + !!cell.tile.steps + !!cell.tile.ramp + hasVictims; + console.log("totalt antal saker", total); + console.log("Has victims", hasVictims); + + if (total == 1 && !hasVictims) { + if (cell.tile.speedbump) { + tile.scoredItems.speedbump = !tile.scoredItems.speedbump; + } + if (cell.tile.checkpoint) { + tile.scoredItems.checkpoint = !tile.scoredItems.checkpoint; + } + if (cell.tile.ramp) { + tile.scoredItems.ramp = !tile.scoredItems.ramp; + } + if (cell.tile.steps) { + tile.scoredItems.steps = !tile.scoredItems.steps; + } + var httpdata = { + tiles: { + [x + ',' + y + ',' + z]: tile + } + }; + upload_run(httpdata); + } else if (total > 1 || hasVictims) { + // Open modal for multi-select + $scope.open(x, y, z); + } + + } + + $scope.open = function (x, y, z) { + var modalInstance = $uibModal.open({ + animation: true, + templateUrl: '/templates/maze_judge_modal.html', + controller: 'ModalInstanceCtrl', + size: 'lm', + resolve: { + cell: function () { + return $scope.cells[x + ',' + y + ',' + z]; + }, + tile: function () { + return $scope.tiles[x + ',' + y + ',' + z]; + }, + sRotate: function (){ + return $scope.sRotate; + }, + leagueType: function () { + return $scope.leagueType; + } + } + }).closed.then(function (result) { + let httpdata = { + tiles: { + [x + ',' + y + ',' + z]: $scope.tiles[x + ',' + y + ',' + z] + } + }; + upload_run(httpdata); + }); + }; + + $scope.saveEverything = function () { + var run = {} + run.exitBonus = $scope.exitBonus; + run.LoPs = $scope.LoPs; + run.misidentification = $scope.MisIdent; + + // Scoring elements of the tiles + run.tiles = $scope.tiles; + $scope.minutes = Math.floor($scope.time / 60000) + $scope.seconds = Math.floor(($scope.time % 60000) / 1000) + run.time = { + minutes: $scope.minutes, + seconds: $scope.seconds + }; + + console.log("Update run", run); + $http.put("/api/runs/maze/" + runId, run, http_config).then(function (response) { + $scope.score = response.data.score; + $scope.networkError = false; + $scope.sync = 0; + }, function (response) { + console.log("Error: " + response.statusText); + $scope.networkError = true; + }); + }; + + $scope.confirm = function () { + playSound(sClick); + var run = {} + run.exitBonus = $scope.exitBonus; + run.LoPs = $scope.LoPs; + run.misidentification = $scope.MisIdent; + + // Scoring elements of the tiles + run.tiles = $scope.tiles; + + // Verified time by timekeeper + run.time = {}; + run.time.minutes = $scope.minutes;; + run.time.seconds = $scope.seconds; + run.status = 3; + + $http.put("/api/runs/maze/" + runId, run).then(function (response) { + $scope.score = response.data.score; + $scope.go('/maze/sign/' + runId + '?return=' + $scope.getParam('return')); + }, function (response) { + console.log("Error: " + response.statusText); + }); + }; + + $scope.nextRun = function (flag) { + playSound(sClick); + var run = {} + run.exitBonus = $scope.exitBonus; + run.LoPs = $scope.LoPs; + run.misidentification = $scope.MisIdent; + + // Scoring elements of the tiles + run.tiles = $scope.tiles; + + // Verified time by timekeeper + run.time = {}; + run.time.minutes = $scope.minutes;; + run.time.seconds = $scope.seconds; + run.status = 3; + + $http.put("/api/runs/maze/" + runId, run).then(function (response) { + $scope.score = response.data.score; + if(flag){ + setRunId($scope.nowRun+1); + $(window).scrollTop(0); + } + else{ + Swal.fire({ + title: 'Complete!', + html: 'Scoring completed! Please close this tab.', + type: 'success' + }).then((result) => { + window.close(); + }) + } + }, function (response) { + console.log("Error: " + response.statusText); + }); + }; + + $scope.getParam = function (key) { + var str = location.search.split("?"); + if (str.length < 2) { + return ""; + } + + var params = str[1].split("&"); + for (var i = 0; i < params.length; i++) { + var keyVal = params[i].split("="); + if (keyVal[0] == key && keyVal.length == 2) { + return decodeURIComponent(keyVal[1]); + } + } + return ""; + } + + $scope.go = function (path) { + playSound(sClick); + window.location = path + } + + $scope.tile_size = function () { + try { + var mapTable = $('#mapTable'); + + let areaTopLeftX = document.getElementById("mapTopLeft").getBoundingClientRect().left + window.pageXOffset; + let areaTopLeftY = document.getElementById("mapTopLeft").getBoundingClientRect().top + window.pageYOffset; + + let scaleX = (window.innerWidth - areaTopLeftX - 10) / mapTable.width(); + let scaleY = (window.innerHeight - areaTopLeftY - 10) / mapTable.height(); + let scale = Math.min(scaleX, scaleY); + + if (scaleX > scaleY) { + $('#wrapTile').css('transform-origin', 'top center'); + } else { + $('#wrapTile').css('transform-origin', 'top left'); + } + + $('#wrapTile').css('transform', `scale(${scale})`); + $('.tilearea').css('height', mapTable.height() * scale + areaTopLeftY - 50); + } catch (e) { + $timeout($scope.tile_size, 500); + } + } + + $scope.handover = function () { + var run = {} + run.id = runId; + run.exitBonus = $scope.exitBonus; + run.LoPs = $scope.LoPs; + run.misidentification = $scope.MisIdent; + + // Scoring elements of the tiles + run.tiles = $scope.tiles; + run.time = { + minutes: $scope.minutes, + seconds: $scope.seconds + }; + run.status = 3; + + swal({ + title: 'Scan it !', + html: '
', + showCloseButton: true + }).then((result) => { + stopMakeQR(); + }) + createMultiQR(run, "qr_code_area", 80); + } + + +var currentWidth = -1; + + +$(window).on('load resize', function () { + if (currentWidth == window.innerWidth) { + return; + } + currentWidth = window.innerWidth; + $scope.tile_size(); + +}); + +}]); + + +// Please note that $uibModalInstance represents a modal window (instance) dependency. +// It is not the same as the $uibModal service used above. + +app.controller('ModalInstanceCtrl', ['$scope','$uibModalInstance','cell','tile','sRotate','leagueType',function ($scope, $uibModalInstance, cell, tile, sRotate, leagueType) { + $scope.cell = cell; + $scope.tile = tile; + $scope.leagueType = leagueType; + $scope.hasVictims = (cell.tile.victims.top != "None") || + (cell.tile.victims.right != "None") || + (cell.tile.victims.bottom != "None") || + (cell.tile.victims.left != "None") || + (cell.tile.victims.floor != "None"); + $scope.clickSound = function(){ + playSound(sClick); + }; + + $scope.incKits = function (direction) { + playSound(sClick); + $scope.tile.scoredItems.rescueKits[direction]++; + }; + + $scope.decKits = function (direction) { + playSound(sClick); + $scope.tile.scoredItems.rescueKits[direction]--; + if ($scope.tile.scoredItems.rescueKits[direction] < 0) { + $scope.tile.scoredItems.rescueKits[direction] = 0; + } + }; + + $scope.changeRamp = function(){ + playSound(sClick); + $scope.tile.scoredItems.ramp = !$scope.tile.scoredItems.ramp; + }; + + $scope.changeCheckPoint = function(){ + playSound(sClick); + $scope.tile.scoredItems.checkpoint = !$scope.tile.scoredItems.checkpoint; + }; + + $scope.changeSpeedbump = function(){ + playSound(sClick); + $scope.tile.scoredItems.speedbump = !$scope.tile.scoredItems.speedbump; + }; + + $scope.changeSteps = function(){ + playSound(sClick); + $scope.tile.scoredItems.steps = !$scope.tile.scoredItems.steps; + }; + + $scope.applyEntryVictimRestriction= function(direction) { + playSound(sClick); + if (!$scope.tile.scoredItems.victims[direction]) { + $scope.tile.scoredItems.rescueKits[direction] = 0; + } + } + + + $scope.lightStatus = function(light, kit){ + if(light) return true; + return false; + }; + + $scope.kitStatus = function(light, kit, type){ + return (maxKit[type] <= kit); + }; + + $scope.modalRotate = function(dir){ + var ro; + switch(dir){ + case 'top': + ro = 0; + break; + case 'right': + ro = 90; + break; + case 'left': + ro = 270; + break; + case 'bottom': + ro = 180; + break; + } + ro += sRotate; + if(ro >= 360)ro -= 360; + switch(ro){ + case 0: + return 'top'; + case 90: + return 'right'; + case 180: + return 'bottom'; + case 270: + return 'left'; + } + } + + $scope.ok = function () { + playSound(sClick); + $uibModalInstance.close(); + }; + +}]); + + + + + +let lastTouch = 0; +document.addEventListener('touchend', event => { + const now = window.performance.now(); + if (now - lastTouch <= 500) { + event.preventDefault(); + } + lastTouch = now; +}, true); + +window.AudioContext = window.AudioContext || window.webkitAudioContext; +var context = new AudioContext(); + +var getAudioBuffer = function(url, fn) { + var req = new XMLHttpRequest(); + req.responseType = 'arraybuffer'; + + req.onreadystatechange = function() { + if (req.readyState === 4) { + if (req.status === 0 || req.status === 200) { + context.decodeAudioData(req.response, function(buffer) { + fn(buffer); + }); + } + } + }; + + req.open('GET', url, true); + req.send(''); +}; + +var playSound = function(buffer) { + var source = context.createBufferSource(); + source.buffer = buffer; + source.connect(context.destination); + source.start(0); +}; + +var sClick,sInfo,sError,sTimeup; +window.onload = function() { + getAudioBuffer('/sounds/click.mp3', function(buffer) { + sClick = buffer; + }); + getAudioBuffer('/sounds/info.mp3', function(buffer) { + sInfo = buffer; + }); + getAudioBuffer('/sounds/error.mp3', function(buffer) { + sError = buffer; + }); + getAudioBuffer('/sounds/timeup.mp3', function(buffer) { + sTimeup = buffer; + }); +}; diff --git a/public/javascripts/manual/maze_2024.js b/public/javascripts/manual/maze_2024.js index 5e425fdd..8dfefc59 100755 --- a/public/javascripts/manual/maze_2024.js +++ b/public/javascripts/manual/maze_2024.js @@ -18,11 +18,11 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt $scope.victimsList = { "H": { "image": "H.png", - "kit": 3 + "kit": 2 }, "S": { "image": "S.png", - "kit": 2 + "kit": 1 }, "U": { "image": "U.png", @@ -30,7 +30,7 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt }, "Red": { "image": "Red.png", - "kit": 1 + "kit": 2 }, "Yellow": { "image": "Yellow.png", diff --git a/public/javascripts/sign/maze_2024.js b/public/javascripts/sign/maze_2024.js index 4ce503c8..29b328b0 100644 --- a/public/javascripts/sign/maze_2024.js +++ b/public/javascripts/sign/maze_2024.js @@ -6,12 +6,12 @@ let victimConstant = {}; let victimTypes = []; const victimConstantWL = { "H": { - "maxKitNum": 3, + "maxKitNum": 2, "linearPoint": 10, "floatingPoint": 30 }, "S": { - "maxKitNum": 2, + "maxKitNum": 1, "linearPoint": 10, "floatingPoint": 30 }, @@ -21,7 +21,7 @@ const victimConstantWL = { "floatingPoint": 30 }, "Red": { - "maxKitNum": 1, + "maxKitNum": 2, "linearPoint": 5, "floatingPoint": 15 }, @@ -37,19 +37,6 @@ const victimConstantWL = { } }; -const victimConstantNL = { - "Red": { - "maxKitNum": 1, - "linearPoint": 15, - "floatingPoint": 30 - }, - "Green": { - "maxKitNum": 1, - "linearPoint": 15, - "floatingPoint": 30 - } -}; - // function referenced by the drop target app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$http', '$translate', '$cookies', function ($scope, $uibModal, $log, $timeout, $http, $translate, $cookies) { var txt_cap_sign, txt_cref_sign, txt_ref_sign, txt_no_sign, txt_complete, txt_confirm; @@ -188,11 +175,8 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt $scope.length = response.data.length; $scope.leagueType = response.data.leagueType; - if ($scope.leagueType == "entry") { - victimConstant = victimConstantNL; - } else { - victimConstant = victimConstantWL; - } + + victimConstant = victimConstantWL; for (let i = 0; i < response.data.cells.length; i++) { $scope.cells[response.data.cells[i].x + ',' + @@ -293,15 +277,13 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt top: false, right: false, left: false, - bottom: false, - floor: false + bottom: false }, rescueKits: { top: 0, right: 0, bottom: 0, - left: 0, - floor: 0 + left: 0 } } }; @@ -363,12 +345,6 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt possible += victimConstant[cell.tile.victims.bottom].maxKitNum; current += Math.min(tile.scoredItems.rescueKits.bottom, victimConstant[cell.tile.victims.bottom].maxKitNum); } - if (cell.tile.victims.floor != "None") { - possible++; - current += tile.scoredItems.victims.floor; - possible += victimConstant[cell.tile.victims.floor].maxKitNum; - current += Math.min(tile.scoredItems.rescueKits.floor, victimConstant[cell.tile.victims.floor].maxKitNum); - } if (tile.processing) return "processing"; @@ -396,8 +372,7 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt var hasVictims = (cell.tile.victims.top != "None") || (cell.tile.victims.right != "None") || (cell.tile.victims.bottom != "None") || - (cell.tile.victims.left != "None") || - (cell.tile.victims.floor != "None"); + (cell.tile.victims.left != "None"); // Total number of scorable things on this tile var total = !!cell.tile.speedbump + !!cell.tile.checkpoint + !!cell.tile.steps + cell.tile.ramp + hasVictims; @@ -427,15 +402,13 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt top: false, right: false, left: false, - bottom: false, - floor: false + bottom: false }, rescueKits: { top: 0, right: 0, bottom: 0, - left: 0, - floor: 0 + left: 0 } } }; @@ -485,10 +458,6 @@ app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$htt current += victimConstant[cell.tile.victims.bottom][wallPointType] * tile.scoredItems.victims.bottom; current += 10 * Math.min(tile.scoredItems.rescueKits.bottom, victimConstant[cell.tile.victims.bottom].maxKitNum); } - if (cell.tile.victims.floor in victimConstant) { - current += victimConstant[cell.tile.victims.floor][wallPointType] * tile.scoredItems.victims.floor; - current += 10 * Math.min(tile.scoredItems.rescueKits.floor, victimConstant[cell.tile.victims.floor].maxKitNum); - } return current; }; @@ -745,8 +714,7 @@ app.controller('ModalInstanceCtrl', ['$scope', '$uibModalInstance', 'cell', 'til $scope.hasVictims = (cell.tile.victims.top != "None") || (cell.tile.victims.right != "None") || (cell.tile.victims.bottom != "None") || - (cell.tile.victims.left != "None") || - (cell.tile.victims.floor != "None"); + (cell.tile.victims.left != "None"); $scope.lightStatus = function (light, kit) { if (light) return true; diff --git a/public/javascripts/sign/maze_2024E.js b/public/javascripts/sign/maze_2024E.js new file mode 100644 index 00000000..4ce503c8 --- /dev/null +++ b/public/javascripts/sign/maze_2024E.js @@ -0,0 +1,881 @@ +// register the directive with your app module +var app = angular.module('ddApp', ['ngTouch', 'ngAnimate', 'ui.bootstrap', 'pascalprecht.translate', 'ngCookies']); +var marker = {}; +var socket; +let victimConstant = {}; +let victimTypes = []; +const victimConstantWL = { + "H": { + "maxKitNum": 3, + "linearPoint": 10, + "floatingPoint": 30 + }, + "S": { + "maxKitNum": 2, + "linearPoint": 10, + "floatingPoint": 30 + }, + "U": { + "maxKitNum": 0, + "linearPoint": 10, + "floatingPoint": 30 + }, + "Red": { + "maxKitNum": 1, + "linearPoint": 5, + "floatingPoint": 15 + }, + "Yellow": { + "maxKitNum": 1, + "linearPoint": 5, + "floatingPoint": 15 + }, + "Green": { + "maxKitNum": 0, + "linearPoint": 5, + "floatingPoint": 15 + } +}; + +const victimConstantNL = { + "Red": { + "maxKitNum": 1, + "linearPoint": 15, + "floatingPoint": 30 + }, + "Green": { + "maxKitNum": 1, + "linearPoint": 15, + "floatingPoint": 30 + } +}; + +// function referenced by the drop target +app.controller('ddController', ['$scope', '$uibModal', '$log', '$timeout', '$http', '$translate', '$cookies', function ($scope, $uibModal, $log, $timeout, $http, $translate, $cookies) { + var txt_cap_sign, txt_cref_sign, txt_ref_sign, txt_no_sign, txt_complete, txt_confirm; + $translate('maze.sign.cap_sign').then(function (val) { + txt_cap_sign = val; + }, function (translationId) { + // = translationId; + }); + $translate('maze.sign.ref_sign').then(function (val) { + txt_ref_sign = val; + }, function (translationId) { + // = translationId; + }); + $translate('maze.sign.cref_sign').then(function (val) { + txt_cref_sign = val; + }, function (translationId) { + // = translationId; + }); + $translate('maze.sign.no_sign').then(function (val) { + txt_no_sign = val; + }, function (translationId) { + // = translationId; + }); + $translate('maze.sign.complete').then(function (val) { + txt_complete = val; + }, function (translationId) { + // = translationId; + }); + $translate('maze.sign.confirm').then(function (val) { + txt_confirm = val; + }, function (translationId) { + // = translationId; + }); + + $scope.countWords = ["Bottom", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh", "Ninth"]; + $scope.z = 0; + + $scope.MisIdent = 0; + + $scope.enableSign = [false, false, false]; + $scope.signData = [null, null, null]; + + $scope.cells = {}; + $scope.tiles = {}; + + //$cookies.remove('sRotate') + if ($cookies.get('sRotate')) { + $scope.sRotate = Number($cookies.get('sRotate')); + } + else $scope.sRotate = 0; + + if (typeof runId !== 'undefined') { + $scope.runId = runId; + loadNewRun(); + } + + (function launchSocketIo() { + // launch socket.io + socket = io(window.location.origin, { + transports: ['websocket'] + }); + if (typeof runId !== 'undefined') { + socket.emit('subscribe', 'runs/' + runId); + socket.on('data', function (data) { + $scope.status = data.status; + $scope.exitBonus = data.exitBonus; + $scope.score = data.score; + $scope.normalizedScore = data.normalizedScore; + $scope.LoPs = data.LoPs; + $scope.foundVictims = sum(data.foundVictims.map(v => v.count)); + $scope.distKits = data.distKits; + $scope.MisIdent = data.misidentification; + + // Verified time by timekeeper + $scope.minutes = data.time.minutes; + $scope.seconds = data.time.seconds; + + // Scoring elements of the tiles + for (var i = 0; i < data.tiles.length; i++) { + $scope.tiles[data.tiles[i].x + ',' + + data.tiles[i].y + ',' + + data.tiles[i].z] = data.tiles[i]; + } + $scope.$apply(); + console.log("Updated view from socket.io"); + }); + } + + })(); + + function loadNewRun() { + $http.get("/api/runs/maze/" + runId + + "?normalized=true").then(function (response) { + $scope.status = response.data.status; + $scope.exitBonus = response.data.exitBonus; + $scope.field = response.data.field.name; + $scope.round = response.data.round.name; + $scope.score = response.data.score; + $scope.normalizedScore = response.data.normalizedScore; + $scope.team = response.data.team.name; + $scope.league = response.data.team.league; + $scope.competition = response.data.competition.name; + $scope.competition_id = response.data.competition._id; + $scope.LoPs = response.data.LoPs; + $scope.foundVictims = sum(response.data.foundVictims.map(v => v.count)); + $scope.distKits = response.data.distKits; + $scope.MisIdent = response.data.misidentification; + + // Verified time by timekeeper + $scope.minutes = response.data.time.minutes; + $scope.seconds = response.data.time.seconds; + + if (response.data.sign) { + $scope.cap_sig = response.data.sign.captain; + $scope.ref_sig = response.data.sign.referee; + $scope.refas_sig = response.data.sign.referee_as; + } + + $scope.comment = response.data.comment; + + // Scoring elements of the tiles + for (let i = 0; i < response.data.tiles.length; i++) { + $scope.tiles[response.data.tiles[i].x + ',' + + response.data.tiles[i].y + ',' + + response.data.tiles[i].z] = response.data.tiles[i]; + } + + // Get the map + $http.get("/api/maps/maze/" + response.data.map + + "?populate=true").then(function (response) { + console.log(response.data); + $scope.startTile = response.data.startTile; + $scope.height = response.data.height; + + $scope.width = response.data.width; + $scope.length = response.data.length; + + $scope.leagueType = response.data.leagueType; + if ($scope.leagueType == "entry") { + victimConstant = victimConstantNL; + } else { + victimConstant = victimConstantWL; + } + + for (let i = 0; i < response.data.cells.length; i++) { + $scope.cells[response.data.cells[i].x + ',' + + response.data.cells[i].y + ',' + + response.data.cells[i].z] = response.data.cells[i]; + } + width = response.data.width; + length = response.data.length; + $timeout(tile_size, 0); + + }, function (response) { + console.log("Error: " + response.statusText); + }); + + }, function (response) { + console.log("Error: " + response.statusText); + if (response.status == 401) { + $scope.go(`/home/access_denied?iframe=${iframe}`); + } + }); + } + + $scope.reliability = function () { + if ($scope.leagueType == "entry") { + return Math.max(($scope.foundVictims * 10) - ($scope.LoPs * 5), 0); + } else { + return Math.max(($scope.foundVictims + $scope.distKits - $scope.LoPs) * 10, 0); + } + } + + $scope.reliabilityLoPs = function () { + if ($scope.leagueType == "entry") { + return Math.min($scope.foundVictims * 10, $scope.LoPs * 5); + } else { + return Math.min(($scope.foundVictims + $scope.distKits) * 10, $scope.LoPs * 10); + } + } + + $scope.changeFloor = function (z) { + playSound(sClick); + $scope.z = z; + $timeout(tile_size, 100); + } + + $scope.tileRot = function (r) { + playSound(sClick); + $scope.sRotate += r; + if ($scope.sRotate >= 360) $scope.sRotate -= 360; + else if ($scope.sRotate < 0) $scope.sRotate += 360; + $timeout(tile_size, 0); + + $cookies.put('sRotate', $scope.sRotate, { + path: '/' + }); + } + + + $scope.range = function (n) { + arr = []; + for (let i = 0; i < n; i++) { + arr.push(i); + } + return arr; + } + + + $scope.isUndefined = function (thing) { + return (typeof thing === "undefined"); + } + + $scope.allItemScore = function () { + let score = 0; + for (let x = 1; x <= width * 2; x += 2) { + for (let y = 1; y <= length * 2; y += 2) { + score += $scope.tilePoint(x, y, 0, true); + } + } + return score; + } + + + $scope.tileStatus = function (x, y, z, isTile) { + // If this is a non-existent tile + var cell = $scope.cells[x + ',' + y + ',' + z]; + if (!cell) + return; + if (!isTile) + return; + + if (!$scope.tiles[x + ',' + y + ',' + z]) { + $scope.tiles[x + ',' + y + ',' + z] = { + scoredItems: { + speedbump: false, + checkpoint: false, + ramp: false, + steps: false, + victims: { + top: false, + right: false, + left: false, + bottom: false, + floor: false + }, + rescueKits: { + top: 0, + right: 0, + bottom: 0, + left: 0, + floor: 0 + } + } + }; + } + var tile = $scope.tiles[x + ',' + y + ',' + z]; + + // Current "score" for this tile + var current = 0; + // Max "score" for this tile. Score is added 1 for every passed mission + var possible = 0; + + + if (cell.tile.speedbump) { + possible++; + if (tile.scoredItems.speedbump) { + current++; + } + } + if (cell.tile.checkpoint) { + possible++; + if (tile.scoredItems.checkpoint) { + current++; + } + } + if (cell.tile.ramp) { + possible += 1; + if (tile.scoredItems.ramp) { + current++; + } + } + if (cell.tile.steps) { + possible++; + if (tile.scoredItems.steps) { + current++; + } + } + + if (cell.tile.victims.top != "None") { + possible++; + current += tile.scoredItems.victims.top; + possible += victimConstant[cell.tile.victims.top].maxKitNum; + current += Math.min(tile.scoredItems.rescueKits.top, victimConstant[cell.tile.victims.top].maxKitNum); + } + if (cell.tile.victims.left != "None") { + possible++; + current += tile.scoredItems.victims.left; + possible += victimConstant[cell.tile.victims.left].maxKitNum; + current += Math.min(tile.scoredItems.rescueKits.left, victimConstant[cell.tile.victims.left].maxKitNum); + } + if (cell.tile.victims.right != "None") { + possible++; + current += tile.scoredItems.victims.right; + possible += victimConstant[cell.tile.victims.right].maxKitNum; + current += Math.min(tile.scoredItems.rescueKits.right, victimConstant[cell.tile.victims.right].maxKitNum); + } + if (cell.tile.victims.bottom != "None") { + possible++; + current += tile.scoredItems.victims.bottom; + possible += victimConstant[cell.tile.victims.bottom].maxKitNum; + current += Math.min(tile.scoredItems.rescueKits.bottom, victimConstant[cell.tile.victims.bottom].maxKitNum); + } + if (cell.tile.victims.floor != "None") { + possible++; + current += tile.scoredItems.victims.floor; + possible += victimConstant[cell.tile.victims.floor].maxKitNum; + current += Math.min(tile.scoredItems.rescueKits.floor, victimConstant[cell.tile.victims.floor].maxKitNum); + } + + if (tile.processing) + return "processing"; + else if (current > 0 && current == possible) + return "done"; + else if (current > 0) + return "halfdone"; + else if (possible > 0) + return "undone"; + else + return ""; + } + + + $scope.cellClick = function (x, y, z, isWall, isTile) { + var cell = $scope.cells[x + ',' + y + ',' + z]; + if (!cell) + return; + if (!isTile) + return; + playSound(sClick); + + var tile = $scope.tiles[x + ',' + y + ',' + z]; + + var hasVictims = (cell.tile.victims.top != "None") || + (cell.tile.victims.right != "None") || + (cell.tile.victims.bottom != "None") || + (cell.tile.victims.left != "None") || + (cell.tile.victims.floor != "None"); + // Total number of scorable things on this tile + var total = !!cell.tile.speedbump + !!cell.tile.checkpoint + !!cell.tile.steps + cell.tile.ramp + hasVictims; + + if (total > 1 || hasVictims) { + // Open modal for multi-select + $scope.open(x, y, z); + } + + }; + + $scope.tilePoint = function (x, y, z, isTile) { + // If this is a non-existent tile + var cell = $scope.cells[x + ',' + y + ',' + z]; + + if (!cell) + return 0; + if (!isTile) + return 0; + + if (!$scope.tiles[x + ',' + y + ',' + z]) { + $scope.tiles[x + ',' + y + ',' + z] = { + scoredItems: { + speedbump: false, + checkpoint: false, + ramp: false, + victims: { + top: false, + right: false, + left: false, + bottom: false, + floor: false + }, + rescueKits: { + top: 0, + right: 0, + bottom: 0, + left: 0, + floor: 0 + } + } + }; + } + var tile = $scope.tiles[x + ',' + y + ',' + z]; + + // Current "score" for this tile + var current = 0; + + + if (cell.tile.speedbump) { + if (tile.scoredItems.speedbump) { + current += 5; + } + } + if (cell.tile.checkpoint) { + if (tile.scoredItems.checkpoint) { + current += 10; + } + } + if (cell.tile.ramp) { + if (tile.scoredItems.ramp) { + current += 10; + } + } + if (cell.tile.steps) { + if (tile.scoredItems.steps) { + current += 5; + } + } + + let wallPointType = cell.isLinear ? 'linearPoint' : 'floatingPoint'; + + if (cell.tile.victims.top in victimConstant) { + current += victimConstant[cell.tile.victims.top][wallPointType] * tile.scoredItems.victims.top; + current += 10 * Math.min(tile.scoredItems.rescueKits.top, victimConstant[cell.tile.victims.top].maxKitNum); + } + if (cell.tile.victims.right in victimConstant) { + current += victimConstant[cell.tile.victims.right][wallPointType] * tile.scoredItems.victims.right; + current += 10 * Math.min(tile.scoredItems.rescueKits.right, victimConstant[cell.tile.victims.right].maxKitNum); + } + if (cell.tile.victims.left in victimConstant) { + current += victimConstant[cell.tile.victims.left][wallPointType] * tile.scoredItems.victims.left; + current += 10 * Math.min(tile.scoredItems.rescueKits.left, victimConstant[cell.tile.victims.left].maxKitNum); + } + if (cell.tile.victims.bottom in victimConstant) { + current += victimConstant[cell.tile.victims.bottom][wallPointType] * tile.scoredItems.victims.bottom; + current += 10 * Math.min(tile.scoredItems.rescueKits.bottom, victimConstant[cell.tile.victims.bottom].maxKitNum); + } + if (cell.tile.victims.floor in victimConstant) { + current += victimConstant[cell.tile.victims.floor][wallPointType] * tile.scoredItems.victims.floor; + current += 10 * Math.min(tile.scoredItems.rescueKits.floor, victimConstant[cell.tile.victims.floor].maxKitNum); + } + + return current; + }; + + + $scope.open = function (x, y, z) { + var modalInstance = $uibModal.open({ + animation: true, + templateUrl: '/templates/maze_view_modal.html', + controller: 'ModalInstanceCtrl', + size: 'lm', + resolve: { + cell: function () { + return $scope.cells[x + ',' + y + ',' + z]; + }, + tile: function () { + return $scope.tiles[x + ',' + y + ',' + z]; + }, + sRotate: function () { + return $scope.sRotate; + }, + leagueType: function () { + return $scope.leagueType; + } + } + }).closed.then(function (result) { + console.log("Closed modal"); + }); + }; + + $scope.getParam = function (key) { + var str = location.search.split("?"); + if (str.length < 2) { + return ""; + } + + var params = str[1].split("&"); + for (var i = 0; i < params.length; i++) { + var keyVal = params[i].split("="); + if (keyVal[0] == key && keyVal.length == 2) { + return decodeURIComponent(keyVal[1]); + } + } + return ""; + } + + $scope.go = function (path) { + playSound(sClick); + socket.emit('unsubscribe', 'runs/' + runId); + socket.emit('subscribe', 'runs/map/' + runId); + window.location = path + } + + + $scope.success_message = function () { + playSound(sInfo); + swal({ + title: 'Recorded!', + text: txt_complete, + type: 'success' + }).then((result) => { + if (result.value) { + if ($scope.getParam('return')) $scope.go($scope.getParam('return')); + else $scope.go("/maze/" + $scope.competition_id + "/" + $scope.league); + } + }) + console.log("Success!!"); + } + + $scope.toggleSign = function (index) { + $scope.enableSign[index] = !$scope.enableSign[index]; + if (!$scope.enableSign[index]) { + let datapair; + switch (index) { + case 0: + datapair = $("#cap_sig").jSignature("getData", "svgbase64"); + break; + case 1: + datapair = $("#ref_sig").jSignature("getData", "svgbase64"); + break; + case 2: + datapair = $("#refas_sig").jSignature("getData", "svgbase64") + break; + } + $scope.signData[index] = "data:" + datapair[0] + "," + datapair[1]; + } else { + if (!$scope.signData[index]) setTimeout(initSign, 100, index); + } + } + + function initSign(index) { + switch (index) { + case 0: + $("#cap_sig").jSignature(); + break; + case 1: + $("#ref_sig").jSignature(); + break; + case 2: + $("#refas_sig").jSignature(); + break; + } + } + + $scope.clearSign = function (index) { + switch (index) { + case 0: + $("#cap_sig").jSignature("clear"); + break; + case 1: + $("#ref_sig").jSignature("clear"); + break; + case 2: + $("#refas_sig").jSignature("clear"); + break; + } + $scope.toggleSign(index); + } + + $scope.send_sign = function () { + playSound(sClick); + var sign_empty = "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMCIgaGVpZ2h0PSIwIj48L3N2Zz4=" + var run = {} + run.comment = $scope.comment; + run.sign = {} + var err_mes = "" + if (!$scope.signData[0]) { + err_mes += "[" + txt_cap_sign + "] " + } else { + run.sign.captain = $scope.signData[0] + } + + if (!$scope.signData[1]) { + err_mes += "[" + txt_ref_sign + "] " + } else { + run.sign.referee = $scope.signData[1] + } + + if (!$scope.signData[2]) { + err_mes += "[" + txt_cref_sign + "] " + } else { + run.sign.referee_as = $scope.signData[2] + } + + + if (err_mes != "") { + playSound(sError); + swal("Oops!", err_mes + txt_no_sign, "error"); + return; + } + playSound(sInfo); + + swal({ + title: "Finish Run?", + text: txt_confirm, + type: "warning", + showCancelButton: true, + confirmButtonText: "Yes, finish it!", + confirmButtonColor: "#ec6c62" + }).then((result) => { + if (result.value) { + console.log("STATUS UPDATED(4)") + run.status = 4; + $http.put("/api/runs/maze/" + runId, run).then(function (response) { + setTimeout($scope.success_message, 500); + }, function (response) { + playSound(sError); + swal("Oops", "We couldn't connect to the server! Please notice to system manager.", "error"); + console.log("Error: " + response.statusText); + }); + } + + }) + + + } + + $scope.wallColor = function (x, y, z, rotate = 0) { + let cell = $scope.cells[x + ',' + y + ',' + z]; + if (!cell) return {}; + if (cell.isWall) return cell.isLinear ? { 'background-color': 'black' } : { 'background-color': 'navy' }; + + if (cell.halfWall > 0) { + let direction = 180 * (cell.halfWall - 1) + (y % 2 == 1 ? 0 : 90); + + //Wall color + let color = 'navy'; + switch (direction) { + case 0: + if (wallCheck($scope.cells[(x - 1) + ',' + (y + 1) + ',' + z])) color = 'black'; + if (wallCheck($scope.cells[(x + 1) + ',' + (y + 1) + ',' + z])) color = 'black'; + if (wallCheck($scope.cells[(x) + ',' + (y + 2) + ',' + z])) color = 'black'; + break; + case 90: + if (wallCheck($scope.cells[(x - 1) + ',' + (y + 1) + ',' + z])) color = 'black'; + if (wallCheck($scope.cells[(x - 1) + ',' + (y - 1) + ',' + z])) color = 'black'; + if (wallCheck($scope.cells[(x - 2) + ',' + (y) + ',' + z])) color = 'black'; + break; + case 180: + if (wallCheck($scope.cells[(x - 1) + ',' + (y - 1) + ',' + z])) color = 'black'; + if (wallCheck($scope.cells[(x + 1) + ',' + (y - 1) + ',' + z])) color = 'black'; + if (wallCheck($scope.cells[(x) + ',' + (y - 2) + ',' + z])) color = 'black'; + break; + case 270: + if (wallCheck($scope.cells[(x + 1) + ',' + (y + 1) + ',' + z])) color = 'black'; + if (wallCheck($scope.cells[(x + 1) + ',' + (y - 1) + ',' + z])) color = 'black'; + if (wallCheck($scope.cells[(x + 2) + ',' + (y) + ',' + z])) color = 'black'; + break; + } + + direction += rotate; + if (direction >= 360) direction -= 360; + + let gradient = String(direction) + "deg," + color + " 0%," + color + " 50%,white 50%,white 100%"; + return { 'background': 'linear-gradient(' + gradient + ')' }; + + } + + }; + + function wallCheck(cell) { + if (!cell) return false; + return cell.isWall && cell.isLinear; + } + + var currentWidth = -1; + + + $(window).on('load resize', function () { + if (currentWidth == window.innerWidth) { + return; + } + currentWidth = window.innerWidth; + tile_size(); + $timeout(tile_size, 500); + $timeout(tile_size, 3000); + + }); + + // Iframe + $scope.navColor = function (stat) { + if (stat == 2) return '#e74c3c'; + if (stat == 3) return '#e67e22'; + return '#7f8c8d'; + } + // Iframe +}]); + + +app.controller('ModalInstanceCtrl', ['$scope', '$uibModalInstance', 'cell', 'tile', 'sRotate', 'leagueType', function ($scope, $uibModalInstance, cell, tile, sRotate, leagueType) { + $scope.cell = cell; + $scope.tile = tile; + $scope.leagueType = leagueType; + $scope.hasVictims = (cell.tile.victims.top != "None") || + (cell.tile.victims.right != "None") || + (cell.tile.victims.bottom != "None") || + (cell.tile.victims.left != "None") || + (cell.tile.victims.floor != "None"); + + $scope.lightStatus = function (light, kit) { + if (light) return true; + return false; + }; + + $scope.kitStatus = function (light, kit, type) { + return (victimConstant[type].maxKitNum <= kit); + }; + + $scope.modalRotate = function (dir) { + var ro; + switch (dir) { + case 'top': + ro = 0; + break; + case 'right': + ro = 90; + break; + case 'left': + ro = 270; + break; + case 'bottom': + ro = 180; + break; + } + ro += sRotate; + if (ro >= 360) ro -= 360; + switch (ro) { + case 0: + return 'top'; + case 90: + return 'right'; + case 180: + return 'bottom'; + case 270: + return 'left'; + } + } + + $scope.ok = function () { + playSound(sClick); + $uibModalInstance.close(); + }; +}]); + + +function sum(array) { + if (array.length == 0) return 0; + return array.reduce(function (a, b) { + return a + b; + }); +} + +$(window).on('beforeunload', function () { + socket.emit('unsubscribe', 'runs/' + runId); + socket.emit('subscribe', 'runs/map/' + runId); +}); + + +let lastTouch = 0; +document.addEventListener('touchend', event => { + const now = window.performance.now(); + if (now - lastTouch <= 500) { + event.preventDefault(); + } + lastTouch = now; +}, true); + +window.AudioContext = window.AudioContext || window.webkitAudioContext; +var context = new AudioContext(); + +var getAudioBuffer = function (url, fn) { + var req = new XMLHttpRequest(); + req.responseType = 'arraybuffer'; + + req.onreadystatechange = function () { + if (req.readyState === 4) { + if (req.status === 0 || req.status === 200) { + context.decodeAudioData(req.response, function (buffer) { + fn(buffer); + }); + } + } + }; + + req.open('GET', url, true); + req.send(''); +}; + +var playSound = function (buffer) { + var source = context.createBufferSource(); + source.buffer = buffer; + source.connect(context.destination); + source.start(0); +}; + +var sClick, sInfo, sError; +window.onload = function () { + getAudioBuffer('/sounds/click.mp3', function (buffer) { + sClick = buffer; + }); + getAudioBuffer('/sounds/info.mp3', function (buffer) { + sInfo = buffer; + }); + getAudioBuffer('/sounds/error.mp3', function (buffer) { + sError = buffer; + }); +}; + +function tile_size() { + try { + var mapTable = $('#mapTable'); + + let areaTopLeftX = document.getElementById("mapTopLeft").getBoundingClientRect().left + window.pageXOffset; + + let scaleX = (window.innerWidth - areaTopLeftX - 10) / mapTable.width(); + let scaleY = (window.innerHeight - 200) / mapTable.height(); + let scale = Math.min(scaleX, scaleY); + + if (scaleX > scaleY) { + $('#wrapTile').css('transform-origin', 'top center'); + } else { + $('#wrapTile').css('transform-origin', 'top left'); + } + + $('#wrapTile').css('transform', `scale(${scale})`); + $('.tilearea').css('height', mapTable.height() * scale + 120); + } catch (e) { + $timeout(tile_size, 500); + } +} \ No newline at end of file diff --git a/views/judge/maze_2024E.pug b/views/judge/maze_2024E.pug index 29b56251..5a1e78c4 100755 --- a/views/judge/maze_2024E.pug +++ b/views/judge/maze_2024E.pug @@ -6,7 +6,7 @@ html(ng-app="ddApp") var movie = "" include ../includes/common_component - script(src="/javascripts/judge/maze_2024.js") + script(src="/javascripts/judge/maze_2024E.js") script(src="/javascripts/deflate.js") script(src="/components/jquery-qrcode/jquery.qrcode.min.js") diff --git a/views/sign/maze_2024E.pug b/views/sign/maze_2024E.pug index a6ef90f3..ca0cec57 100755 --- a/views/sign/maze_2024E.pug +++ b/views/sign/maze_2024E.pug @@ -6,7 +6,7 @@ html(ng-app="ddApp") var iframe = "#{iframe}" include ../includes/common_component - script(src="/javascripts/sign/maze_2024.js") + script(src="/javascripts/sign/maze_2024E.js") script(src="/javascripts/translate_config.js") script(src='/components/jSignature/libs/jSignature.min.js') @@ -34,7 +34,7 @@ html(ng-app="ddApp") .col-md12 button.btn.btn-secondary(style='margin:0 10px 10px 0;', type='button', ng-click="go('/maze/judge/' + runId + '?return=' + getParam('return'))") i.fas.fa-edit(aria-hidden='true') {{'maze.sign.to_judge' | translate}} - include ../view/common/maze_2024 + include ../view/common/maze_2024E .alert.alert-success(style='margin:30 0 0 0;', role='alert') .row .col-md-6 diff --git a/views/view/common/maze_2024.pug b/views/view/common/maze_2024.pug index 5e6d42e8..7f6ee9b7 100755 --- a/views/view/common/maze_2024.pug +++ b/views/view/common/maze_2024.pug @@ -98,8 +98,6 @@ img.tile-image(ng-src='/images/green_right.png', ng-show="cells[c+','+r+','+z].tile.victims.right == 'Green'") img.tile-image(ng-src='/images/green_bottom.png', ng-show="cells[c+','+r+','+z].tile.victims.bottom == 'Green'") img.tile-image(ng-src='/images/green_left.png', ng-show="cells[c+','+r+','+z].tile.victims.left == 'Green'") - img.tile-image(ng-src='/images/red_floor.png', ng-show="cells[c+','+r+','+z].tile.victims.floor == 'Red'") - img.tile-image(ng-src='/images/green_floor.png', ng-show="cells[c+','+r+','+z].tile.victims.floor == 'Green'") i.fas.fa-check.fa-fw.tile-image.tile-font(ng-show="tileStatus(c,r,z,$odd && $parent.$odd) == 'done'", style='padding-top:4px; color:#27ae60; opacity:0.9;') i.fas.fa-play.fa-fw.fa-rotate-270.tile-image.tile-font(ng-show="tileStatus(c,r,z,$odd && $parent.$odd) == 'halfdone'", style='padding-top:4px; color:#f4d03f; opacity:0.9;') i.fas.fa-times.fa-fw.tile-image.tile-font(ng-show="tileStatus(c,r,z,$odd && $parent.$odd) == 'undone'", style='padding-top:6px; color:#e74c3c; opacity:0.9;') @@ -137,8 +135,6 @@ img.tile-image(ng-src='/images/green_bottom.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.right == 'Green'") img.tile-image(ng-src='/images/green_left.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.bottom == 'Green'") img.tile-image(ng-src='/images/green_top.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.left == 'Green'") - img.tile-image(ng-src='/images/red_floor.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.floor == 'Red'") - img.tile-image(ng-src='/images/green_floor.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.floor == 'Green'") i.fas.fa-check.fa-fw.tile-image.tile-font(ng-show="tileStatus(r,(2*length - c),z,$odd && $parent.$odd) == 'done'", style='padding-top:4px; color:#27ae60; opacity:0.9;') i.fas.fa-play.fa-fw.fa-rotate-270.tile-image.tile-font(ng-show="tileStatus(r,(2*length - c),z,$odd && $parent.$odd) == 'halfdone'", style='padding-top:4px; color:#f4d03f; opacity:0.9;') i.fas.fa-times.fa-fw.tile-image.tile-font(ng-show="tileStatus(r,(2*length - c),z,$odd && $parent.$odd) == 'undone'", style='padding-top:6px; color:#e74c3c; opacity:0.9;') @@ -176,8 +172,6 @@ img.tile-image(ng-src='/images/green_left.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.right == 'Green'") img.tile-image(ng-src='/images/green_top.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.bottom == 'Green'") img.tile-image(ng-src='/images/green_right.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.left == 'Green'") - img.tile-image(ng-src='/images/red_floor.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.floor == 'Red'") - img.tile-image(ng-src='/images/green_floor.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.floor == 'Green'") i.fas.fa-check.fa-fw.tile-image.tile-font(ng-show="tileStatus(2*width - c,2*length - r,z,$odd && $parent.$odd) == 'done'", style='padding-top:4px; color:#27ae60; opacity:0.9;') i.fas.fa-play.fa-fw.fa-rotate-270.tile-image.tile-font(ng-show="tileStatus(2*width - c,2*length - r,z,$odd && $parent.$odd) == 'halfdone'", style='padding-top:4px; color:#f4d03f; opacity:0.9;') i.fas.fa-times.fa-fw.tile-image.tile-font(ng-show="tileStatus(2*width - c,2*length - r,z,$odd && $parent.$odd) == 'undone'", style='padding-top:6px; color:#e74c3c; opacity:0.9;') @@ -215,8 +209,6 @@ img.tile-image(ng-src='/images/green_top.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.right == 'Green'") img.tile-image(ng-src='/images/green_right.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.bottom == 'Green'") img.tile-image(ng-src='/images/green_bottom.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.left == 'Green'") - img.tile-image(ng-src='/images/red_floor.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.floor == 'Red'") - img.tile-image(ng-src='/images/green_floor.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.floor == 'Green'") i.fas.fa-check.fa-fw.tile-image.tile-font(ng-show="tileStatus(2*width - r,c,z,$odd && $parent.$odd) == 'done'", style='padding-top:4px; color:#27ae60; opacity:0.9;') i.fas.fa-play.fa-fw.fa-rotate-270.tile-image.tile-font(ng-show="tileStatus(2*width - r,c,z,$odd && $parent.$odd) == 'halfdone'", style='padding-top:4px; color:#f4d03f; opacity:0.9;') i.fas.fa-times.fa-fw.tile-image.tile-font(ng-show="tileStatus(2*width - r,c,z,$odd && $parent.$odd) == 'undone'", style='padding-top:6px; color:#e74c3c; opacity:0.9;') diff --git a/views/view/common/maze_2024E.pug b/views/view/common/maze_2024E.pug new file mode 100755 index 00000000..5e6d42e8 --- /dev/null +++ b/views/view/common/maze_2024E.pug @@ -0,0 +1,302 @@ + +.row + .col-md-4.col-lg-3(style='margin-bottom:70px;') + #card_area + .card + h3.card-header + i.fas.fa-step-forward(aria-hidden='true') + | LoPs + .card-body + .col-md-12(style='position: relative;') + p.card-text + b {{'maze.sign.total_lops' | translate}} + br + .input-group.mb-3(style='width:100%;height:40px;') + .input-group-prepend + button.btn.btn-danger(type='button', disabled) + i.fas.fa-minus(aria-hidden='true') + div(style='background-color: #F2F2F2; width:calc(100% - 80px); text-align: center;') + span.count {{LoPs}} + .input-group-append + button.btn.btn-success(type='button', disabled) + i.fas.fa-plus(aria-hidden='true') + p + h3.card-header + i.fas.fa-home(aria-hidden='true') + | {{'common.other' | translate}} + .card-body + .col-md-12(style='position: relative;') + strong {{'maze.judge.misidentification' | translate}} + br + .input-group.mb-3(style='width:100%;height:40px;') + .input-group-prepend + button.btn.btn-danger(type='button', disabled) + i.fas.fa-minus(aria-hidden='true') + div(style='background-color: #F2F2F2; width:calc(100% - 80px); text-align: center;') + span.count {{MisIdent}} + .input-group-append + button.btn.btn-success(type='button', disabled) + i.fas.fa-plus(aria-hidden='true') + br + .col-md-12(style='position: relative;') + strong {{'maze.judge.return' | translate}} + br + img.img-thumbnail(src='/images/maze_bonus.png', width='100px', height='100px', ng-style="{'background-color': exitBonus?'#2ecc71':'#D91E18'}") + div(style='position:absolute; top:30px; left:25px;') + i.fas.fa-check.fa-fw.fa-5x(ng-show='exitBonus && !exitBonusP', style='color:#27ae60; opacity:0.9;') + i.fas.fa-times.fa-fw.fa-5x(ng-show='!exitBonus && !exitBonusP', style='padding-top:4px; color:#e74c3c; opacity:0.9;') + .col-md-8.col-lg-9.tilearea(style='margin-top:-45px;') + .alert.alert-primary(style='margin-bottom:5px;text-align:center;', role='alert') + h2(style='text-align:center;') + | {{'common.stotal' | translate}} : {{allItemScore()}} {{'common.point' |translate}} + div(style='text-align:left;float:left;') + .btn-group + .input-group-prepend + span.input-group-text + i.fas.fa-arrows-alt-v(aria-hidden='true') + button.btn.btn-outline-dark(type='button', ng-click='changeFloor(zz)', ng-repeat='zz in range(height)', ng-class='{active: zz == z}')  {{zz}}  + div(style='text-align:right;float:right;') + .btn-group + button.btn.btn-outline-dark(type='button', ng-click='tileRot(-90)') + i.fas.fa-undo(aria-hidden='true') + button.btn.btn-outline-dark(type='button', ng-click='tileRot(90)') + i.fas.fa-redo(aria-hidden='true') + div(style='clear:both;')#mapTopLeft + #wrapTile(style='margin-top:5px;transform-origin: top left;') + h2(ng-show='!(length&&width)', style='text-align:center') {{'common.loading' | translate}} + table.map.mx-auto(ng-if='sRotate == 0')#mapTable + tbody + tr(ng-repeat='r in range(2*length + 1)') + td.cell(ng-repeat='c in range(2*width + 1)', ng-class="{'tile': $odd && $parent.$odd, 'wall': cells[c+','+r+','+z].isWall, 'checkpoint': cells[c+','+r+','+z].tile.checkpoint, 'black': cells[c+','+r+','+z].tile.black, 'blue': cells[c+','+r+','+z].tile.blue, 'linear': cells[c+','+r+','+z].isLinear}", ng-click='cellClick(c, r, z, $odd != $parent.$odd, $odd && $parent.$odd)', ng-style="wallColor(c,r,z,0)") + .tile-image-container(ng-show="cells[c+','+r+','+z].isTile") + img.tile-image(ng-src='/images/log.png', ng-show="cells[c+','+r+','+z].tile.speedbump") + img.tile-image(ng-src='/images/start.png', ng-show='startTile.x == c && startTile.y == r && startTile.z == z') + img.tile-image(ng-src='/images/ramp.png', ng-show="cells[c+','+r+','+z].tile.ramp") + img.tile-image(ng-src='/images/steps.png', ng-show="cells[c+','+r+','+z].tile.steps") + img.tile-image(ng-src='/images/h_top.png', ng-show="cells[c+','+r+','+z].tile.victims.top == 'H'") + img.tile-image(ng-src='/images/h_right.png', ng-show="cells[c+','+r+','+z].tile.victims.right == 'H'") + img.tile-image(ng-src='/images/h_bottom.png', ng-show="cells[c+','+r+','+z].tile.victims.bottom == 'H'") + img.tile-image(ng-src='/images/h_left.png', ng-show="cells[c+','+r+','+z].tile.victims.left == 'H'") + img.tile-image(ng-src='/images/s_top.png', ng-show="cells[c+','+r+','+z].tile.victims.top == 'S'") + img.tile-image(ng-src='/images/s_right.png', ng-show="cells[c+','+r+','+z].tile.victims.right == 'S'") + img.tile-image(ng-src='/images/s_bottom.png', ng-show="cells[c+','+r+','+z].tile.victims.bottom == 'S'") + img.tile-image(ng-src='/images/s_left.png', ng-show="cells[c+','+r+','+z].tile.victims.left == 'S'") + img.tile-image(ng-src='/images/u_top.png', ng-show="cells[c+','+r+','+z].tile.victims.top == 'U'") + img.tile-image(ng-src='/images/u_right.png', ng-show="cells[c+','+r+','+z].tile.victims.right == 'U'") + img.tile-image(ng-src='/images/u_bottom.png', ng-show="cells[c+','+r+','+z].tile.victims.bottom == 'U'") + img.tile-image(ng-src='/images/u_left.png', ng-show="cells[c+','+r+','+z].tile.victims.left == 'U'") + p.tile-point(ng-if='tileStatus(c,r,z,$odd && $parent.$odd)', style='color:#000; opacity:1;z-index:50;position: relative;text-align:center;') {{tilePoint(c,r,z,$odd && $parent.$odd)}} + img.tile-image(ng-src='/images/red_top.png', ng-show="cells[c+','+r+','+z].tile.victims.top == 'Red'") + img.tile-image(ng-src='/images/red_right.png', ng-show="cells[c+','+r+','+z].tile.victims.right == 'Red'") + img.tile-image(ng-src='/images/red_bottom.png', ng-show="cells[c+','+r+','+z].tile.victims.bottom == 'Red'") + img.tile-image(ng-src='/images/red_left.png', ng-show="cells[c+','+r+','+z].tile.victims.left == 'Red'") + img.tile-image(ng-src='/images/yellow_top.png', ng-show="cells[c+','+r+','+z].tile.victims.top == 'Yellow'") + img.tile-image(ng-src='/images/yellow_right.png', ng-show="cells[c+','+r+','+z].tile.victims.right == 'Yellow'") + img.tile-image(ng-src='/images/yellow_bottom.png', ng-show="cells[c+','+r+','+z].tile.victims.bottom == 'Yellow'") + img.tile-image(ng-src='/images/yellow_left.png', ng-show="cells[c+','+r+','+z].tile.victims.left == 'Yellow'") + img.tile-image(ng-src='/images/green_top.png', ng-show="cells[c+','+r+','+z].tile.victims.top == 'Green'") + img.tile-image(ng-src='/images/green_right.png', ng-show="cells[c+','+r+','+z].tile.victims.right == 'Green'") + img.tile-image(ng-src='/images/green_bottom.png', ng-show="cells[c+','+r+','+z].tile.victims.bottom == 'Green'") + img.tile-image(ng-src='/images/green_left.png', ng-show="cells[c+','+r+','+z].tile.victims.left == 'Green'") + img.tile-image(ng-src='/images/red_floor.png', ng-show="cells[c+','+r+','+z].tile.victims.floor == 'Red'") + img.tile-image(ng-src='/images/green_floor.png', ng-show="cells[c+','+r+','+z].tile.victims.floor == 'Green'") + i.fas.fa-check.fa-fw.tile-image.tile-font(ng-show="tileStatus(c,r,z,$odd && $parent.$odd) == 'done'", style='padding-top:4px; color:#27ae60; opacity:0.9;') + i.fas.fa-play.fa-fw.fa-rotate-270.tile-image.tile-font(ng-show="tileStatus(c,r,z,$odd && $parent.$odd) == 'halfdone'", style='padding-top:4px; color:#f4d03f; opacity:0.9;') + i.fas.fa-times.fa-fw.tile-image.tile-font(ng-show="tileStatus(c,r,z,$odd && $parent.$odd) == 'undone'", style='padding-top:6px; color:#e74c3c; opacity:0.9;') + table.map.mx-auto(ng-if='sRotate == 90')#mapTable + tbody + tr(ng-repeat='r in range(2*width + 1)') + td.cell(ng-repeat='c in range(2*length + 1)', ng-class="{'tile': $odd && $parent.$odd, 'wall': cells[r+','+(2*length - c)+','+z].isWall, 'checkpoint': cells[r+','+(2*length - c)+','+z].tile.checkpoint, 'black': cells[r+','+(2*length - c)+','+z].tile.black, 'blue': cells[r+','+(2*length - c)+','+z].tile.blue, 'linear': cells[r+','+(2*length - c)+','+z].isLinear}", ng-click='cellClick(r, (2*length - c), z, $odd != $parent.$odd, $odd && $parent.$odd)', ng-style="wallColor(r,2*length - c,z,90)") + .tile-image-container(ng-show="cells[r+','+(2*length - c)+','+z].isTile") + img.tile-image(ng-src='/images/log.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.speedbump") + img.tile-image(ng-src='/images/start.png', ng-show='startTile.x == r && startTile.y == (2*length - c) && startTile.z == z') + img.tile-image(ng-src='/images/ramp.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.ramp") + img.tile-image(ng-src='/images/steps.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.steps") + img.tile-image(ng-src='/images/h_right.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.top == 'H'") + img.tile-image(ng-src='/images/h_bottom.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.right == 'H'") + img.tile-image(ng-src='/images/h_left.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.bottom == 'H'") + img.tile-image(ng-src='/images/h_top.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.left == 'H'") + img.tile-image(ng-src='/images/s_right.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.top == 'S'") + img.tile-image(ng-src='/images/s_bottom.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.right == 'S'") + img.tile-image(ng-src='/images/s_left.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.bottom == 'S'") + img.tile-image(ng-src='/images/s_top.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.left == 'S'") + img.tile-image(ng-src='/images/u_right.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.top == 'U'") + img.tile-image(ng-src='/images/u_bottom.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.right == 'U'") + img.tile-image(ng-src='/images/u_left.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.bottom == 'U'") + img.tile-image(ng-src='/images/u_top.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.left == 'U'") + p.tile-point(ng-if='tileStatus(r,(2*length - c),z,$odd && $parent.$odd)', style='color:#000; opacity:1;z-index:50;position: relative;text-align:center;') {{tilePoint(r,(2*length - c),z,$odd && $parent.$odd)}} + img.tile-image(ng-src='/images/red_right.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.top == 'Red'") + img.tile-image(ng-src='/images/red_bottom.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.right == 'Red'") + img.tile-image(ng-src='/images/red_left.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.bottom == 'Red'") + img.tile-image(ng-src='/images/red_top.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.left == 'Red'") + img.tile-image(ng-src='/images/yellow_right.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.top == 'Yellow'") + img.tile-image(ng-src='/images/yellow_bottom.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.right == 'Yellow'") + img.tile-image(ng-src='/images/yellow_left.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.bottom == 'Yellow'") + img.tile-image(ng-src='/images/yellow_top.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.left == 'Yellow'") + img.tile-image(ng-src='/images/green_right.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.top == 'Green'") + img.tile-image(ng-src='/images/green_bottom.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.right == 'Green'") + img.tile-image(ng-src='/images/green_left.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.bottom == 'Green'") + img.tile-image(ng-src='/images/green_top.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.left == 'Green'") + img.tile-image(ng-src='/images/red_floor.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.floor == 'Red'") + img.tile-image(ng-src='/images/green_floor.png', ng-show="cells[r+','+(2*length - c)+','+z].tile.victims.floor == 'Green'") + i.fas.fa-check.fa-fw.tile-image.tile-font(ng-show="tileStatus(r,(2*length - c),z,$odd && $parent.$odd) == 'done'", style='padding-top:4px; color:#27ae60; opacity:0.9;') + i.fas.fa-play.fa-fw.fa-rotate-270.tile-image.tile-font(ng-show="tileStatus(r,(2*length - c),z,$odd && $parent.$odd) == 'halfdone'", style='padding-top:4px; color:#f4d03f; opacity:0.9;') + i.fas.fa-times.fa-fw.tile-image.tile-font(ng-show="tileStatus(r,(2*length - c),z,$odd && $parent.$odd) == 'undone'", style='padding-top:6px; color:#e74c3c; opacity:0.9;') + table.map.mx-auto(ng-if='sRotate == 180')#mapTable + tbody + tr(ng-repeat='r in range(2*length + 1)') + td.cell(ng-repeat='c in range(2*width + 1)', ng-class="{'tile': $odd && $parent.$odd, 'wall': cells[2*width - c+','+(2*length - r)+','+z].isWall, 'checkpoint': cells[2*width - c+','+(2*length - r)+','+z].tile.checkpoint, 'black': cells[2*width - c+','+(2*length - r)+','+z].tile.black, 'blue': cells[2*width - c+','+(2*length - r)+','+z].tile.blue, 'linear': cells[2*width - c+','+(2*length - r)+','+z].isLinear}", ng-click='cellClick(2*width - c, 2*length - r, z, $odd != $parent.$odd, $odd && $parent.$odd)', ng-style="wallColor(2*width - c, 2*length - r, z,180)") + .tile-image-container(ng-show="cells[2*width - c+','+(2*length - r)+','+z].isTile") + img.tile-image(ng-src='/images/log.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.speedbump") + img.tile-image(ng-src='/images/start.png', ng-show='startTile.x == 2*width - c && startTile.y == 2*length - r && startTile.z == z') + img.tile-image(ng-src='/images/ramp.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.ramp") + img.tile-image(ng-src='/images/steps.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.steps") + img.tile-image(ng-src='/images/h_bottom.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.top == 'H'") + img.tile-image(ng-src='/images/h_left.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.right == 'H'") + img.tile-image(ng-src='/images/h_top.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.bottom == 'H'") + img.tile-image(ng-src='/images/h_right.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.left == 'H'") + img.tile-image(ng-src='/images/s_bottom.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.top == 'S'") + img.tile-image(ng-src='/images/s_left.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.right == 'S'") + img.tile-image(ng-src='/images/s_top.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.bottom == 'S'") + img.tile-image(ng-src='/images/s_right.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.left == 'S'") + img.tile-image(ng-src='/images/u_bottom.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.top == 'U'") + img.tile-image(ng-src='/images/u_left.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.right == 'U'") + img.tile-image(ng-src='/images/u_top.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.bottom == 'U'") + img.tile-image(ng-src='/images/u_right.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.left == 'U'") + p.tile-point(ng-if='tileStatus(2*width - c,2*length - r,z,$odd && $parent.$odd)', style='color:#000; opacity:1;z-index:50;position: relative;text-align:center;') {{tilePoint(2*width - c,2*length - r,z,$odd && $parent.$odd)}} + img.tile-image(ng-src='/images/red_bottom.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.top == 'Red'") + img.tile-image(ng-src='/images/red_left.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.right == 'Red'") + img.tile-image(ng-src='/images/red_top.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.bottom == 'Red'") + img.tile-image(ng-src='/images/red_right.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.left == 'Red'") + img.tile-image(ng-src='/images/yellow_bottom.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.top == 'Yellow'") + img.tile-image(ng-src='/images/yellow_left.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.right == 'Yellow'") + img.tile-image(ng-src='/images/yellow_top.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.bottom == 'Yellow'") + img.tile-image(ng-src='/images/yellow_right.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.left == 'Yellow'") + img.tile-image(ng-src='/images/green_bottom.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.top == 'Green'") + img.tile-image(ng-src='/images/green_left.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.right == 'Green'") + img.tile-image(ng-src='/images/green_top.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.bottom == 'Green'") + img.tile-image(ng-src='/images/green_right.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.left == 'Green'") + img.tile-image(ng-src='/images/red_floor.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.floor == 'Red'") + img.tile-image(ng-src='/images/green_floor.png', ng-show="cells[2*width - c+','+(2*length - r)+','+z].tile.victims.floor == 'Green'") + i.fas.fa-check.fa-fw.tile-image.tile-font(ng-show="tileStatus(2*width - c,2*length - r,z,$odd && $parent.$odd) == 'done'", style='padding-top:4px; color:#27ae60; opacity:0.9;') + i.fas.fa-play.fa-fw.fa-rotate-270.tile-image.tile-font(ng-show="tileStatus(2*width - c,2*length - r,z,$odd && $parent.$odd) == 'halfdone'", style='padding-top:4px; color:#f4d03f; opacity:0.9;') + i.fas.fa-times.fa-fw.tile-image.tile-font(ng-show="tileStatus(2*width - c,2*length - r,z,$odd && $parent.$odd) == 'undone'", style='padding-top:6px; color:#e74c3c; opacity:0.9;') + table.map.mx-auto(ng-if='sRotate == 270')#mapTable + tbody + tr(ng-repeat='r in range(2*width + 1)') + td.cell(ng-repeat='c in range(2*length + 1)', ng-class="{'tile': $odd && $parent.$odd, 'wall': cells[2*width - r+','+c+','+z].isWall, 'checkpoint': cells[2*width - r+','+c+','+z].tile.checkpoint, 'black': cells[2*width - r+','+c+','+z].tile.black, 'blue': cells[2*width - r+','+c+','+z].tile.blue, 'linear': cells[2*width - r+','+c+','+z].isLinear}", ng-click='cellClick(2*width - r, c, z, $odd != $parent.$odd, $odd && $parent.$odd)', ng-style="wallColor(2*width - r, c, z,270)") + .tile-image-container(ng-show="cells[2*width - r+','+c+','+z].isTile") + img.tile-image(ng-src='/images/log.png', ng-show="cells[2*width - r+','+c+','+z].tile.speedbump") + img.tile-image(ng-src='/images/start.png', ng-show='startTile.x == 2*width - r && startTile.y == c && startTile.z == z') + img.tile-image(ng-src='/images/ramp.png', ng-show="cells[2*width - r+','+c+','+z].tile.ramp") + img.tile-image(ng-src='/images/steps.png', ng-show="cells[2*width - r+','+c+','+z].tile.steps") + img.tile-image(ng-src='/images/h_left.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.top == 'H'") + img.tile-image(ng-src='/images/h_top.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.right == 'H'") + img.tile-image(ng-src='/images/h_right.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.bottom == 'H'") + img.tile-image(ng-src='/images/h_bottom.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.left == 'H'") + img.tile-image(ng-src='/images/s_left.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.top == 'S'") + img.tile-image(ng-src='/images/s_top.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.right == 'S'") + img.tile-image(ng-src='/images/s_right.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.bottom == 'S'") + img.tile-image(ng-src='/images/s_bottom.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.left == 'S'") + img.tile-image(ng-src='/images/u_left.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.top == 'U'") + img.tile-image(ng-src='/images/u_top.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.right == 'U'") + img.tile-image(ng-src='/images/u_right.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.bottom == 'U'") + img.tile-image(ng-src='/images/u_bottom.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.left == 'U'") + p.tile-point(ng-if='tileStatus(2*width - r,c,z,$odd && $parent.$odd)', style='color:#000; opacity:1;z-index:50;position: relative;text-align:center;') {{tilePoint(2*width - r,c,z,$odd && $parent.$odd)}} + img.tile-image(ng-src='/images/red_left.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.top == 'Red'") + img.tile-image(ng-src='/images/red_top.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.right == 'Red'") + img.tile-image(ng-src='/images/red_right.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.bottom == 'Red'") + img.tile-image(ng-src='/images/red_bottom.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.left == 'Red'") + img.tile-image(ng-src='/images/yellow_left.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.top == 'Yellow'") + img.tile-image(ng-src='/images/yellow_top.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.right == 'Yellow'") + img.tile-image(ng-src='/images/yellow_right.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.bottom == 'Yellow'") + img.tile-image(ng-src='/images/yellow_bottom.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.left == 'Yellow'") + img.tile-image(ng-src='/images/green_left.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.top == 'Green'") + img.tile-image(ng-src='/images/green_top.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.right == 'Green'") + img.tile-image(ng-src='/images/green_right.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.bottom == 'Green'") + img.tile-image(ng-src='/images/green_bottom.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.left == 'Green'") + img.tile-image(ng-src='/images/red_floor.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.floor == 'Red'") + img.tile-image(ng-src='/images/green_floor.png', ng-show="cells[2*width - r+','+c+','+z].tile.victims.floor == 'Green'") + i.fas.fa-check.fa-fw.tile-image.tile-font(ng-show="tileStatus(2*width - r,c,z,$odd && $parent.$odd) == 'done'", style='padding-top:4px; color:#27ae60; opacity:0.9;') + i.fas.fa-play.fa-fw.fa-rotate-270.tile-image.tile-font(ng-show="tileStatus(2*width - r,c,z,$odd && $parent.$odd) == 'halfdone'", style='padding-top:4px; color:#f4d03f; opacity:0.9;') + i.fas.fa-times.fa-fw.tile-image.tile-font(ng-show="tileStatus(2*width - r,c,z,$odd && $parent.$odd) == 'undone'", style='padding-top:6px; color:#e74c3c; opacity:0.9;') +hr +h2 {{'maze.sign.reliability' | translate}} +.alert.alert-info(style='margin-bottom:30px;text-align:center;', role='alert', ng-if="leagueType=='standard'") + .row + .col-md-2 + p(style='text-align:center;height:40px;') {{'maze.sign.rescue' | translate}} + i.fas.fa-child.fa-2x(aria-hidden='true') + | : {{foundVictims}} + br + br + | {{foundVictims * 10}} {{'common.point' | translate}} + .col-md-1 + h1(style='line-height:140px;text-align:center;') + + .col-md-2 + p(style='text-align:center;height:40px;') {{'maze.sign.kits' | translate}} + i.fas.fa-medkit.fa-2x(aria-hidden='true') + | : {{distKits}} + br + br + | {{distKits * 10}} {{'common.point' | translate}} + .col-md-1 + h1(style='line-height:140px;text-align:center;') - + .col-md-2 + p(style='text-align:center;height:40px;') {{'maze.sign.total_lops' | translate}} + i.fas.fa-step-forward.fa-2x(aria-hidden='true') + | : {{LoPs}} + br + br + | {{reliabilityLoPs()}} {{'common.point' | translate}} + .col-md-1 + h1(style='line-height:140px;text-align:center;') = + .col-md-3 + h1(style='line-height:140px;text-align:center;') {{reliability()}} {{'common.point' | translate}} +.alert.alert-info(style='margin-bottom:30px;text-align:center;', role='alert', ng-if="leagueType=='entry'") + .row + .col-md-3 + p(style='text-align:center;height:40px;') {{'maze.sign.rescue' | translate}} + i.fas.fa-child.fa-2x(aria-hidden='true') + | : {{foundVictims}} + br + br + | {{foundVictims * 10}} {{'common.point' | translate}} + .col-md-1 + h1(style='line-height:140px;text-align:center;') - + .col-md-3 + p(style='text-align:center;height:40px;') {{'maze.sign.total_lops' | translate}} + i.fas.fa-step-forward.fa-2x(aria-hidden='true') + | : {{LoPs}} + br + br + | {{reliabilityLoPs()}} {{'common.point' | translate}} + .col-md-1 + h1(style='line-height:140px;text-align:center;') = + .col-md-3 + h1(style='line-height:140px;text-align:center;') {{reliability()}} {{'common.point' | translate}} +h2 {{'maze.sign.calc' | translate}} +.alert.alert-warning(style='margin-bottom:80px;text-align:center;', role='alert') + .row + .col-md-2 + p(style='height:30px;') {{'maze.sign.item' | translate}} + h1 + | {{allItemScore()}} {{'common.point' | translate}} + .col-md-1 + p(style='height:30px;') + h1 + + .col-md-2 + p(style='height:30px;') {{'maze.sign.reliability' | translate}} + h1 {{reliability()}} {{'common.point' | translate}} + .col-md-1 + p(style='height:30px;') + h1 + + .col-md-2 + p(style='text-align:center;height:30px;') {{'maze.sign.return' | translate}} + h1 {{foundVictims * 10 * exitBonus}} {{'common.point' | translate}} + .col-md-1 + p(style='height:30px;') + h1 - + .col-md-3 + p(style='height:30px;') {{'maze.sign.misidentification' | translate}} + h1 {{MisIdent*5}} {{'common.point' | translate}} \ No newline at end of file diff --git a/views/view/maze_2024E.pug b/views/view/maze_2024E.pug index 8033943d..0384506a 100755 --- a/views/view/maze_2024E.pug +++ b/views/view/maze_2024E.pug @@ -6,7 +6,7 @@ html(ng-app="ddApp") var iframe = "#{iframe}" include ../includes/common_component - script(src="/javascripts/sign/maze_2024.js") + script(src="/javascripts/sign/maze_2024E.js") script(src="/javascripts/translate_config.js") link(href="/stylesheets/fredrik.css" rel="stylesheet") @@ -76,7 +76,7 @@ html(ng-app="ddApp") br br br - include common/maze_2024 + include common/maze_2024E .alert.alert-success(style='margin:50 0 30 0;', role='alert') .row .col-md-6 diff --git a/views/view_iframe/maze_2024E.pug b/views/view_iframe/maze_2024E.pug index 5caae3f9..57968d52 100755 --- a/views/view_iframe/maze_2024E.pug +++ b/views/view_iframe/maze_2024E.pug @@ -5,7 +5,7 @@ html(ng-app="ddApp") var runId = "#{id}" include ../includes/common_component - script(src="/javascripts/sign/maze_2024.js") + script(src="/javascripts/sign/maze_2024E.js") script. document.cookie = 'sRotate=0'; function tile_size() {