Simple game name sanitation.

main
Martin Felis 2024-12-01 22:04:43 +01:00
parent 9a829c30b0
commit 43da3e12a5
2 changed files with 3 additions and 7 deletions

View File

@ -424,7 +424,6 @@ text = "Back"
[node name="CreateGameUI" type="Panel" parent="."] [node name="CreateGameUI" type="Panel" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
visible = false
anchors_preset = 8 anchors_preset = 8
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
@ -473,13 +472,10 @@ layout_mode = 2
layout_mode = 2 layout_mode = 2
text = "Name" 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 unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 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"] [node name="MarginContainer2" type="MarginContainer" parent="CreateGameUI/MarginContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2

View File

@ -2,14 +2,14 @@ extends Panel
signal start_game(game_path:String) 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. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
pass # Replace with function body. pass # Replace with function body.
func sanitize_game_name(value:String) -> String: func sanitize_game_name(value:String) -> String:
push_warning("Warning: sanitize_game_name not yet implemented!") value.to_lower().replace(" ", "_")
return value return value
func create_game_directory() -> String: func create_game_directory() -> String: