fix darg and drop V3 and some changes in Tick V1 &V2
This commit is contained in:
@@ -79,16 +79,7 @@ import Layout from '../../layouts/Layout.astro';
|
||||
let submitButton;
|
||||
let formattedDateTime;
|
||||
let shortUniqueID;
|
||||
let imageElement1;
|
||||
let imageElement2;
|
||||
let imageElement3;
|
||||
let imageElement4;
|
||||
let imageElement5;
|
||||
let imageElement6;
|
||||
let imageElement7;
|
||||
let imageElement8;
|
||||
// let allElement = [element1, element2, element3, element4, element5, element6, element7, element8];
|
||||
// allElement.setVisible(false)
|
||||
let retryButton;
|
||||
gameResult = [];
|
||||
window.onload = function() {
|
||||
// Get the current date and time
|
||||
@@ -203,24 +194,24 @@ import Layout from '../../layouts/Layout.astro';
|
||||
var assetsList = {};
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
const data = fetch(`https://management.beanstalkedu.com/items/game_drag/${encodeURIComponent(paramsID)}`)
|
||||
const data = fetch(`https://game-du.teachertrainingkolkata.in/items/game_drag_v3/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
|
||||
.then(response => response.json())
|
||||
.then(({data}) => {
|
||||
const {left_image1, left_image2, left_image3, left_image4, right_image1, right_image2, right_image3, right_image4} = data;
|
||||
const {image1, image2, image3, image4, image5, image6, image7, image8} = data;
|
||||
if(isMobile){
|
||||
imageCustomWidth = "?width=100";
|
||||
} else{
|
||||
imageCustomWidth = "?width=100";
|
||||
}
|
||||
const assetsURL = "https://management.beanstalkedu.com/assets/"
|
||||
assetsList.element1 = assetsURL + left_image1 + imageCustomWidth;
|
||||
assetsList.element2 = assetsURL + left_image2 + imageCustomWidth;
|
||||
assetsList.element3 = assetsURL + left_image3 + imageCustomWidth;
|
||||
assetsList.element4 = assetsURL + left_image4 + imageCustomWidth;
|
||||
assetsList.element5 = assetsURL + right_image1 + imageCustomWidth;
|
||||
assetsList.element6 = assetsURL + right_image2 + imageCustomWidth;
|
||||
assetsList.element7 = assetsURL + right_image3 + imageCustomWidth;
|
||||
assetsList.element8 = assetsURL + right_image4 + imageCustomWidth;
|
||||
const assetsURL = "https://game-du.teachertrainingkolkata.in/assets/"
|
||||
assetsList.element1 = assetsURL + image1 + imageCustomWidth;
|
||||
assetsList.element2 = assetsURL + image2 + imageCustomWidth;
|
||||
assetsList.element3 = assetsURL + image3 + imageCustomWidth;
|
||||
assetsList.element4 = assetsURL + image4 + imageCustomWidth;
|
||||
assetsList.element5 = assetsURL + image5 + imageCustomWidth;
|
||||
assetsList.element6 = assetsURL + image6 + imageCustomWidth;
|
||||
assetsList.element7 = assetsURL + image7 + imageCustomWidth;
|
||||
assetsList.element8 = assetsURL + image8 + imageCustomWidth;
|
||||
// console.log(assetsList.left_image1)
|
||||
const config = {
|
||||
type: Phaser.AUTO,
|
||||
@@ -350,7 +341,7 @@ import Layout from '../../layouts/Layout.astro';
|
||||
create() {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
fetch(`https://management.beanstalkedu.com/items/game_drag/${encodeURIComponent(paramsID)}`)
|
||||
fetch(`https://game-du.teachertrainingkolkata.in/items/game_drag_v3/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
|
||||
.then(response => response.json())
|
||||
.then(({ data }) => {
|
||||
// console.log(data)
|
||||
@@ -366,16 +357,16 @@ import Layout from '../../layouts/Layout.astro';
|
||||
// this.add.text(displayW / 14 - 15, 50, data.LearningArea, {font: `20px`}).setTint(0x7c4c23);
|
||||
// this.add.text(displayW / 14 - 15, 70, data.LearningSubArea_copy, {font: `19px`}).setTint(0x7c4c23);
|
||||
// Left Image Name
|
||||
this.add.text(leftTargetZoneW - 45, 240, data.left_image1_name).setTint(0x7c4c23);
|
||||
this.add.text(leftTargetZoneW - 45, 409, data.left_image2_name).setTint(0x7c4c23);
|
||||
this.add.text(leftTargetZoneW - 45, 579, data.left_image3_name).setTint(0x7c4c23);
|
||||
this.add.text(leftTargetZoneW - 45, 750, data.left_image4_name).setTint(0x7c4c23);
|
||||
// this.add.text(leftTargetZoneW - 45, 240, data.left_image1_name).setTint(0x7c4c23);
|
||||
// this.add.text(leftTargetZoneW - 45, 409, data.left_image2_name).setTint(0x7c4c23);
|
||||
// this.add.text(leftTargetZoneW - 45, 579, data.left_image3_name).setTint(0x7c4c23);
|
||||
// this.add.text(leftTargetZoneW - 45, 750, data.left_image4_name).setTint(0x7c4c23);
|
||||
|
||||
//Right Image Name leftTargetZoneW rightTargetZoneW
|
||||
this.add.text(rightTargetZoneW - 44, 240, data.right_image1_name).setTint(0x7c4c23);
|
||||
this.add.text(rightTargetZoneW - 44, 409, data.right_image2_name).setTint(0x7c4c23);
|
||||
this.add.text(rightTargetZoneW - 44, 579, data.right_image3_name).setTint(0x7c4c23);
|
||||
this.add.text(rightTargetZoneW - 44, 750, data.right_image4_name).setTint(0x7c4c23);
|
||||
// //Right Image Name leftTargetZoneW rightTargetZoneW
|
||||
// this.add.text(rightTargetZoneW - 44, 240, data.right_image1_name).setTint(0x7c4c23);
|
||||
// this.add.text(rightTargetZoneW - 44, 409, data.right_image2_name).setTint(0x7c4c23);
|
||||
// this.add.text(rightTargetZoneW - 44, 579, data.right_image3_name).setTint(0x7c4c23);
|
||||
// this.add.text(rightTargetZoneW - 44, 750, data.right_image4_name).setTint(0x7c4c23);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching initial data:', error);
|
||||
@@ -449,43 +440,43 @@ import Layout from '../../layouts/Layout.astro';
|
||||
id: "block1",
|
||||
},
|
||||
{
|
||||
x: displayW / 2,
|
||||
x: displayW / 2-100,
|
||||
y: window.innerHeight - 120,
|
||||
textureKey: "blocks2",
|
||||
id: "block2",
|
||||
},
|
||||
{
|
||||
x: displayW / 2,
|
||||
x: displayW / 2+100,
|
||||
y: window.innerHeight - 120,
|
||||
textureKey: "blocks3",
|
||||
id: "block3",
|
||||
},
|
||||
{
|
||||
x: displayW / 2,
|
||||
x: displayW / 2-200,
|
||||
y: window.innerHeight - 120,
|
||||
textureKey: "blocks4",
|
||||
id: "block4",
|
||||
},
|
||||
{
|
||||
x: displayW / 2,
|
||||
x: displayW / 2+200,
|
||||
y: window.innerHeight - 120,
|
||||
textureKey: "blocks5",
|
||||
id: "block5",
|
||||
},
|
||||
{
|
||||
x: displayW / 2,
|
||||
x: displayW / 2-300,
|
||||
y: window.innerHeight - 120,
|
||||
textureKey: "blocks6",
|
||||
id: "block6",
|
||||
},
|
||||
{
|
||||
x: displayW / 2,
|
||||
x: displayW / 2+300,
|
||||
y: window.innerHeight - 120,
|
||||
textureKey: "blocks7",
|
||||
id: "block7",
|
||||
},
|
||||
{
|
||||
x: displayW / 2,
|
||||
x: displayW / 2-400,
|
||||
y: window.innerHeight - 120,
|
||||
textureKey: "blocks8",
|
||||
id: "block8",
|
||||
@@ -551,10 +542,11 @@ import Layout from '../../layouts/Layout.astro';
|
||||
// backgroundColor: 'blue',
|
||||
// padding: { x: 20, y: 10 },
|
||||
// })
|
||||
let retryButton = this.add.image(retryButtonWidth, retryButtonHeight, 'retryIcon')
|
||||
retryButton = this.add.image(retryButtonWidth, retryButtonHeight, 'retryIcon')
|
||||
retryButton.setInteractive().on('pointerdown', () => {
|
||||
window.location.reload();
|
||||
})
|
||||
retryButton.setVisible(false);
|
||||
}
|
||||
}
|
||||
const displayResult = (droppedBlocks) => {
|
||||
@@ -578,6 +570,7 @@ import Layout from '../../layouts/Layout.astro';
|
||||
overlap.style.display = "block";
|
||||
console.log(counter)
|
||||
submitButton.setVisible(true);
|
||||
retryButton.setVisible(true);
|
||||
}
|
||||
}
|
||||
const match = blockMatches.find((m) => m.blockName === blockName && m.targetName === targetName);
|
||||
|
||||
Reference in New Issue
Block a user