mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-29 02:25:37 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
203374d2cc
8 changed files with 33 additions and 13 deletions
|
@ -111,9 +111,6 @@ class AudioPlayer extends CocoClass
|
||||||
@soundsToPlayWhenLoaded[name] = audioOptions.volume
|
@soundsToPlayWhenLoaded[name] = audioOptions.volume
|
||||||
audioOptions = @applyPanning audioOptions, pos if @camera and not @camera.destroyed and pos
|
audioOptions = @applyPanning audioOptions, pos if @camera and not @camera.destroyed and pos
|
||||||
instance = createjs.Sound.play name, audioOptions
|
instance = createjs.Sound.play name, audioOptions
|
||||||
# For some reason, individual sound volume control doesn't work any more.
|
|
||||||
# I tried updating to SoundJS NEXT on 2014-09-10, but couldn't get any sounds to play with that one.
|
|
||||||
#console.log 'got instance with volume', instance.volume, instance._volume, instance.gainNode?.gain.value
|
|
||||||
instance
|
instance
|
||||||
|
|
||||||
hasLoadedSound: (filename, name) ->
|
hasLoadedSound: (filename, name) ->
|
||||||
|
|
|
@ -10,7 +10,7 @@ module.exports = class Simulator extends CocoClass
|
||||||
@options ?= {}
|
@options ?= {}
|
||||||
_.extend @, Backbone.Events
|
_.extend @, Backbone.Events
|
||||||
@trigger 'statusUpdate', 'Starting simulation!'
|
@trigger 'statusUpdate', 'Starting simulation!'
|
||||||
@retryDelayInSeconds = 10
|
@retryDelayInSeconds = 2
|
||||||
@taskURL = '/queue/scoring'
|
@taskURL = '/queue/scoring'
|
||||||
@simulatedByYou = 0
|
@simulatedByYou = 0
|
||||||
@god = new God maxAngels: 1, workerCode: @options.workerCode, headless: true # Start loading worker.
|
@god = new God maxAngels: 1, workerCode: @options.workerCode, headless: true # Start loading worker.
|
||||||
|
@ -85,7 +85,11 @@ module.exports = class Simulator extends CocoClass
|
||||||
|
|
||||||
processSingleGameResults: (simulationResults) ->
|
processSingleGameResults: (simulationResults) ->
|
||||||
return console.error "Weird, we destroyed the Simulator before it processed results?" if @destroyed
|
return console.error "Weird, we destroyed the Simulator before it processed results?" if @destroyed
|
||||||
|
try
|
||||||
taskResults = @formTaskResultsObject simulationResults
|
taskResults = @formTaskResultsObject simulationResults
|
||||||
|
catch error
|
||||||
|
console.log "Failed to form task results:", error
|
||||||
|
return @cleanupAndSimulateAnotherTask()
|
||||||
console.log 'Processing results:', taskResults
|
console.log 'Processing results:', taskResults
|
||||||
humanSessionRank = taskResults.sessions[0].metrics.rank
|
humanSessionRank = taskResults.sessions[0].metrics.rank
|
||||||
ogreSessionRank = taskResults.sessions[1].metrics.rank
|
ogreSessionRank = taskResults.sessions[1].metrics.rank
|
||||||
|
@ -237,7 +241,11 @@ module.exports = class Simulator extends CocoClass
|
||||||
|
|
||||||
processResults: (simulationResults) ->
|
processResults: (simulationResults) ->
|
||||||
return console.error "Weird, we destroyed the Simulator before it processed results?" if @destroyed
|
return console.error "Weird, we destroyed the Simulator before it processed results?" if @destroyed
|
||||||
|
try
|
||||||
taskResults = @formTaskResultsObject simulationResults
|
taskResults = @formTaskResultsObject simulationResults
|
||||||
|
catch error
|
||||||
|
console.log "Failed to form task results:", error
|
||||||
|
return @cleanupAndSimulateAnotherTask()
|
||||||
unless taskResults.taskID
|
unless taskResults.taskID
|
||||||
console.error "*** Error: taskResults has no taskID ***\ntaskResults:", taskResults
|
console.error "*** Error: taskResults has no taskID ***\ntaskResults:", taskResults
|
||||||
@cleanupAndSimulateAnotherTask()
|
@cleanupAndSimulateAnotherTask()
|
||||||
|
|
|
@ -27,7 +27,7 @@ module.exports = class MusicPlayer extends CocoClass
|
||||||
onPlayMusic: (e) ->
|
onPlayMusic: (e) ->
|
||||||
return if application.isIPadApp # Hard to measure, but just guessing this will save memory.
|
return if application.isIPadApp # Hard to measure, but just guessing this will save memory.
|
||||||
src = e.file
|
src = e.file
|
||||||
src = "/file#{e.file}#{AudioPlayer.ext}"
|
src = "/file#{src}#{AudioPlayer.ext}"
|
||||||
if (not e.file) or src is @currentMusic?.src
|
if (not e.file) or src is @currentMusic?.src
|
||||||
if e.play then @restartCurrentMusic() else @fadeOutCurrentMusic()
|
if e.play then @restartCurrentMusic() else @fadeOutCurrentMusic()
|
||||||
return
|
return
|
||||||
|
|
|
@ -144,7 +144,7 @@ module.exports = class User extends CocoModel
|
||||||
@subscribeCopyGroup = switch group
|
@subscribeCopyGroup = switch group
|
||||||
when 0, 1, 2 then 'original'
|
when 0, 1, 2 then 'original'
|
||||||
when 3, 4, 5 then 'new'
|
when 3, 4, 5 then 'new'
|
||||||
if /^en/.test(@get('preferredLanguage')) and not me.isAdmin()
|
if (not @get('preferredLanguage') or /^en/.test(@get('preferredLanguage'))) and not me.isAdmin()
|
||||||
application.tracker.identify subscribeCopyGroup: @subscribeCopyGroup
|
application.tracker.identify subscribeCopyGroup: @subscribeCopyGroup
|
||||||
else
|
else
|
||||||
@subscribeCopyGroup = 'original'
|
@subscribeCopyGroup = 'original'
|
||||||
|
|
|
@ -96,6 +96,7 @@ $gameControlMargin: 30px
|
||||||
.map-background
|
.map-background
|
||||||
width: 100%
|
width: 100%
|
||||||
height: 100%
|
height: 100%
|
||||||
|
@include user-select(none)
|
||||||
|
|
||||||
.level, .level-shadow
|
.level, .level-shadow
|
||||||
position: absolute
|
position: absolute
|
||||||
|
|
|
@ -48,7 +48,7 @@ block content
|
||||||
strong Variables
|
strong Variables
|
||||||
| - adds the skill of referencing values that change over time.
|
| - adds the skill of referencing values that change over time.
|
||||||
|
|
||||||
p Students may continue past level 12, depending on their speed and interest, to learn two additional concepts in later levels:
|
p Students may continue past level 20, depending on their speed and interest, to learn two additional concepts in later levels:
|
||||||
ol
|
ol
|
||||||
li
|
li
|
||||||
strong Conditional logic
|
strong Conditional logic
|
||||||
|
|
|
@ -425,6 +425,9 @@ module.exports = class CocoView extends Backbone.View
|
||||||
isIPadBrowser: ->
|
isIPadBrowser: ->
|
||||||
navigator?.userAgent?.indexOf('iPad') isnt -1
|
navigator?.userAgent?.indexOf('iPad') isnt -1
|
||||||
|
|
||||||
|
isFirefox: ->
|
||||||
|
navigator.userAgent.toLowerCase().indexOf('firefox') isnt -1
|
||||||
|
|
||||||
initSlider: ($el, startValue, changeCallback) ->
|
initSlider: ($el, startValue, changeCallback) ->
|
||||||
slider = $el.slider({animate: 'fast'})
|
slider = $el.slider({animate: 'fast'})
|
||||||
slider.slider('value', startValue)
|
slider.slider('value', startValue)
|
||||||
|
|
|
@ -27,6 +27,8 @@ module.exports = class SimulateTabView extends CocoView
|
||||||
onLoaded: ->
|
onLoaded: ->
|
||||||
super()
|
super()
|
||||||
@render()
|
@render()
|
||||||
|
if document.location.hash is '#simulate' and not @simulator
|
||||||
|
@startSimulating()
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
ctx = super()
|
ctx = super()
|
||||||
|
@ -43,9 +45,18 @@ module.exports = class SimulateTabView extends CocoView
|
||||||
|
|
||||||
onSimulateButtonClick: (e) ->
|
onSimulateButtonClick: (e) ->
|
||||||
application.tracker?.trackEvent 'Simulate Button Click', {}
|
application.tracker?.trackEvent 'Simulate Button Click', {}
|
||||||
|
@startSimulating
|
||||||
|
|
||||||
|
startSimulating: ->
|
||||||
|
@simulationPageRefreshTimeout = _.delay @refreshAndContinueSimulating, 20 * 60 * 1000
|
||||||
|
@simulateNextGame()
|
||||||
$('#simulate-button').prop 'disabled', true
|
$('#simulate-button').prop 'disabled', true
|
||||||
$('#simulate-button').text 'Simulating...'
|
$('#simulate-button').text 'Simulating...'
|
||||||
@simulateNextGame()
|
|
||||||
|
refreshAndContinueSimulating: =>
|
||||||
|
# We refresh the page every now and again to make sure simulations haven't gotten derailed by bogus games, and that simulators don't hang on to old, stale code or data.
|
||||||
|
document.location.hash = '#simulate'
|
||||||
|
document.location.reload()
|
||||||
|
|
||||||
simulateNextGame: ->
|
simulateNextGame: ->
|
||||||
unless @simulator
|
unless @simulator
|
||||||
|
@ -101,7 +112,7 @@ module.exports = class SimulateTabView extends CocoView
|
||||||
console.log jqxhr.responseText
|
console.log jqxhr.responseText
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
clearInterval @refreshInterval
|
clearTimeout @simulationPageRefreshTimeout
|
||||||
@simulator?.destroy()
|
@simulator?.destroy()
|
||||||
super()
|
super()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue