mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-02 11:58:10 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
f93753b4bc
6 changed files with 31 additions and 18 deletions
|
@ -378,6 +378,7 @@ self.onWorldLoaded = function onWorldLoaded() {
|
|||
}
|
||||
var t3 = new Date();
|
||||
console.log("And it was so: (" + (diff / self.world.totalFrames).toFixed(3) + "ms per frame,", self.world.totalFrames, "frames)\nSimulation :", diff + "ms \nSerialization:", (t2 - t1) + "ms\nDelivery :", (t3 - t2) + "ms");
|
||||
self.world.goalManager.destroy();
|
||||
self.world = null;
|
||||
};
|
||||
|
||||
|
@ -408,6 +409,7 @@ self.onWorldLoadProgress = function onWorldLoadProgress(progress) {
|
|||
self.abort = function abort() {
|
||||
if(self.world) {
|
||||
self.world.abort();
|
||||
self.world.goalManager.destroy();
|
||||
self.world = null;
|
||||
}
|
||||
self.postMessage({type: 'abort'});
|
||||
|
|
|
@ -47,7 +47,9 @@ module.exports = class God extends CocoClass
|
|||
|
||||
setLevel: (@level) ->
|
||||
setLevelSessionIDs: (@levelSessionIDs) ->
|
||||
setGoalManager: (goalManager) -> @angelsShare.goalManager = goalManager
|
||||
setGoalManager: (goalManager) ->
|
||||
@angelsShare.goalManager?.destroy() unless @angelsShare.goalManager is goalManager
|
||||
@angelsShare.goalManager = goalManager
|
||||
setWorldClassMap: (worldClassMap) -> @angelsShare.worldClassMap = worldClassMap
|
||||
|
||||
onTomeCast: (e) ->
|
||||
|
|
|
@ -36,6 +36,7 @@ module.exports = class Simulator extends CocoClass
|
|||
error: (errorData) ->
|
||||
console.log "There was an error fetching two games! #{JSON.stringify errorData}"
|
||||
success: (taskData) =>
|
||||
return if @destroyed
|
||||
@trigger 'statusUpdate', 'Setting up simulation...'
|
||||
#refactor this
|
||||
@task = new SimulationTask(taskData)
|
||||
|
@ -48,6 +49,7 @@ module.exports = class Simulator extends CocoClass
|
|||
@simulateSingleGame()
|
||||
else
|
||||
@listenToOnce @supermodel, 'loaded-all', @simulateSingleGame
|
||||
|
||||
simulateSingleGame: ->
|
||||
return if @destroyed
|
||||
@trigger 'statusUpdate', 'Simulating...'
|
||||
|
@ -191,7 +193,7 @@ module.exports = class Simulator extends CocoClass
|
|||
|
||||
setupGod: ->
|
||||
@god.setLevel @level.serialize @supermodel
|
||||
@god.setLevelSessionIDs (session.id for session in @task.getSessions())
|
||||
@god.setLevelSessionIDs (session.sessionID for session in @task.getSessions())
|
||||
@god.setWorldClassMap @world.classMap
|
||||
@god.setGoalManager new GoalManager(@world, @level.get 'goals')
|
||||
|
||||
|
@ -250,6 +252,7 @@ module.exports = class Simulator extends CocoClass
|
|||
complete: @cleanupAndSimulateAnotherTask
|
||||
|
||||
handleTaskResultsTransferSuccess: (result) =>
|
||||
return if @destroyed
|
||||
console.log "Task registration result: #{JSON.stringify result}"
|
||||
@trigger 'statusUpdate', 'Results were successfully sent back to server!'
|
||||
console.log "Simulated by you: " + @simulatedByYou
|
||||
|
@ -260,10 +263,12 @@ module.exports = class Simulator extends CocoClass
|
|||
application.tracker?.trackEvent 'Simulator Result', label: "Success"
|
||||
|
||||
handleTaskResultsTransferError: (error) =>
|
||||
return if @destroyed
|
||||
@trigger 'statusUpdate', 'There was an error sending the results back to the server.'
|
||||
console.log "Task registration error: #{JSON.stringify error}"
|
||||
|
||||
cleanupAndSimulateAnotherTask: =>
|
||||
return if @destroyed
|
||||
@cleanupSimulation()
|
||||
@fetchAndSimulateTask()
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ module.exports = class Mark extends CocoClass
|
|||
if @name is 'debug' or (@name is 'shadow' and @sprite.thang?.shape in ["rectangle", "box"])
|
||||
@mark.rotation = @sprite.thang.rotation * 180 / Math.PI
|
||||
|
||||
updateScale: ->
|
||||
updateScale: (log) ->
|
||||
if @name is 'bounds' and (@sprite.thang.width isnt @lastWidth or @sprite.thang.height isnt @lastHeight)
|
||||
oldMark = @mark
|
||||
@buildBounds()
|
||||
|
@ -243,6 +243,7 @@ module.exports = class Mark extends CocoClass
|
|||
oldMark.parent.removeChild oldMark
|
||||
|
||||
if @markSprite?
|
||||
@markSprite.scaleFactor = 1.2
|
||||
@markSprite.updateScale()
|
||||
return unless @name in ["selection", "target", "repair", "highlight"]
|
||||
if @sprite?.imageObject
|
||||
|
|
|
@ -94,6 +94,7 @@ module.exports = class MyMatchesTabView extends CocoView
|
|||
|
||||
afterRender: ->
|
||||
super()
|
||||
@removeSubView subview for key, subview of @subviews when subview instanceof LadderSubmissionView
|
||||
@$el.find('.ladder-submission-view').each (i, el) =>
|
||||
placeholder = $(el)
|
||||
sessionID = placeholder.data('session-id')
|
||||
|
|
|
@ -22,7 +22,9 @@ module.exports = class ThangAvatarView extends View
|
|||
unless @thangType.isFullyLoaded() or @thangType.loading
|
||||
@thangType.fetch()
|
||||
|
||||
@supermodel.loadModel @thangType, 'thang'
|
||||
# couldn't get the level view to load properly through the supermodel
|
||||
# so just doing it manually this time.
|
||||
@listenTo @thangType, 'sync', @render
|
||||
|
||||
getSpriteThangType: ->
|
||||
thangs = @supermodel.getModels(ThangType)
|
||||
|
|
Loading…
Reference in a new issue