mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
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
|
@ -197,8 +197,10 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
|||
scaleX = if @getActionProp 'flipX' then -1 else 1
|
||||
scaleY = if @getActionProp 'flipY' then -1 else 1
|
||||
scaleFactor = @thang.scaleFactor ? 1
|
||||
@imageObject.scaleX = @originalScaleX * scaleX * scaleFactor
|
||||
@imageObject.scaleY = @originalScaleY * scaleY * scaleFactor
|
||||
scaleFactorX = @thang.scaleFactorX ? scaleFactor
|
||||
scaleFactorY = @thang.scaleFactorY ? scaleFactor
|
||||
@imageObject.scaleX = @originalScaleX * scaleX * scaleFactorX
|
||||
@imageObject.scaleY = @originalScaleY * scaleY * scaleFactorY
|
||||
|
||||
updateAlpha: ->
|
||||
@imageObject.alpha = if @hiding then 0 else 1
|
||||
|
|
|
@ -64,6 +64,8 @@ module.exports = class HUDView extends View
|
|||
|
||||
onNewWorld: (e) ->
|
||||
@thang = e.world.thangMap[@thang.id] if @thang
|
||||
if not @thang
|
||||
@setThang null, null
|
||||
|
||||
setThang: (thang, thangType) ->
|
||||
unless @speaker
|
||||
|
@ -281,7 +283,7 @@ module.exports = class HUDView extends View
|
|||
return unless @thang.world and not _.isEmpty @thang.actions
|
||||
@buildActionTimespans() unless @timespans
|
||||
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')
|
||||
timelineWidth = tableContainer.find('.action-timeline').width()
|
||||
right = (1 - (@timeProgress ? 0)) * timelineWidth
|
||||
|
|
|
@ -52,7 +52,7 @@ module.exports = class ThangListView extends View
|
|||
super()
|
||||
@addThangListEntries()
|
||||
|
||||
addThangListEntries: (forThangs) ->
|
||||
addThangListEntries: ->
|
||||
@entries = []
|
||||
for [thangs, section, permission] in [
|
||||
[@readwriteThangs, "#readwrite-thangs", "readwrite"] # Your Minions
|
||||
|
@ -60,7 +60,7 @@ module.exports = class ThangListView extends View
|
|||
[@muggleThangs, "#muggle-thangs", null] # Non-Castable
|
||||
]
|
||||
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
|
||||
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
|
||||
|
@ -72,11 +72,11 @@ module.exports = class ThangListView extends View
|
|||
return entry.spells[0]
|
||||
null
|
||||
|
||||
adjustThangs: (spells, thangs, toRemove, toAdd) ->
|
||||
for entry in @entries when _.find toRemove, {id: entry.thang.id}
|
||||
adjustThangs: (spells, thangs) ->
|
||||
@spells = @options.spells = spells
|
||||
for entry in @entries
|
||||
entry.$el.remove()
|
||||
entry.destroy()
|
||||
@spells = @options.spells = spells
|
||||
@thangs = @options.thangs = _.filter thangs, 'isSelectable'
|
||||
@thangs = @options.thangs = thangs
|
||||
@sortThangs()
|
||||
@addThangListEntries toAdd
|
||||
@addThangListEntries()
|
||||
|
|
|
@ -64,15 +64,13 @@ module.exports = class TomeView extends View
|
|||
@castButton = @insertSubView new CastButtonView spells: @spells
|
||||
else
|
||||
@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) ->
|
||||
oldThangs = @thangList.thangs
|
||||
newThangs = e.world.thangs
|
||||
toRemove = (thang for thang in oldThangs when not e.world.getThangByID thang.id)
|
||||
toAdd = (thang for thang in newThangs when not _.find oldThangs, id: thang.id)
|
||||
@createSpells toAdd, e.world
|
||||
@thangList.adjustThangs @spells, newThangs, toRemove, toAdd
|
||||
thangs = _.filter e.world.thangs, 'isSelectable'
|
||||
programmableThangs = _.filter thangs, 'isProgrammable'
|
||||
@createSpells programmableThangs, e.world
|
||||
@thangList.adjustThangs @spells, thangs
|
||||
@spellList.adjustSpells @spells
|
||||
|
||||
createSpells: (programmableThangs, world) ->
|
||||
|
|
Loading…
Reference in a new issue