29 lines
662 B
GDScript
29 lines
662 B
GDScript
extends Panel
|
|
|
|
|
|
var dragging := false
|
|
var drag_offset := Vector2.ZERO
|
|
|
|
func _gui_input(event):
|
|
if event is InputEventMouseButton:
|
|
if event.button_index == MOUSE_BUTTON_LEFT:
|
|
if event.pressed:
|
|
# Kliknięto na panel → zaczynamy drag
|
|
dragging = true
|
|
drag_offset = get_local_mouse_position()
|
|
else:
|
|
# Zwolniono przycisk → kończymy drag
|
|
dragging = false
|
|
elif event is InputEventMouseMotion and dragging:
|
|
# Przesuwamy panel względem pozycji myszy
|
|
position += event.relative
|
|
|
|
|
|
func show_for_station(station):
|
|
self.visible = true
|
|
#planet_name_label.text = planet.name
|
|
|
|
|
|
func _on_button_2_pressed() -> void:
|
|
self.visible = false
|