aboutsummaryrefslogtreecommitdiff
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.gd74
1 files changed, 52 insertions, 22 deletions
diff --git a/client/menu/popup_message.gd b/client/menu/popup_message.gd
index 1464e20c..d3e7905d 100644
--- a/client/menu/popup_message.gd
+++ b/client/menu/popup_message.gd
@@ -109,32 +109,55 @@ func _input(_event):
Global.set_hint("has_reset", true)
func _on_boost_timeout():
- if not Global.get_hint("has_boosted") and not Global.get_setting("ui.touch_controls"):
- display_hint_msg(tr("Press %s to boost") % display_keybind(tr("SHIFT"), "B"))
+ if not Global.get_hint("has_boosted") and not Global.using_touch:
+ display_hint_msg(tr("c.hint.boost") % display_keybind("boost"))
func _on_move_timeout():
- if not Global.get_hint("has_moved") and not Global.get_setting("ui.touch_controls"):
- display_hint_msg(tr("Use %s to move") % display_keybind("WASD", tr("left stick")))
+ if not Global.get_hint("has_moved") and not Global.using_touch:
+ display_hint_msg(tr("c.hint.movement") % ", ".join(
+ [
+ display_keybind("forwards"),
+ display_keybind("left"),
+ display_keybind("backwards"),
+ display_keybind("right")
+ ]
+ ))
func _on_interact_timeout():
- if not Global.get_hint("has_interacted") and not Global.get_setting("ui.touch_controls"):
- var keybind = display_keybind(tr("SPACE"), "A")
- display_hint_msg(tr("Press %s to pick up items and hold %s to interact with tools") % [keybind, keybind])
+ if not Global.get_hint("has_interacted") and not Global.using_touch:
+ display_hint_msg(tr("c.hint.interact") % display_keybind("interact"))
func _on_reset_timeout():
- if not Global.get_hint("has_reset") and not Global.get_setting("ui.touch_controls"):
- display_hint_msg(tr("Press %s to reset the camera view") % display_keybind("R", "Y"))
+ if not Global.get_hint("has_reset") and not Global.using_touch:
+ display_hint_msg(tr("c.hint.reset_camera") % display_keybind("reset"))
func _on_zoom_timeout():
- if not Global.get_hint("has_zoomed") and not Global.get_setting("ui.touch_controls"):
- display_hint_msg(tr("Use %s to zoom in/out") % display_keybind(tr("PageUp/PageDown"), "LT/RT"))
+ if not Global.get_hint("has_zoomed") and not Global.using_touch:
+ display_hint_msg(tr("c.hint.zoom_camera") % ", ".join(
+ [
+ display_keybind("zoom_in"),
+ display_keybind("zoom_out")
+ ]
+ ))
-func display_keybind(keyboard: String, joypad: String, touch = null) -> String:
- if Global.using_joypad:
- return joypad + " (Joypad)"
- if touch != null:
- return touch
- return keyboard
+func display_keybind(action_name: String) -> String:
+ var events := InputManager.get_events(action_name)
+
+ if events.size() == 0:
+ # There are no events which match the action
+ return tr("c.settings.input.unknown_event")
+
+ for event: InputEvent in events:
+ # Try to find event which matches input method
+ var type := InputManager.get_event_type(event)
+ if Global.using_joypad and type != InputManager.EventType.JOYPAD:
+ continue
+ if Global.using_touch and type != InputManager.EventType.TOUCH:
+ continue
+ return InputManager.display_input_event(event)
+
+ # No matching event found. Just show any event.
+ return InputManager.display_input_event(events[0])
func any_action_just_pressed(actions: Array) -> bool:
for a: String in actions:
@@ -143,20 +166,27 @@ func any_action_just_pressed(actions: Array) -> bool:
return false
func _on_rotate_camera_timeout():
- if not Global.get_hint("has_rotated") and not Global.get_setting("ui.touch_controls"):
- display_hint_msg(tr("Use %s to rotate the camera view") % display_keybind(tr("arrow keys"), tr("right stick")))
+ if not Global.get_hint("has_rotated") and not Global.using_touch:
+ display_hint_msg(tr("c.hint.rotate") % ", ".join(
+ [
+ display_keybind("rotate_up"),
+ display_keybind("rotate_left"),
+ display_keybind("rotate_down"),
+ display_keybind("rotate_right")
+ ]
+ ))
func _on_nametags_timeout():
if not Global.get_hint("has_seen_nametags") and not Global.get_setting("graphics.usernames"):
Global.set_hint("has_seen_nametags", true)
- display_hint_msg(tr("Username tags can be enabled/disabled in the settings"))
+ display_hint_msg(tr("c.hint.username_tags"))
func _on_join_while_running_timeout():
if not game.is_joined and not Global.get_hint("has_seen_join_while_running"):
Global.set_hint("has_seen_join_while_running", true)
- display_hint_msg(tr("Press %s and click \"Join\" to join the game while it is running") % display_keybind(tr("ESCAPE"), tr("Menu button")))
+ display_hint_msg(tr("c.hint.join_while_running") % display_keybind("menu"))
func _on_performance_timeout() -> void:
if not Global.get_hint("has_seen_performance") and Engine.get_frames_per_second() < DisplayServer.screen_get_refresh_rate() * 0.75:
Global.set_hint("has_seen_performance", true)
- display_hint_msg(tr("Your framerate seems to be low. You can lower your graphics settings in the settings menu."))
+ display_hint_msg(tr("c.hint.framerate_low"))