Do not automatically show victory modal for shareable game dev levels

Students are likely to want to keep working on their level, even if
they beat it.
This commit is contained in:
Scott Erickson 2016-08-08 16:19:44 -07:00
parent d14bea3110
commit ffa840910d
3 changed files with 6 additions and 4 deletions

View file

@ -117,6 +117,7 @@ module.exports =
'level:show-victory': c.object {required: ['showModal']},
showModal: {type: 'boolean'}
manual: { type: 'boolean' }
'level:highlight-dom': c.object {required: ['selector']},
selector: {type: 'string'}

View file

@ -548,9 +548,9 @@ module.exports = class PlayLevelView extends RootView
onDonePressed: -> @showVictory()
onShowVictory: (e) ->
onShowVictory: (e={}) ->
$('#level-done-button').show() unless @level.isType('hero', 'hero-ladder', 'hero-coop', 'course', 'course-ladder', 'game-dev', 'web-dev')
@showVictory() if e.showModal
@showVictory(_.pick(e, 'manual')) if e.showModal
return if @victorySeen
@victorySeen = true
victoryTime = (new Date()) - @loadEndTime
@ -563,8 +563,9 @@ module.exports = class PlayLevelView extends RootView
ls: @session?.get('_id')
application.tracker?.trackTiming victoryTime, 'Level Victory Time', @levelID, @levelID
showVictory: ->
showVictory: (options={}) ->
return if @level.hasLocalChanges() # Don't award achievements when beating level changed in level editor
return if @level.isType('game-dev') and @level.get('shareable') and not options.manual
@endHighlight()
options = {level: @level, supermodel: @supermodel, session: @session, hasReceivedMemoryWarning: @hasReceivedMemoryWarning, courseID: @courseID, courseInstanceID: @courseInstanceID, world: @world}
ModalClass = if @level.isType('hero', 'hero-ladder', 'hero-coop', 'course', 'course-ladder', 'game-dev', 'web-dev') then HeroVictoryModal else VictoryModal

View file

@ -81,7 +81,7 @@ module.exports = class CastButtonView extends CocoView
onDoneButtonClick: (e) ->
return if @options.level.hasLocalChanges() # Don't award achievements when beating level changed in level editor
@options.session.recordScores @world?.scores, @options.level
Backbone.Mediator.publish 'level:show-victory', showModal: true
Backbone.Mediator.publish 'level:show-victory', { showModal: true, manual: true }
onSpellChanged: (e) ->
@updateCastButton()