29 lines
1006 B
GDScript
29 lines
1006 B
GDScript
class_name ABGM52GuildResourceStatus
|
|
extends Control
|
|
|
|
const UIFactory = preload("res://ui/shared/ui_factory.gd")
|
|
|
|
var value_text := ""
|
|
var icon_kind := "coin"
|
|
|
|
func configure(next_value: String, next_icon_kind: String) -> ABGM52GuildResourceStatus:
|
|
value_text = next_value
|
|
icon_kind = next_icon_kind
|
|
return self
|
|
|
|
func _ready() -> void:
|
|
clip_contents = true
|
|
var icon := UIFactory.attach_icon(self, icon_kind, "ResourceIcon", "dark", Rect2(0.04, 0.18, 0.26, 0.64))
|
|
icon.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
var label := UIFactory.label(value_text, "label", 1.0, Color("#2f3130"))
|
|
label.name = "ResourceValue"
|
|
label.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
|
label.anchor_left = 0.28
|
|
label.anchor_right = 0.96
|
|
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
label.clip_text = true
|
|
label.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
|
label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
add_child(label)
|