Add shop closes on buying something

This commit is contained in:
JonShard
2026-08-05 09:54:46 +02:00
parent 3646992e35
commit 528f66627b
3 changed files with 6 additions and 2 deletions
-1
View File
@@ -10,7 +10,6 @@ extends Panel
@export var button: Button @export var button: Button
# Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
name_label.text = station_name name_label.text = station_name
cost_label.text = str(cost) + "$" cost_label.text = str(cost) + "$"
+1
View File
@@ -35,6 +35,7 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
action_mode = 0
icon = ExtResource("2_e1k4i") icon = ExtResource("2_e1k4i")
icon_alignment = 1 icon_alignment = 1
expand_icon = true expand_icon = true
+5 -1
View File
@@ -19,7 +19,7 @@ func _ready() -> void:
controller.button_pressed.connect(_on_controller_button_pressed) controller.button_pressed.connect(_on_controller_button_pressed)
if other_controller: if other_controller:
other_controller.button_pressed.connect(_on_other_controller_button_pressed) other_controller.button_pressed.connect(_on_other_controller_button_pressed)
Signals.station_bought.connect(_on_station_bought)
viewport = get_parent().get_parent() as XRToolsViewport2DIn3D viewport = get_parent().get_parent() as XRToolsViewport2DIn3D
if not viewport: if not viewport:
push_error("Shop UI could not find XRToolsViewport2DIn3D grand parent") push_error("Shop UI could not find XRToolsViewport2DIn3D grand parent")
@@ -76,6 +76,10 @@ func _on_other_controller_button_pressed(button_name: String) -> void:
enabled = false enabled = false
func _on_station_bought(instance) -> void:
enabled = false
func detect_hand_from_xr_ancestor() -> void: func detect_hand_from_xr_ancestor() -> void:
controller = XRHelpers.get_xr_controller(self) controller = XRHelpers.get_xr_controller(self)
if not controller: if not controller: