worked on drag games score calculations
This commit is contained in:
@@ -75,6 +75,7 @@ import Layout from '../../layouts/Layout.astro';
|
||||
let submitButton;
|
||||
let formattedDateTime;
|
||||
let shortUniqueID;
|
||||
let blockMatches;
|
||||
gameResult = [];
|
||||
window.onload = function() {
|
||||
// Get the current date and time
|
||||
@@ -123,24 +124,6 @@ import Layout from '../../layouts/Layout.astro';
|
||||
block: null,
|
||||
},
|
||||
];
|
||||
const blockMatches = [
|
||||
{
|
||||
blockName: "blocks1",
|
||||
targetName: "target1",
|
||||
},
|
||||
{
|
||||
blockName: "blocks2",
|
||||
targetName: "target2",
|
||||
},
|
||||
{
|
||||
blockName: "blocks3",
|
||||
targetName: "target3",
|
||||
},
|
||||
{
|
||||
blockName: "blocks4",
|
||||
targetName: "target4",
|
||||
},
|
||||
];
|
||||
// console.log(blockMatches.blockName, blockMatches.targetName)
|
||||
var assetsList = {}
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
@@ -293,7 +276,25 @@ import Layout from '../../layouts/Layout.astro';
|
||||
fetch(`https://game-du.teachertrainingkolkata.in/items/game_drag_v2/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
|
||||
.then(response => response.json())
|
||||
.then(({ data }) => {
|
||||
// console.log(data)
|
||||
// console.log(data) right_match
|
||||
blockMatches = [
|
||||
{
|
||||
blockName: "blocks1",
|
||||
targetName: `target${data.right_match1}`,
|
||||
},
|
||||
{
|
||||
blockName: "blocks2",
|
||||
targetName: `target${data.right_match2}`,
|
||||
},
|
||||
{
|
||||
blockName: "blocks3",
|
||||
targetName: `target${data.right_match3}`,
|
||||
},
|
||||
{
|
||||
blockName: "blocks4",
|
||||
targetName: `target${data.right_match4}`,
|
||||
},
|
||||
];
|
||||
const screenCenterX = this.cameras.main.worldView.x + this.cameras.main.width / 2;
|
||||
// Base font size for your text
|
||||
const baseFontSize = 30;
|
||||
@@ -572,6 +573,7 @@ import Layout from '../../layouts/Layout.astro';
|
||||
}
|
||||
}
|
||||
const match = blockMatches.find((m) => m.blockName === blockName && m.targetName === targetName);
|
||||
console.log(match)
|
||||
let scoreTotal=0;
|
||||
if(match){
|
||||
scoreTotal++;
|
||||
|
||||
Reference in New Issue
Block a user