diff --git a/src/components/academy/game/backend/backend.js b/src/components/academy/game/backend/backend.js new file mode 100644 index 0000000000..426eb5619c --- /dev/null +++ b/src/components/academy/game/backend/backend.js @@ -0,0 +1,7 @@ +const LIVE_ASSETS_HOST = 'https://s3-ap-southeast-1.amazonaws.com/source-academy-assets/'; + +// placeholder URL +const TEST_ASSETS_HOST = 'https://localhost:8080/source-academy-assets/'; + +// placeholder predicate +export const ASSETS_HOST = true ? LIVE_ASSETS_HOST : TEST_ASSETS_HOST; \ No newline at end of file diff --git a/src/components/academy/game/constants/constants.js b/src/components/academy/game/constants/constants.js index c9451ca822..d42c4ca6bb 100644 --- a/src/components/academy/game/constants/constants.js +++ b/src/components/academy/game/constants/constants.js @@ -1,26 +1,27 @@ -module.exports = { - screenWidth: 1920, - screenHeight: 1080, - dialogBoxHeight: 260, - dialogBoxWidth: 1720, - dialogBoxPadding: 25, - fontSize: 44, - innerDialogPadding: 46, - avatarOffset: 46, - nameBoxXPadding: 50, - nameBoxHeight: 80, - playerAvatarSize: 300, - playerAvatarLineWidth: 10, - playerAvatarOffset: 40, - glowDistance: 30, - textSpeed: 0.02, - storyXMLPath: ASSETS_HOST + 'stories/', - locationPath: ASSETS_HOST + 'locations/', - objectPath: ASSETS_HOST + 'objects/', - imgPath: ASSETS_HOST + 'images/', - avatarPath: ASSETS_HOST + 'avatars/', - uiPath: ASSETS_HOST + 'UI/', - soundPath: ASSETS_HOST + 'sounds/', - fadeTime: 0.3, - nullFunction: function() {} -}; +import {ASSETS_HOST} from '../backend/backend' + +export const + screenWidth = 1920, + screenHeight = 1080, + dialogBoxHeight = 260, + dialogBoxWidth = 1720, + dialogBoxPadding = 25, + fontSize = 44, + innerDialogPadding = 46, + avatarOffset = 46, + nameBoxXPadding = 50, + nameBoxHeight = 80, + playerAvatarSize = 300, + playerAvatarLineWidth = 10, + playerAvatarOffset = 40, + glowDistance = 30, + textSpeed = 0.02, + storyXMLPath = ASSETS_HOST + 'stories/', + locationPath = ASSETS_HOST + 'locations/', + objectPath = ASSETS_HOST + 'objects/', + imgPath = ASSETS_HOST + 'images/', + avatarPath = ASSETS_HOST + 'avatars/', + uiPath = ASSETS_HOST + 'UI/', + soundPath = ASSETS_HOST + 'sounds/', + fadeTime = 0.3, + nullFunction = function() {}; \ No newline at end of file diff --git a/src/components/academy/game/create-initializer.js b/src/components/academy/game/create-initializer.js index 5e7a32208c..a641ffc611 100644 --- a/src/components/academy/game/create-initializer.js +++ b/src/components/academy/game/create-initializer.js @@ -1,5 +1,6 @@ import {LINKS} from '../../../utils/constants' import {history} from '../../../utils/history' +import {soundPath} from './constants/constants' export default function (StoryXMLPlayer, story, username, attemptedAll) { function saveToServer() { @@ -45,7 +46,7 @@ export default function (StoryXMLPlayer, story, username, attemptedAll) { } }, playSound: function (name) { - var sound = new Audio(ASSETS_HOST + 'sounds/' + name + '.mp3'); + var sound = new Audio(soundPath + name + '.mp3'); if (sound) { sound.play(); } diff --git a/src/components/academy/game/game.js b/src/components/academy/game/game.js index 63b228f8cd..7dafbe772f 100644 --- a/src/components/academy/game/game.js +++ b/src/components/academy/game/game.js @@ -1,8 +1,6 @@ import createInitializer from './create-initializer' export default function(div, canvas, username, story, attemptedAll) { - window.ASSETS_HOST = - 'https://s3-ap-southeast-1.amazonaws.com/source-academy-assets/'; var StoryXMLPlayer = require('./story-xml-player'); var container = document.getElementById('game-display') var initialize = createInitializer(StoryXMLPlayer, story, username, attemptedAll)