next work start from tick_phonics_v1
This commit is contained in:
@@ -98,6 +98,9 @@ import Layout from '../../layouts/Layout.astro';
|
||||
let noticeHeight;
|
||||
let maxScore;
|
||||
let erase;
|
||||
let audioData;
|
||||
let audioFileId = false;
|
||||
let isPlaying = false;
|
||||
if(isMobile){
|
||||
topLogoWidth = 4.5;
|
||||
muteIconWidth = 1.8;
|
||||
@@ -170,6 +173,10 @@ import Layout from '../../layouts/Layout.astro';
|
||||
const data = fetch(`https://game-du.teachertrainingkolkata.in/items/game_drawing_v2/${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`;
|
||||
colorList = data.colors;
|
||||
defaultColor = colorList[0];
|
||||
const {image1, image2} = data;
|
||||
@@ -210,6 +217,9 @@ import Layout from '../../layouts/Layout.astro';
|
||||
let colorList;
|
||||
|
||||
function preload() {
|
||||
if(audioFileId === true){
|
||||
this.load.audio('instructAudio', audioData)
|
||||
}
|
||||
this.load.image('image1', assetsList.image1);
|
||||
this.load.image('image2', assetsList.image2);
|
||||
this.load.image('topLogo', '/assets/top_logo.svg');
|
||||
@@ -297,6 +307,19 @@ import Layout from '../../layouts/Layout.astro';
|
||||
retryButton = this.add.image(customWidth / resetIconWidth, 30, "resetIcon");
|
||||
submitButton = this.add.image(customWidth / tickIconWidth, 30, "tickIcon");
|
||||
|
||||
if(audioFileId === true){
|
||||
let instructionAudio = this.sound.add('instructAudio')
|
||||
muteIcon.setInteractive().on('pointerdown', () => {
|
||||
if(isPlaying === false){
|
||||
instructionAudio.play()
|
||||
isPlaying = true
|
||||
} else if(isPlaying === true) {
|
||||
instructionAudio.stop();
|
||||
isPlaying = false
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
retryButton.setInteractive().on('pointerdown', ()=>{
|
||||
graphics.clear();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user