Files
aetherbound-guild/runtime/ui/m52/identity_module.gd
T

36 lines
1.3 KiB
GDScript

class_name ABGM52IdentityModule
extends Control
const UIFactory = preload("res://ui/shared/ui_factory.gd")
const MarketChrome = preload("res://ui/shared/market_chrome.gd")
const NAME_PLATE = preload("res://assets/ui_m52_components/v2_trimmed/frames/name_plate.png")
var value := ""
func configure(next_value: String) -> ABGM52IdentityModule:
value = next_value
return self
func _ready() -> void:
clip_contents = true
var plate := TextureRect.new()
plate.name = "NamePlate"
plate.texture = NAME_PLATE
plate.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
plate.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
plate.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
plate.texture_filter = CanvasItem.TEXTURE_FILTER_LINEAR_WITH_MIPMAPS
plate.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(plate)
var label := UIFactory.label(value, "label", 1.0, MarketChrome.INK)
label.name = "NameLabel"
label.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
label.offset_left = 6.0
label.offset_right = -6.0
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)