PageSourceSearch

https://quranera.com/assets/js/games/mosque.js?VERSION=2

js quranera.com collected 2026-10-01 14:05:51 UTC 68,156 bytes, 1,378 lines download raw bytes

1var game;
2var sh;
3function mosqueCompleteVerse(json) {
4    (function (sh) {
5        class App extends Phaser.Game {
6            constructor(json) {
7                App.json = json;
8
9                let config = {
10                    type: Phaser.CANVAS,
11                    width: App.CANVAS_WIDTH,
12                    height: App.CANVAS_HEIGHT,
13                    parent: 'game-container',
14                    dom: {
15                        createContainer: false
16                    },
17                    scale: {
18                        parent: 'game-container',
19                        width: App.CANVAS_WIDTH,
20                        height: App.CANVAS_HEIGHT,
21                        mode: Phaser.Scale.FIT,
22                        autoCenter: Phaser.Scale.CENTER_BOTH
23                    },
24                    transparent: true,
25                    scene: {
26                        create: () => {
27                            this.scene.add('Boot', sh.scene.Boot, true);
28                        }
29                    }
30                };
31                super(config);
32                window.addEventListener('scroll', () => this.scale.refresh());
33            }
34        }
35        App.CANVAS_WIDTH = 980;
36        App.CANVAS_HEIGHT = 600;
37        sh.App = App;
38    })(sh || (sh = {}));
39
40    game = new sh.App(json);
41    window.ACTIVE_GAME = game;
42
43    var delayedCalls = [];
44    function delayedCall(delay, callback, args, callbackScope) {
45        let scene = game.scene.getAt(0);
46        if (scene) {
47            let dc = scene.time.delayedCall(delay, callback, args, callbackScope);
48            delayedCalls.push(dc);
49            return dc;
50        }
51        let t = setTimeout(callback, delay);
52        delayedCalls.push(t);
53        return t;
54    }
55
56    function pauseAllDelayedCalls() {
57        for (let dc of delayedCalls) {
58            if (dc instanceof Phaser.Time.TimerEvent) {
59                dc.paused = true;
60            }
61        }
62    }
63
64    function resumeAllDelayedCalls() {
65        for (let dc of delayedCalls) {
66            if (dc instanceof Phaser.Time.TimerEvent) {
67                dc.paused = false;
68            }
69        }
70    }
71
72    function destroyAllDelayedCalls() {
73        for (let dc of delayedCalls) {
74            if (dc instanceof Phaser.Time.TimerEvent) {
75                dc.remove(false);
76            }
77            else {
78                clearTimeout(dc);
79            }
80        }
81        delayedCalls = [];
82    }
83
84    function setPageBackground(bg) {
85        // document.querySelector("html").style.backgroundImage = "url(https://storage.googleapis.com/quran-era-web.appspot.com/assets/games/mosque-complete-verse/imgs/" + bg + ".jpg)";
86    }
87
88    function setupButton(btn, frame) {
89        btn.on('pointerdown', () => { btn.setFrame(frame + '_hover' + '0000'); });
90        btn.on('pointerover', () => { btn.setFrame(frame + '_hover' + '0000'); game.scene.getAt(0).sound.add("button hover").play(); });
91        btn.on('pointerout', () => { btn.setFrame(frame + '0000'); });
92        btn.on('pointerup', () => { btn.setFrame(frame + '0000'); game.scene.getAt(0).sound.add('activity selection - button selection').play(); });
93    }
94
95    function setupButtonTextureBased(btn, texture, hoverTexture) {
96        btn.on('pointerdown', () => { btn.setTexture(hoverTexture); });
97        btn.on('pointerover', () => { btn.setTexture(hoverTexture); game.scene.getAt(0).sound.add("button hover").play(); });
98        btn.on('pointerout', () => { btn.setTexture(texture); });
99        btn.on('pointerup', () => { btn.setTexture(texture); game.scene.getAt(0).sound.add('activity selection - button selection').play(); });
100    }
101
102    (function (sh) {
103        var core;
104        (function (core) {
105            class Gameplay {
106                constructor() {
107                    this.currentRound = 0;
108                    this.currentLetter = 0;
109                    this.correctAnswersCount = 0;
110                    this.wrongAnswersCount = 0;
111                    this.correctAnswersCountThisRound = 0;
112                    this.wrongAnswersCountThisRound = 0;
113                    this.reset();
114                    let json = game.cache.json.get('gameplay');
115                    this.wrongAnswersToLose = json["wrongAnswersToLose"];
116                    this.numberOfQuestionsPerRound = json["numberOfQuestionsPerRound"];
117                    this.lettersConfig = JSON.parse(JSON.stringify(json["lettersConfig"]));
118                    this.rounds = JSON.parse(JSON.stringify(json["rounds"]));
119                    this.numberOfRounds = json["numberOfRounds"] ?? this.rounds.length;
120                    this.useImages = Boolean(game.cache.json.get('gameplay')["useImages"]);
121                }
122                setupCallbacks(onComplete, onLose) {
123                    this.onComplete = onComplete;
124                    this.onLose = onLose;
125                }
126                onLetterChosen(forceNewRound) {
127                    if (forceNewRound || this.isNewRound()) {
128                        return this.nextRound();
129                    }
130                    return false;
131                }
132                nextRound() {
133                    this.correctAnswersCountThisRound = 0;
134                    this.wrongAnswersCountThisRound = 0;
135                    this.currentRound++;
136                    if (this.isRoundsComplete()) {
137                        this.onComplete(this.correctAnswersCount, this.correctAnswersCount);
138                        return true;
139                    }
140
141                    return false;
142                }
143                getCorrectLetters() {
144                    return this.rounds[this.currentRound]['correctLetters'];
145                }
146                isCorrectLetterAudioQuestionEnable() {
147                    return this.rounds[this.currentRound]['audioQuestionEnable'];
148                }
149                getCorrectAndLetterSoundSfxAudioKey(firstOrSecond) {
150                    return "Q-" + this.lettersConfig[this.getCorrectLetters()[firstOrSecond - 1]]['Sounds of the letters'];
151                }
152                onCorrectAnswer() {
153                    this.correctAnswersCountThisRound++;
154                    this.correctAnswersCount++;
155                    return this.onLetterChosen();
156                }
157                onWrongAnswer(forceNewRound) {
158                    this.wrongAnswersCountThisRound++;
159                    this.wrongAnswersCount++;
160                    if (this.wrongAnswersCount >= this.wrongAnswersToLose) {
161                        this.onLose(this.correctAnswersCount, this.correctAnswersCount);
162                        return true;
163                    }
164                    else {
165                        this.onLetterChosen(forceNewRound);
166                    }
167                    return false;
168                }
169
170                getMaxTotalAnswersCount() {
171                    return this.wrongAnswersToLose + this.numberOfRounds - 1;
172                }
173
174                getCurrentTotalAnswersCount() {
175                    return this.correctAnswersCount + this.wrongAnswersCount;
176                }
177                isNewRound() {
178                    return this.correctAnswersCountThisRound >= 1 || (this.correctAnswersCountThisRound + this.wrongAnswersCountThisRound) === 4 || (this.correctAnswersCountThisRound + this.wrongAnswersCountThisRound) === 0;
179                }
180                isRoundsComplete() {
181                    return this.currentRound >= this.numberOfRounds && this.wrongAnswersCount < this.wrongAnswersToLose;
182                }
183                reset() {
184                    this.currentRound = 0;
185                    this.correctAnswersCount = 0;
186                    this.wrongAnswersCount = 0;
187                }
188                getCurrentRoundLetters() {
189                    return this.rounds[this.currentRound]["letters"];
190                }
191            }
192            core.Gameplay = Gameplay;
193        })(core = sh.core || (sh.core = {}));
194    })(sh || (sh = {}));
195
196    (function (sh) {
197        var scene;
198        (function (scene) {
199            class Boot extends Phaser.Scene {
200                init() {
201                    //var sm = new FitScaleManager(this.game);
202                    //sm.setup();
203                    //this.game.scale.transformX = (pageX) => {
204                    //    let offsetLeft = 0;
205                    //    let parentElement = game.canvas.parentElement;
206                    //    while (parentElement) {
207                    //        if (parentElement.offsetLeft) {
208                    //            offsetLeft = parentElement.offsetLeft;
209                    //            break;
210                    //        }
211                    //        parentElement = parentElement.parentElement;
212                    //    }
213                    //    return (pageX - offsetLeft) * this.game.scale.displayScale.x;
214                    //};
215                    //this.game.scale.transformY = (pageY) => {
216                    //    let offsetTop = 0;
217                    //    let parentElement = game.canvas.parentElement;
218                    //    while (parentElement) {
219                    //        if (parentElement.offsetTop) {
220                    //            offsetTop = parentElement.offsetTop;
221                    //            break;
222                    //        }
223                    //        parentElement = parentElement.parentElement;
224                    //    }
225                    //    return (pageY - offsetTop) * this.game.scale.displayScale.y;
226                    //};
227                }
228                create() {
229                    game.scene.remove('Boot');
230                    game.scene.add('Preloader', sh.scene.Preloader, true);
231                }
232            }
233            scene.Boot = Boot;
234        })(scene = sh.scene || (sh.scene = {}));
235    })(sh || (sh = {}));
236
237    (function (sh) {
238        var scene;
239        (function (scene) {
240            var Gameplay = sh.core.Gameplay;
241            class MainScene extends Phaser.Scene {
242                create() {
243                    this.gameplay = new Gameplay();
244                    this.gameplayScreen = new sh.screen.GameplayScreen(this, this.gameplay);
245                    this.children.add(this.gameplayScreen);
246                    this.gameplayScreen.showInstructionPage();
247                    document.getElementById("game-container").style.visibility = "unset";
248                }
249            }
250            scene.MainScene = MainScene;
251        })(scene = sh.scene || (sh.scene = {}));
252    })(sh || (sh = {}));
253
254    (function (sh) {
255        var scene;
256        (function (scene) {
257            class Preloader extends Phaser.Scene {
258                preload() {
259                    this.load.json('gameplay', sh.App.json);
260                }
261                create() {
262                    let json = game.cache.json.get('gameplay');
263                    let lettersConfig = json["lettersConfig"];
264                    this.load.audio("englQuestion", "https://storage.googleapis.com/quran-era-web.appspot.com/assets/games/mosque-complete-verse/sound/mp3/letters/englQuestion.mp3");
265                    for (let letterName in lettersConfig) {
266                        if (json["useImages"]) this.load.image(letterName, "https://storage.googleapis.com/quran-era-web.appspot.com/assets/games/mosque-complete-verse/imgs/letters/" + letterName + ".png");
267                        if (lettersConfig[letterName]) {
268                            this.load.audio("Q-" + lettersConfig[letterName]["Sounds of the letters"], "https://storage.googleapis.com/quran-era-web.appspot.com/assets/games/mosque-complete-verse/sound/mp3/letters/Sounds of the letters/" + lettersConfig[letterName]["Sounds of the letters"]);
269                        }
270                    }
271                    let progressTxt = this.add.text(game.scale.width / 2, game.scale.height / 2 + 50, "", {
272                        "fontFamily": "QuranEraV3",
273                        "fontSize": 25,
274                        "color": "#333333",
275                        "align": 'center'
276                    });
277                    progressTxt.setOrigin(0.5, 0.5);
278                    this.load.pack('preloader', 'https://storage.googleapis.com/quran-era-web.appspot.com/assets/games/mosque-complete-verse/pack.json?v=13');
279                    this.load.on('progress', (value) => {
280                        progressTxt.text = Math.ceil(value * 100) + "%";
281                    }, this);
282                    this.load.on('complete', () => {
283                        this.nextScene();
284                    });
285                    this.load.start();
286                }
287                static playAnim(animKey, sprite, onComplete = null) {
288                    let mainScene = game.scene.getScene('ScreenMain');
289                    let data = Preloader.ANIMS_DATA[animKey];
290                    if (!mainScene.anims.exists(animKey)) {
291                        mainScene.anims.create({
292                            key: animKey,
293                            frames: mainScene.anims.generateFrameNames(data['atlas'], {
294                                start: data['start'], end: data['end'], zeroPad: data['padNum'],
295                                prefix: data['prefix'], suffix: ''
296                            }),
297                            frameRate: data['frameRate'],
298                            repeat: data['repeat']
299                        });
300                    }
301                    if (sprite.anims.currentAnim) {
302                        sprite.anims.currentAnim.off('complete');
303                    }
304                    sprite.anims.stop();
305                    // sprite.setTexture(data['atlas']);
306                    sprite.play(animKey);
307                    sprite.anims.currentAnim.once('complete', () => {
308                        if (onComplete)
309                            onComplete();
310                    });
311                    return sprite;
312                }
313                nextScene() {
314                    game.scene.remove('Preloader');
315                    game.scene.add('ScreenMain', sh.scene.MainScene, true);
316                }
317            }
318            Preloader.ANIMS_DATA = {
319            };
320            scene.Preloader = Preloader;
321        })(scene = sh.scene || (sh.scene = {}));
322    })(sh || (sh = {}));
323    (function (sh) {
324        var screen;
325        (function (screen) {
326            class AreYouSureWindow extends Phaser.GameObjects.Container {
327                constructor(scene, onYes, onNo) {
328                    super(scene);
329                    this._areYouSurePage = new Phaser.GameObjects.Image(this.scene, -105, 0 - 48, 'Exit warning');
330                    this._areYouSurePage.setOrigin(0, 0);
331                    this._areYouSurePage.setInteractive();
332                    this._btnSureYes = new Phaser.GameObjects.Image(this.scene, game.scale.width / 2 - 95, 485 - 50, 'btnYES1');
333                    this._btnSureYes.setInteractive({ cursor: 'pointer' });
334                    this._btnSureYes.on('pointerup', () => {
335                        onYes;
336                        window.CLOSE_GAME();
337                    });
338                    var modalTextStyle = {
339                        backgroundColor: 'transparent',
340                        stroke: '#ffffff',
341                        strokeThickness: 2,
342                        lineSpacing: 15,
343                        fontFamily: 'Kids Rock DEMO',
344                        fontSize: 27,
345                        color: '#43425d',
346                        wordWrap: true,
347                        align: 'center'
348                    };
349                    var modalText = this.scene.add.text(game.scale.width / 2 + 12, game.scale.height / 2, "Your progress in this activity will not be saved. \n Are you sure you want to exit? ", modalTextStyle);
350                    modalText.setOrigin(0.5, 0.5);
351
352                    setupButtonTextureBased(this._btnSureYes, 'btnYES1', 'btnYES2');
353                    this._btnSureNo = new Phaser.GameObjects.Image(this.scene, game.scale.width / 2 + 95, 485 - 50, 'btnNO1');
354                    this._btnSureNo.setInteractive({ cursor: 'pointer' });
355                    this._btnSureNo.on('pointerup', onNo);
356                    setupButtonTextureBased(this._btnSureNo, 'btnNO1', 'btnNO2');
357                    this.add(this._areYouSurePage);
358                    this.add(this._btnSureYes);
359                    this.add(this._btnSureNo);
360                    this.add(modalText);
361                }
362            }
363            screen.AreYouSureWindow = AreYouSureWindow;
364        })(screen = sh.screen || (sh.screen = {}));
365    })(sh || (sh = {}));
366
367    (function (sh) {
368        var screen;
369        (function (screen) {
370            class CompleteWindow extends Phaser.GameObjects.Container {
371                constructor(scene, onBack, onReplay, onNext) {
372                    super(scene);
373                    this.music = null;
374                    this.setPosition(-104.5, -48);
375                    this._bgComplete = new Phaser.GameObjects.Image(this.scene, 0, 0, 'Completion page LATEST UPDATED');
376                    this._bgComplete.setOrigin(0, 0);
377                    this._bgComplete.setInteractive();
378                    this._cup = new Phaser.GameObjects.Image(this.scene, 400, 410, 'Trophy');
379                    this._btnReplay = new Phaser.GameObjects.Image(this.scene, 720, 570, 'btnReplay1');
380                    let _CollectedPoints = new Phaser.GameObjects.Image(this.scene, 620, 440, 'Collected Points');
381                    this.totalScoreTxt = this.scene.add.text(845, 352, "", {
382                        "fontFamily": "Kids Rock Demo",
383                        "fontSize": 35,
384                        "color": "#F49F1C",
385                        "align": 'center',
386                        'stroke': '#70451A',
387                        'strokeThickness': 6
388                    });
389                    this.totalScoreTxt.setOrigin(0.5, 0.5);
390                    let grd = this.totalScoreTxt.context.createLinearGradient(0, 0, 0, this.totalScoreTxt.height);
391                    grd.addColorStop(0, '#FFFF00');
392                    grd.addColorStop(1, '#C17316');
393                    this.totalScoreTxt.setFill(grd);
394                    this.starScoreTxt = this.scene.add.text(648, 433, "", {
395                        "fontFamily": "Kids Rock Demo",
396                        "fontSize": 24,
397                        "color": "#FFFFFF",
398                        "align": 'center'
399                    });
400                    this.starScoreTxt.setOrigin(0.5, 0.5);
401                    this.add([
402                        this._bgComplete,
403                        _CollectedPoints,
404                        this._cup,
405                        this._btnReplay,
406                        this.totalScoreTxt,
407                        this.starScoreTxt
408                    ]);
409
410                    this._btnReplay.setInteractive({ cursor: 'pointer' });
411                    this._btnReplay.once('pointerup', () => {
412                        onReplay(this._btnReplay);
413                        if (this.music) {
414                            this.music.stop();
415                        }
416                    });
417                    setupButtonTextureBased(this._btnReplay, 'btnReplay1', 'btnReplay2');
418                }
419                show(score, starScore) {
420                    this._cup.scale = 1.25;
421                    this.scene.tweens.add({
422                        targets: this._cup,
423                        "scale": 1,
424                        duration: 500,
425                        ease: Phaser.Math.Easing.Back.Out
426                    });
427                    this.totalScoreTxt.text = String(5);
428                    this.starScoreTxt.text = String(starScore);
429                    // let music = this.scene.sound.add("viktory");
430                    this.music = this.scene.sound.add("Activity completion fantastic");
431                    this.music.play();
432                }
433            }
434            screen.CompleteWindow = CompleteWindow;
435        })(screen = sh.screen || (sh.screen = {}));
436    })(sh || (sh = {}));
437
438    (function (sh) {
439        var screen;
440        (function (screen) {
441            class GameplayScreen extends Phaser.GameObjects.Container {
442                constructor(scene, gameplay) {
443                    super(scene);
444                    this.wordRectPositions = [{ x: 200, y: 463 }, { x: 500, y: 463 }, { x: 767, y: 463 }];
445                    this.bgMusic = null;
446                    this.correctAudio = null;
447                    this.wfsnd = null;
448                    this.showCompleteWindow = (score, starScore) => {
449                        let completeWindow = new screen.CompleteWindow(this.scene, (target) => {
450                            this.playBtnClickAnim(target);
451                        }, (target) => {
452                            this.playBtnClickAnim(target);
453                            this.destroyGameplay();
454                            this.remove(completeWindow);
455                            this.showInstructionPage();
456                        }, (target) => {
457                            this.playBtnClickAnim(target);
458                        });
459                        this.setLettersInputEnabled(false);
460                        delayedCall(7500, () => {
461                            setPageBackground("bg-blue");
462                            this.add(completeWindow);
463                            completeWindow.show(score, starScore);
464                            if (this.bgMusic) this.bgMusic.stop();
465                        });
466                    };
467                    this.showLoseWindow = (score, starScore) => {
468                        let tryAgainWindow = new screen.TryAgainWindow(this.scene, (target) => {
469                            this.playBtnClickAnim(target);
470                        }, (target) => {
471                            this.playBtnClickAnim(target);
472                            this.destroyGameplay();
473                            this.remove(tryAgainWindow);
474                            this.showInstructionPage();
475                        });
476                        this.setLettersInputEnabled(false);
477                        delayedCall(2000, () => {
478                            setPageBackground("bg-blue");
479                            this.add(tryAgainWindow);
480                            tryAgainWindow.show(score, starScore);
481                            if (this.bgMusic) this.bgMusic.stop();
482                        });
483                    };
484                    this.gameplay = gameplay;
485                    window["t"] = this;
486                }
487                createHexagons() {
488                    if (this.contentContainer && this.contentContainer.parentContainer) {
489                        this.contentContainer.parentContainer.remove(this.contentContainer);
490                    }
491
492                    this.contentContainer = this.scene.add.container(0, 0);
493                    this.gameplayContainer.addAt(this.contentContainer, this.gameplayContainer.getIndex(this._btnSound) + 1);
494                    window['this.contentContainer'] = this.contentContainer;
495
496                    this.light = new Phaser.GameObjects.Image(this.scene, 484, 321, 'light');
497                    this.light.alpha = 0;
498                    this.contentContainer.add(this.light);
499
500                    window['this.gameplayContainer'] = this.gameplayContainer;
501
502                    let firstWord = this.gameplay.getCorrectLetters()[1];
503                    if (this.gameplay.useImages) {
504                        this.firstWordText = new Phaser.GameObjects.Image(this.scene, 0, 0, firstWord);
505                    } else {
506                        this.firstWordText = this.scene.add.text(0, 0, firstWord, {
507                            "fontFamily": "QuranEraV3",
508                            "fontSize": 50,
509                            "color": "#333333",
510                            "align": 'center'
511                        });
512                        this.firstWordText.setOrigin(0.5, 0.5);
513                        this.firstWordText.setPadding({ left: 0, right: 0, top: 65, bottom: 65 });
514                    }
515                    this.contentContainer.add(this.firstWordText);
516                    this.firstWordText.setPosition(593, 85);
517                    window['this.firstWordText'] = this.firstWordText;
518                    if (this.firstWordText.width >
518 165) this.firstWordText.setScale(165 / this.firstWordText.width);
519                    this.firstWordText.alpha = 0;
520                    this.scene.tweens.add({
521                        targets: this.firstWordText,
522                        "alpha": 1,
523                        duration: 10
524                    });
525
526                    if (this.gameplay.currentRound > 0) this.scene.sound.add('Movement').play();
527
528                    for (let _i = 0; _i < this.wordRectPositions.length; _i++) {
529                        let bookHolder = new Phaser.GameObjects.Image(this.scene, this.wordRectPositions[_i]['x'], this.wordRectPositions[_i]['y'] + 30, 'bookHolder' + _i);
530                        this.contentContainer.addAt(bookHolder, 1);
531
532                        let shadow = new Phaser.GameObjects.Image(this.scene, this.wordRectPositions[_i]['x'] + 5, this.wordRectPositions[_i]['y'] + 100, 'shadow' + _i);
533                        this.contentContainer.addAt(shadow, 1);
534
535                        if (this.gameplay.getCurrentTotalAnswersCount() === 0) {
536                            bookHolder.y = -100;
537                            this.scene.tweens.add({
538                                targets: bookHolder,
539                                "y": this.wordRectPositions[_i]['y'] + 30,
540                                duration: 400,
541                                ease: Phaser.Math.Easing.Quadratic.In,
542                                delay: _i * 425 + 1000
543                            });
544
545                            shadow.setScale(0.5);
546                            shadow.alpha = 0;
547                            this.scene.tweens.add({
548                                targets: shadow,
549                                "alpha": 1,
550                                "scaleX": 1,
551                                "scaleY": 1,
552                                delay: _i * 425 + 1000,
553                                duration: 400,
554                                ease: Phaser.Math.Easing.Quadratic.In
555                            });
556                        }
557                    }
558                    if (this.gameplay.getCurrentTotalAnswersCount() === 0) {
559                        delayedCall(1250, () => this.scene.sound.add('Sound boxes falling').play());
560                    }
561
562                    this.wordsRects = [];
563                    let _i = 0;
564                    for (let p of this.wordRectPositions) {
565                        let hc = this.scene.add.container(this.wordRectPositions[_i]['x'], this.wordRectPositions[_i]['y']);
566                        let hcIdleMotionContainer = this.scene.add.container();
567                        hc.add(hcIdleMotionContainer);
568                        let h = this.scene.add.sprite(0, 0, 'selectRect');
569                        hc["-image-"] = h;
570                        hc['-draggable-'] = true;
571                        hc.add(h);
572                        hc["bg"] = h;
573                        window['hc_' + _i] = hc;
574                        window['h_' + _i] = h;
575                        hcIdleMotionContainer.add(h);
576                        hc['hcIdleMotionContainer'] = hcIdleMotionContainer;
577
578                        let doIdleMove = () => {
579                            if (!this.scene) return;
580                            hcIdleMotionContainer['idleTween'] = this.scene.tweens.add({
581                                targets: hcIdleMotionContainer,
582                                "x": (0 + Math.random() * 6) * (Math.random() > 0.5 ? 1 : -1),
583                                "y": (0 + Math.random() * 6) * (Math.random() > 0.5 ? 1 : -1),
584                                yoyo: true,
585                                delay: Math.random() > 0.5 ? 0 : Math.random() * 500,
586                                duration: 1500,
587                                ease: Phaser.Math.Easing.Quadratic.InOut,
588                                onComplete: doIdleMove
589                            });
590                        };
591                        // doIdleMove();
592
593                        hc['startPosition'] = { x: hc.x, y: hc.y };
594
595                        hc["defX"] = p['x'];
596                        hc["defY"] = p['y'];
597                        this.wordsRects.push(hc);
598                        this.contentContainer.add(hc);
599                        hc['index'] = _i;
600                        _i++;
601                    }
602                    window['this.cars'] = this.wordsRects;
603
604                    this.frameWhiteContainer = this.scene.add.container(0, 0);
605                    this.contentContainer.addAt(this.frameWhiteContainer, 0);
606                    this.frameWhiteContainer.alpha = 0;
607
608                    this.frameWhiteLeft = new Phaser.GameObjects.Image(this.scene, 380, 84, 'frameWhite');
609                    this.frameWhiteLeft.scaleX = -1.1;
610                    this.frameWhiteLeft.setPosition(380, 84);
611                    window['this.frameWhiteLeft'] = this.frameWhiteLeft;
612                    this.frameWhiteContainer.add(this.frameWhiteLeft);
613
614                    this.frameWhiteRight = new Phaser.GameObjects.Image(this.scene, 597, 84, 'frameWhite');
615                    this.frameWhiteRight.scaleX = 1.05;
616                    window['this.frameWhiteRight'] = this.frameWhiteRight;
617                    this.frameWhiteContainer.add(this.frameWhiteRight);
618                }
619                createLetters() {
620                    /* if (this.letters) {
621                        for (let l of this.letters) {
622                            l.parentContainer["letter"] = null;
623                            l["hexagon"] = null;
624                            l.parentContainer.remove(l);
625                        }
626                    } */
627
628                    this.letters = [];
629                    let _letters = this.gameplay.getCurrentRoundLetters();
630                    for (let n of _letters) {
631                        let wordText;
632                        if (this.gameplay.useImages) {
633                            wordText = new Phaser.GameObjects.Image(this.scene, 0, 0, n);
634                        } else {
635                            wordText = this.scene.add.text(0, 0, n, {
636                                "fontFamily": "QuranEraV3",
637                                "fontSize": 50,
638                                "color": "#0d0c0c",
639                                "align": 'center'
640                            });
641                            wordText.setOrigin(0.5, 0.5);
642                            wordText.setPadding({ left: 0, right: 0, top: 65, bottom: 65 });
643                        }
644                        this.add(wordText);
645
646                        if (wordText.width >
646 165) wordText.setScale(165 / wordText.width);
647                        wordText["key"] = n;
648                        this.letters.push(wordText);
649                        window['wordText'] = wordText;
650
651                        if (this.gameplay.getCurrentTotalAnswersCount() !== 0) {
652                            wordText.alpha = 0;
653                            this.scene.tweens.add({
654                                targets: wordText,
655                                "alpha": 1,
656                                duration: 10
657                            });
658                        }
659                    }
660                }
661                showGameplay() {
662                    this.isLost = false;
663                    setPageBackground("bg-australia");
664                    this.bgMusic = this.scene.sound.add("bg_sound");
665                    // this.bgMusic.play();
666                    this.bgMusic.loop = true;
667                    this.gameplay.reset();
668                    this._gameStage = new Phaser.GameObjects.Image(this.scene, game.scale.width / 2, game.scale.height / 2, 'bg');
669                    this._gameStage.setOrigin(0.5, 0.5);
670                    this._gameStage.setInteractive();
671                    window['this._gameStage'] = this._gameStage;
672                    // let selectRect = this.scene.add.sprite(598, 84, 'selectRect');
673                    // window['selectRect']=selectRect;
674
675                    this._btnSound = new Phaser.GameObjects.Image(this.scene, 160 - 105, 100 - 50, 'Sound');
676                    this._btnSound.setInteractive({ cursor: 'pointer' });
677                    this._btnSound["defScale"] = this._btnSound.scale;
678                    setupButtonTextureBased(this._btnSound, 'Sound', 'Sound HOVER EFFECT');
679                    this._btnClose = new Phaser.GameObjects.Image(this.scene, 1025 - 105, 100 - 50, 'x Button');
680                    this._btnClose.setInteractive({ cursor: 'pointer' });
681                    this._btnClose["defScale"] = this._btnClose.scale;
682                    setupButtonTextureBased(this._btnClose, 'x Button', 'x Button HOVER EFFECT');
683                    this.gameplayContainer = new Phaser.GameObjects.Container(this.scene);
684                    this.addAt(this.gameplayContainer, 0);
685                    this.gameplayContainer.add([
686                        this._gameStage,
687                        // selectRect,
688                        this._btnSound,
689                        this._btnClose
690                    ]);
691
692                    this.createBeehives();
693                    this.shuffleOutHexagons();
694                    this.gameplay.setupCallbacks(this.showCompleteWindow, this.showLoseWindow);
695                }
696                createBeehives() {
697                    let startX = 45;
698                    let startY = 125;
699                    let dy = 35;
700                    let _BeehiveEmptyArrayPositions = [];
701                    for (let i = 0; i < this.gameplay.getMaxTotalAnswersCount(); i++) {
702                        _BeehiveEmptyArrayPositions.push({ x: startX, y: startY + i * dy });
703                    }
704                    this._BeehiveEmptyArray = []; window["_BeehiveEmptyArray"] = this._BeehiveEmptyArray;
705                    this._Beehive = [];
706                    for (let p of _BeehiveEmptyArrayPositions) {
707                        let _BeehiveEmpty = new Phaser.GameObjects.Image(this.scene, p['x'], p['y'], 'Beehive 1 Empty');
708                        this._BeehiveEmptyArray.push(_BeehiveEmpty);
709                        _BeehiveEmpty.setScale(0.9);
710                        _BeehiveEmpty.visible = false;
711                        let _Beehive = new Phaser.GameObjects.Image(this.scene, p['x'], p['y'], 'Beehive 1');
712                        _Beehive.setScale(0.9);
713                        this._Beehive.push(_Beehive);
714                    }
715                    for (let bea of this._BeehiveEmptyArray) {
716                        this.gameplayContainer.add(bea);
717                    }
718                    for (let bee of this._Beehive) {
719                        this.gameplayContainer.add(bee);
720                        bee.visible = false;
721                    }
722                }
723                randomizeLettersPosition() {
724                    let hx = this.wordsRects.slice();
725                    for (let l of this.letters) {
726                        if (hx.length == 0)
727                            return;
728                        let hc = Phaser.Utils.Array.RemoveRandomElement(hx);
729                        hc['hcIdleMotionContainer'].add(l);
730                        hc["letter"] = l;
731                        hc["-letter-text"] = l.key ?? l.text;
732                        l["hexagon"] = hc;
733                    }
734                }
735                updateHexagonsArrange() {
736                    for (let hc of this.wordsRects) {
737                        if (!hc["letter"]) {
738                            hc.parentContainer.bringToTop(hc);
739                            break;
740                        }
741                    }
742                }
743                shuffleOutHexagons() {
744                    this.createHexagons();
745
746                    let setLettersInputEnabled = () => {
747                        // if (this.correctAudio && this.correctAudio.isPlaying) {
748                        delayedCall((this.correctAudio.duration * 0.8) * 1000, () => {
749                            this.setLettersInputEnabled(true);
750                        });
751                        // }
752                        // else {
753                        // this.setLettersInputEnabled(true);
754                        // }
755                    };
756
757                    delayedCall(this.gameplay.getCurrentTotalAnswersCount() === 0 ? 2200 : 100, () => {
758                        if (!this.gameplay.isRoundsComplete()) {
759                            if (this.gameplay.isCorrectLetterAudioQuestionEnable()) {
760                                this.playCorrectAudio();
761                            }
762                            setLettersInputEnabled();
763                        }
764                    });
765
766                    if (this.sfxCarAccelerating) {
767                        this.sfxCarAccelerating.stop();
768                        this.sfxCarAccelerating = null;
769                    }
770                    if (this.sfxWrong) {
771                        this.sfxWrong.stop();
772                        this.sfxWrong = null;
773                    }
774
775                    if (!this.gameplay.isRoundsComplete()) {
776                        this.createLetters();
777                        this.randomizeLettersPosition();
778                    }
779
780                    this.setLettersInputEnabled(false);
781                    this.updateHexagonsArrange();
782                    // Phaser.Utils.Array.Shuffle(this.carsPositions);
783                    let cars = this.wordsRects;
784                    for (let i = 0; i < cars.length; i++) {
785                        let hc = cars[i];
786                        hc["defX"] = this.wordRectPositions[i]["x"];
787                        hc["defY"] = this.wordRectPositions[i]["y"];
788                        this.scene.tweens.killTweensOf(hc);
789
790                        if (this.gameplay.getCurrentTotalAnswersCount() === 0) {
791                            hc.y = -100;
792                            this.scene.tweens.add({
793                                targets: hc,
794                                y: hc["defY"],
795                                duration: 400,
796                                ease: Phaser.Math.Easing.Quadratic.In,
797                                delay: i * 425 + 1000,
798                            });
799                        }
800                    }
801
802                    for (let c of cars) this.gameplayContainer.remove(c);
803                    this.wordsRects.sort((c1, c2) => c1.y - c2.y);
804                    // for (let c of cars) this.gameplayContainer.add(c);
805
806                    this.createInput();
807                    this.setLettersInputEnabled(false);
808                }
809                shuffleInHexagons() {
810                    this.updateHexagonsArrange();
811                    let positions = this.wordRectPositions.slice();
812                    this.setLettersInputEnabled(false);
813
814                    // delayedCall(600, () => {
815                    // this.scene.sound.add('move to centre').play();
816                    this.shuffleOutHexagons();
817                    // });
818                }
819                onCorrectDragsMade() {
820                    let sfxKeyOnLeft = this.gameplay.getCorrectAndLetterSoundSfxAudioKey(1);
821                    let sfxKeyOnRight = this.gameplay.getCorrectAndLetterSoundSfxAudioKey(2);
822
823                    let completed = this.onCorrectAnswer();
824
825                    // this.scene.sound.add('Snail giggling sound - correct selection').play();
826
827                    this.scene.tweens.add({
828                        targets: this.light,
829                        "alpha": 1,
830                        ease: Phaser.Math.Easing.Cubic.In,
831                        duration: 500,
832                        onComplete: () => {
833                            this.scene.tweens.add({
834                                targets: this.light,
835                                "alpha": 0,
836                                ease: Phaser.Math.Easing.Cubic.In,
837                                duration: 500,
838                                delay: 1250,
839                            });
840                        }
841                    });
842
843                    // delayedCall(1250, () => {
844                    // let sndRight = this.scene.sound.add(sfxKeyOnRight);
845                    // sndRight.once('complete', ()=>{
846                    delayedCall(1250, () => {
847                        let sndLeft = this.scene.sound.add(sfxKeyOnLeft);
848                        sndLeft.play();
849                        sndLeft.once('complete', () => {
850                            delayedCall(completed ? 500 : 500/* 2250 */, () => {
851                                if (!completed) {
852                                    delayedCall(0, () => {
853                                        for (let _hc of this.wordsRects) {
854                                            this.scene.tweens.add({
855                                                targets: _hc["letter"],
856                                                "alpha": 0,
857                                                ease: Phaser.Math.Easing.Cubic.In,
858                                                duration: 10
859                                            });
860                                        }
861
862                                        this.scene.tweens.add({
863                                            targets: this.firstWordText,
864                                            "alpha": 0,
865                                            ease: Phaser.Math.Easing.Cubic.In,
866                                            duration: 10
867                                        });
868                                        this.scene.sound.add('Movement').play();
869                                    });
870
871                                    delayedCall(750, () => {
872                                        this.shuffleInHexagons();
873                                    });
874                                } else {
875                                    this.scene.sound.add("Success 2").play();
876                                }
877                            });
878                        });
879                        // });
880                        // });
881                        // sndRight.play();
882                    });
883
884                    // delayedCall(650, () => this.scene.sound.add('Going up sound').play())
885                    // if (completed) delayedCall(1750, () => this.scene.sound.add('Final celebration sound').play())
886
887                    this.scene.tweens.add({
888                        targets: this.frameWhiteContainer,
889                        "alpha": 1,
890                        duration: 300
891                    });
892
893                    let l = this.lastCorrectBlock["-block-"]["letter"];
894                    let mid = (this.firstWordText.width + l.width) / 2;
895                    let dx = mid - this.firstWordText.width;
896
897                    this.scene.tweens.add({
898                        targets: this.firstWordText,
899                        "x": 493 + dx - 6,
900                        "originX": 0,
901                        delay: 300,
902                        duration: 300,
903                        onUpdate: () => {
904                            this.firstWordText.setOrigin(this.firstWordText.originX, this.firstWordText.originY);
905                        }
906                    });
907                    this.scene.tweens.add({
908                        targets: this.lastCorrectBlock["-block-"]["bg"],
909                        "alpha": 0,
910                        duration: 300
911                    });
912
913                    this.scene.tweens.add({
914                        targets: l,
915                        "x": 101 + dx + 6,
916                        "originX": 1,
917                        delay: 300,
918                        duration: 300,
919                        onUpdate: () => {
920                            l.setOrigin(l.originX, l.originY);
921                        }
922                    });
923                }
924                createInput() {
925                    this.scene.input.on('drag', (pointer, block, dragX, dragY) => {
926                        if (!block['-draggable-'])
927                            return;
928                        block.x = dragX;
929                        block.y = dragY;
930                        block.parentContainer.bringToTop(block);
931                    });
932                    console.log("CORRECT WORDS: ", this.gameplay.getCorrectLetters());
933                    this.targetBlocks = [];
934                    let bb = [{ x: 375, y: 84 }];
935                    // for (let i = 0; i < bb.length; i++) {
936                    let b = bb[0/* i */];
937                    b['alreadyFilled'] = false;
938                    this.targetBlocks.push(b);
939                    b["-letter-text"] = this.gameplay.getCorrectLetters()[0/* i */];
940                    b["-block-"] = null;
941                    // }
942                    window['this.targetBlocks'] = this.targetBlocks;
943
944                    for (let a of this.wordsRects) {
945                        // let correctAnswer = hc["letter"] && hc["letter"]["key"] == this.gameplay.getCorrectLetters(1);
946                        //hc["letter"].alpha = correctAnswer ? 1 : 0.5;
947
948                        a.setSize(a["-image-"].width, a["-image-"].height);
949                        a.setInteractive({ cursor: 'pointer' });
950                        this.scene.input.setDraggable(a, true);
951                        a.on('pointerdown', () => {
952                            if (a["-placedAtBlock-"]) {
953                                a["-placedAtBlock-"]['alreadyFilled'] = false;
954                                a["-placedAtBlock-"] = null;
955                            }
956
957                            a['-pointerdown-'] = true;
958                            if (a['-draggable-']) this.scene.sound.add("Move the block from its spot").play();
959                        });
960                        a.on('pointerup', () => {
961                            a['-pointerdown-'] = false;
962                            if (!a['-draggable-'])
963                                return;
964
965                            let wasTargetBlockFound = false;
966                            let targetBlock;
967                            for (targetBlock of this.targetBlocks) {
968                                if (targetBlock['alreadyFilled'])
969                                    continue;
970                                if (Phaser.Math.Distance.Between(a.x, a.y, targetBlock.x, targetBlock.y) < 50) {
971                                    //as
972                                    // a['-draggable-'] = false;
973                                    targetBlock['alreadyFilled'] = true;
974                                    this.scene.tweens.add({
975                                        targets: a,
976                                        x: targetBlock.x,
977                                        y: targetBlock.y,
978                                        duration: 200,
979                                        ease: Phaser.Math.Easing.Back.Out
980                                    });
981                                    targetBlock["-block-"] = a;
982                                    a["-placedAtBlock-"] = targetBlock;
983                                    this.scene.sound.add("Dopping the block").play();
984
985                                    wasTargetBlockFound = true;
986                                    break;
987                                }
988                            }
989
990                            let allTargetsFilled = true;
991                            for (targetBlock of this.targetBlocks) {
992                                if (!targetBlock['alreadyFilled']) {
993                                    allTargetsFilled = false;
994                                    break;
995                                }
996                            }
997                            if (allTargetsFilled) this.checkTargetBlockLetters();
998
999                            if (!wasTargetBlockFound) {
1000                                this.moveBridgeBackToStartPosition(a, null, true);
1001                            }
1002                        });
1003                        a.on('pointerout', () => {
1004                            if (!a['-draggable-'])
1005                                return;
1006                            if (!a['-pointerdown-'])
1007                                return;
1008                            this.moveBridgeBackToStartPosition(a, null, true);
1009                        });
1010                    }
1011                    this._btnSound.on('pointerup', () => {
1012                        this.playBtnClickAnim(this._btnSound);
1013                        this.onSoundClick();
1014                    });
1015                    this._btnClose.on('pointerup', () => {
1016                        this.playBtnClickAnim(this._btnClose);
1017                        this.onCloseClick();
1018                    });
1019                }
1020                hideAllUnusedBeehives() {
1021                    let i = this.gameplay.getCurrentTotalAnswersCount();
1022                    for (let k = i + 1; k < this._BeehiveEmptyArray.length; k++) {
1023                        this._BeehiveEmptyArray[k].visible = false;
1024                        this._Beehive[k].visible = false;
1025                    }
1026                }
1027                checkTargetBlockLetters() {
1028                    let sameLettersNum = 0;
1029                    for (let targetBlock of this.targetBlocks) {
1030                        if (!targetBlock['-block-']) {
1031                            // this.scene.sound.add("Placing block above").play();
1032                            return;
1033                        }
1034                        if (targetBlock["-letter-text"] == targetBlock['-block-']["-letter-text"]) {
1035                            sameLettersNum++;
1036                            this.lastCorrectBlock = targetBlock;
1037                        }
1038                    }
1039
1040                    this.setLettersInputEnabled(false);
1041                    if (sameLettersNum == this.targetBlocks.length) {
1042                        // this.scene.sound.add("Blocks disappearing").play();
1043
1044                        this.setLettersInputEnabled(false);
1045                        delayedCall(250, () => {
1046                            this.onCorrectDragsMade();
1047                        });
1048                    } else {
1049                        // for (let targetBlock of this.targetBlocks) targetBlock['-block-']["-image-"].setTexture('DoughWrong');
1050
1051                        // delayedCall(500, () => { this.scene.sound.add("wrong drop").play(); });
1052                        delayedCall(900, () => {
1053                            for (let targetBlock of this.targetBlocks) {
1054                                // for (let targetBlock of this.targetBlocks) targetBlock['-block-']["-image-"].setTexture('DoughNormal');
1055                                this.moveBridgeBackToStartPosition(targetBlock['-block-'], null, false);
1056                            }
1057                            for (let targetBlock of this.targetBlocks) {
1058                                targetBlock['alreadyFilled'] = false;
1059                                targetBlock['-block-']['-draggable-'] = true;
1060                                targetBlock['-block-']["-placedAtBlock-"] = null;
1061                                targetBlock["-block-"] = null;
1062                            }
1063                            // delayedCall(100, ()=>this.scene.sound.add("all three blocks move back after wrong").play());
1064                        });
1065                        delayedCall(650, () => this.scene.sound.add("Two blocks move back after a wrong placement").play());
1066                        delayedCall(150, () => {
1067                            let lost = this.onWrongAnswer();
1068
1069                            // delayedCall(650, () => {this.scene.sound.add('No snail animation sound').play();});
1070
1071                            delayedCall(2000, () => {
1072                                if (!lost) this.setLettersInputEnabled(true);
1073                            });
1074                        });
1075                    }
1076                }
1077                moveBridgeBackToStartPosition(block, onComplete, playSound) {
1078                    this.scene.tweens.add({
1079                        targets: block,
1080                        x: block['startPosition'].x,
1081                        y: block['startPosition'].y,
1082                        duration: 200,
1083                        ease: Phaser.Math.Easing.Sine.Out,
1084                        onComplete: () => {
1085                            if (onComplete)
1086                                onComplete();
1087                        }
1088                    });
1089                    if (Phaser.Math.Distance.Between(block['startPosition'].x, block['startPosition'].y, block.x, block.y) > 20) {
1090                        delayedCall(100, () => {
1091                            if (playSound) {
1092                                this.scene.sound.add("Block goes back when released").play();
1093                            }
1094                        });
1095                    }
1096                }
1097                onCorrectAnswer() {
1098                    let i = this.gameplay.getCurrentTotalAnswersCount();
1099                    if (i < this._BeehiveEmptyArray.length) {
1100                        this._BeehiveEmptyArray[i].visible = false;
1101                        this._Beehive[i].visible = true;
1102                    }
1103                    this.hideAllUnusedBeehives();
1104
1105                    let completed = this.gameplay.onCorrectAnswer();
1106                    this.scene.sound.add('Correct sfx').play();
1107
1108                    // this.sfxCarAccelerating = this.scene.sound.add('Car accelerating');
1109                    // this.sfxCarAccelerating.play();
1110                    return completed;
1111                }
1112                onWrongAnswer(forceNewRound) {
1113                    let i = this.gameplay.getCurrentTotalAnswersCount();
1114                    if (i < this._BeehiveEmptyArray.length) {
1115                        this._BeehiveEmptyArray[i].visible = true;
1116                        this._Beehive[i].visible = false;
1117                    }
1118                    this.hideAllUnusedBeehives();
1119                    let lost = this.gameplay.onWrongAnswer(forceNewRound);
1120                    this.sfxWrong = this.scene.sound.add("wrong sfx");
1121                    this.sfxWrong.play();
1122                    return lost;
1123                }
1124                playCorrectAudio() {
1125                    if (this.correctAudio) {
1126                        this.correctAudio.stop();
1127                    }
1128                    this.correctAudio = this.scene.sound.add("englQuestion");
1129                    this.correctAudio.once('complete', () => {
1130                        this.correctAudio = this.scene.sound.add(this.gameplay.getCorrectAndLetterSoundSfxAudioKey(1));
1131                        this.correctAudio.play();
1132                    });
1133                    this.correctAudio.play();
1134                    if (this.areYouSureWindow && this.areYouSureWindow.parentContainer == this) {
1135                        this.correctAudio.pause();
1136                    }
1137                }
1138                onSoundClick() {
1139                    this.playCorrectAudio();
1140                }
1141                onCloseClick() {
1142                    this.showAreYouSurePage();
1143                    this.scene.sound.add('warning page pop up sfx').play();
1144                }
1145                playBtnClickAnim(target) {
1146                    let sc = target["defScale"] ? target["defScale"] : 1;
1147                    target.scaleX = target.scaleY = sc;
1148                    this.scene.tweens.add({
1149                        targets: target,
1150                        "scaleX": 0.9 * sc,
1151                        "scaleY": 0.9 * sc,
1152                        duration: 100,
1153                        yoyo: true
1154                    });
1155                }
1156                showInstructionPage() {
1157                    setPageBackground("bg-blue");
1158                    this.instructionPage = new screen.InstructionPage(this.scene, (target) => {
1159                        this.playBtnClickAnim(target);
1160                        this.remove(this.instructionPage);
1161                        this.showGameplay();
1162                        if (this.wfsnd) {
1163                            this.wfsnd.stop();
1164                        }
1165                    }, (target) => {
1166                        this.playBtnClickAnim(target);
1167                        if (this.wfsnd) {
1168                            this.wfsnd.stop();
1169                        }
1170                        if (!game.cache.json.get('gameplay')['welcomeAudioDisabled']) {
1171                            this.wfsnd = this.scene.sound.add("Welcome Find the sound");
1172                            this.wfsnd.play();
1173                        }
1174                    });
1175                    this.add(this.instructionPage);
1176                    try {
1177                        if (!game.cache.json.get('gameplay')['welcomeAudioDisabled']) {
1178                            this.wfsnd = this.scene.sound.add("Welcome Find the sound");
1179                            this.wfsnd.play();
1180                        }
1181                    }
1182                    catch (e) {
1183                        console.error(e);
1184                    }
1185                }
1186                showAreYouSurePage() {
1187                    /* for (let j = 0; j < this.cars.length; j++) {
1188                        if (this.cars[j]["raceTween"]) {
1189                            this.cars[j]["raceTween"].pause();
1190                        }
1191                    } */
1192
1193                    pauseAllDelayedCalls();
1194                    setPageBackground("bg-blue");
1195                    this.pauseSounds();
1196                    if (!this.areYouSureWindow) this.areYouSureWindow = new screen.AreYouSureWindow(this.scene, () => {
1197                        this.remove(this.areYouSureWindow);
1198                        this.destroyGameplay();
1199                        this.showInstructionPage();
1200                    }, () => {
1201                        this.remove(this.areYouSureWindow);
1202                        this.unpauseSounds();
1203                        resumeAllDelayedCalls();
1204
1205                        /* for (let j = 0; j < this.cars.length; j++) {
1206                            if (this.cars[j]["raceTween"]) {
1207                                this.cars[j]["raceTween"].resume();
1208                            }
1209                        } */
1210
1211                        setPageBackground("bg-australia");
1212                    });
1213                    this.add(this.areYouSureWindow);
1214                }
1215                setLettersInputEnabled(enabled) {
1216                    if (enabled) {
1217                        for (let hc of this.wordsRects) {
1218                            hc.setInteractive({ cursor: 'pointer' });
1219                            this.scene.input.setDraggable(hc, true);
1220                            // hc["bg"].setInteractive(new Phaser.Geom.Rectangle(80, 100, 240, 200), Phaser.Geom.Rectangle.Contains);
1221                        }
1222                    }
1223                    else {
1224                        for (let hc of this.wordsRects) {
1225                            try { this.scene.input.setDraggable(hc, false); } catch (e) { }
1226                            hc.disableInteractive();
1227                        }
1228                    }
1229                }
1230                pauseSounds() {
1231                    if (this.correctAudio)
1232                        this.correctAudio.pause();
1233                    if (this.bgMusic)
1234                        this.bgMusic.pause();
1235                }
1236                unpauseSounds() {
1237                    if (this.correctAudio)
1238                        this.correctAudio.resume();
1239                    if (this.bgMusic)
1240                        this.bgMusic.resume();
1241                }
1242                destroyGameplay() {
1243                    this.setLettersInputEnabled(false);
1244                    this.remove(this.gameplayContainer);
1245                    this.scene.sound.stopAll();
1246                    destroyAllDelayedCalls();
1247                }
1248            }
1249            screen.GameplayScreen = GameplayScreen;
1250        })(screen = sh.screen || (sh.screen = {}));
1251    })(sh || (sh = {}));
1252    (function (sh) {
1253        var screen;
1254        (function (screen) {
1255            class InstructionPage extends Phaser.GameObjects.Container {
1256                constructor(scene, onPlayClick, onSndClick) {
1257                    super(scene);
1258                    this._instructionPage = new Phaser.GameObjects.Image(this.scene, 0 - 105, 0 - 48, 'Instructions page  ALL ACTIVITY  TITLEs');
1259                    this._instructionPage.setOrigin(0, 0);
1260                    this._instructionPage.setInteractive();
1261
1262                    this._instructionPageTitle = this.scene.add.text(475, 110, sh.App.json.instructionTitle ?? 'Mosque', {
1263                        "fontFamily": "Kids Rock DEMO",
1264                        "fontSize": 45,
1265                        "color": "#43425D",
1266                        "align": 'center'
1267                    });
1268                    this._instructionPageTitle.setOrigin(0.5, 0.5);
1269                    window['this._instructionPageTitle'] = this._instructionPageTitle;
1270                    this._instructionPageTitle.setStroke('#ffffff', 5);
1271                    //  Apply the gradient fill.
1272                    const gradient = this._instructionPageTitle.context.createLinearGradient(0, 0, 0, this._instructionPageTitle.height);
1273                    gradient.addColorStop(0, '#eeef67');
1274                    gradient.addColorStop(0.55, '#e98c2c');
1275                    gradient.addColorStop(1, '#91301a');
1276                    this._instructionPageTitle.setFill(gradient);
1277
1278                    this._btnPlay = new Phaser.GameObjects.Image(this.scene, game.scale.width / 2, 480 - 50, 'btnPLAY1');
1279                    this._btnPlay.setInteractive({ cursor: 'pointer' });
1280                    this._btnPlay.once('pointerup', onPlayClick);
1281                    setupButtonTextureBased(this._btnPlay, 'btnPLAY1', 'btnPLAY2');
1282                    this.instrTxt = this.scene.add.text(game.scale.width / 2, game.scale.height / 2, "Complete the verse by dragging the \n right word to the board.", {
1283                        "fontFamily": "Kids Rock DEMO",
1284                        "fontSize": 30,
1285                        "lineSpacing": 15,
1286                        "color": "#43425D",
1287                        "align": 'center'
1288                    });
1289                    this.instrTxt.setOrigin(0.5, 0.5);
1290                    this._btnSoundInstruction = new Phaser.GameObjects.Image(this.scene, 800 - 105, 156 - 50, 'Sound');
1291                    this._btnSoundInstruction.setInteractive({ cursor: 'pointer' });
1292                    this._btnSoundInstruction.on('pointerup', onSndClick);
1293                    this._btnSoundInstruction["defScale"] = this._btnSoundInstruction.scale;
1294                    setupButtonTextureBased(this._btnSoundInstruction, 'Sound', 'Sound HOVER EFFECT');
1295                    this.add(this._instructionPage);
1296                    this.add(this._instructionPageTitle);
1297                    this.add(this.instrTxt);
1298                    this.add(this._btnPlay);
1299                    this.add(this._btnSoundInstruction);
1300                }
1301            }
1302            screen.InstructionPage = InstructionPage;
1303        })(screen = sh.screen || (sh.screen = {}));
1304    })(sh || (sh = {}));
1305    (function (sh) {
1306        var screen;
1307        (function (screen) {
1308            class TryAgainWindow extends Phaser.GameObjects.Container {
1309                constructor(scene, onBack, onReplay) {
1310                    super(scene);
1311                    this.music = null;
1312                    this.setPosition(-106, -48);
1313                    this._bg = new Phaser.GameObjects.Image(this.scene, 0, 0, 'Try again page');
1314                    this._bg.setOrigin(0, 0);
1315                    this._bg.setInteractive();
1316                    this._star = new Phaser.GameObjects.Image(this.scene, 400, 415, 'Break Star');
1317                    this._btnReplay = new Phaser.GameObjects.Image(this.scene, 765, 580, 'btnReplay1');
1318                    this.totalScoreTxt = this.scene.add.text(850, 355, "", {
1319                        "fontFamily": "Kids Rock Demo",
1320                        "fontSize": 35,
1321                        "color": "#F49F1C",
1322                        "align": 'center',
1323                        'stroke': '#70451A',
1324                        'strokeThickness': 6
1325                    });
1326                    this.totalScoreTxt.setOrigin(0.5, 0.5);
1327                    let grd = this.totalScoreTxt.context.createLinearGradient(0, 0, 0, this.totalScoreTxt.height);
1328                    grd.addColorStop(0, '#FFFF00');
1329                    grd.addColorStop(1, '#C17316');
1330                    this.totalScoreTxt.setFill(grd);
1331                    this.starScoreTxt = this.scene.add.text(635, 431, "", {
1332                        "fontFamily": "Kids Rock Demo",
1333                        "fontSize": 24,
1334                        "color": "#FFFFFF",
1335                        "align": 'center'
1336                    });
1337                    this.starScoreTxt.setOrigin(0.5, 0.5);
1338                    this.add([
1339                        this._bg,
1340                        this._star,
1341                        this._btnReplay,
1342                        this.totalScoreTxt,
1343                        this.starScoreTxt
1344                    ]);
1345
1346                    this._btnReplay.setInteractive({ cursor: 'pointer' });
1347                    this._btnReplay.once('pointerup', () => {
1348                        onReplay(this._btnReplay);
1349                        if (this.music) {
1350                            this.music.stop();
1351                        }
1352                    });
1353                    setupButtonTextureBased(this._btnReplay, 'btnReplay1', 'btnReplay2');
1354                }
1355                show(score, starScore) {
1356                    this._star.scale = 1.25;
1357                    this.scene.tweens.add({
1358                        targets: this._star,
1359                        "scale": 1,
1360                        duration: 500,
1361                        ease: Phaser.Math.Easing.Back.Out
1362                    });
1363                    this.totalScoreTxt.text = String(5);
1364                    this.starScoreTxt.text = String(0);
1365                    this.music = this.scene.sound.add("Fail - close one");
1366                    this.music.play();
1367                }
1368            }
1369            screen.TryAgainWindow = TryAgainWindow;
1370        })(screen = sh.screen || (sh.screen = {}));
1371    })(sh || (sh = {}));
1372}
1373
1374function destroymosqueCV() {
1375    if (game) {
1376        game.destroy();
1377    }
1378}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.