Scale transfer UI for phones
This commit is contained in:
parent
98fd654e3f
commit
bcbf1b6515
2 changed files with 30 additions and 30 deletions
|
|
@ -1490,7 +1490,7 @@ offset_left = 24
|
||||||
offset_top = 184
|
offset_top = 184
|
||||||
offset_right = -24
|
offset_right = -24
|
||||||
offset_bottom = 284
|
offset_bottom = 284
|
||||||
theme_override_font_sizes/font_size = 30
|
theme_override_font_sizes/font_size = 32
|
||||||
autowrap_mode = 2
|
autowrap_mode = 2
|
||||||
text = ""
|
text = ""
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
|
|
@ -1498,9 +1498,9 @@ horizontal_alignment = 1
|
||||||
[node name="ResourceList" type="Control" parent="UI/TransferMenu"]
|
[node name="ResourceList" type="Control" parent="UI/TransferMenu"]
|
||||||
mouse_filter = 2
|
mouse_filter = 2
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
offset_left = 24
|
offset_left = 16
|
||||||
offset_top = 294
|
offset_top = 294
|
||||||
offset_right = -24
|
offset_right = -16
|
||||||
offset_bottom = 1080
|
offset_bottom = 1080
|
||||||
script = ExtResource("27")
|
script = ExtResource("27")
|
||||||
|
|
||||||
|
|
@ -1525,7 +1525,7 @@ offset_bottom = 1150
|
||||||
text = "Arrows move the selected amount from that side"
|
text = "Arrows move the selected amount from that side"
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
theme_override_colors/font_color = Color(0.55, 0.7, 0.78, 1)
|
theme_override_colors/font_color = Color(0.55, 0.7, 0.78, 1)
|
||||||
theme_override_font_sizes/font_size = 20
|
theme_override_font_sizes/font_size = 23
|
||||||
|
|
||||||
[node name="FormationMenu" type="Control" parent="UI" groups=["modal_menus"]]
|
[node name="FormationMenu" type="Control" parent="UI" groups=["modal_menus"]]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ extends Control
|
||||||
|
|
||||||
signal transfer_requested(resource_type: String, to_building: bool, amount: int)
|
signal transfer_requested(resource_type: String, to_building: bool, amount: int)
|
||||||
|
|
||||||
const HEADER_HEIGHT: float = 58.0
|
const HEADER_HEIGHT: float = 66.0
|
||||||
const FLEET_COLOR: Color = Color(1.0, 0.78, 0.25)
|
const FLEET_COLOR: Color = Color(1.0, 0.78, 0.25)
|
||||||
const LOCAL_COLOR: Color = Color(0.45, 0.9, 0.55)
|
const LOCAL_COLOR: Color = Color(0.45, 0.9, 0.55)
|
||||||
const RULE_COLOR: Color = Color(0.18, 0.38, 0.52)
|
const RULE_COLOR: Color = Color(0.18, 0.38, 0.52)
|
||||||
|
|
@ -20,10 +20,10 @@ var _rows: Dictionary = {}
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
var fleet_heading := _make_label("FLEET HOLD", 22, FLEET_COLOR)
|
var fleet_heading := _make_label("FLEET HOLD", 26, FLEET_COLOR)
|
||||||
fleet_heading.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
fleet_heading.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
add_child(fleet_heading)
|
add_child(fleet_heading)
|
||||||
_destination_heading = _make_label("THIS BUILDING", 22, LOCAL_COLOR)
|
_destination_heading = _make_label("THIS BUILDING", 26, LOCAL_COLOR)
|
||||||
_destination_heading.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
_destination_heading.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
add_child(_destination_heading)
|
add_child(_destination_heading)
|
||||||
|
|
||||||
|
|
@ -32,13 +32,13 @@ func _ready() -> void:
|
||||||
var glyph := ResourceGlyph.new()
|
var glyph := ResourceGlyph.new()
|
||||||
glyph.resource_type = resource_type
|
glyph.resource_type = resource_type
|
||||||
add_child(glyph)
|
add_child(glyph)
|
||||||
var name_label := _make_label(GameState.resource_name(resource_type).to_upper(), 25, colour)
|
var name_label := _make_label(GameState.resource_name(resource_type).to_upper(), 29, colour)
|
||||||
name_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
name_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
add_child(name_label)
|
add_child(name_label)
|
||||||
var fleet_amount := _make_label("0", 42, FLEET_COLOR)
|
var fleet_amount := _make_label("0", 48, FLEET_COLOR)
|
||||||
fleet_amount.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
fleet_amount.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
add_child(fleet_amount)
|
add_child(fleet_amount)
|
||||||
var local_amount := _make_label("0", 42, LOCAL_COLOR)
|
var local_amount := _make_label("0", 48, LOCAL_COLOR)
|
||||||
local_amount.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
local_amount.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
add_child(local_amount)
|
add_child(local_amount)
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ func _ready() -> void:
|
||||||
unload.glow_color = colour
|
unload.glow_color = colour
|
||||||
unload.pressed.connect(_request_transfer.bind(resource_type, true))
|
unload.pressed.connect(_request_transfer.bind(resource_type, true))
|
||||||
add_child(unload)
|
add_child(unload)
|
||||||
var unload_label := _make_label("UNLOAD →", 20, colour)
|
var unload_label := _make_label("UNLOAD →", 23, colour)
|
||||||
unload_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
unload_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
add_child(unload_label)
|
add_child(unload_label)
|
||||||
|
|
||||||
|
|
@ -58,7 +58,7 @@ func _ready() -> void:
|
||||||
load.glow_color = colour
|
load.glow_color = colour
|
||||||
load.pressed.connect(_request_transfer.bind(resource_type, false))
|
load.pressed.connect(_request_transfer.bind(resource_type, false))
|
||||||
add_child(load)
|
add_child(load)
|
||||||
var load_label := _make_label("← LOAD", 20, colour)
|
var load_label := _make_label("← LOAD", 23, colour)
|
||||||
load_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
load_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
add_child(load_label)
|
add_child(load_label)
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ func _ready() -> void:
|
||||||
decrease.glow_color = colour
|
decrease.glow_color = colour
|
||||||
decrease.pressed.connect(_change_amount.bind(resource_type, -1))
|
decrease.pressed.connect(_change_amount.bind(resource_type, -1))
|
||||||
add_child(decrease)
|
add_child(decrease)
|
||||||
var amount_label := _make_label("ALL", 24, colour)
|
var amount_label := _make_label("ALL", 28, colour)
|
||||||
amount_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
amount_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
add_child(amount_label)
|
add_child(amount_label)
|
||||||
var increase := IconButton.new()
|
var increase := IconButton.new()
|
||||||
|
|
@ -77,7 +77,7 @@ func _ready() -> void:
|
||||||
increase.glow_color = colour
|
increase.glow_color = colour
|
||||||
increase.pressed.connect(_change_amount.bind(resource_type, 1))
|
increase.pressed.connect(_change_amount.bind(resource_type, 1))
|
||||||
add_child(increase)
|
add_child(increase)
|
||||||
var amount_caption := _make_label("AMOUNT", 16, Color(0.62, 0.78, 0.86))
|
var amount_caption := _make_label("AMOUNT", 18, Color(0.62, 0.78, 0.86))
|
||||||
amount_caption.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
amount_caption.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||||
add_child(amount_caption)
|
add_child(amount_caption)
|
||||||
|
|
||||||
|
|
@ -158,7 +158,7 @@ func refresh() -> void:
|
||||||
func _layout() -> void:
|
func _layout() -> void:
|
||||||
if _destination_heading == null:
|
if _destination_heading == null:
|
||||||
return
|
return
|
||||||
var side_width: float = size.x * 0.36
|
var side_width: float = size.x * 0.35
|
||||||
var centre_width: float = size.x - side_width * 2.0
|
var centre_width: float = size.x - side_width * 2.0
|
||||||
var right_x: float = side_width + centre_width
|
var right_x: float = side_width + centre_width
|
||||||
var fleet_heading: Label = get_child(0)
|
var fleet_heading: Label = get_child(0)
|
||||||
|
|
@ -172,31 +172,31 @@ func _layout() -> void:
|
||||||
for resource_type in GameState.RESOURCE_TYPES:
|
for resource_type in GameState.RESOURCE_TYPES:
|
||||||
var row: Dictionary = _rows[resource_type]
|
var row: Dictionary = _rows[resource_type]
|
||||||
var y: float = HEADER_HEIGHT + float(row_index) * row_height
|
var y: float = HEADER_HEIGHT + float(row_index) * row_height
|
||||||
var glyph_size: float = minf(58.0, row_height * 0.22)
|
var glyph_size: float = minf(66.0, row_height * 0.23)
|
||||||
row.glyph.position = Vector2(size.x * 0.5 - glyph_size * 0.5, y + 12.0)
|
row.glyph.position = Vector2(size.x * 0.5 - glyph_size * 0.5, y + 10.0)
|
||||||
row.glyph.size = Vector2(glyph_size, glyph_size)
|
row.glyph.size = Vector2(glyph_size, glyph_size)
|
||||||
row.name.position = Vector2(side_width, y + 12.0 + glyph_size)
|
row.name.position = Vector2(side_width, y + 10.0 + glyph_size)
|
||||||
row.name.size = Vector2(centre_width, 38.0)
|
row.name.size = Vector2(centre_width, 44.0)
|
||||||
|
|
||||||
row.fleet_amount.position = Vector2(0.0, y + 12.0)
|
row.fleet_amount.position = Vector2(0.0, y + 10.0)
|
||||||
row.fleet_amount.size = Vector2(side_width, 62.0)
|
row.fleet_amount.size = Vector2(side_width, 70.0)
|
||||||
row.local_amount.position = Vector2(right_x, y + 12.0)
|
row.local_amount.position = Vector2(right_x, y + 10.0)
|
||||||
row.local_amount.size = Vector2(side_width, 62.0)
|
row.local_amount.size = Vector2(side_width, 70.0)
|
||||||
|
|
||||||
var button_size: float = minf(118.0, row_height * 0.42)
|
var button_size: float = minf(132.0, row_height * 0.44)
|
||||||
var button_y: float = y + 78.0
|
var button_y: float = y + 88.0
|
||||||
row.unload.position = Vector2(side_width * 0.5 - button_size * 0.5, button_y)
|
row.unload.position = Vector2(side_width * 0.5 - button_size * 0.5, button_y)
|
||||||
row.unload.size = Vector2(button_size, button_size)
|
row.unload.size = Vector2(button_size, button_size)
|
||||||
row.load.position = Vector2(right_x + side_width * 0.5 - button_size * 0.5, button_y)
|
row.load.position = Vector2(right_x + side_width * 0.5 - button_size * 0.5, button_y)
|
||||||
row.load.size = Vector2(button_size, button_size)
|
row.load.size = Vector2(button_size, button_size)
|
||||||
var caption_y: float = button_y + button_size + 2.0
|
var caption_y: float = button_y + button_size + 2.0
|
||||||
row.unload_label.position = Vector2(0.0, caption_y)
|
row.unload_label.position = Vector2(0.0, caption_y)
|
||||||
row.unload_label.size = Vector2(side_width, 36.0)
|
row.unload_label.size = Vector2(side_width, 42.0)
|
||||||
row.load_label.position = Vector2(right_x, caption_y)
|
row.load_label.position = Vector2(right_x, caption_y)
|
||||||
row.load_label.size = Vector2(side_width, 36.0)
|
row.load_label.size = Vector2(side_width, 42.0)
|
||||||
|
|
||||||
var selector_size: float = minf(60.0, centre_width * 0.32)
|
var selector_size: float = minf(66.0, centre_width * 0.33)
|
||||||
var selector_y: float = y + 126.0
|
var selector_y: float = y + 142.0
|
||||||
row.decrease.position = Vector2(side_width + 2.0, selector_y)
|
row.decrease.position = Vector2(side_width + 2.0, selector_y)
|
||||||
row.decrease.size = Vector2(selector_size, selector_size)
|
row.decrease.size = Vector2(selector_size, selector_size)
|
||||||
row.increase.position = Vector2(right_x - selector_size - 2.0, selector_y)
|
row.increase.position = Vector2(right_x - selector_size - 2.0, selector_y)
|
||||||
|
|
@ -204,7 +204,7 @@ func _layout() -> void:
|
||||||
row.amount_label.position = Vector2(side_width + selector_size + 2.0, selector_y)
|
row.amount_label.position = Vector2(side_width + selector_size + 2.0, selector_y)
|
||||||
row.amount_label.size = Vector2(centre_width - selector_size * 2.0 - 4.0, selector_size)
|
row.amount_label.size = Vector2(centre_width - selector_size * 2.0 - 4.0, selector_size)
|
||||||
row.amount_caption.position = Vector2(side_width, selector_y + selector_size + 2.0)
|
row.amount_caption.position = Vector2(side_width, selector_y + selector_size + 2.0)
|
||||||
row.amount_caption.size = Vector2(centre_width, 30.0)
|
row.amount_caption.size = Vector2(centre_width, 34.0)
|
||||||
row_index += 1
|
row_index += 1
|
||||||
queue_redraw()
|
queue_redraw()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue