Merge branch 'master' into production

This commit is contained in:
Nick Winter 2014-10-10 19:20:10 -07:00
commit fb39081380
12 changed files with 163 additions and 95 deletions

View file

@ -29,7 +29,7 @@ module.exports = class LevelBus extends Bus
constructor: -> constructor: ->
super(arguments...) super(arguments...)
@changedSessionProperties = {} @changedSessionProperties = {}
@saveSession = _.debounce(@saveSession, 1000, {maxWait: 5000}) @saveSession = _.debounce(@reallySaveSession, 1000, {maxWait: 5000})
@playerIsIdle = false @playerIsIdle = false
init: -> init: ->
@ -190,7 +190,7 @@ module.exports = class LevelBus extends Bus
state.complete = true state.complete = true
@session.set('state', state) @session.set('state', state)
@changedSessionProperties.state = true @changedSessionProperties.state = true
@saveSession() @reallySaveSession() # Make sure it saves right away; don't debounce it.
onNewGoalStates: ({goalStates})-> onNewGoalStates: ({goalStates})->
state = @session.get 'state' state = @session.get 'state'
@ -232,7 +232,8 @@ module.exports = class LevelBus extends Bus
@changedSessionProperties.permissions = true @changedSessionProperties.permissions = true
@saveSession() @saveSession()
saveSession: -> # Debounced as saveSession
reallySaveSession: ->
return if _.isEmpty @changedSessionProperties return if _.isEmpty @changedSessionProperties
# don't let peeking admins mess with the session accidentally # don't let peeking admins mess with the session accidentally
return unless @session.get('multiplayer') or @session.get('creator') is me.id return unless @session.get('multiplayer') or @session.get('creator') is me.id

View file

@ -8,7 +8,7 @@ module.exports.createAetherOptions = (options) ->
aetherOptions = aetherOptions =
functionName: options.functionName functionName: options.functionName
protectAPI: not options.skipProtectAPI protectAPI: not options.skipProtectAPI
includeFlow: options.includeFlow includeFlow: Boolean options.includeFlow
yieldConditionally: options.functionName is 'plan' yieldConditionally: options.functionName is 'plan'
simpleLoops: true simpleLoops: true
globals: ['Vector', '_'] globals: ['Vector', '_']
@ -47,3 +47,4 @@ functionParameters =
chooseAction: [] chooseAction: []
plan: [] plan: []
initializeCentroids: [] initializeCentroids: []
update: []

View file

@ -81,6 +81,7 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass
#- Layer ordering #- Layer ordering
updateLayerOrder: -> updateLayerOrder: ->
return if @destroyed
@container.sortChildren @layerOrderComparator @container.sortChildren @layerOrderComparator
layerOrderComparator: (a, b) -> layerOrderComparator: (a, b) ->

View file

@ -58,14 +58,14 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis
hours_played: "horas jugadas" # Hover over a level on /play hours_played: "horas jugadas" # Hover over a level on /play
# items: "Items" # Tooltip on item shop button from /play # items: "Items" # Tooltip on item shop button from /play
# heroes: "Heroes" # Tooltip on hero shop button from /play # heroes: "Heroes" # Tooltip on hero shop button from /play
# achievements: "Achievements" # Tooltip on achievement list button from /play achievements: "Logros" # Tooltip on achievement list button from /play
# account: "Account" # Tooltip on account button from /play account: "Cuenta" # Tooltip on account button from /play
# settings: "Settings" # Tooltip on settings button from /play # settings: "Settings" # Tooltip on settings button from /play
# next: "Next" # Go from choose hero to choose inventory before playing a level next: "Siguiente Heroe" # Go from choose hero to choose inventory before playing a level
# change_hero: "Change Hero" # Go back from choose inventory to choose hero change_hero: "Seleccionar Heroe" # Go back from choose inventory to choose hero
# choose_inventory: "Equip Items" # choose_inventory: "Equip Items"
# older_campaigns: "Older Campaigns" older_campaigns: "Campañas Anteriores"
# anonymous: "Anonymous Player" anonymous: "Jugador Anonimo"
level_difficulty: "Dificultad: " level_difficulty: "Dificultad: "
campaign_beginner: "Campaña de Principiante" campaign_beginner: "Campaña de Principiante"
choose_your_level: "Elige tu nivel" # The rest of this section is the old play view at /play-old and isn't very important. choose_your_level: "Elige tu nivel" # The rest of this section is the old play view at /play-old and isn't very important.
@ -182,12 +182,12 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis
play_level: play_level:
done: "Hecho" done: "Hecho"
home: "Inicio" home: "Inicio"
# skip: "Skip" skip: "Saltar"
game_menu: "Menu del Juego" game_menu: "Menu del Juego"
guide: "Guía" guide: "Guía"
restart: "Reiniciar" restart: "Reiniciar"
goals: "Objetivos" goals: "Objetivos"
# goal: "Goal" goal: "Objetivo Principal"
success: "Exito!" success: "Exito!"
incomplete: "Incompleto" incomplete: "Incompleto"
timed_out: "Te has quedado sin tiempo" timed_out: "Te has quedado sin tiempo"
@ -204,7 +204,7 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis
victory_rate_the_level: "Puntúa este nivel: " # Only in old-style levels. victory_rate_the_level: "Puntúa este nivel: " # Only in old-style levels.
victory_return_to_ladder: "Volver a Clasificación" victory_return_to_ladder: "Volver a Clasificación"
victory_play_next_level: "Jugar el siguiente nivel" # Only in old-style levels. victory_play_next_level: "Jugar el siguiente nivel" # Only in old-style levels.
# victory_play_continue: "Continue" victory_play_continue: "Continuar"
victory_go_home: "Ir a Inicio" # Only in old-style levels. victory_go_home: "Ir a Inicio" # Only in old-style levels.
victory_review: "¡Cuéntanos más!" # Only in old-style levels. victory_review: "¡Cuéntanos más!" # Only in old-style levels.
victory_hour_of_code_done: "¿Ya terminaste?" victory_hour_of_code_done: "¿Ya terminaste?"
@ -220,18 +220,18 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis
# tome_cast_button_running: "Running" # tome_cast_button_running: "Running"
# tome_cast_button_ran: "Ran" # tome_cast_button_ran: "Ran"
# tome_submit_button: "Submit" # tome_submit_button: "Submit"
# tome_reload_method: "Reload original code for this method" # Title text for individual method reload button. tome_reload_method: "Recargcar código original para este método" # Title text for individual method reload button.
# tome_select_method: "Select a Method" tome_select_method: "Seleccionar método"
# tome_see_all_methods: "See all methods you can edit" # Title text for method list selector (shown when there are multiple programmable methdos). tome_see_all_methods: "Métodos que pueden ser editados" # Title text for method list selector (shown when there are multiple programmable methdos).
tome_select_a_thang: "Selecciona a alguien para " tome_select_a_thang: "Selecciona a alguien para "
tome_available_spells: "Hechizos disponibles" tome_available_spells: "Hechizos disponibles"
# tome_your_skills: "Your Skills" tome_your_skills: "Tus Habilidades"
hud_continue: "Continuar (pulsa Shift+Space)" hud_continue: "Continuar (pulsa Shift+Space)"
spell_saved: "Hechizo guardado" spell_saved: "Hechizo guardado"
skip_tutorial: "Saltar (esc)" skip_tutorial: "Saltar (esc)"
keyboard_shortcuts: "Atajos de teclado" keyboard_shortcuts: "Atajos de teclado"
loading_ready: "¡Listo!" loading_ready: "¡Listo!"
# loading_start: "Start Level" loading_start: "Iniciar Nivel"
time_current: "Ahora:" time_current: "Ahora:"
time_total: "Máx:" time_total: "Máx:"
time_goto: "Ir a:" time_goto: "Ir a:"
@ -266,7 +266,7 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis
tip_hardware_problem: "P: Cuantos programadores hacen falta para cambiar una bombilla? R: Ninguno, es un problema de hardware." tip_hardware_problem: "P: Cuantos programadores hacen falta para cambiar una bombilla? R: Ninguno, es un problema de hardware."
# tip_hofstadters_law: "Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law." # tip_hofstadters_law: "Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law."
# tip_premature_optimization: "Premature optimization is the root of all evil. - Donald Knuth" # tip_premature_optimization: "Premature optimization is the root of all evil. - Donald Knuth"
# tip_brute_force: "When in doubt, use brute force. - Ken Thompson" tip_brute_force: "Cuando haya dudas, usa la fuerza bruta. - Ken Thompson"
customize_wizard: "Personalizar Mago" customize_wizard: "Personalizar Mago"
game_menu: game_menu:
@ -286,14 +286,14 @@ module.exports = nativeDescription: "español (ES)", englishDescription: "Spanis
# inventory: # inventory:
# choose_inventory: "Equip Items" # choose_inventory: "Equip Items"
# choose_hero: choose_hero:
# choose_hero: "Choose Your Hero" choose_hero: "Selecciona tu Heroe"
# programming_language: "Programming Language" programming_language: "Lenguaje de Programación"
# programming_language_description: "Which programming language do you want to use?" programming_language_description: "¿Qué lenguaje de programación deseas usar?"
# status: "Status" status: "Estado"
# weapons: "Weapons" weapons: "Armas"
# health: "Health" health: "Salud"
# speed: "Speed" speed: "Velocidad"
save_load: save_load:
granularity_saved_games: "Salvado" granularity_saved_games: "Salvado"

View file

@ -28,3 +28,5 @@ module.exports =
'world:attacked-when-out-of-range': c.object {required: ['thang']}, 'world:attacked-when-out-of-range': c.object {required: ['thang']},
replacedNoteChain: {type: 'array'} replacedNoteChain: {type: 'array'}
thang: {type: 'object'} thang: {type: 'object'}
'world:custom-script-trigger': {type: 'object'}

View file

@ -68,6 +68,10 @@ $stashWidth: $totalWidth - $equippedWidth - $stashMargin
border-color: #28f border-color: #28f
@include box-shadow(0 0 10px #28f) @include box-shadow(0 0 10px #28f)
&.should-equip
background-color: #8fa
outline: 2px solid #8af
&.droppable &.droppable
outline: 2px solid blue outline: 2px solid blue
@ -189,6 +193,14 @@ $stashWidth: $totalWidth - $equippedWidth - $stashMargin
.item-info:after .item-info:after
content: ' (available)' content: ' (available)'
&.should-equip
background-color: #8fa
outline: 2px solid #8af
.item-info:after
content: ' (drag to equip)'
font-weight: bold
&.equipped &.equipped
background-color: #ff5 background-color: #ff5

View file

@ -14,9 +14,9 @@ block modal-footer-content
if readyToRank if readyToRank
.ladder-submission-view .ladder-submission-view
else if level.get('type') === 'ladder' else if level.get('type') === 'ladder'
a.btn.btn-primary(href="/play/ladder/#{level.get('slug')}#my-matches", data-dismiss="modal", data-i18n="play_level.victory_go_ladder") Return to Ladder a.btn.btn-primary(href="/play/ladder/#{level.get('slug')}#my-matches", data-dismiss="modal", data-i18n="play_level.victory_return_to_ladder") Return to Ladder
else if level.get('type', true) === 'hero' else if level.get('type', true) === 'hero'
a.btn.btn-success.world-map-button(href="/play-hero", data-dismiss="modal", data-i18n="play_level.victory_continue") Continue a.btn.btn-success.world-map-button(href="/play-hero", data-dismiss="modal", data-i18n="play_level.victory_play_continue") Continue
else if hasNextLevel else if hasNextLevel
button.btn.btn-success.next-level-button(data-dismiss="modal", data-i18n="play_level.victory_play_next_level") Play Next Level button.btn.btn-success.next-level-button(data-dismiss="modal", data-i18n="play_level.victory_play_next_level") Play Next Level
else else

View file

@ -29,7 +29,7 @@ module.exports = class InventoryView extends CocoView
@items = new CocoCollection([], {model: ThangType}) @items = new CocoCollection([], {model: ThangType})
@equipment = options.equipment or @options.session?.get('heroConfig')?.inventory or me.get('heroConfig')?.inventory or {} @equipment = options.equipment or @options.session?.get('heroConfig')?.inventory or me.get('heroConfig')?.inventory or {}
@equipment = $.extend true, {}, @equipment @equipment = $.extend true, {}, @equipment
@assignLevelEquipment() @requireLevelEquipment()
@items.url = '/db/thang.type?view=items&project=name,components,original,rasterIcon' @items.url = '/db/thang.type?view=items&project=name,components,original,rasterIcon'
@supermodel.loadCollection(@items, 'items') @supermodel.loadCollection(@items, 'items')
@ -103,25 +103,44 @@ module.exports = class InventoryView extends CocoView
for itemSlot in @$el.find '.item-slot' for itemSlot in @$el.find '.item-slot'
slot = $(itemSlot).data 'slot' slot = $(itemSlot).data 'slot'
#$(itemSlot).find('.placeholder').css('background-image', "url(/images/pages/game-menu/slot-#{slot}.png)") do (slot, itemSlot) =>
do (slot) =>
$(itemSlot).droppable $(itemSlot).droppable
drop: (e, ui) => @onAvailableItemDoubleClick() drop: (e, ui) => @onAvailableItemDoubleClick()
accept: (el) -> $(el).parent().hasClass slot accept: (el) -> $(el).parent().hasClass slot
activeClass: 'droppable' activeClass: 'droppable'
hoverClass: 'droppable-hover' hoverClass: 'droppable-hover'
tolerance: 'touch' tolerance: 'touch'
@makeEquippedSlotDraggable $(itemSlot)
@$el.find('#selected-items').hide() # Hide until one is selected @$el.find('#selected-items').hide() # Hide until one is selected
@delegateEvents() @delegateEvents()
if @selectedHero and not @startedLoadingFirstHero if @selectedHero and not @startedLoadingFirstHero
@loadHero() @loadHero()
@requireLevelEquipment()
afterInsert: -> afterInsert: ->
super() super()
@canvasWidth = @$el.find('canvas').innerWidth() @canvasWidth = @$el.find('canvas').innerWidth()
@canvasHeight = @$el.find('canvas').innerHeight() @canvasHeight = @$el.find('canvas').innerHeight()
@inserted = true
makeEquippedSlotDraggable: (slot) ->
unequip = => @unequipItemFromSlot slot
shouldStayEquippedWhenDropped = (isValidDrop) ->
pos = $(@).position()
revert = Math.abs(pos.left) < $(@).outerWidth() and Math.abs(pos.top) < $(@).outerHeight()
unequip() if not revert
revert
# TODO: figure out how to make this actually above the available items list (the .ui-draggable-helper img is still inside .item-view and so underlaps...)
$(slot).find('img').draggable
revert: shouldStayEquippedWhenDropped
appendTo: @$el
cursorAt: {left: 35.5, top: 35.5}
revertDuration: 200
distance: 10
scroll: false
zIndex: 100
clearSelection: -> clearSelection: ->
@$el.find('.item-slot.selected').removeClass 'selected' @$el.find('.item-slot.selected').removeClass 'selected'
@ -197,7 +216,10 @@ module.exports = class InventoryView extends CocoView
for el in @$el.find('#available-equipment .list-group-item') for el in @$el.find('#available-equipment .list-group-item')
itemID = $(el).find('.item-view').data('item-id') itemID = $(el).find('.item-view').data('item-id')
if itemID is itemIDToUnequip if itemID is itemIDToUnequip
return $(el).removeClass('equipped') unequipped = $(el).removeClass('equipped')
break
@requireLevelEquipment() if unequipped
return unequipped
equipSelectedItemToSlot: (slot) -> equipSelectedItemToSlot: (slot) ->
selectedItemContainer = @getSelectedAvailableItemContainer() selectedItemContainer = @getSelectedAvailableItemContainer()
@ -207,6 +229,8 @@ module.exports = class InventoryView extends CocoView
slotContainer.html(newItemHTML) slotContainer.html(newItemHTML)
slotContainer.find('.item-view').data('item-id', selectedItemContainer.find('.item-view').data('item-id')) slotContainer.find('.item-view').data('item-id', selectedItemContainer.find('.item-view').data('item-id'))
@$el.find('.list-group-item').removeClass('active') @$el.find('.list-group-item').removeClass('active')
@makeEquippedSlotDraggable slot
@requireLevelEquipment()
onSelectionChanged: -> onSelectionChanged: ->
@$el.find('.item-slot').show() @$el.find('.item-slot').show()
@ -290,7 +314,7 @@ module.exports = class InventoryView extends CocoView
config[slotName] = item.get('original') config[slotName] = item.get('original')
config config
assignLevelEquipment: -> requireLevelEquipment: ->
# This is temporary, until we have a more general way of awarding items and configuring needed/locked items per level. # This is temporary, until we have a more general way of awarding items and configuring needed/locked items per level.
gear = gear =
'simple-boots': '53e237bf53457600003e3f05' 'simple-boots': '53e237bf53457600003e3f05'
@ -306,17 +330,37 @@ module.exports = class InventoryView extends CocoView
'shadow-guard': {feet: 'simple-boots'} 'shadow-guard': {feet: 'simple-boots'}
'true-names': {feet: 'simple-boots', 'right-hand': 'longsword'} 'true-names': {feet: 'simple-boots', 'right-hand': 'longsword'}
'the-raised-sword': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic'} 'the-raised-sword': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic'}
'the-first-kithmaze': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i'} 'the-first-kithmaze': {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
'the-second-kithmaze': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i'} 'the-second-kithmaze': {feet: 'simple-boots', 'programming-book': 'programmaticon-i'}
'new-sight': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i'} 'new-sight': {'right-hand': 'longsword', 'programming-book': 'programmaticon-i'}
'lowly-kithmen': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'} 'lowly-kithmen': {feet: 'simple-boots', 'right-hand': 'longsword', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
'a-bolt-in-the-dark': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'} 'a-bolt-in-the-dark': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', eyes: 'crude-glasses'}
'the-final-kithmaze': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'} 'the-final-kithmaze': {feet: 'simple-boots', 'right-hand': 'longsword', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'}
'kithgard-gates': {feet: 'simple-boots', 'right-hand': 'builders-hammer', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'} 'kithgard-gates': {feet: 'simple-boots', 'right-hand': 'builders-hammer'}
'defence-of-plainswood': {feet: 'simple-boots', 'right-hand': 'builders-hammer', torso: 'leather-tunic', 'programming-book': 'programmaticon-i', eyes: 'crude-glasses'} 'defence-of-plainswood': {feet: 'simple-boots', 'right-hand': 'builders-hammer'}
# TODO: figure out leather boots for plainswood (or next one?)
return unless necessaryGear = gearByLevel[@options.levelID] return unless necessaryGear = gearByLevel[@options.levelID]
for slot, item of necessaryGear ? {} if @inserted
@equipment[slot] ?= gear[item] if @supermodel.finished()
equipment = @getCurrentEquipmentConfig() # Make sure @equipment is updated
else
equipment = @equipment
hadRequired = @remainingRequiredEquipment?.length
@remainingRequiredEquipment = []
@$el.find('.should-equip').removeClass('should-equip')
inWorldMap = $('#world-map-view').length
for slot, item of necessaryGear
continue if item is 'leather-tunic' and inWorldMap # Don't tell them they need it until they need it in the level
continue if equipment[slot] and not (item is 'builders-hammer' and @equipment[slot] is gear.longsword)
availableSlotSelector = "#available-equipment li[data-item-id='#{gear[item]}']"
@highlightElement availableSlotSelector, delay: 500, sides: ['right'], rotation: Math.PI / 2
@$el.find(availableSlotSelector).addClass 'should-equip'
@$el.find("#equipped div[data-slot='#{slot}']").addClass 'should-equip'
@remainingRequiredEquipment.push slot: slot, item: gear[item]
if hadRequired and not @remainingRequiredEquipment.length
@endHighlight()
@highlightElement (if inWorldMap then '#play-level-button' else '.overlaid-close-button'), duration: 5000
$('#play-level-button').prop('disabled', @remainingRequiredEquipment.length > 0)
# Restrict available items to those that would be available by this item. # Restrict available items to those that would be available by this item.
@allowedItems = [] @allowedItems = []
@ -370,7 +414,9 @@ module.exports = class InventoryView extends CocoView
onShown: -> onShown: ->
# Called when we switch tabs to this within the modal # Called when we switch tabs to this within the modal
@requireLevelEquipment()
@loadHero() @loadHero()
onHidden: -> onHidden: ->
# Called when the modal itself is dismissed # Called when the modal itself is dismissed
@endHighlight()

View file

@ -60,6 +60,7 @@ module.exports = class CocoView extends Backbone.View
view.destroy() for id, view of @subviews view.destroy() for id, view of @subviews
$('#modal-wrapper .modal').off 'hidden.bs.modal', @modalClosed $('#modal-wrapper .modal').off 'hidden.bs.modal', @modalClosed
@endHighlight() @endHighlight()
@getPointer(false).remove()
@[key] = undefined for key, value of @ @[key] = undefined for key, value of @
@destroyed = true @destroyed = true
@off = doNothing @off = doNothing
@ -354,16 +355,17 @@ module.exports = class CocoView extends Backbone.View
setTimeout (=> $pointer.css transition: 'all 0.4s ease-in', transform: "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance}px)"), 800 setTimeout (=> $pointer.css transition: 'all 0.4s ease-in', transform: "rotate(#{@pointerRotation}rad) translate(-3px, #{@pointerRadialDistance}px)"), 800
endHighlight: -> endHighlight: ->
@getPointer().css('opacity', 0.0) @getPointer(false).css('opacity', 0.0)
clearInterval @pointerInterval clearInterval @pointerInterval
clearTimeout @pointerDelayTimeout clearTimeout @pointerDelayTimeout
clearTimeout @pointerDurationTimeout clearTimeout @pointerDurationTimeout
@pointerInterval = @pointerDelayTimeout = @pointerDurationTimeout = null @pointerInterval = @pointerDelayTimeout = @pointerDurationTimeout = null
getPointer: -> getPointer: (add=true) ->
return $pointer if ($pointer = @$el.find('.highlight-pointer')) and $pointer.length return $pointer if ($pointer = $(".highlight-pointer[data-cid='#{@cid}']")) and ($pointer.length or not add)
$pointer = $('<img src="/images/level/pointer.png" class="highlight-pointer">') $pointer = $("<img src='/images/level/pointer.png' class='highlight-pointer' data-cid='#{@cid}'>")
@$el.append($pointer) $pointer.css('z-index', 1040) if @$el.parents('#modal-wrapper').length
$('body').append($pointer)
$pointer $pointer
# Utilities # Utilities

View file

@ -430,7 +430,7 @@ module.exports = class PlayLevelView extends RootView
viewArgs: [{supermodel: @supermodel, autoUnveil: true}, @levelID] viewArgs: [{supermodel: @supermodel, autoUnveil: true}, @levelID]
} }
onWindowResize: (e) -> @endHighlight() onWindowResize: (e) => @endHighlight()
onDisableControls: (e) -> onDisableControls: (e) ->
return if e.controls and not ('level' in e.controls) return if e.controls and not ('level' in e.controls)

