summaryrefslogtreecommitdiff
path: root/client/menu/popup_message.gd
diff options
context:
space:
mode:
Diffstat (limited to 'client/menu/popup_message.gd')
-rw-r--r--client/menu/popup_message.gd32
1 files changed, 32 insertions, 0 deletions
diff --git a/client/menu/popup_message.gd b/client/menu/popup_message.gd
index d37343c3..921e3647 100644
--- a/client/menu/popup_message.gd
+++ b/client/menu/popup_message.gd
@@ -16,6 +16,9 @@
extends MarginContainer
class_name PopupMessage
+var is_ingame := false
+var is_joined := false
+
@onready var server_msg = $VBox/ServerMessage
@onready var hint_msg = $VBox/HintMessage
@@ -29,6 +32,34 @@ class_name PopupMessage
@onready var reset_timer = $Reset
+@onready var game: Game = get_parent()
+
+func _ready():
+ game.joined.connect(
+ func player_joined():
+ is_joined = true
+ update_state()
+ )
+ game.left.connect(
+ func player_joined():
+ is_joined = false
+ update_state()
+ )
+
+func ingame():
+ is_ingame = true
+ update_state()
+
+func lobby():
+ is_ingame = false
+ update_state()
+
+func update_state():
+ if is_ingame and is_joined:
+ start_game_hints()
+ else:
+ stop_game_hints()
+
func display_server_msg(msg: String):
server_msg.show()
server_msg_label.text = msg
@@ -53,6 +84,7 @@ func stop_game_hints():
_on_hint_timer_timeout()
for c: Timer in auto_hint_timers.get_children():
c.stop()
+ reset_timer.stop()
func _input(_event):
if Input.is_action_just_pressed("boost"):