mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 16:17:57 -05:00
commit
32147cc16b
10 changed files with 30 additions and 13 deletions
|
@ -165,6 +165,7 @@ module.exports = class Camera extends CocoClass
|
|||
target = {x: newTargetX, y:newTargetY}
|
||||
else
|
||||
target = @target
|
||||
if not(newZoom >= MAX_ZOOM or newZoom <= Math.max(@minZoom, MIN_ZOOM))
|
||||
@zoomTo target, newZoom, 0
|
||||
|
||||
onMouseDown: (e) ->
|
||||
|
|
|
@ -7,7 +7,6 @@ module.exports = class RegionChooser extends CocoClass
|
|||
@options.stage.addEventListener 'stagemousedown', @onMouseDown
|
||||
@options.stage.addEventListener 'stagemousemove', @onMouseMove
|
||||
@options.stage.addEventListener 'stagemouseup', @onMouseUp
|
||||
@options.camera.dragDisabled = true
|
||||
|
||||
destroy: ->
|
||||
@options.stage.removeEventListener 'stagemousedown', @onMouseDown
|
||||
|
@ -18,6 +17,7 @@ module.exports = class RegionChooser extends CocoClass
|
|||
onMouseDown: (e) =>
|
||||
return unless key.shift
|
||||
@firstPoint = @options.camera.canvasToWorld {x: e.stageX, y: e.stageY}
|
||||
@options.camera.dragDisabled = true
|
||||
|
||||
onMouseMove: (e) =>
|
||||
return unless @firstPoint
|
||||
|
@ -30,6 +30,7 @@ module.exports = class RegionChooser extends CocoClass
|
|||
Backbone.Mediator.publish 'choose-region', points: [@firstPoint, @secondPoint]
|
||||
@firstPoint = null
|
||||
@secondPoint = null
|
||||
@options.camera.dragDisabled = false
|
||||
|
||||
restrictRegion: ->
|
||||
RATIO = 1.56876 # 924 / 589
|
||||
|
|
|
@ -29,6 +29,7 @@ module.exports = class AdminView extends View
|
|||
espionageSuccess: (model) ->
|
||||
storage.save('whoami',model)
|
||||
window.location.reload()
|
||||
|
||||
espionageFailure: (jqxhr, status,error)->
|
||||
console.log "There was an error entering espionage mode: #{error}"
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ module.exports = class ThangsTabView extends View
|
|||
@surface.playing = false
|
||||
@surface.setWorld @world
|
||||
@surface.camera.zoomTo({x:262, y:-164}, 1.66, 0)
|
||||
@surface.camera.dragDisabled = true
|
||||
|
||||
destroy: ->
|
||||
@selectAddThangType null
|
||||
|
@ -168,6 +167,7 @@ module.exports = class ThangsTabView extends View
|
|||
|
||||
onSpriteDragged: (e) ->
|
||||
return unless @selectedExtantThang and e.thang?.id is @selectedExtantThang?.id
|
||||
@surface.camera.dragDisabled = true
|
||||
{stageX, stageY} = e.originalEvent
|
||||
wop = @surface.camera.canvasToWorld x: stageX, y: stageY
|
||||
wop.z = @selectedExtantThang.depth / 2
|
||||
|
@ -178,6 +178,7 @@ module.exports = class ThangsTabView extends View
|
|||
onSpriteMouseUp: (e) ->
|
||||
clearInterval(@movementInterval) if @movementInterval?
|
||||
@movementInterval = null
|
||||
@surface.camera.dragDisabled = false
|
||||
return unless @selectedExtantThang and e.thang?.id is @selectedExtantThang?.id
|
||||
pos = @selectedExtantThang.pos
|
||||
physicalOriginal = componentOriginals["physics.Physical"]
|
||||
|
|
|
@ -458,10 +458,6 @@ module.exports = class SpectateLevelView extends View
|
|||
else
|
||||
cb(null, $.parseJSON(jqxhr.responseText))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
destroy: ()->
|
||||
@supermodel?.off 'error', @onLevelLoadError
|
||||
@levelLoader?.off 'loaded-all', @onLevelLoaderLoaded
|
||||
|
|
|
@ -185,6 +185,7 @@ class MongoQueue extends events.EventEmitter
|
|||
subscribe: (eventName, callback) -> @on eventName, callback
|
||||
unsubscribe: (eventName, callback) -> @removeListener eventName, callback
|
||||
|
||||
totalMessagesInQueue: (callback) -> @Message.count {}, callback
|
||||
|
||||
receiveMessage: (callback) ->
|
||||
conditions =
|
||||
|
|
|
@ -25,6 +25,17 @@ connectToScoringQueue = ->
|
|||
scoringTaskQueue = data
|
||||
log.info "Connected to scoring task queue!"
|
||||
|
||||
module.exports.messagesInQueueCount = (req, res) ->
|
||||
scoringTaskQueue.totalMessagesInQueue (err, count) ->
|
||||
if err? then return errors.serverError res, "There was an issue finding the Mongoose count:#{err}"
|
||||
response =
|
||||
point:
|
||||
number: count
|
||||
timestamp: Date.now()
|
||||
res.send(response)
|
||||
res.end()
|
||||
|
||||
|
||||
module.exports.addPairwiseTaskToQueueFromRequest = (req, res) ->
|
||||
taskPair = req.body.sessions
|
||||
addPairwiseTaskToQueue req.body.sessions (err, success) ->
|
||||
|
|
|
@ -10,6 +10,11 @@ module.exports.setup = (app) ->
|
|||
# handler = loadQueueHandler 'scoring'
|
||||
# handler.addPairwiseTaskToQueue req, res
|
||||
|
||||
app.get '/queue/messagesInQueueCount', (req, res) ->
|
||||
handler = loadQueueHandler 'scoring'
|
||||
handler.messagesInQueueCount req, res
|
||||
|
||||
|
||||
app.all '/queue/*', (req, res) ->
|
||||
setResponseHeaderToJSONContentType res
|
||||
|
||||
|
|
Loading…
Reference in a new issue