From e109cbbbdce9b95571e665366d9988fa52216737 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 23 Sep 2014 11:39:56 -0700 Subject: [PATCH] Hid world map level icons for now. Hid play counts when fewer than 20 players. Disabled Zatanna for now until it can stop doing this.this.moveRight()(). Disabled hover debugger for new hero levels for now. Fixed bug with victory modal not allowing replay of completed non-hero levels. --- app/templates/play/world-map-view.jade | 10 ++++---- app/views/play/WorldMapView.coffee | 2 +- app/views/play/level/LevelLoadingView.coffee | 5 +++- app/views/play/level/PlayLevelView.coffee | 2 +- app/views/play/level/tome/Spell.coffee | 2 +- app/views/play/level/tome/SpellView.coffee | 26 +++++++++++--------- app/views/play/level/tome/TomeView.coffee | 1 + 7 files changed, 27 insertions(+), 21 deletions(-) diff --git a/app/templates/play/world-map-view.jade b/app/templates/play/world-map-view.jade index 951c4f30c..81ada39d8 100644 --- a/app/templates/play/world-map-view.jade +++ b/app/templates/play/world-map-view.jade @@ -10,10 +10,10 @@ a(href=level.type == 'hero' ? '#' : level.disabled ? "/play" : "/play/#{level.levelPath || 'level'}/#{level.id}", disabled=level.disabled, data-level-id=level.id, data-level-path=level.levelPath || 'level', data-level-name=level.name) div(style="left: #{level.x}%; bottom: #{level.y}%", class="level-shadow" + (next ? " next" : "") + " " + levelStatusMap[level.id] || "") .level-info-container(data-level-id=level.id) - if level.image - img.level-image(src="#{level.image}", alt="#{level.name}") - else - img.level-image(src="/images/generic-icon.png", alt="#{level.name}") + //if level.image + // img.level-image(src="#{level.image}", alt="#{level.name}") + //else + // img.level-image(src="/images/generic-icon.png", alt="#{level.name}") div(class="level-info " + (levelStatusMap[level.id] || "")) h3= level.name + (level.disabled ? " (Coming soon!)" : "") .level-description= level.description @@ -21,7 +21,7 @@ each i in Array(level.difficulty) i.icon-star - var playCount = levelPlayCountMap[level.id] - if playCount + if playCount && playCount > 20 div span.spr #{playCount.sessions} span(data-i18n="play.players") players diff --git a/app/views/play/WorldMapView.coffee b/app/views/play/WorldMapView.coffee index 13bed4dcd..7c7899abe 100644 --- a/app/views/play/WorldMapView.coffee +++ b/app/views/play/WorldMapView.coffee @@ -574,7 +574,7 @@ hero = [ { name: 'The Final Kithmaze' type: 'hero' - difficulty: 2 + difficulty: 1 id: 'the-final-kithmaze' image: '/file/db/level/526bda3fe79aefde2a003e36/mobile_artillery_icon.png' description: 'To escape you must find your way through an Elder Kithman\'s maze.' diff --git a/app/views/play/level/LevelLoadingView.coffee b/app/views/play/level/LevelLoadingView.coffee index 73aa77011..4f2ad5cea 100644 --- a/app/views/play/level/LevelLoadingView.coffee +++ b/app/views/play/level/LevelLoadingView.coffee @@ -49,11 +49,14 @@ module.exports = class LevelLoadingView extends CocoView startUnveiling: (e) -> Backbone.Mediator.publish 'level:loading-view-unveiling', {} + _.delay @onClickStartLevel, 1000 # If they never mouse-up for the click (or a modal shows up and interrupts the click), do it anyway. - onClickStartLevel: (e) -> + onClickStartLevel: (e) => + return if @destroyed @unveil() unveil: -> + return if @$el.hasClass 'unveiled' @$el.addClass 'unveiled' loadingDetails = @$el.find('.loading-details') duration = parseFloat loadingDetails.css 'transition-duration' diff --git a/app/views/play/level/PlayLevelView.coffee b/app/views/play/level/PlayLevelView.coffee index 5a72ed7c8..7c0857ee4 100644 --- a/app/views/play/level/PlayLevelView.coffee +++ b/app/views/play/level/PlayLevelView.coffee @@ -329,7 +329,7 @@ module.exports = class PlayLevelView extends RootView onLevelStarted: -> return unless @surface? @loadingView.showReady() - if window.currentModal and not window.currentModal.destroyed + if window.currentModal and not window.currentModal.destroyed and window.currentModal.constructor isnt VictoryModal return Backbone.Mediator.subscribeOnce 'modal:closed', @onLevelStarted, @ @surface.showLevel() if @otherSession and @level.get('type', true) isnt 'hero' diff --git a/app/views/play/level/tome/Spell.coffee b/app/views/play/level/tome/Spell.coffee index 7c0da531a..be55f5c35 100644 --- a/app/views/play/level/tome/Spell.coffee +++ b/app/views/play/level/tome/Spell.coffee @@ -41,7 +41,7 @@ module.exports = class Spell @source = sessionSource @thangs = {} if @canRead() # We can avoid creating these views if we'll never use them. - @view = new SpellView {spell: @, session: @session, worker: @worker} + @view = new SpellView {spell: @, level: options.level, session: @session, worker: @worker} @view.render() # Get it ready and code loaded in advance @tabView = new SpellListTabEntryView spell: @, supermodel: @supermodel, language: @language @tabView.render() diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index 8f71c0c02..aba6881cb 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -100,11 +100,11 @@ module.exports = class SpellView extends CocoView @toggleControls null, @writable @aceSession.selection.on 'changeCursor', @onCursorActivity $(@ace.container).find('.ace_gutter').on 'click', '.ace_error, .ace_warning, .ace_info', @onAnnotationClick - @zatanna = new Zatanna @ace, - - liveCompletion: aceConfig.liveCompletion ? true - completers: - keywords: false + # TODO: restore Zatanna when it totally stops the this.this.moveRight()(); problem + #@zatanna = new Zatanna @ace, + # liveCompletion: aceConfig.liveCompletion ? true + # completers: + # keywords: false createACEShortcuts: -> @aceCommands = aceCommands = [] @@ -192,6 +192,7 @@ module.exports = class SpellView extends CocoView @ace.clearSelection() addZatannaSnippets: (e) -> + return unless @zatanna snippetEntries = [] for owner, props of e.propGroups for prop in props @@ -250,6 +251,7 @@ module.exports = class SpellView extends CocoView @createToolbarView() createDebugView: -> + return if @options.level.get('type', true) is 'hero' # We'll turn this on later, maybe, but not yet. @debugView = new SpellDebugView ace: @ace, thang: @thang, spell:@spell @$el.append @debugView.render().$el.hide() @@ -258,7 +260,7 @@ module.exports = class SpellView extends CocoView @$el.append @toolbarView.render().$el onMouseOut: (e) -> - @debugView.onMouseOut e + @debugView?.onMouseOut e getSource: -> @ace.getValue() # could also do @firepad.getText() @@ -269,7 +271,7 @@ module.exports = class SpellView extends CocoView @thang = thang @spellThang = @spell.thangs[@thang.id] @createDebugView() unless @debugView - @debugView.thang = @thang + @debugView?.thang = @thang @toolbarView?.toggleFlow false @updateAether false, false # @addZatannaSnippets() @@ -589,7 +591,7 @@ module.exports = class SpellView extends CocoView @decoratedGutter[row] = '' if not executed.length or (@spell.name is 'plan' and @spellThang.castAether.metrics.statementsExecuted < 20) @toolbarView?.toggleFlow false - @debugView.setVariableStates {} + @debugView?.setVariableStates {} return lastExecuted = _.last executed @toolbarView?.toggleFlow true @@ -606,7 +608,7 @@ module.exports = class SpellView extends CocoView marked[start.row] = true markerType = 'fullLine' else - @debugView.setVariableStates state.variables + @debugView?.setVariableStates state.variables gotVariableStates = true markerType = 'text' markerRange = new Range start.row, start.col, end.row, end.col @@ -618,7 +620,7 @@ module.exports = class SpellView extends CocoView @aceSession.removeGutterDecoration start.row, @decoratedGutter[start.row] if @decoratedGutter[start.row] isnt '' @aceSession.addGutterDecoration start.row, clazz @decoratedGutter[start.row] = clazz - @debugView.setVariableStates {} unless gotVariableStates + @debugView?.setVariableStates {} unless gotVariableStates null highlightComments: -> @@ -676,12 +678,12 @@ module.exports = class SpellView extends CocoView @ace.setDisplayIndentGuides aceConfig.indentGuides # default false @ace.setShowInvisibles aceConfig.invisibles # default false @ace.setKeyboardHandler @keyBindings[aceConfig.keyBindings ? 'default'] - @zatanna.set 'liveCompletion', (aceConfig.liveCompletion ? false) + @zatanna?.set 'liveCompletion', (aceConfig.liveCompletion ? false) onChangeLanguage: (e) -> return unless @spell.canWrite() @aceSession.setMode @editModes[e.language] - # @zatanna.set 'language', @editModes[e.language].substr('ace/mode/') + # @zatanna?.set 'language', @editModes[e.language].substr('ace/mode/') wasDefault = @getSource() is @spell.originalSource @spell.setLanguage e.language @reloadCode true if wasDefault diff --git a/app/views/play/level/tome/TomeView.coffee b/app/views/play/level/tome/TomeView.coffee index add1f18b3..f79f4edab 100644 --- a/app/views/play/level/tome/TomeView.coffee +++ b/app/views/play/level/tome/TomeView.coffee @@ -137,6 +137,7 @@ module.exports = class TomeView extends CocoView spectateView: @options.spectateView spectateOpponentCodeLanguage: @options.spectateOpponentCodeLanguage levelID: @options.levelID + level: @options.level for thangID, spellKeys of @thangSpells thang = world.getThangByID thangID