From 43da3e12a57707a0d4b9c2d148db0e9ef69fe2ab Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Sun, 1 Dec 2024 22:04:43 +0100 Subject: [PATCH] Simple game name sanitation. --- root_ui.tscn | 6 +----- ui/create_game_ui.gd | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/root_ui.tscn b/root_ui.tscn index 753b1e2..a901fe5 100644 --- a/root_ui.tscn +++ b/root_ui.tscn @@ -424,7 +424,6 @@ text = "Back" [node name="CreateGameUI" type="Panel" parent="."] unique_name_in_owner = true -visible = false anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 @@ -473,13 +472,10 @@ layout_mode = 2 layout_mode = 2 text = "Name" -[node name="GameNameEdit" type="TextEdit" parent="CreateGameUI/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"] +[node name="GameNameEdit" type="LineEdit" parent="CreateGameUI/MarginContainer/VBoxContainer/MarginContainer/HBoxContainer"] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 -size_flags_stretch_ratio = 0.0 -placeholder_text = "My Adventure" -scroll_fit_content_height = true [node name="MarginContainer2" type="MarginContainer" parent="CreateGameUI/MarginContainer/VBoxContainer"] layout_mode = 2 diff --git a/ui/create_game_ui.gd b/ui/create_game_ui.gd index fd29ad8..e8f4732 100644 --- a/ui/create_game_ui.gd +++ b/ui/create_game_ui.gd @@ -2,14 +2,14 @@ extends Panel signal start_game(game_path:String) -@onready var game_name_edit: TextEdit = %GameNameEdit +@onready var game_name_edit: LineEdit = %GameNameEdit # Called when the node enters the scene tree for the first time. func _ready() -> void: pass # Replace with function body. func sanitize_game_name(value:String) -> String: - push_warning("Warning: sanitize_game_name not yet implemented!") + value.to_lower().replace(" ", "_") return value func create_game_directory() -> String: