Scale transfer UI for phones
This commit is contained in:
parent
98fd654e3f
commit
bcbf1b6515
2 changed files with 30 additions and 30 deletions
|
|
@ -7,7 +7,7 @@ extends Control
|
|||
|
||||
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 LOCAL_COLOR: Color = Color(0.45, 0.9, 0.55)
|
||||
const RULE_COLOR: Color = Color(0.18, 0.38, 0.52)
|
||||
|
|
@ -20,10 +20,10 @@ var _rows: Dictionary = {}
|
|||
|
||||
|
||||
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
|
||||
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
|
||||
add_child(_destination_heading)
|
||||
|
||||
|
|
@ -32,13 +32,13 @@ func _ready() -> void:
|
|||
var glyph := ResourceGlyph.new()
|
||||
glyph.resource_type = resource_type
|
||||
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
|
||||
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
|
||||
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
|
||||
add_child(local_amount)
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ func _ready() -> void:
|
|||
unload.glow_color = colour
|
||||
unload.pressed.connect(_request_transfer.bind(resource_type, true))
|
||||
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
|
||||
add_child(unload_label)
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ func _ready() -> void:
|
|||
load.glow_color = colour
|
||||
load.pressed.connect(_request_transfer.bind(resource_type, false))
|
||||
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
|
||||
add_child(load_label)
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ func _ready() -> void:
|
|||
decrease.glow_color = colour
|
||||
decrease.pressed.connect(_change_amount.bind(resource_type, -1))
|
||||
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
|
||||
add_child(amount_label)
|
||||
var increase := IconButton.new()
|
||||
|
|
@ -77,7 +77,7 @@ func _ready() -> void:
|
|||
increase.glow_color = colour
|
||||
increase.pressed.connect(_change_amount.bind(resource_type, 1))
|
||||
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
|
||||
add_child(amount_caption)
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ func refresh() -> void:
|
|||
func _layout() -> void:
|
||||
if _destination_heading == null:
|
||||
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 right_x: float = side_width + centre_width
|
||||
var fleet_heading: Label = get_child(0)
|
||||
|
|
@ -172,31 +172,31 @@ func _layout() -> void:
|
|||
for resource_type in GameState.RESOURCE_TYPES:
|
||||
var row: Dictionary = _rows[resource_type]
|
||||
var y: float = HEADER_HEIGHT + float(row_index) * row_height
|
||||
var glyph_size: float = minf(58.0, row_height * 0.22)
|
||||
row.glyph.position = Vector2(size.x * 0.5 - glyph_size * 0.5, y + 12.0)
|
||||
var glyph_size: float = minf(66.0, row_height * 0.23)
|
||||
row.glyph.position = Vector2(size.x * 0.5 - glyph_size * 0.5, y + 10.0)
|
||||
row.glyph.size = Vector2(glyph_size, glyph_size)
|
||||
row.name.position = Vector2(side_width, y + 12.0 + glyph_size)
|
||||
row.name.size = Vector2(centre_width, 38.0)
|
||||
row.name.position = Vector2(side_width, y + 10.0 + glyph_size)
|
||||
row.name.size = Vector2(centre_width, 44.0)
|
||||
|
||||
row.fleet_amount.position = Vector2(0.0, y + 12.0)
|
||||
row.fleet_amount.size = Vector2(side_width, 62.0)
|
||||
row.local_amount.position = Vector2(right_x, y + 12.0)
|
||||
row.local_amount.size = Vector2(side_width, 62.0)
|
||||
row.fleet_amount.position = Vector2(0.0, y + 10.0)
|
||||
row.fleet_amount.size = Vector2(side_width, 70.0)
|
||||
row.local_amount.position = Vector2(right_x, y + 10.0)
|
||||
row.local_amount.size = Vector2(side_width, 70.0)
|
||||
|
||||
var button_size: float = minf(118.0, row_height * 0.42)
|
||||
var button_y: float = y + 78.0
|
||||
var button_size: float = minf(132.0, row_height * 0.44)
|
||||
var button_y: float = y + 88.0
|
||||
row.unload.position = Vector2(side_width * 0.5 - button_size * 0.5, button_y)
|
||||
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.size = Vector2(button_size, button_size)
|
||||
var caption_y: float = button_y + button_size + 2.0
|
||||
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.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_y: float = y + 126.0
|
||||
var selector_size: float = minf(66.0, centre_width * 0.33)
|
||||
var selector_y: float = y + 142.0
|
||||
row.decrease.position = Vector2(side_width + 2.0, selector_y)
|
||||
row.decrease.size = Vector2(selector_size, selector_size)
|
||||
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.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.size = Vector2(centre_width, 30.0)
|
||||
row.amount_caption.size = Vector2(centre_width, 34.0)
|
||||
row_index += 1
|
||||
queue_redraw()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue