31 lines
1.1 KiB
GDScript
31 lines
1.1 KiB
GDScript
extends CanvasLayer
|
|
var inventory: Node
|
|
var _icon: TextureRect
|
|
var _label: Label
|
|
func _ready() -> void:
|
|
name = "OrbTargetCursor"
|
|
layer = 110
|
|
_icon = TextureRect.new()
|
|
_icon.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
_icon.size = Vector2(26,26)
|
|
_icon.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
add_child(_icon)
|
|
_label = Label.new()
|
|
_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
_label.add_theme_font_size_override("font_size",12)
|
|
_label.add_theme_color_override("font_color",Color("ffdc99"))
|
|
_label.add_theme_color_override("font_shadow_color",Color.BLACK)
|
|
_label.add_theme_constant_override("shadow_offset_x",1)
|
|
_label.add_theme_constant_override("shadow_offset_y",1)
|
|
add_child(_label)
|
|
func _process(_delta: float) -> void:
|
|
if inventory.selected_orb == null or not inventory.cargo.has(inventory.selected_orb):
|
|
if inventory.selected_orb != null: inventory.cancel_orb()
|
|
queue_free()
|
|
return
|
|
_icon.texture = inventory.selected_orb.definition.icon
|
|
var point := get_viewport().get_mouse_position()+Vector2(18,18)
|
|
_icon.position = point
|
|
_label.position = point+Vector2(31,0)
|
|
_label.text = "Wybierz moduł lub broń\nPPM / Esc — anuluj"
|