diff --git a/info.txt b/info.txt new file mode 100644 index 0000000..1d7ca1a --- /dev/null +++ b/info.txt @@ -0,0 +1 @@ +1. Auto brake line Drag v4 Left & Right Heading. \ No newline at end of file diff --git a/public/assets/color_button.png b/public/assets/color_button.png new file mode 100644 index 0000000..6d11e5c Binary files /dev/null and b/public/assets/color_button.png differ diff --git a/public/saveGameData.js b/public/saveGameData.js index 99d83a4..7249ffa 100644 --- a/public/saveGameData.js +++ b/public/saveGameData.js @@ -1,17 +1,30 @@ const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); -const userId = urlParams.get('userid'); -const gameId = urlParams.get('id'); +const userId = urlParams.get('userId'); +let gameId; +let submitNotic; +console.log(userId); let startTime = Date.now(); const url = window.location.href; const gameName = url.split('/'); const gameType = gameName[3].split('?id='); -const gameVersion = gameType[0] + '-' + gameName[4]; +let gameVersion; +if(gameType[0] == "guided-tracing"){ + gameVersion = gameType[0].split('?')[0]; + gameId = gameName[4]; +} else if(gameName.length == 5){ + gameVersion = gameName[3]; + gameId = urlParams.get('id'); +}else if(gameName.length == 6){ + gameVersion = gameType[0] + '-' + gameName[4]; + gameId = urlParams.get('id'); +} + function submitUserData(drawingZone) { @@ -22,7 +35,7 @@ function submitUserData(drawingZone) { let imageCode; let gameScore; - let scoreTotal=0; + if(scoreTotal){ gameScore = scoreTotal; }else{ @@ -39,10 +52,25 @@ function submitUserData(drawingZone) { image.style.paddingLeft = '2px'; document.body.appendChild(image); // Download the snapshot as an image - const link = document.createElement('a'); - link.href = image.src; - link.download = 'my_drawing.png'; - link.click(); + // const link = document.createElement('a'); + // link.href = image.src; + // link.download = 'my_drawing.png'; + // link.click(); + document.body.removeChild(image); + imageCode = image.src; + }else if( gameType[0] == "guided-tracing"){ + // submitButton.setVisible(true); + // snapshotButton.setVisible(true); + // customCursor.setVisible(true); + image.style.width = '160px'; + image.style.height = '120px'; + image.style.paddingLeft = '2px'; + document.body.appendChild(image); + // Download the snapshot as an image + // const link = document.createElement('a'); + // link.href = image.src; + // link.download = `guided-tracing-${gameId}.png`; + // link.click(); document.body.removeChild(image); imageCode = image.src; } @@ -61,7 +89,7 @@ function submitUserData(drawingZone) { }; console.log(userData); - fetch(`http://192.168.0.166:3000/save-data`, { + fetch(`https://phaser-game-api.s38.siliconpin.com/save-data`, { method: 'POST', headers: { 'Content-Type' : 'application/json' @@ -70,9 +98,12 @@ function submitUserData(drawingZone) { }) .then(response => { if(response.ok){ - console.log('Data Saved', response) + console.log('Data Saved', response.status) + if(response.status == 200){ + submitNotic.setVisible(true); + } } else{ - // console.log('Something Wrong', response) + // console.log('Something Wrong', response) } }) .catch(error => { diff --git a/src/pages/cross/cross_phonics_v1.astro b/src/pages/cross/cross_phonics_v1.astro index 482b675..3fcfd84 100644 --- a/src/pages/cross/cross_phonics_v1.astro +++ b/src/pages/cross/cross_phonics_v1.astro @@ -10,7 +10,7 @@ import Layout from "../../layouts/Layout.astro";
-
+
@@ -24,51 +24,51 @@ import Layout from "../../layouts/Layout.astro";

--> -

+

-
-
-
-

+

@@ -79,10 +79,12 @@ import Layout from "../../layouts/Layout.astro"; + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -