Show old difficulty instead of new difficulty when observing a replayable success. This will likely need revisiting when we are using observing for more than just leaderboards.

This commit is contained in:
Nick Winter 2015-02-04 11:31:43 -08:00
parent 18202b6852
commit 46ef93190a
4 changed files with 10 additions and 2 deletions

View file

@ -32,6 +32,7 @@ module.exports = class LevelLoader extends CocoClass
@team = options.team
@headless = options.headless
@spectateMode = options.spectateMode ? false
@observing = options.observing
@worldNecessities = []
@listenTo @supermodel, 'resource-loaded', @onWorldNecessityLoaded
@ -389,6 +390,8 @@ module.exports = class LevelLoader extends CocoClass
@world.submissionCount = @session?.get('state')?.submissionCount ? 0
@world.flagHistory = @session?.get('state')?.flagHistory ? []
@world.difficulty = @session?.get('state')?.difficulty ? 0
if @observing
@world.difficulty = Math.max 0, @world.difficulty - 1 # Show the difficulty they won, not the next one.
serializedLevel = @level.serialize(@supermodel, @session, @opponentSession)
@world.loadFromLevel serializedLevel, false
console.log 'World has been initialized from level loader.'

View file

@ -64,6 +64,8 @@ module.exports = class ControlBarView extends CocoView
c.multiplayerStatus = @multiplayerStatusManager?.status
if @level.get 'replayable'
c.levelDifficulty = @session.get('state')?.difficulty ? 0
if @observing
c.levelDifficulty = Math.max 0, c.levelDifficulty - 1 # Show the difficulty they won, not the next one.
c.difficultyTitle = "#{$.i18n.t 'play.level_difficulty'}#{c.levelDifficulty}"
@lastDifficulty = c.levelDifficulty
c.spectateGame = @spectateGame

View file

@ -127,7 +127,7 @@ module.exports = class PlayLevelView extends RootView
load: ->
@loadStartTime = new Date()
@god = new God debugWorker: true
@levelLoader = new LevelLoader supermodel: @supermodel, levelID: @levelID, sessionID: @sessionID, opponentSessionID: @opponentSessionID, team: @getQueryVariable('team')
@levelLoader = new LevelLoader supermodel: @supermodel, levelID: @levelID, sessionID: @sessionID, opponentSessionID: @opponentSessionID, team: @getQueryVariable('team'), observing: @observing
@listenToOnce @levelLoader, 'world-necessities-loaded', @onWorldNecessitiesLoaded
trackLevelLoadEnd: ->

View file

@ -166,7 +166,10 @@ module.exports = class TomeView extends CocoView
sessionState.flagHistory = _.filter sessionState.flagHistory ? [], (event) => event.team isnt (@options.session.get('team') ? 'humans')
sessionState.lastUnsuccessfulSubmissionTime = new Date() if @options.level.get 'replayable'
@options.session.set 'state', sessionState
Backbone.Mediator.publish 'tome:cast-spells', spells: @spells, preload: preload, realTime: realTime, submissionCount: sessionState.submissionCount ? 0, flagHistory: sessionState.flagHistory ? [], difficulty: sessionState.difficulty ? 0
difficulty = sessionState.difficulty ? 0
if @options.observing
difficulty = Math.max 0, difficulty - 1 # Show the difficulty they won, not the next one.
Backbone.Mediator.publish 'tome:cast-spells', spells: @spells, preload: preload, realTime: realTime, submissionCount: sessionState.submissionCount ? 0, flagHistory: sessionState.flagHistory ? [], difficulty: difficulty
onToggleSpellList: (e) ->
@spellList.rerenderEntries()