mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Thang Editor can now drag Thangs to adjust registration points. Fixed missing terrain save property on ThangTypes. Fixed text search test. Added new Talus (mountain floors) to floor ThangType list for proper stretching.
This commit is contained in:
parent
2e25beccd4
commit
7d7db5dafe
5 changed files with 34 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
SpriteBuilder = require 'lib/sprites/SpriteBuilder'
|
||||
|
||||
floors = ['Dungeon Floor', 'Indoor Floor', 'Grass', 'Grass01', 'Grass02', 'Grass03', 'Grass04', 'Grass05', 'Goal Trigger', 'Obstacle', 'Sand 01', 'Sand 02', 'Sand 03', 'Sand 04', 'Sand 05', 'Sand 06']
|
||||
floors = ['Dungeon Floor', 'Indoor Floor', 'Grass', 'Grass01', 'Grass02', 'Grass03', 'Grass04', 'Grass05', 'Goal Trigger', 'Obstacle', 'Sand 01', 'Sand 02', 'Sand 03', 'Sand 04', 'Sand 05', 'Sand 06', 'Talus 1', 'Talus 2', 'Talus 3', 'Talus 4', 'Talus 5', 'Talus 6']
|
||||
|
||||
module.exports = class SingularSprite extends createjs.Sprite
|
||||
childMovieClips: null
|
||||
|
|
|
@ -15,7 +15,7 @@ module.exports = class LevelComponent extends CocoModel
|
|||
@ProgrammableID: '524b7b5a7fc0f6d51900000e'
|
||||
@MovesID: '524b7b8c7fc0f6d519000013'
|
||||
@MissileID: '524cc2593ea855e0ab000142'
|
||||
@FindsPaths: '52872b0ead92b98561000002'
|
||||
@FindsPathsID: '52872b0ead92b98561000002'
|
||||
urlRoot: '/db/level.component'
|
||||
|
||||
set: (key, val, options) ->
|
||||
|
|
|
@ -152,7 +152,9 @@ module.exports = class ThangTypeEditView extends RootView
|
|||
'click .play-with-level-parent': 'onPlayLevelSelect'
|
||||
'keyup .play-with-level-input': 'onPlayLevelKeyUp'
|
||||
'click li:not(.disabled) > #pop-level-i18n-button': 'onPopulateLevelI18N'
|
||||
|
||||
'mousedown #canvas': 'onCanvasMouseDown'
|
||||
'mouseup #canvas': 'onCanvasMouseUp'
|
||||
'mousemove #canvas': 'onCanvasMouseMove'
|
||||
|
||||
onClickSetVectorIcon: ->
|
||||
modal = new VectorIconSetupModal({}, @thangType)
|
||||
|
@ -411,6 +413,7 @@ module.exports = class ThangTypeEditView extends RootView
|
|||
@layerAdapter.resetSpriteSheet()
|
||||
@layerAdapter.addLank(lank)
|
||||
@currentLank = lank
|
||||
@currentLankOffset = null
|
||||
|
||||
showSprite: (sprite) ->
|
||||
@clearDisplayObject()
|
||||
|
@ -621,6 +624,31 @@ module.exports = class ThangTypeEditView extends RootView
|
|||
@childWindow = window.open("/play/level/#{scratchLevelID}", 'child_window', 'width=1024,height=560,left=10,top=10,location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0', true)
|
||||
@childWindow.focus()
|
||||
|
||||
# Canvas mouse drag handlers
|
||||
|
||||
onCanvasMouseMove: (e) ->
|
||||
return unless p1 = @canvasDragStart
|
||||
p2 = x: e.offsetX, y: e.offsetY
|
||||
offset = x: p2.x - p1.x, y: p2.y - p1.y
|
||||
@currentLank.sprite.x = @currentLankOffset.x + offset.x / @scale
|
||||
@currentLank.sprite.y = @currentLankOffset.y + offset.y / @scale
|
||||
@canvasDragOffset = offset
|
||||
|
||||
onCanvasMouseDown: (e) ->
|
||||
return unless @currentLank
|
||||
@canvasDragStart = x: e.offsetX, y: e.offsetY
|
||||
@currentLankOffset ?= x: @currentLank.sprite.x, y: @currentLank.sprite.y
|
||||
|
||||
onCanvasMouseUp: (e) ->
|
||||
@canvasDragStart = null
|
||||
return unless @canvasDragOffset
|
||||
return unless node = @treema.getLastSelectedTreema()
|
||||
offset = node.get '/'
|
||||
offset.x += Math.round @canvasDragOffset.x
|
||||
offset.y += Math.round @canvasDragOffset.y
|
||||
@canvasDragOffset = null
|
||||
node.set '/', offset
|
||||
|
||||
destroy: ->
|
||||
@camera?.destroy()
|
||||
super()
|
||||
|
|
|
@ -34,6 +34,7 @@ ThangTypeHandler = class ThangTypeHandler extends Handler
|
|||
'extendedName'
|
||||
'unlockLevelName'
|
||||
'tasks'
|
||||
'terrains'
|
||||
]
|
||||
|
||||
hasAccess: (req) ->
|
||||
|
|
|
@ -280,10 +280,10 @@ describe 'SearchablePlugin', ->
|
|||
firstArticle.save (err) ->
|
||||
throw err if err
|
||||
|
||||
Article.textSearch 'best', {filter: {index: true}}, (err, results) ->
|
||||
Article.find {$text: {$search: 'best'}, index: true}, (err, results) ->
|
||||
expect(err).toBeNull()
|
||||
if results
|
||||
expect(results.results.length).toBeGreaterThan(0)
|
||||
expect(results.length).toBeGreaterThan(0)
|
||||
else
|
||||
console.log('ERROR:', err)
|
||||
done()
|
||||
|
|
Loading…
Reference in a new issue