mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-27 21:31:16 -04:00
Adds code for passing randomised thangs to thang view
This commit is contained in:
parent
1436a4dac7
commit
74205b31d2
2 changed files with 18 additions and 1 deletions
app/views
|
@ -43,6 +43,7 @@ module.exports = class ThangsTabView extends View
|
|||
'sprite:mouse-up': 'onSpriteMouseUp'
|
||||
'sprite:double-clicked': 'onSpriteDoubleClicked'
|
||||
'surface:stage-mouse-up': 'onStageMouseUp'
|
||||
'randomise:terrain-generated': 'onRandomiseTerrain'
|
||||
|
||||
events:
|
||||
'click #extant-thangs-filter button': 'onFilterExtantThangs'
|
||||
|
@ -223,6 +224,11 @@ module.exports = class ThangsTabView extends View
|
|||
return unless e.thang
|
||||
@editThang thangID: e.thang.id
|
||||
|
||||
onRandomiseTerrain: (e) ->
|
||||
console.log e
|
||||
for thang in e.thangs
|
||||
console.log thang.id, thang.pos
|
||||
|
||||
# TODO: figure out a good way to have all Surface clicks and Treema clicks just proxy in one direction, so we can maintain only one way of handling selection and deletion
|
||||
onExtantThangSelected: (e) ->
|
||||
@selectedExtantSprite?.setNameLabel? null unless @selectedExtantSprite is e.sprite
|
||||
|
|
|
@ -8,7 +8,7 @@ module.exports = class TerrainRandomiseModal extends ModalView
|
|||
thangs = []
|
||||
|
||||
events:
|
||||
'click .play-option': 'onRandomise'
|
||||
'click .choose-option': 'onRandomise'
|
||||
|
||||
onRevertModel: (e) ->
|
||||
id = $(e.target).val()
|
||||
|
@ -17,6 +17,17 @@ module.exports = class TerrainRandomiseModal extends ModalView
|
|||
@reloadOnClose = true
|
||||
|
||||
onRandomise: (e) ->
|
||||
@thangs = []
|
||||
@thangs.push {
|
||||
'id':'Grass01'
|
||||
'pos':{
|
||||
'x':20
|
||||
'y':20
|
||||
}
|
||||
}
|
||||
Backbone.Mediator.publish('randomise:terrain-generated',
|
||||
'thangs': @thangs
|
||||
)
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
|
|
Loading…
Add table
Reference in a new issue