From ff80faaf7d3ebddbae99fd27e3d76daa7a6c8879 Mon Sep 17 00:00:00 2001 From: Suvodip Date: Fri, 18 Oct 2024 16:59:03 +0530 Subject: [PATCH] game name from get parameter --- public/assets/svg/cancel.svg | 2 +- public/assets/svg/help_icon.svg | 4 + public/saveGameAI.js | 37 ++--- public/saveGameData.js | 37 ++--- src/pages/drag/v4.astro | 2 +- src/pages/drawing/index.astro | 2 +- src/pages/guided-tracing/0.astro | 252 ++++++++++++++++--------------- 7 files changed, 175 insertions(+), 161 deletions(-) create mode 100644 public/assets/svg/help_icon.svg diff --git a/public/assets/svg/cancel.svg b/public/assets/svg/cancel.svg index 45697ea..1dc0730 100644 --- a/public/assets/svg/cancel.svg +++ b/public/assets/svg/cancel.svg @@ -1,4 +1,4 @@ - + diff --git a/public/assets/svg/help_icon.svg b/public/assets/svg/help_icon.svg new file mode 100644 index 0000000..2e29ed8 --- /dev/null +++ b/public/assets/svg/help_icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/saveGameAI.js b/public/saveGameAI.js index af9c279..da2a630 100644 --- a/public/saveGameAI.js +++ b/public/saveGameAI.js @@ -5,6 +5,7 @@ const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const userId = urlParams.get('userId'); + const gameVersion = urlParams.get('gameName'); let gameId; let submitNotic; @@ -15,25 +16,25 @@ const url = window.location.href; const gameName = url.split('/'); const gameType = gameName[3].split('?id='); - let gameVersion; - if(gameType[0] == "guided-tracing"){ - gameVersion = gameType[0].split('?')[0]; - gameId = gameName[4]; - console.log('Type - 1'); + // let gameVersion; + // if(gameType[0] == "guided-tracing"){ + // gameVersion = gameType[0].split('?')[0]; + // gameId = gameName[4]; + // console.log('Type - 1'); - } else if(gameName.length == 4){ - gameVersion = gameName[3].split('?')[0]; - gameId = urlParams.get('id'); - } - else if(gameName.length == 5){ - gameVersion = gameName[3] + '-' + gameName[4].split('?')[0]; - gameId = urlParams.get('id'); - console.log('Type - 2'); - }else if(gameName.length == 6){ - gameVersion = gameType[0] + '-' + gameName[4]; - gameId = urlParams.get('id'); - console.log('Type - 3'); - } + // } else if(gameName.length == 4){ + // gameVersion = gameName[3].split('?')[0]; + // gameId = urlParams.get('id'); + // } + // else if(gameName.length == 5){ + // gameVersion = gameName[3] + '-' + gameName[4].split('?')[0]; + // gameId = urlParams.get('id'); + // console.log('Type - 2'); + // }else if(gameName.length == 6){ + // gameVersion = gameType[0] + '-' + gameName[4]; + // gameId = urlParams.get('id'); + // console.log('Type - 3'); + // } // console.log("Here is game name ", gameType[0]) // console.log(gameVersion) diff --git a/public/saveGameData.js b/public/saveGameData.js index f01c837..d01bea7 100644 --- a/public/saveGameData.js +++ b/public/saveGameData.js @@ -5,6 +5,7 @@ function retryGame(){ const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const userId = urlParams.get('userId'); +const gameVersion = urlParams.get('gameName'); let gameId; let submitNotic; @@ -15,28 +16,28 @@ let startTime = Date.now(); const url = window.location.href; const gameName = url.split('/'); const gameType = gameName[3].split('?id='); -let gameVersion; +// let gameVersion; // console.log("Here is game name ", gameType[0]) -if(gameType[0] == "guided-tracing"){ - gameVersion = gameType[0].split('?')[0]; - gameId = gameName[4]; - console.log('Type - 1'); +// if(gameType[0] == "guided-tracing"){ +// gameVersion = gameType[0].split('?')[0]; +// gameId = gameName[4]; +// console.log('Type - 1'); -} else if(gameName.length == 4){ - gameVersion = gameName[3].split('?')[0]; - gameId = urlParams.get('id'); -} -else if(gameName.length == 5){ - gameVersion = gameName[3] + '-' + gameName[4].split('?')[0]; - gameId = urlParams.get('id'); - console.log('Type - 2'); -}else if(gameName.length == 6){ - gameVersion = gameType[0] + '-' + gameName[4]; - gameId = urlParams.get('id'); - console.log('Type - 3'); -} +// } else if(gameName.length == 4){ +// gameVersion = gameName[3].split('?')[0]; +// gameId = urlParams.get('id'); +// } +// else if(gameName.length == 5){ +// gameVersion = gameName[3] + '-' + gameName[4].split('?')[0]; +// gameId = urlParams.get('id'); +// console.log('Type - 2'); +// }else if(gameName.length == 6){ +// gameVersion = gameType[0] + '-' + gameName[4]; +// gameId = urlParams.get('id'); +// console.log('Type - 3'); +// } console.log(gameVersion) diff --git a/src/pages/drag/v4.astro b/src/pages/drag/v4.astro index 7419de5..4df130c 100644 --- a/src/pages/drag/v4.astro +++ b/src/pages/drag/v4.astro @@ -573,7 +573,7 @@ import Layout from '../../layouts/Layout.astro'; // console.log(match) if(match !== undefined){ scoreTotal++; - // console.log("Score Total", scoreTotal) + console.log("Score Total", scoreTotal) } if(counter === 8){ // console.log(counter) diff --git a/src/pages/drawing/index.astro b/src/pages/drawing/index.astro index bfea7ed..e5127dd 100644 --- a/src/pages/drawing/index.astro +++ b/src/pages/drawing/index.astro @@ -254,8 +254,8 @@ import Layout from '../../layouts/Layout.astro'; this.load.image("muteIcon", '/assets/svg/mute.svg'); this.load.image("cancelIcon", '/assets/svg/cancel.svg'); this.load.image("resetIcon", '/assets/svg/reset.svg'); - this.load.svg('buttonIcons', '/assets/svg/button-icon.svg'); this.load.svg('galleryIcons', '/assets/svg/gallery-icon.svg'); + this.load.svg('buttonIcons', '/assets/svg/button-icon.svg'); this.load.svg('cursorImage', '/assets/svg/pencil.svg'); this.load.image('colorButton', '/assets/color_button.png'); } diff --git a/src/pages/guided-tracing/0.astro b/src/pages/guided-tracing/0.astro index dba59f5..da99dc2 100644 --- a/src/pages/guided-tracing/0.astro +++ b/src/pages/guided-tracing/0.astro @@ -9,8 +9,10 @@ import Layout from "../../layouts/Layout.astro"; -