Merge branch 'master' of https://github.com/codecombat/codecombat
This commit is contained in:
commit
9fd12b15bf
4 changed files with 19 additions and 17 deletions
app
lib/surface
views/play/level
|
@ -197,8 +197,10 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
||||||
scaleX = if @getActionProp 'flipX' then -1 else 1
|
scaleX = if @getActionProp 'flipX' then -1 else 1
|
||||||
scaleY = if @getActionProp 'flipY' then -1 else 1
|
scaleY = if @getActionProp 'flipY' then -1 else 1
|
||||||
scaleFactor = @thang.scaleFactor ? 1
|
scaleFactor = @thang.scaleFactor ? 1
|
||||||
@imageObject.scaleX = @originalScaleX * scaleX * scaleFactor
|
scaleFactorX = @thang.scaleFactorX ? scaleFactor
|
||||||
@imageObject.scaleY = @originalScaleY * scaleY * scaleFactor
|
scaleFactorY = @thang.scaleFactorY ? scaleFactor
|
||||||
|
@imageObject.scaleX = @originalScaleX * scaleX * scaleFactorX
|
||||||
|
@imageObject.scaleY = @originalScaleY * scaleY * scaleFactorY
|
||||||
|
|
||||||
updateAlpha: ->
|
updateAlpha: ->
|
||||||
@imageObject.alpha = if @hiding then 0 else 1
|
@imageObject.alpha = if @hiding then 0 else 1
|
||||||
|
|
|
@ -64,6 +64,8 @@ module.exports = class HUDView extends View
|
||||||
|
|
||||||
onNewWorld: (e) ->
|
onNewWorld: (e) ->
|
||||||
@thang = e.world.thangMap[@thang.id] if @thang
|
@thang = e.world.thangMap[@thang.id] if @thang
|
||||||
|
if not @thang
|
||||||
|
@setThang null, null
|
||||||
|
|
||||||
setThang: (thang, thangType) ->
|
setThang: (thang, thangType) ->
|
||||||
unless @speaker
|
unless @speaker
|
||||||
|
@ -281,7 +283,7 @@ module.exports = class HUDView extends View
|
||||||
return unless @thang.world and not _.isEmpty @thang.actions
|
return unless @thang.world and not _.isEmpty @thang.actions
|
||||||
@buildActionTimespans() unless @timespans
|
@buildActionTimespans() unless @timespans
|
||||||
for actionName, action of @thang.actions
|
for actionName, action of @thang.actions
|
||||||
@updateActionElement(actionName, @timespans[actionName], @thang.action.name is actionName)
|
@updateActionElement(actionName, @timespans[actionName], @thang.action is actionName)
|
||||||
tableContainer = @$el.find('.table-container')
|
tableContainer = @$el.find('.table-container')
|
||||||
timelineWidth = tableContainer.find('.action-timeline').width()
|
timelineWidth = tableContainer.find('.action-timeline').width()
|
||||||
right = (1 - (@timeProgress ? 0)) * timelineWidth
|
right = (1 - (@timeProgress ? 0)) * timelineWidth
|
||||||
|
|
|
@ -52,7 +52,7 @@ module.exports = class ThangListView extends View
|
||||||
super()
|
super()
|
||||||
@addThangListEntries()
|
@addThangListEntries()
|
||||||
|
|
||||||
addThangListEntries: (forThangs) ->
|
addThangListEntries: ->
|
||||||
@entries = []
|
@entries = []
|
||||||
for [thangs, section, permission] in [
|
for [thangs, section, permission] in [
|
||||||
[@readwriteThangs, "#readwrite-thangs", "readwrite"] # Your Minions
|
[@readwriteThangs, "#readwrite-thangs", "readwrite"] # Your Minions
|
||||||
|
@ -60,7 +60,7 @@ module.exports = class ThangListView extends View
|
||||||
[@muggleThangs, "#muggle-thangs", null] # Non-Castable
|
[@muggleThangs, "#muggle-thangs", null] # Non-Castable
|
||||||
]
|
]
|
||||||
section = @$el.find(section).toggle thangs.length > 0
|
section = @$el.find(section).toggle thangs.length > 0
|
||||||
for thang in thangs when not forThangs or thang in forThangs
|
for thang in thangs
|
||||||
spells = _.filter @spells, (s) -> thang.id of s.thangs
|
spells = _.filter @spells, (s) -> thang.id of s.thangs
|
||||||
entry = new ThangListEntryView thang: thang, spells: spells, permission: permission, supermodel: @supermodel
|
entry = new ThangListEntryView thang: thang, spells: spells, permission: permission, supermodel: @supermodel
|
||||||
section.find('.thang-list').append entry.el # Render after appending so that we can access parent container for popover
|
section.find('.thang-list').append entry.el # Render after appending so that we can access parent container for popover
|
||||||
|
@ -72,11 +72,11 @@ module.exports = class ThangListView extends View
|
||||||
return entry.spells[0]
|
return entry.spells[0]
|
||||||
null
|
null
|
||||||
|
|
||||||
adjustThangs: (spells, thangs, toRemove, toAdd) ->
|
adjustThangs: (spells, thangs) ->
|
||||||
for entry in @entries when _.find toRemove, {id: entry.thang.id}
|
@spells = @options.spells = spells
|
||||||
|
for entry in @entries
|
||||||
entry.$el.remove()
|
entry.$el.remove()
|
||||||
entry.destroy()
|
entry.destroy()
|
||||||
@spells = @options.spells = spells
|
@thangs = @options.thangs = thangs
|
||||||
@thangs = @options.thangs = _.filter thangs, 'isSelectable'
|
|
||||||
@sortThangs()
|
@sortThangs()
|
||||||
@addThangListEntries toAdd
|
@addThangListEntries()
|
||||||
|
|
|
@ -64,15 +64,13 @@ module.exports = class TomeView extends View
|
||||||
@castButton = @insertSubView new CastButtonView spells: @spells
|
@castButton = @insertSubView new CastButtonView spells: @spells
|
||||||
else
|
else
|
||||||
@cast()
|
@cast()
|
||||||
console.log "Warning: There are no Programmable Thangs in this level, which makes it unplayable."
|
console.warn "Warning: There are no Programmable Thangs in this level, which makes it unplayable."
|
||||||
|
|
||||||
onNewWorld: (e) ->
|
onNewWorld: (e) ->
|
||||||
oldThangs = @thangList.thangs
|
thangs = _.filter e.world.thangs, 'isSelectable'
|
||||||
newThangs = e.world.thangs
|
programmableThangs = _.filter thangs, 'isProgrammable'
|
||||||
toRemove = (thang for thang in oldThangs when not e.world.getThangByID thang.id)
|
@createSpells programmableThangs, e.world
|
||||||
toAdd = (thang for thang in newThangs when not _.find oldThangs, id: thang.id)
|
@thangList.adjustThangs @spells, thangs
|
||||||
@createSpells toAdd, e.world
|
|
||||||
@thangList.adjustThangs @spells, newThangs, toRemove, toAdd
|
|
||||||
@spellList.adjustSpells @spells
|
@spellList.adjustSpells @spells
|
||||||
|
|
||||||
createSpells: (programmableThangs, world) ->
|
createSpells: (programmableThangs, world) ->
|
||||||
|
|
Reference in a new issue