Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ REACT_APP_DEPLOYMENT_NAME=Source Academy

REACT_APP_BACKEND_URL=http://localhost:4000
REACT_APP_USE_BACKEND=TRUE
REACT_APP_USE_BACKEND_ASSET_PREFIX=FALSE
REACT_APP_PLAYGROUND_ONLY=FALSE
REACT_APP_SHOW_RESEARCH_PROMPT=FALSE

Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"mdast-util-from-markdown": "^2.0.0",
"mdast-util-to-hast": "^13.0.0",
"normalize.css": "^8.0.1",
"phaser": "^3.55.2",
"phaser": "^3.87.0",
"query-string": "^9.0.0",
"re-resizable": "^6.9.9",
"react": "^18.3.1",
Expand Down Expand Up @@ -100,6 +100,7 @@
"yareco": "^0.1.5"
},
"devDependencies": {
"//": "See: https://github.com/facebook/react/issues/28313#issuecomment-2076798972, https://github.com/t3-oss/create-t3-turbo/issues/984#issuecomment-2076413457",
"@babel/core": "^7.24.5",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-typescript": "^7.24.1",
Expand Down Expand Up @@ -138,15 +139,16 @@
"cross-env": "^7.0.3",
"eslint": "^9.9.0",
"eslint-plugin-react": "^7.35.0",
"//": "See: https://github.com/facebook/react/issues/28313#issuecomment-2076798972, https://github.com/t3-oss/create-t3-turbo/issues/984#issuecomment-2076413457",
"eslint-plugin-react-hooks": "5.1.0-canary-cb151849e1-20240424",
"eslint-plugin-react-refresh": "^0.4.9",
"eslint-plugin-simple-import-sort": "^12.1.1",
"https-browserify": "^1.0.0",
"husky": "^9.0.0",
"npm-run-all2": "^7.0.0",
"os-browserify": "^0.3.0",
"path": "^0.12.7",
"path-browserify": "^1.0.1",
"phaser3spectorjs": "^0.0.8",
"prettier": "^3.3.3",
"process": "^0.11.10",
"react-error-overlay": "^6.0.11",
Expand Down Expand Up @@ -177,5 +179,6 @@
"last 1 firefox version",
"last 1 safari version"
]
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
2 changes: 1 addition & 1 deletion public/assets/mockChapter0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ dialogues
Hmmm
update_assessment_status*()
Let me check
goto 2 if !userstate.assessments.173 else 3
goto 1 if !userstate.assessments.173 else 3

what, What should I do now, Scottie?
@you
Expand Down
1 change: 1 addition & 0 deletions src/features/game/commons/CommonConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import FontAssets from '../assets/FontAssets';

export const Constants = {
assetsFolder: Links.sourceAcademyAssets,
useBackendAssetPrefix: process.env.REACT_APP_USE_BACKEND_ASSET_PREFIX?.toUpperCase() === 'TRUE',
fadeDuration: 600,
nullFunction: () => {},
nullInteractionId: '',
Expand Down
6 changes: 4 additions & 2 deletions src/features/game/input/GameInputManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class GameInputManager {
* @param active if true, mouse input is enabled. Else, mouse input is disabled.
*/
public enableMouseInput(active: boolean) {
this.scene.input.mouse.enabled = active;
if (this.scene.input.mouse) this.scene.input.mouse.enabled = active;
}

/**
Expand All @@ -41,7 +41,7 @@ class GameInputManager {
* @param active if true, keyboard input is enabled. Else, keyboard input is disabled.
*/
public enableKeyboardInput(active: boolean) {
this.scene.input.keyboard.enabled = active;
if (this.scene.input.keyboard) this.scene.input.keyboard.enabled = active;
}

/**
Expand All @@ -57,6 +57,8 @@ class GameInputManager {
event: string | symbol,
callback: Function
) {
if (!this.scene.input.keyboard) return;

const keyObj = this.scene.input.keyboard.addKey(key);
const keyboardListener = keyObj.addListener(event, callback);
this.keyboardListeners.push(keyboardListener);
Expand Down
20 changes: 12 additions & 8 deletions src/features/game/sound/GameSoundManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,18 @@ class GameSoundManager {
const soundAsset = mandatory(this.getSoundAsset(soundKey));
const bgmVol = soundAsset.config.volume !== undefined ? soundAsset.config.volume : 1;

this.currBgMusic = this.getBaseSoundManager().add(soundAsset.key, {
...soundAsset.config,
volume: bgmVol * this.bgmVol
}) as Phaser.Sound.WebAudioSound;
this.currBgMusicKey = soundAsset.key;

// Finally, play it
this.currBgMusic.play();
try {
this.currBgMusic = this.getBaseSoundManager().add(soundAsset.key, {
...soundAsset.config,
volume: bgmVol * this.bgmVol
}) as Phaser.Sound.WebAudioSound;
this.currBgMusicKey = soundAsset.key;

// Finally, play it
this.currBgMusic.play();
} catch (err) {
console.error(err);
}
}

/**
Expand Down
7 changes: 5 additions & 2 deletions src/features/game/utils/GameUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ export function limitNumber(value: number, min: number, max: number) {
*/
export function toS3Path(fileName: string, courseCoded = false) {
if (fileName.startsWith('/')) {
fileName = fileName.substr(1);
fileName = fileName.substring(1);
}
return Constants.assetsFolder + (courseCoded ? assetsPrefix() + fileName : fileName);
return (
Constants.assetsFolder +
(courseCoded && Constants.useBackendAssetPrefix ? assetsPrefix() + fileName : fileName)
);
}

/**
Expand Down
23 changes: 16 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6633,11 +6633,16 @@ event-emitter-es6@^1.1.5:
resolved "https://registry.yarnpkg.com/event-emitter-es6/-/event-emitter-es6-1.1.5.tgz#ef95311b2e17aa39be763b031ce4af7ee9cb7849"
integrity sha512-/n7qzkJBySdbe1W9/FBDdO7gzDIaewgj+Rj6Ayc2BdvVcaGP+p40DyViOFudCgV47UU8+cUFmcD3tJgjwY65qQ==

eventemitter3@^4.0.0, eventemitter3@^4.0.1, eventemitter3@^4.0.7:
eventemitter3@^4.0.0, eventemitter3@^4.0.1:
version "4.0.7"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==

eventemitter3@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4"
integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==

events@^3.2.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400"
Expand Down Expand Up @@ -10420,13 +10425,17 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==

phaser@^3.55.2:
version "3.55.2"
resolved "https://registry.yarnpkg.com/phaser/-/phaser-3.55.2.tgz#c1e2e9e70de7085502885e06f46b7eb4bd95e29a"
integrity sha512-amKXsbb2Ht29dGPKvt1edq3yGGYKtq8373GpJYGKPNPnneYY6MtVTOgjHDuZwtmUyK4v86FugkT3hzW/N4tjxQ==
phaser3spectorjs@^0.0.8:
version "0.0.8"
resolved "https://registry.yarnpkg.com/phaser3spectorjs/-/phaser3spectorjs-0.0.8.tgz#a7996eebc9c498b6d9d19ecda35f16ad3918a8a8"
integrity sha512-0dSO7/aMjEUPrp5EcjRvRRsEf+jXDbmzalPeJ6VtTB2Pn1PeaKc+qlL/DmO3l1Dvc5lkzc+Sil1Ta+Hkyi5cbA==

phaser@^3.87.0:
version "3.87.0"
resolved "https://registry.yarnpkg.com/phaser/-/phaser-3.87.0.tgz#209f1673b311a3f76d59f14b785699709a8f9cf5"
integrity sha512-AyI1b3T5fp05gzf6WUmu2FNqaZL+Y7w88yBRLf7YZXF9bncUSHpnDrupnTGoPqy/RKHRLBcay7zWeqQ2wiMWcw==
dependencies:
eventemitter3 "^4.0.7"
path "^0.12.7"
eventemitter3 "^5.0.1"

picocolors@^0.2.1:
version "0.2.1"
Expand Down
Loading