next work start from tick_phonics_v1
This commit is contained in:
@@ -55,6 +55,9 @@ import Layout from '../../layouts/Layout.astro';
|
||||
let resetIconWidth;
|
||||
let tickIconWidth;
|
||||
let cancelIconWidth;
|
||||
let audioData;
|
||||
let audioFileId = false;
|
||||
let isPlaying = false;
|
||||
|
||||
if(isMobile){
|
||||
topLogoWidth = 4.5;
|
||||
@@ -147,6 +150,10 @@ import Layout from '../../layouts/Layout.astro';
|
||||
const data = fetch(`https://game-du.teachertrainingkolkata.in/items/drag_phonics/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
|
||||
.then(response => response.json())
|
||||
.then(({data}) => {
|
||||
if(data.instruction){
|
||||
audioFileId = true;
|
||||
}
|
||||
audioData = `https://game-du.teachertrainingkolkata.in/assets/${data.instruction}.mp3`;
|
||||
const {left_image1, left_image2, left_image3, left_image4, right_image1, right_image2, right_image3, right_image4} = data;
|
||||
if(isMobile){
|
||||
imageCustomWidth = "?width=100";
|
||||
@@ -243,6 +250,9 @@ import Layout from '../../layouts/Layout.astro';
|
||||
for (var i = 0; i < 5; i++) {
|
||||
this.load.image('logo'+i, '/assets/background.jpg');
|
||||
}
|
||||
if(audioFileId === true){
|
||||
this.load.audio('instructAudio', audioData)
|
||||
}
|
||||
this.load.image("topMatch", "/assets/top_match.jpg");
|
||||
this.load.image('topLogo', '/assets/top_logo.svg');
|
||||
this.load.image("tick", '/assets/tick.png');
|
||||
@@ -372,7 +382,7 @@ import Layout from '../../layouts/Layout.astro';
|
||||
// });
|
||||
// };
|
||||
this.add.image(displayW / topLogoWidth, 30, "topLogo").setScale();
|
||||
this.add.image(displayW / muteIconWidth, 30, "muteIcon").setScale();
|
||||
let soundButton = this.add.image(displayW / muteIconWidth, 30, "muteIcon").setScale();
|
||||
const retryButton = this.add.image(displayW / resetIconWidth, 30, "resetIcon").setScale();
|
||||
submitButton = this.add.image(displayW / tickIconWidth, 30, "tickIcon").setScale();
|
||||
this.add.image(displayW / cancelIconWidth, 30, "cancelIcon").setScale();
|
||||
@@ -385,6 +395,19 @@ import Layout from '../../layouts/Layout.astro';
|
||||
this.add.image(displayW * 0.9-32, 680, "target4");
|
||||
// this.add.image(displayW * 0.9-33, 680, "border").setAlpha(1).setScale(1).setDepth(-1);
|
||||
|
||||
if(audioFileId === true){
|
||||
let instructionAudio = this.sound.add('instructAudio')
|
||||
soundButton.setInteractive().on('pointerdown', () => {
|
||||
if(isPlaying === false){
|
||||
instructionAudio.play()
|
||||
isPlaying = true
|
||||
} else if(isPlaying === true) {
|
||||
instructionAudio.stop();
|
||||
isPlaying = false
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
const graphics = this.add.graphics();
|
||||
const x = 0; const y = 54;
|
||||
|
||||
Reference in New Issue
Block a user