Redesign resource transfer interface

This commit is contained in:
Loïc Wisniewski 2026-08-13 23:02:09 +02:00
commit 7d05042f51
3 changed files with 44 additions and 20 deletions

View file

@ -128,10 +128,12 @@ var lab_building_id: int = 0
@onready var to_building_label: Label = get_node("../UI/TransferMenu/ToBuildingLabel")
@onready var to_building_batch_button: IconButton = get_node("../UI/TransferMenu/ToBuildingBatchButton")
@onready var to_building_batch_label: Label = get_node("../UI/TransferMenu/ToBuildingBatchLabel")
@onready var to_building_all_label: Label = get_node("../UI/TransferMenu/ToBuildingAllLabel")
@onready var to_building_all_button: IconButton = get_node("../UI/TransferMenu/ToBuildingAllButton")
@onready var to_fleet_label: Label = get_node("../UI/TransferMenu/ToFleetLabel")
@onready var to_fleet_batch_button: IconButton = get_node("../UI/TransferMenu/ToFleetBatchButton")
@onready var to_fleet_batch_label: Label = get_node("../UI/TransferMenu/ToFleetBatchLabel")
@onready var to_fleet_all_label: Label = get_node("../UI/TransferMenu/ToFleetAllLabel")
@onready var to_fleet_all_button: IconButton = get_node("../UI/TransferMenu/ToFleetAllButton")
@onready var gas_to_building_button: IconButton = get_node("../UI/TransferMenu/GasToBuildingButton")
@onready var gas_to_fleet_button: IconButton = get_node("../UI/TransferMenu/GasToFleetButton")
@ -1033,6 +1035,14 @@ func _refresh_transfer() -> void:
to_building_label.text = "Unload into %s" % _transfer_place_name()
to_fleet_label.text = "Load from %s" % _transfer_place_name()
to_building_label.text = "ORE — unload / load all"
to_fleet_label.text = "GAS — unload / load all"
to_building_batch_button.visible = false
to_building_batch_label.visible = false
to_fleet_batch_button.visible = false
to_fleet_batch_label.visible = false
to_building_all_label.text = "Unload all"
to_fleet_all_label.text = "Load all"
# The batch buttons say what they would actually move, not the nominal
# batch size: offering "25" when the hold has 4 in it is a promise the
# press cannot keep.

View file

@ -1537,8 +1537,8 @@ horizontal_alignment = 1
[node name="ToBuildingAllButton" type="Control" parent="UI/TransferMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 36
offset_right = 184
offset_left = -180
offset_right = -32
offset_top = 462
offset_bottom = 610
script = ExtResource("10")
@ -1549,8 +1549,8 @@ glow_color = Color(0.45, 0.9, 0.55, 1)
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -10
offset_right = 230
offset_left = -230
offset_right = 10
offset_top = 616
offset_bottom = 668
theme_override_font_sizes/font_size = 30
@ -1561,9 +1561,9 @@ horizontal_alignment = 1
mouse_filter = 2
anchor_right = 1.0
offset_left = 24
offset_top = 694
offset_top = 400
offset_right = -24
offset_bottom = 746
offset_bottom = 452
theme_override_font_sizes/font_size = 34
text = ""
horizontal_alignment = 1
@ -1594,10 +1594,10 @@ horizontal_alignment = 1
[node name="ToFleetAllButton" type="Control" parent="UI/TransferMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 36
offset_right = 184
offset_top = 756
offset_bottom = 904
offset_left = 32
offset_right = 180
offset_top = 462
offset_bottom = 610
script = ExtResource("10")
icon = 4
glow_color = Color(1, 0.78, 0.25, 1)
@ -1606,10 +1606,10 @@ glow_color = Color(1, 0.78, 0.25, 1)
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -10
offset_left = 10
offset_right = 230
offset_top = 910
offset_bottom = 962
offset_top = 616
offset_bottom = 668
theme_override_font_sizes/font_size = 30
text = "All"
horizontal_alignment = 1
@ -1630,8 +1630,8 @@ anchor_left = 0.5
anchor_right = 0.5
offset_left = -180
offset_right = -32
offset_top = 1020
offset_bottom = 1168
offset_top = 740
offset_bottom = 888
script = ExtResource("10")
icon = 25
glow_color = Color(0.85, 0.52, 1, 1)
@ -1641,8 +1641,8 @@ anchor_left = 0.5
anchor_right = 0.5
offset_left = 32
offset_right = 180
offset_top = 1020
offset_bottom = 1168
offset_top = 740
offset_bottom = 888
script = ExtResource("10")
icon = 25
glow_color = Color(0.85, 0.52, 1, 1)
@ -1650,9 +1650,9 @@ glow_color = Color(0.85, 0.52, 1, 1)
[node name="GasTransferLabel" type="Label" parent="UI/TransferMenu"]
mouse_filter = 2
anchor_right = 1.0
offset_top = 1172
offset_bottom = 1222
text = "GAS: unload all load all"
offset_top = 894
offset_bottom = 944
text = "GAS — unload all load all"
horizontal_alignment = 1
theme_override_colors/font_color = Color(0.85, 0.52, 1, 1)
theme_override_font_sizes/font_size = 22

View file

@ -43,6 +43,7 @@ var _numbers: Array[NeonNumber] = []
var _captions: Array[Label] = []
var _gas_caption: Label
var _gas_icon: IconButton
var _summary: Label
func _ready() -> void:
@ -81,6 +82,12 @@ func _ready() -> void:
_gas_icon.icon = IconButton.Icon.GAS
_gas_icon.glow_color = Color(0.85, 0.52, 1.0)
add_child(_gas_icon)
_summary = Label.new()
_summary.mouse_filter = Control.MOUSE_FILTER_IGNORE
_summary.add_theme_font_size_override("font_size", 18)
_summary.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_summary.size = size
add_child(_summary)
func _layout() -> void:
@ -103,6 +110,13 @@ func _layout() -> void:
func _process(_delta: float) -> void:
# Resource rows scale without inventing a new menu per resource. The old
# ore-only columns remain behind this concise, explicit summary.
_summary.text = "ORE Bank %d Fleet %d Local %d\nGAS Bank %d Fleet %d Local %d" % [GameState.rocks, GameState.fleet_cargo, GameState.building_holdings(building_id), GameState.gas, GameState.fleet_gas_cargo, GameState.building_gas_holdings(building_id)]
for number in _numbers: number.visible = false
for caption in _captions: caption.visible = false
_gas_caption.visible = false
_gas_icon.visible = false
_gas_caption.text = "GAS %d / %d / %d" % [GameState.gas, GameState.fleet_gas_cargo, GameState.building_gas_holdings(building_id)]
_numbers[0].set_amount(GameState.rocks)
_numbers[1].set_amount(GameState.fleet_cargo)