30 lines
1.2 KiB
GDScript
30 lines
1.2 KiB
GDScript
extends "res://scripts/ui/captain_skill_button.gd"
|
|
|
|
func configure_navigation(artwork: Texture2D, accent: Color, caption: String) -> void:
|
|
configure(artwork, accent)
|
|
custom_minimum_size = Vector2(64, 80)
|
|
for state in ["normal", "hover", "pressed"]:
|
|
var frame := get_theme_stylebox(state).duplicate() as StyleBoxFlat
|
|
frame.set_corner_radius_all(9)
|
|
frame.border_color = accent if state == "hover" else accent.darkened(0.45)
|
|
frame.shadow_color = Color(accent, 0.12 if state == "hover" else 0.04)
|
|
frame.shadow_size = 5 if state == "hover" else 3
|
|
add_theme_stylebox_override(state, frame)
|
|
var picture := get_node_or_null("RoundedArtwork") as TextureRect
|
|
if picture != null:
|
|
picture.offset_left = 5
|
|
picture.offset_right = -5
|
|
picture.offset_top = 5
|
|
picture.offset_bottom = -21
|
|
var label := Label.new()
|
|
label.text = caption
|
|
label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
label.add_theme_font_size_override("font_size", 9)
|
|
label.add_theme_color_override("font_color", accent.lightened(0.25))
|
|
add_child(label)
|
|
label.set_anchors_and_offsets_preset(Control.PRESET_BOTTOM_WIDE)
|
|
label.offset_top = -21
|
|
label.offset_bottom = -2
|