feat: 优化UI操作逻辑,增加退出游戏按钮
This commit is contained in:
@@ -44,6 +44,15 @@ theme_override_fonts/font = ExtResource("1_l6cm7")
|
|||||||
theme_override_font_sizes/font_size = 36
|
theme_override_font_sizes/font_size = 36
|
||||||
text = "加入局域网游戏"
|
text = "加入局域网游戏"
|
||||||
|
|
||||||
|
[node name="QuitGame" type="Button" parent="." unique_id=70898198]
|
||||||
|
offset_left = 932.0
|
||||||
|
offset_top = 959.0
|
||||||
|
offset_right = 1248.0386
|
||||||
|
offset_bottom = 1058.0
|
||||||
|
theme_override_fonts/font = ExtResource("1_l6cm7")
|
||||||
|
theme_override_font_sizes/font_size = 36
|
||||||
|
text = "退出游戏"
|
||||||
|
|
||||||
[node name="CreateGameUI" type="Node2D" parent="." unique_id=462604530]
|
[node name="CreateGameUI" type="Node2D" parent="." unique_id=462604530]
|
||||||
visible = false
|
visible = false
|
||||||
position = Vector2(585, 355)
|
position = Vector2(585, 355)
|
||||||
@@ -150,6 +159,7 @@ text = "设置"
|
|||||||
|
|
||||||
[connection signal="pressed" from="StartGame" to="." method="_on_start_game_pressed"]
|
[connection signal="pressed" from="StartGame" to="." method="_on_start_game_pressed"]
|
||||||
[connection signal="pressed" from="JoinGame" to="." method="_on_join_game_pressed"]
|
[connection signal="pressed" from="JoinGame" to="." method="_on_join_game_pressed"]
|
||||||
|
[connection signal="pressed" from="QuitGame" to="." method="_on_quit_game_pressed"]
|
||||||
[connection signal="pressed" from="CreateGameUI/CreateGameButton" to="CreateGameUI" method="_on_create_game_button_pressed"]
|
[connection signal="pressed" from="CreateGameUI/CreateGameButton" to="CreateGameUI" method="_on_create_game_button_pressed"]
|
||||||
[connection signal="pressed" from="CreateGameUI/Warn/WarnButton" to="CreateGameUI" method="_on_warn_button_pressed"]
|
[connection signal="pressed" from="CreateGameUI/Warn/WarnButton" to="CreateGameUI" method="_on_warn_button_pressed"]
|
||||||
[connection signal="pressed" from="JoinGameUI/JoinGameButton" to="JoinGameUI" method="_on_join_game_button_pressed"]
|
[connection signal="pressed" from="JoinGameUI/JoinGameButton" to="JoinGameUI" method="_on_join_game_button_pressed"]
|
||||||
|
|||||||
@@ -96,10 +96,10 @@ offset_bottom = 60.0
|
|||||||
theme_override_font_sizes/font_size = 25
|
theme_override_font_sizes/font_size = 25
|
||||||
|
|
||||||
[node name="SaveButton" type="Button" parent="." unique_id=1377249836]
|
[node name="SaveButton" type="Button" parent="." unique_id=1377249836]
|
||||||
offset_left = 150.0
|
offset_left = 147.0
|
||||||
offset_top = 1321.0
|
offset_top = 1315.0
|
||||||
offset_right = 314.0
|
offset_right = 311.0
|
||||||
offset_bottom = 1398.0
|
offset_bottom = 1392.0
|
||||||
theme_override_fonts/font = ExtResource("2_6wm04")
|
theme_override_fonts/font = ExtResource("2_6wm04")
|
||||||
theme_override_font_sizes/font_size = 30
|
theme_override_font_sizes/font_size = 30
|
||||||
text = "保存设置"
|
text = "保存设置"
|
||||||
@@ -120,7 +120,7 @@ offset_right = 550.0
|
|||||||
offset_bottom = 1394.0
|
offset_bottom = 1394.0
|
||||||
theme_override_fonts/font = ExtResource("2_6wm04")
|
theme_override_fonts/font = ExtResource("2_6wm04")
|
||||||
theme_override_font_sizes/font_size = 30
|
theme_override_font_sizes/font_size = 30
|
||||||
text = "取消"
|
text = "返回"
|
||||||
|
|
||||||
[node name="LoadButton" type="Button" parent="." unique_id=2015694853]
|
[node name="LoadButton" type="Button" parent="." unique_id=2015694853]
|
||||||
offset_left = 135.0
|
offset_left = 135.0
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ func init() -> void:
|
|||||||
for address in addresses:
|
for address in addresses:
|
||||||
if address.substr(0, GameManager.ip_begin.length()) == GameManager.ip_begin:
|
if address.substr(0, GameManager.ip_begin.length()) == GameManager.ip_begin:
|
||||||
ipaddress = address
|
ipaddress = address
|
||||||
|
break
|
||||||
$IPLabel.text = ipaddress
|
$IPLabel.text = ipaddress
|
||||||
$Player1/Username.text = GameManager.username
|
$Player1/Username.text = GameManager.username
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ func _on_join_game_pressed() -> void:
|
|||||||
func _on_start_game_pressed() -> void:
|
func _on_start_game_pressed() -> void:
|
||||||
$CreateGameUI.show()
|
$CreateGameUI.show()
|
||||||
|
|
||||||
|
|
||||||
func _on_setting_button_pressed() -> void:
|
func _on_setting_button_pressed() -> void:
|
||||||
SceneManager.goto_scene("settings")
|
SceneManager.goto_scene("settings")
|
||||||
|
|
||||||
|
func _on_quit_game_pressed() -> void:
|
||||||
|
get_tree().quit()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ func _on_save_button_pressed() -> void:
|
|||||||
GameManager.ip_begin = $IPBeginSetting/LineEdit.text
|
GameManager.ip_begin = $IPBeginSetting/LineEdit.text
|
||||||
GameManager.username = $UsernameSetting/LineEdit.text
|
GameManager.username = $UsernameSetting/LineEdit.text
|
||||||
GameManager.source = $LoadSource/ChooseSource.get_selected()
|
GameManager.source = $LoadSource/ChooseSource.get_selected()
|
||||||
SceneManager.goto_scene("main_menu")
|
$Tips.text = "提示:保存设置成功"
|
||||||
|
|
||||||
|
|
||||||
func _on_cancel_button_pressed() -> void:
|
func _on_cancel_button_pressed() -> void:
|
||||||
|
|||||||
Reference in New Issue
Block a user