27 lines
940 B
GDScript
27 lines
940 B
GDScript
class_name HelpPanel
|
||
extends PanelContainer
|
||
|
||
const InputBindingsType = preload("res://scripts/game/input_bindings.gd")
|
||
|
||
@onready var body: RichTextLabel = $Body
|
||
|
||
func present() -> void:
|
||
visible = true
|
||
refresh()
|
||
|
||
func dismiss() -> void:
|
||
visible = false
|
||
|
||
func refresh() -> void:
|
||
var lines: PackedStringArray = ["Commandes", ""]
|
||
for action: StringName in InputBindingsType.input_actions():
|
||
var events := InputMap.action_get_events(action)
|
||
var binding := "—"
|
||
if not events.is_empty() and events[0] is InputEventKey:
|
||
binding = OS.get_keycode_string((events[0] as InputEventKey).physical_keycode)
|
||
lines.append("%s — %s" % [binding, InputBindingsType.help_name_for(action)])
|
||
lines.append("\nCiblage : flèches, Entrée pour confirmer, Échap pour annuler")
|
||
lines.append("Sauvegarde : V (éditeur) ou Ctrl+S (jeu autonome), puis choix d’un emplacement")
|
||
lines.append("F1 / Échap — fermer")
|
||
body.text = "\n".join(lines)
|