diff options
Diffstat (limited to 'client/menu/popup_message.gd')
-rw-r--r-- | client/menu/popup_message.gd | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/client/menu/popup_message.gd b/client/menu/popup_message.gd new file mode 100644 index 00000000..b0ead906 --- /dev/null +++ b/client/menu/popup_message.gd @@ -0,0 +1,61 @@ +# Hurry Curry! - a game about cooking +# Copyright 2024 tpart +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +extends MarginContainer +class_name PopupMessage + +@onready var server_msg = $VBox/ServerMessage +@onready var hint_msg = $VBox/HintMessage + +@onready var server_msg_timer: Timer = $ServerTimer +@onready var hint_msg_timer: Timer = $HintTimer + +@onready var server_msg_label: Label = $VBox/ServerMessage/CenterContainer/Label +@onready var hint_msg_label: Label = $VBox/HintMessage/CenterContainer/Label + +@onready var hint_timers: Node = $HintTimers + +func display_server_msg(msg: String): + server_msg.show() + server_msg_label.text = msg + server_msg_timer.start() + +func _on_server_timer_timeout(): + server_msg.hide() + +func display_hint_msg(msg: String): + hint_msg.show() + hint_msg_label.text = tr("Hint") + ": %s" % msg + hint_msg_timer.start() + +func _on_hint_timer_timeout(): + hint_msg.hide() + +func start_game_hints(): + for c: Timer in hint_timers.get_children(): + c.start() + +func stop_game_hints(): + _on_hint_timer_timeout() + for c: Timer in hint_timers.get_children(): + c.stop() + +func _input(_event): + if Input.is_action_just_pressed("boost"): + Global.set_profile("hint_boost_seen", true) + +func _on_boost_timeout(): + if not Global.get_profile("hint_boost_seen") and not Global.get_setting("touch_controls"): + display_hint_msg(tr("Press SHIFT/Controller B to boost")) |