mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-23 22:12:32 -05:00
Some tweaks and fixes to the folderized thangs in the level editor.
This commit is contained in:
parent
0cc593e3ac
commit
9439f0d47d
2 changed files with 36 additions and 4 deletions
|
@ -60,7 +60,14 @@
|
||||||
|
|
||||||
.treema-children .treema-row *
|
.treema-children .treema-row *
|
||||||
cursor: pointer !important
|
cursor: pointer !important
|
||||||
|
|
||||||
|
img
|
||||||
|
float: left
|
||||||
|
width: 18px
|
||||||
|
margin-right: 5px
|
||||||
|
position: relative
|
||||||
|
top: 2px
|
||||||
|
|
||||||
.world-container
|
.world-container
|
||||||
margin-left: 0
|
margin-left: 0
|
||||||
margin-right: 0
|
margin-right: 0
|
||||||
|
|
|
@ -138,7 +138,7 @@ module.exports = class ThangsTabView extends CocoView
|
||||||
{
|
{
|
||||||
type: 'object'
|
type: 'object'
|
||||||
format: 'thang'
|
format: 'thang'
|
||||||
required: ['thangType', 'id', 'index']
|
required: ['thangType', 'id']
|
||||||
}
|
}
|
||||||
{ $ref: '#' }
|
{ $ref: '#' }
|
||||||
]
|
]
|
||||||
|
@ -432,7 +432,7 @@ module.exports = class ThangsTabView extends CocoView
|
||||||
|
|
||||||
folderForThang: (thang) ->
|
folderForThang: (thang) ->
|
||||||
thangType = @supermodel.getModelByOriginal ThangType, thang.thangType
|
thangType = @supermodel.getModelByOriginal ThangType, thang.thangType
|
||||||
[thangType.get('kind')]
|
[thangType.get('kind'), thangType.get('name')]
|
||||||
|
|
||||||
pathForThang: (thang) ->
|
pathForThang: (thang) ->
|
||||||
folder = @folderForThang(thang)
|
folder = @folderForThang(thang)
|
||||||
|
@ -572,6 +572,7 @@ module.exports = class ThangsTabView extends CocoView
|
||||||
class ThangsFolderNode extends TreemaNode.nodeMap.object
|
class ThangsFolderNode extends TreemaNode.nodeMap.object
|
||||||
valueClass: 'treema-thangs-folder'
|
valueClass: 'treema-thangs-folder'
|
||||||
nodeDescription: 'Thang'
|
nodeDescription: 'Thang'
|
||||||
|
@nameToThangTypeMap: null
|
||||||
|
|
||||||
getTrackedActionDescription: (trackedAction) ->
|
getTrackedActionDescription: (trackedAction) ->
|
||||||
trackedActionDescription = super(trackedAction)
|
trackedActionDescription = super(trackedAction)
|
||||||
|
@ -582,7 +583,31 @@ class ThangsFolderNode extends TreemaNode.nodeMap.object
|
||||||
trackedActionDescription
|
trackedActionDescription
|
||||||
|
|
||||||
buildValueForDisplay: (valEl, data) ->
|
buildValueForDisplay: (valEl, data) ->
|
||||||
@buildValueForDisplaySimply valEl, _.keys(data).length
|
@buildValueForDisplaySimply valEl, @countThangs(data)
|
||||||
|
|
||||||
|
countThangs: (data) ->
|
||||||
|
return 0 if data.thangType and data.id
|
||||||
|
num = 0
|
||||||
|
for key, value of data
|
||||||
|
if value.thangType and value.id
|
||||||
|
num += 1
|
||||||
|
else
|
||||||
|
num += @countThangs(value)
|
||||||
|
num
|
||||||
|
|
||||||
|
build: ->
|
||||||
|
res = super(arguments...)
|
||||||
|
if thangType = @nameToThangType(@keyForParent)
|
||||||
|
@$el.prepend($("<img src='#{thangType.getPortraitURL()}' />"))
|
||||||
|
res
|
||||||
|
|
||||||
|
nameToThangType: (name) ->
|
||||||
|
if not ThangsFolderNode.nameToThangTypeMap
|
||||||
|
thangTypes = @settings.supermodel.getModels(ThangType)
|
||||||
|
map = {}
|
||||||
|
map[thangType.get('name')] = thangType for thangType in thangTypes
|
||||||
|
ThangsFolderNode.nameToThangTypeMap = map
|
||||||
|
ThangsFolderNode.nameToThangTypeMap[name]
|
||||||
|
|
||||||
class ThangNode extends TreemaObjectNode
|
class ThangNode extends TreemaObjectNode
|
||||||
valueClass: 'treema-thang'
|
valueClass: 'treema-thang'
|
||||||
|
|
Loading…
Reference in a new issue