View file

@ -656,6 +656,8 @@ module.exports = class SpellView extends CocoView
session.addGutterDecoration index, 'comment-line' session.addGutterDecoration index, 'comment-line'
onAnnotationClick: -> onAnnotationClick: ->
# @ is the gutter element
msg = "Edit line #{$(@).index() + 1} to fix it."
alertBox = $("<div class='alert alert-info fade in'>#{msg}</div>") alertBox = $("<div class='alert alert-info fade in'>#{msg}</div>")
offset = $(@).offset() offset = $(@).offset()
offset.left -= 162 # default width of the Bootstrap alert here offset.left -= 162 # default width of the Bootstrap alert here

View file

@ -64,7 +64,7 @@ module.exports = class PlayLevelModal extends ModalView
updateConfig: (callback, skipSessionSave) -> updateConfig: (callback, skipSessionSave) ->
sessionHeroConfig = @options.session.get('heroConfig') ? {} sessionHeroConfig = @options.session.get('heroConfig') ? {}
lastHeroConfig = me.get('heroConfig') ? {} lastHeroConfig = me.get('heroConfig') ? {}
thangType = @subviews.choose_hero_view.selectedHero.get 'original' thangType = @subviews.choose_hero_view.selectedHero?.get('original') ? sessionHeroConfig.thangType ? lastHeroConfig.thangType
inventory = @subviews.inventory_view.getCurrentEquipmentConfig() inventory = @subviews.inventory_view.getCurrentEquipmentConfig()
patchSession = patchMe = false patchSession = patchMe = false
props = thangType: thangType, inventory: inventory props = thangType: thangType, inventory: inventory
@ -101,6 +101,7 @@ module.exports = class PlayLevelModal extends ModalView
@chooseHeroView.onShown() @chooseHeroView.onShown()
onClickPlayLevel: (e) -> onClickPlayLevel: (e) ->
return if @$el.find('#play-level-button').prop 'disabled'
@showLoading() @showLoading()
@updateConfig => @updateConfig =>
@navigatingToPlay = true @navigatingToPlay = true