Hide real-time playback countdown outside of flag levels. Later we can figure this out dynamically.

This commit is contained in:
Nick Winter 2014-10-30 16:21:08 -07:00
parent cec8350232
commit fa25cd9c32
3 changed files with 18 additions and 9 deletions

View file

@ -10,6 +10,7 @@ module.exports = class CountdownScreen extends CocoClass
options ?= {}
@camera = options.camera
@layer = options.layer
@showsCountdown = options.showsCountdown
console.error @toString(), 'needs a camera.' unless @camera
console.error @toString(), 'needs a layer.' unless @layer
@build()
@ -44,14 +45,17 @@ module.exports = class CountdownScreen extends CocoClass
show: ->
return if @showing
@showing = true
@dimLayer.alpha = 0
createjs.Tween.removeTweens @dimLayer
createjs.Tween.get(@dimLayer).to({alpha: 1}, 500)
@secondsRemaining = 3
@countdownInterval = setInterval @decrementCountdown, 1000
@updateText()
@layer.addChild @dimLayer
if @showsCountdown
@dimLayer.alpha = 0
@showing = true
createjs.Tween.get(@dimLayer).to({alpha: 1}, 500)
@secondsRemaining = 3
@countdownInterval = setInterval @decrementCountdown, 1000
@updateText()
@layer.addChild @dimLayer
else
@endCountdown()
hide: ->
return unless @showing

View file

@ -114,7 +114,7 @@ module.exports = Surface = class Surface extends CocoClass
@screenLayer.addChild new Letterbox canvasWidth: canvasWidth, canvasHeight: canvasHeight
@lankBoss = new LankBoss camera: @camera, webGLStage: @webGLStage, surfaceTextLayer: @surfaceTextLayer, world: @world, thangTypes: @options.thangTypes, choosing: @options.choosing, navigateToSelection: @options.navigateToSelection, showInvisible: @options.showInvisible
@countdownScreen = new CountdownScreen camera: @camera, layer: @screenLayer
@countdownScreen = new CountdownScreen camera: @camera, layer: @screenLayer, showsCountdown: @world.showsCountdown
@playbackOverScreen = new PlaybackOverScreen camera: @camera, layer: @screenLayer
@normalStage.addChildAt @playbackOverScreen.dimLayer, 0 # Put this below the other layers, actually, so we can more easily read text on the screen.
@waitingScreen = new WaitingScreen camera: @camera, layer: @screenLayer

View file

@ -17,6 +17,7 @@ REAL_TIME_BUFFER_MAX = 3 * PROGRESS_UPDATE_INTERVAL
REAL_TIME_BUFFERED_WAIT_INTERVAL = 0.5 * PROGRESS_UPDATE_INTERVAL
REAL_TIME_COUNTDOWN_DELAY = 3000 # match CountdownScreen
ITEM_ORIGINAL = '53e12043b82921000051cdf9'
COUNTDOWN_LEVELS = ['sky-span', 'dueling-grounds', 'cavern-survival'] # TODO: determine flag usage dynamically
module.exports = class World
@className: 'World'
@ -104,7 +105,10 @@ module.exports = class World
@realTimeSpeedFactor = 3
else
@realTimeSpeedFactor = 1
return setTimeout @finishCountdown(continueLaterFn), REAL_TIME_COUNTDOWN_DELAY
if @showsCountdown
return setTimeout @finishCountdown(continueLaterFn), REAL_TIME_COUNTDOWN_DELAY
else
@finishCountdown continueLaterFn
t1 = now()
@t0 ?= t1
@worldLoadStartTime ?= t1
@ -199,6 +203,7 @@ module.exports = class World
loadFromLevel: (level, willSimulate=true) ->
@levelID = level.slug
@showsCountdown = @levelID in COUNTDOWN_LEVELS
@levelComponents = level.levelComponents
@thangTypes = level.thangTypes
@loadScriptsFromLevel level