Skip to content
Merged
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
7 changes: 7 additions & 0 deletions src/components/academy/game/backend/backend.js
Original file line number Diff line number Diff line change
@@ -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;
53 changes: 27 additions & 26 deletions src/components/academy/game/constants/constants.js
Original file line number Diff line number Diff line change
@@ -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() {};
3 changes: 2 additions & 1 deletion src/components/academy/game/create-initializer.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/academy/game/game.js
Original file line number Diff line number Diff line change
@@ -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)
Expand Down