Add max length to name
This commit is contained in:
parent
a29273bced
commit
e78c300ba6
BIN
godot/raw_assets/sfx/Hit.mp3
Normal file
BIN
godot/raw_assets/sfx/Hit.mp3
Normal file
Binary file not shown.
BIN
godot/raw_assets/sfx/LaserFast.mp3
Normal file
BIN
godot/raw_assets/sfx/LaserFast.mp3
Normal file
Binary file not shown.
BIN
godot/raw_assets/sfx/LaserWithRecovery.mp3
Normal file
BIN
godot/raw_assets/sfx/LaserWithRecovery.mp3
Normal file
Binary file not shown.
Binary file not shown.
@ -53,6 +53,7 @@ text = "Name:"
|
|||||||
[node name="text_edit" type="LineEdit" parent="v_box_container/h_box_container" unique_id=284528736]
|
[node name="text_edit" type="LineEdit" parent="v_box_container/h_box_container" unique_id=284528736]
|
||||||
custom_minimum_size = Vector2(150, 0)
|
custom_minimum_size = Vector2(150, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
max_length = 20
|
||||||
|
|
||||||
[node name="players_label" type="Label" parent="v_box_container" unique_id=1537542117]
|
[node name="players_label" type="Label" parent="v_box_container" unique_id=1537542117]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|||||||
@ -103,19 +103,20 @@ impl IPanel for SettingsPanel {
|
|||||||
slider.upcast::<Control>()
|
slider.upcast::<Control>()
|
||||||
}
|
}
|
||||||
SettingValue::String(value) => {
|
SettingValue::String(value) => {
|
||||||
let mut text_edit = LineEdit::new_alloc();
|
let mut line_edit = LineEdit::new_alloc();
|
||||||
text_edit.set_custom_minimum_size(Vector2::new(100., -1.));
|
line_edit.set_custom_minimum_size(Vector2::new(100., -1.));
|
||||||
text_edit.set_text(value);
|
line_edit.set_text(value);
|
||||||
|
line_edit.set_max_length(20);
|
||||||
|
|
||||||
let setting_clone = setting.clone();
|
let setting_clone = setting.clone();
|
||||||
text_edit
|
line_edit
|
||||||
.signals()
|
.signals()
|
||||||
.text_changed()
|
.text_changed()
|
||||||
.connect_other(self, move |s, v| {
|
.connect_other(self, move |s, v| {
|
||||||
s.on_change(setting_clone, SettingValue::String(v.to_string()));
|
s.on_change(setting_clone, SettingValue::String(v.to_string()));
|
||||||
});
|
});
|
||||||
|
|
||||||
text_edit.upcast()
|
line_edit.upcast()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user