Skip to content

Commit 8d68801

Browse files
committed
Add Confetti to win screen
1 parent c5e8cab commit 8d68801

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# SMS - SweeperForce Changelog
22

3+
## v1.0.4
4+
5+
### Added
6+
7+
- Add Confetti when winning the game (currently only working in Digital Experience sites).
8+
9+
### Fixed
10+
11+
- Fixed Enable Sound FX setting not saving when turned off.
12+
313
## v1.0.3
414

515
### Added

force-app/main/default/lwc/smsSweeperForce/smsSweeperForce.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { LightningElement } from "lwc";
99
import SmsSweeperForceModal from "c/smsSweeperForceModal";
1010
import SmsAssets from "@salesforce/resourceUrl/smsSweeperForce";
11+
import { loadScript } from "lightning/platformResourceLoader";
1112

1213
export default class SmsSweeperForce extends LightningElement {
1314
// --- Private Properties ---
@@ -40,6 +41,7 @@ export default class SmsSweeperForce extends LightningElement {
4041
exposed = [];
4142
flagged = [];
4243
questioned = [];
44+
jsConfetti;
4345

4446
/**
4547
* Immutable setup data.
@@ -58,10 +60,20 @@ export default class SmsSweeperForce extends LightningElement {
5860
renderedCallback() {
5961
if (!this.isRendered) {
6062
this.isRendered = true;
63+
64+
Promise.all([loadScript(this, `${SmsAssets}/js-confetti.browser.js`)])
65+
.then(() => {
66+
setTimeout(()=> {
67+
this.jsConfetti = new JSConfetti();
68+
},1000);
69+
})
70+
.catch((error) => console.error(error));
71+
6172
const jsonString = localStorage.getItem("sms-sweeper-force-settings");
6273
if (jsonString) {
6374
this.applySettings(jsonString);
6475
}
76+
6577
this.setUpGame();
6678
this.isInit = true;
6779
}
@@ -481,6 +493,7 @@ export default class SmsSweeperForce extends LightningElement {
481493
if (this.useSfx) {
482494
this.sfxWin.play();
483495
}
496+
this.jsConfetti.addConfetti();
484497
} else {
485498
this.gameOver();
486499
}

force-app/main/default/staticresources/smsSweeperForce/js-confetti.browser.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)