From d23e75275575140d4b3792af2d29dc84dcec78e6 Mon Sep 17 00:00:00 2001 From: Imperadeiro98 Date: Thu, 25 Sep 2014 12:46:06 +0100 Subject: [PATCH 1/5] Update pt-PT.coffee --- app/locale/pt-PT.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/locale/pt-PT.coffee b/app/locale/pt-PT.coffee index 2372114f6..1aa3df745 100644 --- a/app/locale/pt-PT.coffee +++ b/app/locale/pt-PT.coffee @@ -378,7 +378,7 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription: done: "Concluir" customize_wizard: "Personalizar Feiticeiro" home: "Início" -# skip: "Skip" + skip: "Saltar" game_menu: "Menu do Jogo" guide: "Guia" restart: "Reiniciar" @@ -400,7 +400,7 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription: victory_rate_the_level: "Classifica este nível: " victory_return_to_ladder: "Voltar à Classificação" victory_play_next_level: "Jogar Próximo Nível" -# victory_play_continue: "Continue" + victory_play_continue: "Continuar" victory_go_home: "Ir para o Início" victory_review: "Conta-nos mais!" victory_hour_of_code_done: "Terminaste?" @@ -419,7 +419,7 @@ module.exports = nativeDescription: "Português (Portugal)", englishDescription: tome_select_spell: "Seleciona um Feitiço" tome_select_a_thang: "Seleciona Alguém para " tome_available_spells: "Feitiços Disponíveis" -# tome_your_skills: "Your Skills" + tome_your_skills: "As Tuas Habilidades" hud_continue: "Continuar (shift-espaço)" spell_saved: "Feitiço Guardado" skip_tutorial: "Saltar (esc)" From 9ea24f4c7405f5c058ddbc494217b9384423a2ef Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Thu, 25 Sep 2014 09:48:14 -0700 Subject: [PATCH 2/5] Added a workaround for Surface resize failure on realtime playback end that Maksym had seen. --- app/lib/surface/Surface.coffee | 5 ++++- app/views/play/level/LevelPlaybackView.coffee | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/lib/surface/Surface.coffee b/app/lib/surface/Surface.coffee index d95b37408..3a608a045 100644 --- a/app/lib/surface/Surface.coffee +++ b/app/lib/surface/Surface.coffee @@ -19,6 +19,8 @@ PointChooser = require './PointChooser' RegionChooser = require './RegionChooser' MusicPlayer = require './MusicPlayer' +resizeDelay = 500 # At least as much as $level-resize-transition-time. + module.exports = Surface = class Surface extends CocoClass stage: null @@ -88,7 +90,7 @@ module.exports = Surface = class Surface extends CocoClass @options = _.extend(@options, givenOptions) if givenOptions @initEasel() @initAudio() - @onResize = _.debounce @onResize, 500 # At least as much as $level-resize-transition-time. + @onResize = _.debounce @onResize, resizeDelay $(window).on 'resize', @onResize if @world.ended _.defer => @setWorld @world @@ -545,6 +547,7 @@ module.exports = Surface = class Surface extends CocoClass return unless @realTime @realTime = false @onResize() + _.delay @onResize, resizeDelay + 100 # Do it again just to be double sure that we don't stay zoomed in due to timing problems. @spriteBoss.selfWizardSprite?.toggle true @canvas.removeClass 'flag-color-selected' if @previousCameraZoom diff --git a/app/views/play/level/LevelPlaybackView.coffee b/app/views/play/level/LevelPlaybackView.coffee index e3beaef11..a754d9455 100644 --- a/app/views/play/level/LevelPlaybackView.coffee +++ b/app/views/play/level/LevelPlaybackView.coffee @@ -312,6 +312,7 @@ module.exports = class LevelPlaybackView extends CocoView Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'real-time-playback-end', volume: 1 onStopRealTimePlayback: (e) -> + Backbone.Mediator.publish 'level:set-letterbox', on: false Backbone.Mediator.publish 'playback:real-time-playback-ended', {} onSetDebug: (e) -> From 9fc7fca52877b409ae6c5be9c79d23b49eee6353 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Thu, 25 Sep 2014 10:30:43 -0700 Subject: [PATCH 3/5] Hooked up real-time playback music. --- app/lib/surface/MusicPlayer.coffee | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/lib/surface/MusicPlayer.coffee b/app/lib/surface/MusicPlayer.coffee index 606e7eed6..f1ddada7e 100644 --- a/app/lib/surface/MusicPlayer.coffee +++ b/app/lib/surface/MusicPlayer.coffee @@ -12,6 +12,8 @@ module.exports = class MusicPlayer extends CocoClass subscriptions: 'music-player:play-music': 'onPlayMusic' 'audio-player:loaded': 'onAudioLoaded' + 'playback:real-time-playback-started': 'onRealTimePlaybackStarted' + 'playback:real-time-playback-ended': 'onRealTimePlaybackEnded' constructor: -> super arguments... @@ -62,6 +64,17 @@ module.exports = class MusicPlayer extends CocoClass createjs.Tween.removeTweens(@currentMusic) @currentMusic.volume = if me.get('music') then MUSIC_VOLUME else 0.0 + onRealTimePlaybackStarted: (e) -> + @previousMusic = @currentMusic + trackNumber = _.random 0, 2 + Backbone.Mediator.publish 'music-player:play-music', file: "/music/music_real_time_#{trackNumber}", play: true + + onRealTimePlaybackEnded: (e) -> + @fadeOutCurrentMusic() + if @previousMusic + @currentMusic = @previousMusic + @restartCurrentMusic() + destroy: -> me.off 'change:music', @onMusicSettingChanged, @ super() From 68bb1dc135207a2d0464cd4ad863ecca0ef52fde Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Thu, 25 Sep 2014 11:17:04 -0700 Subject: [PATCH 4/5] Sped up "real-time" playback for the maze levels. --- app/lib/world/world.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/lib/world/world.coffee b/app/lib/world/world.coffee index 43db43ca6..b3c5f6bd4 100644 --- a/app/lib/world/world.coffee +++ b/app/lib/world/world.coffee @@ -98,6 +98,7 @@ module.exports = class World continueLaterFn = => @loadFrames(loadedCallback, errorCallback, loadProgressCallback, preloadedCallback, skipDeferredLoading, loadUntilFrame) unless @destroyed if @realTime and not @countdownFinished + @realTimeSpeedFactor ?= 1 return setTimeout @finishCountdown(continueLaterFn), REAL_TIME_COUNTDOWN_DELAY t1 = now() @t0 ?= t1 @@ -136,18 +137,18 @@ module.exports = class World shouldDelayRealTimeSimulation: (t) -> return false unless @realTime - timeSinceStart = t - @worldLoadStartTime + timeSinceStart = (t - @worldLoadStartTime) * @realTimeSpeedFactor timeLoaded = @frames.length * @dt * 1000 timeBuffered = timeLoaded - timeSinceStart - timeBuffered > REAL_TIME_BUFFER_MAX + timeBuffered > REAL_TIME_BUFFER_MAX * @realTimeSpeedFactor shouldUpdateRealTimePlayback: (t) -> return false unless @realTime return false if @frames.length * @dt is @lastRealTimeUpdate timeLoaded = @frames.length * @dt * 1000 - timeSinceStart = t - @worldLoadStartTime + timeSinceStart = (t - @worldLoadStartTime) * @realTimeSpeedFactor remainingBuffer = @lastRealTimeUpdate * 1000 - timeSinceStart - remainingBuffer < REAL_TIME_BUFFER_MIN + remainingBuffer < REAL_TIME_BUFFER_MIN * @realTimeSpeedFactor shouldContinueLoading: (t1, loadProgressCallback, skipDeferredLoading, continueLaterFn) -> t2 = now() @@ -192,6 +193,8 @@ module.exports = class World @flagHistory.push flagEvent loadFromLevel: (level, willSimulate=true) -> + if level.slug in ['the-first-kithmaze', 'the-second-kithmaze', 'the-final-kithmaze'] + @realTimeSpeedFactor = 3 @levelComponents = level.levelComponents @thangTypes = level.thangTypes @loadSystemsFromLevel level From 2ed6b737c2ede2115d7dda77de2694b2617b7306 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Thu, 25 Sep 2014 11:37:29 -0700 Subject: [PATCH 5/5] Added WorldMapView ambient sounds. --- app/views/play/WorldMapView.coffee | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/views/play/WorldMapView.coffee b/app/views/play/WorldMapView.coffee index 6eae866f1..e9b3428be 100644 --- a/app/views/play/WorldMapView.coffee +++ b/app/views/play/WorldMapView.coffee @@ -33,9 +33,13 @@ module.exports = class WorldMapView extends RootView @listenToOnce @sessions, 'sync', @onSessionsLoaded @getLevelPlayCounts() $(window).on 'resize', @onWindowResize + @playAmbientSound() destroy: -> $(window).off 'resize', @onWindowResize + if ambientSound = @ambientSound + # Doesn't seem to work; stops immediately. + createjs.Tween.get(ambientSound).to({volume: 0.0}, 1500).call -> ambientSound.stop() super() getLevelPlayCounts: -> @@ -156,6 +160,19 @@ module.exports = class WorldMapView extends RootView resultingMarginY = (pageHeight - resultingHeight) / 2 @$el.find('.map').css(width: resultingWidth, height: resultingHeight, 'margin-left': resultingMarginX, 'margin-top': resultingMarginY) + playAmbientSound: -> + return if @ambientSound + terrain = 'Grass' + return unless file = {Dungeon: 'ambient-map-dungeon', Grass: 'ambient-map-grass'}[terrain] + src = "/file/interface/#{file}#{AudioPlayer.ext}" + unless AudioPlayer.getStatus(src)?.loaded + AudioPlayer.preloadSound src + Backbone.Mediator.subscribeOnce 'audio-player:loaded', @playAmbientSound, @ + return + @ambientSound = createjs.Sound.play src, loop: -1, volume: 0.1 + createjs.Tween.get(@ambientSound).to({volume: 1.0}, 1000) + + tutorials = [ { name: 'Rescue Mission'