mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-01 03:16:56 -05:00
commit
20a5ae1b8c
9 changed files with 51 additions and 48 deletions
|
@ -710,3 +710,4 @@
|
||||||
user_names: "User Names"
|
user_names: "User Names"
|
||||||
files: "Files"
|
files: "Files"
|
||||||
top_simulators: "Top Simulators"
|
top_simulators: "Top Simulators"
|
||||||
|
source_document: "Source Document"
|
|
@ -10,6 +10,8 @@
|
||||||
display: none
|
display: none
|
||||||
#docs-button
|
#docs-button
|
||||||
display: none
|
display: none
|
||||||
|
#gold-view
|
||||||
|
right: 1%
|
||||||
|
|
||||||
#control-bar-view
|
#control-bar-view
|
||||||
width: 100%
|
width: 100%
|
||||||
|
@ -41,7 +43,7 @@
|
||||||
margin: 0 auto
|
margin: 0 auto
|
||||||
|
|
||||||
canvas#surface
|
canvas#surface
|
||||||
background-color: #ddd
|
background-color: #333
|
||||||
max-height: 93%
|
max-height: 93%
|
||||||
max-height: -webkit-calc(100% - 60px)
|
max-height: -webkit-calc(100% - 60px)
|
||||||
max-height: calc(100% - 60px)
|
max-height: calc(100% - 60px)
|
||||||
|
|
|
@ -17,14 +17,11 @@ module.exports = class PatchModal extends ModalView
|
||||||
constructor: (@patch, @targetModel, options) ->
|
constructor: (@patch, @targetModel, options) ->
|
||||||
super(options)
|
super(options)
|
||||||
targetID = @patch.get('target').id
|
targetID = @patch.get('target').id
|
||||||
if false
|
if targetID is @targetModel.id
|
||||||
@originalSource = targetModel.clone(false)
|
@originalSource = @targetModel.clone(false)
|
||||||
@onOriginalLoaded()
|
|
||||||
else
|
else
|
||||||
@originalSource = new targetModel.constructor({_id:targetID})
|
@originalSource = new @targetModel.constructor({_id:targetID})
|
||||||
@originalSource.fetch()
|
@supermodel.loadModel @originalSource, 'source_document'
|
||||||
@listenToOnce @originalSource, 'sync', @onOriginalLoaded
|
|
||||||
@addResourceToLoad(@originalSource)
|
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
c = super()
|
c = super()
|
||||||
|
@ -35,7 +32,7 @@ module.exports = class PatchModal extends ModalView
|
||||||
c
|
c
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
return if @originalSource.loading
|
return unless @supermodel.finished()
|
||||||
headModel = null
|
headModel = null
|
||||||
if @targetModel.hasWriteAccess()
|
if @targetModel.hasWriteAccess()
|
||||||
headModel = @originalSource.clone(false)
|
headModel = @originalSource.clone(false)
|
||||||
|
|
|
@ -168,7 +168,7 @@ module.exports = class LadderTabView extends CocoView
|
||||||
$.when(
|
$.when(
|
||||||
$.get("/db/level/#{@level.get('slug')}/histogram_data?team=#{team.name.toLowerCase()}", (data) -> histogramData = data)
|
$.get("/db/level/#{@level.get('slug')}/histogram_data?team=#{team.name.toLowerCase()}", (data) -> histogramData = data)
|
||||||
).then =>
|
).then =>
|
||||||
@generateHistogram(histogramWrapper, histogramData, team.name.toLowerCase())
|
@generateHistogram(histogramWrapper, histogramData, team.name.toLowerCase()) unless @destroyed
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
ctx = super()
|
ctx = super()
|
||||||
|
@ -242,7 +242,7 @@ module.exports = class LadderTabView extends CocoView
|
||||||
if teamName.toLowerCase() is "humans" then rankClass = "rank-text humans-rank-text"
|
if teamName.toLowerCase() is "humans" then rankClass = "rank-text humans-rank-text"
|
||||||
|
|
||||||
message = "#{histogramData.length} players"
|
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")
|
svg.append("g")
|
||||||
.append("text")
|
.append("text")
|
||||||
.attr("class",rankClass)
|
.attr("class",rankClass)
|
||||||
|
|
|
@ -35,7 +35,6 @@ module.exports = class ControlBarView extends View
|
||||||
@session = options.session
|
@session = options.session
|
||||||
@level = options.level
|
@level = options.level
|
||||||
@playableTeams = options.playableTeams
|
@playableTeams = options.playableTeams
|
||||||
@ladderGame = options.ladderGame
|
|
||||||
@spectateGame = options.spectateGame ? false
|
@spectateGame = options.spectateGame ? false
|
||||||
super options
|
super options
|
||||||
|
|
||||||
|
@ -55,13 +54,13 @@ module.exports = class ControlBarView extends View
|
||||||
super c
|
super c
|
||||||
c.worldName = @worldName
|
c.worldName = @worldName
|
||||||
c.multiplayerEnabled = @session.get('multiplayer')
|
c.multiplayerEnabled = @session.get('multiplayer')
|
||||||
c.ladderGame = @ladderGame
|
c.ladderGame = @level.get('type') is 'ladder'
|
||||||
c.spectateGame = @spectateGame
|
c.spectateGame = @spectateGame
|
||||||
c.homeLink = "/"
|
console.log "level type is", @level.get('type')
|
||||||
levelID = @level.get('slug')
|
if @level.get('type') in ['ladder', 'ladder-tutorial']
|
||||||
if levelID in ["brawlwood", "brawlwood-tutorial", "dungeon-arena", "dungeon-arena-tutorial"]
|
c.homeLink = '/play/ladder/' + @level.get('slug').replace /\-tutorial$/, ''
|
||||||
levelID = 'brawlwood' if levelID is 'brawlwood-tutorial'
|
else
|
||||||
c.homeLink = "/play/ladder/" + levelID
|
c.homeLink = '/'
|
||||||
c
|
c
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
|
|
|
@ -97,8 +97,12 @@ module.exports = class SpellView extends View
|
||||||
aceCommands.push c.name
|
aceCommands.push c.name
|
||||||
addCommand
|
addCommand
|
||||||
name: 'run-code'
|
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', {}
|
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
|
addCommand
|
||||||
name: 'toggle-playing'
|
name: 'toggle-playing'
|
||||||
bindKey: {win: 'Ctrl-P', mac: 'Command-P|Ctrl-P'}
|
bindKey: {win: 'Ctrl-P', mac: 'Command-P|Ctrl-P'}
|
||||||
|
|
|
@ -174,7 +174,7 @@ module.exports = class PlayLevelView extends View
|
||||||
@initSurface()
|
@initSurface()
|
||||||
@initGoalManager()
|
@initGoalManager()
|
||||||
@initScriptManager()
|
@initScriptManager()
|
||||||
@insertSubviews ladderGame: (@level.get('type') is "ladder")
|
@insertSubviews()
|
||||||
@initVolume()
|
@initVolume()
|
||||||
@listenTo(@session, 'change:multiplayer', @onMultiplayerChanged)
|
@listenTo(@session, 'change:multiplayer', @onMultiplayerChanged)
|
||||||
@originalSessionState = $.extend(true, {}, @session.get('state'))
|
@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.clearRect(0, 0, canvas.width, canvas.height)
|
||||||
ctx.fillText("Loaded #{@modelsLoaded} thingies",50,50)
|
ctx.fillText("Loaded #{@modelsLoaded} thingies",50,50)
|
||||||
|
|
||||||
insertSubviews: (subviewOptions) ->
|
insertSubviews: ->
|
||||||
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel, ladderGame: subviewOptions.ladderGame
|
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel
|
||||||
@insertSubView new PlaybackView {}
|
@insertSubView new PlaybackView {}
|
||||||
@insertSubView new GoalsView {}
|
@insertSubView new GoalsView {}
|
||||||
@insertSubView new GoldView {}
|
@insertSubView new GoldView {}
|
||||||
@insertSubView new HUDView {}
|
@insertSubView new HUDView {}
|
||||||
@insertSubView new ChatView levelID: @levelID, sessionID: @session.id, session: @session
|
@insertSubView new ChatView levelID: @levelID, sessionID: @session.id, session: @session
|
||||||
worldName = utils.i18n @level.attributes, 'name'
|
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!'
|
#Backbone.Mediator.publish('level-set-debug', debug: true) if me.displayName() is 'Nick!'
|
||||||
|
|
||||||
afterInsert: ->
|
afterInsert: ->
|
||||||
|
|
|
@ -161,7 +161,7 @@ module.exports = class SpectateLevelView extends View
|
||||||
@initSurface()
|
@initSurface()
|
||||||
@initGoalManager()
|
@initGoalManager()
|
||||||
@initScriptManager()
|
@initScriptManager()
|
||||||
@insertSubviews ladderGame: @otherSession?
|
@insertSubviews()
|
||||||
@initVolume()
|
@initVolume()
|
||||||
|
|
||||||
@originalSessionState = $.extend(true, {}, @session.get('state'))
|
@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.clearRect(0, 0, canvas.width, canvas.height)
|
||||||
ctx.fillText("Loaded #{@modelsLoaded} thingies",50,50)
|
ctx.fillText("Loaded #{@modelsLoaded} thingies",50,50)
|
||||||
|
|
||||||
insertSubviews: (subviewOptions) ->
|
insertSubviews: ->
|
||||||
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel, ladderGame: subviewOptions.ladderGame
|
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel
|
||||||
@insertSubView new PlaybackView {}
|
@insertSubView new PlaybackView {}
|
||||||
|
|
||||||
@insertSubView new GoldView {}
|
@insertSubView new GoldView {}
|
||||||
|
|
|
@ -108,7 +108,7 @@ sendLadderUpdateEmail = (session, now, daysAgo) ->
|
||||||
context =
|
context =
|
||||||
email_id: sendwithus.templates.ladder_update_email
|
email_id: sendwithus.templates.ladder_update_email
|
||||||
recipient:
|
recipient:
|
||||||
address: if DEBUGGING then 'nick@codecombat.com' else user.email
|
address: if DEBUGGING then 'nick@codecombat.com' else user.get('email')
|
||||||
name: name
|
name: name
|
||||||
email_data:
|
email_data:
|
||||||
name: name
|
name: name
|
||||||
|
|
Loading…
Reference in a new issue