Store resources in generic inventories
This commit is contained in:
parent
02643c76c4
commit
1721edd123
24 changed files with 385 additions and 172 deletions
|
|
@ -3,7 +3,7 @@ extends Control
|
|||
|
||||
# Compact resource table shared by crafting, research and the ship lab.
|
||||
# Rows are resources; columns are locations. Adding another material to
|
||||
# GameState.RESOURCE_TYPES automatically gives it a row here.
|
||||
# The resource-definition catalog automatically gives each material a row.
|
||||
|
||||
var building_id: int = 0
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ func _ready() -> void:
|
|||
add_child(label)
|
||||
_header_labels.append(label)
|
||||
|
||||
for resource_type in GameState.RESOURCE_TYPES:
|
||||
for resource_type in GameState.resource_types():
|
||||
var glyph := ResourceGlyph.new()
|
||||
glyph.resource_type = resource_type
|
||||
add_child(glyph)
|
||||
|
|
@ -78,7 +78,7 @@ func _layout() -> void:
|
|||
|
||||
var row_height: float = (size.y - HEADER_HEIGHT - 4.0) / maxf(1.0, float(_rows.size()))
|
||||
var row_index: int = 0
|
||||
for resource_type in GameState.RESOURCE_TYPES:
|
||||
for resource_type in GameState.resource_types():
|
||||
var row: Dictionary = _rows[resource_type]
|
||||
var y: float = HEADER_HEIGHT + float(row_index) * row_height
|
||||
row.glyph.position = Vector2(2.0, y + 2.0)
|
||||
|
|
@ -94,7 +94,7 @@ func _layout() -> void:
|
|||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
for resource_type in GameState.RESOURCE_TYPES:
|
||||
for resource_type in GameState.resource_types():
|
||||
var row: Dictionary = _rows.get(resource_type, {})
|
||||
if row.is_empty():
|
||||
continue
|
||||
|
|
|
|||
Loading…
Reference in a new issue