This commit is contained in:
Scott Erickson 2014-05-05 16:35:45 -07:00
commit 8d67e28977
7 changed files with 45 additions and 40 deletions

View file

@ -10,6 +10,8 @@
display: none
#docs-button
display: none
#gold-view
right: 1%
#control-bar-view
width: 100%
@ -41,7 +43,7 @@
margin: 0 auto
canvas#surface
background-color: #ddd
background-color: #333
max-height: 93%
max-height: -webkit-calc(100% - 60px)
max-height: calc(100% - 60px)

View file

@ -168,7 +168,7 @@ module.exports = class LadderTabView extends CocoView
$.when(
$.get("/db/level/#{@level.get('slug')}/histogram_data?team=#{team.name.toLowerCase()}", (data) -> histogramData = data)
).then =>
@generateHistogram(histogramWrapper, histogramData, team.name.toLowerCase())
@generateHistogram(histogramWrapper, histogramData, team.name.toLowerCase()) unless @destroyed
getRenderData: ->
ctx = super()
@ -242,7 +242,7 @@ module.exports = class LadderTabView extends CocoView
if teamName.toLowerCase() is "humans" then rankClass = "rank-text humans-rank-text"
message = "#{histogramData.length} players"
if @leaderboards[teamName].session? then message="#{@leaderboards[teamName].myRank}/#{histogramData.length}"
if @leaderboards[teamName].session? then message="##{@leaderboards[teamName].myRank} of #{histogramData.length}"
svg.append("g")
.append("text")
.attr("class",rankClass)

View file

@ -35,7 +35,6 @@ module.exports = class ControlBarView extends View
@session = options.session
@level = options.level
@playableTeams = options.playableTeams
@ladderGame = options.ladderGame
@spectateGame = options.spectateGame ? false
super options
@ -55,13 +54,13 @@ module.exports = class ControlBarView extends View
super c
c.worldName = @worldName
c.multiplayerEnabled = @session.get('multiplayer')
c.ladderGame = @ladderGame
c.ladderGame = @level.get('type') is 'ladder'
c.spectateGame = @spectateGame
c.homeLink = "/"
levelID = @level.get('slug')
if levelID in ["brawlwood", "brawlwood-tutorial", "dungeon-arena", "dungeon-arena-tutorial"]
levelID = 'brawlwood' if levelID is 'brawlwood-tutorial'
c.homeLink = "/play/ladder/" + levelID
console.log "level type is", @level.get('type')
if @level.get('type') in ['ladder', 'ladder-tutorial']
c.homeLink = '/play/ladder/' + @level.get('slug').replace /\-tutorial$/, ''
else
c.homeLink = '/'
c
afterRender: ->

View file

@ -97,8 +97,12 @@ module.exports = class SpellView extends View
aceCommands.push c.name
addCommand
name: 'run-code'
bindKey: {win: 'Shift-Enter|Ctrl-Enter|Ctrl-S', mac: 'Shift-Enter|Command-Enter|Ctrl-Enter|Command-S|Ctrl-S'}
bindKey: {win: 'Shift-Enter|Ctrl-Enter', mac: 'Shift-Enter|Command-Enter|Ctrl-Enter'}
exec: -> Backbone.Mediator.publish 'tome:manual-cast', {}
addCommand
name: 'no-op'
bindKey: {win: 'Ctrl-S', mac: 'Command-S|Ctrl-S'}
exec: -> # just prevent page save call
addCommand
name: 'toggle-playing'
bindKey: {win: 'Ctrl-P', mac: 'Command-P|Ctrl-P'}

View file

@ -174,7 +174,7 @@ module.exports = class PlayLevelView extends View
@initSurface()
@initGoalManager()
@initScriptManager()
@insertSubviews ladderGame: (@level.get('type') is "ladder")
@insertSubviews()
@initVolume()
@listenTo(@session, 'change:multiplayer', @onMultiplayerChanged)
@originalSessionState = $.extend(true, {}, @session.get('state'))
@ -238,15 +238,15 @@ module.exports = class PlayLevelView extends View
ctx.clearRect(0, 0, canvas.width, canvas.height)
ctx.fillText("Loaded #{@modelsLoaded} thingies",50,50)
insertSubviews: (subviewOptions) ->
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel, ladderGame: subviewOptions.ladderGame
insertSubviews: ->
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel
@insertSubView new PlaybackView {}
@insertSubView new GoalsView {}
@insertSubView new GoldView {}
@insertSubView new HUDView {}
@insertSubView new ChatView levelID: @levelID, sessionID: @session.id, session: @session
worldName = utils.i18n @level.attributes, 'name'
@controlBar = @insertSubView new ControlBarView {worldName: worldName, session: @session, level: @level, supermodel: @supermodel, playableTeams: @world.playableTeams, ladderGame: subviewOptions.ladderGame}
@controlBar = @insertSubView new ControlBarView {worldName: worldName, session: @session, level: @level, supermodel: @supermodel, playableTeams: @world.playableTeams}
#Backbone.Mediator.publish('level-set-debug', debug: true) if me.displayName() is 'Nick!'
afterInsert: ->

View file

@ -161,7 +161,7 @@ module.exports = class SpectateLevelView extends View
@initSurface()
@initGoalManager()
@initScriptManager()
@insertSubviews ladderGame: @otherSession?
@insertSubviews()
@initVolume()
@originalSessionState = $.extend(true, {}, @session.get('state'))
@ -229,8 +229,8 @@ module.exports = class SpectateLevelView extends View
ctx.clearRect(0, 0, canvas.width, canvas.height)
ctx.fillText("Loaded #{@modelsLoaded} thingies",50,50)
insertSubviews: (subviewOptions) ->
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel, ladderGame: subviewOptions.ladderGame
insertSubviews: ->
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel
@insertSubView new PlaybackView {}
@insertSubView new GoldView {}

View file

@ -108,7 +108,7 @@ sendLadderUpdateEmail = (session, now, daysAgo) ->
context =
email_id: sendwithus.templates.ladder_update_email
recipient:
address: if DEBUGGING then 'nick@codecombat.com' else user.email
address: if DEBUGGING then 'nick@codecombat.com' else user.get('email')
name: name
email_data:
name: name