feat: 优化代码,更新README
This commit is contained in:
@@ -21,6 +21,9 @@ game/
|
|||||||
- main_menu.tscn
|
- main_menu.tscn
|
||||||
- game.tscn
|
- game.tscn
|
||||||
- settings.tscn
|
- settings.tscn
|
||||||
|
- prefabs/
|
||||||
|
- game/
|
||||||
|
- card.tscn
|
||||||
- scripts/
|
- scripts/
|
||||||
- autoload/
|
- autoload/
|
||||||
- GameManager.gd # 游戏管理
|
- GameManager.gd # 游戏管理
|
||||||
@@ -39,12 +42,12 @@ game/
|
|||||||
|
|
||||||
## 如何运行
|
## 如何运行
|
||||||
|
|
||||||
请先运行数据后端,在游戏设置中输入后端 URL(包含端口号和 `http://` 或 `https://` 前缀,然后创建游戏或加入游戏开始游玩。
|
请先运行数据后端,在游戏设置中输入后端 URL(包含端口号和 `http://` 或 `https://` 前缀,或者选择本地已有的数据源,然后创建游戏或加入游戏开始游玩。
|
||||||
|
|
||||||
## 最佳实践
|
## 最佳实践
|
||||||
|
|
||||||
本项目目前正在使用 Godot 4.6 进行开发。开发用语言为 GDScript。
|
本项目目前正在使用 Godot 4.6 进行开发。开发用语言为 GDScript。
|
||||||
|
|
||||||
你的开发应当遵循 Godot 引擎提供的[最佳实践](https://docs.godotengine.org/zh-cn/4.5/tutorials/best_practices/)及[GDScript 编写风格指南](https://docs.godotengine.org/zh-cn/4.5/tutorials/scripting/gdscript/gdscript_styleguide.html)。但下面提到的除外:
|
你的开发应当遵循 Godot 引擎提供的[最佳实践](https://docs.godotengine.org/zh-cn/4.x/tutorials/best_practices/)及[GDScript 编写风格指南](https://docs.godotengine.org/zh-cn/4.x/tutorials/scripting/gdscript/gdscript_styleguide.html)。但下面提到的除外:
|
||||||
|
|
||||||
除 `autoload` 目录下的单例脚本使用大驼峰式命名,其余脚本均应使用小蛇形式命令。所有节点均应使用大驼峰式命名。
|
除 `autoload` 目录下的单例脚本使用大驼峰式命名,其余脚本均应使用小蛇形式命令。所有节点均应使用大驼峰式命名。
|
||||||
|
|||||||
@@ -122,15 +122,6 @@ 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="Tips" type="Label" parent="." unique_id=1777076648]
|
|
||||||
offset_left = 711.0
|
|
||||||
offset_top = 913.0
|
|
||||||
offset_right = 1738.0
|
|
||||||
offset_bottom = 966.0
|
|
||||||
theme_override_fonts/font = ExtResource("2_6wm04")
|
|
||||||
theme_override_font_sizes/font_size = 50
|
|
||||||
text = "提示:无"
|
|
||||||
|
|
||||||
[node name="LoadButton" type="Button" parent="." unique_id=2015694853]
|
[node name="LoadButton" type="Button" parent="." unique_id=2015694853]
|
||||||
offset_left = 73.0
|
offset_left = 73.0
|
||||||
offset_top = 793.0
|
offset_top = 793.0
|
||||||
@@ -140,6 +131,15 @@ 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="Tips" type="Label" parent="." unique_id=1777076648]
|
||||||
|
offset_left = 711.0
|
||||||
|
offset_top = 913.0
|
||||||
|
offset_right = 1738.0
|
||||||
|
offset_bottom = 966.0
|
||||||
|
theme_override_fonts/font = ExtResource("2_6wm04")
|
||||||
|
theme_override_font_sizes/font_size = 50
|
||||||
|
text = "提示:无"
|
||||||
|
|
||||||
[connection signal="pressed" from="SaveButton" to="." method="_on_save_button_pressed"]
|
[connection signal="pressed" from="SaveButton" to="." method="_on_save_button_pressed"]
|
||||||
[connection signal="pressed" from="DownloadButton" to="." method="_on_download_button_pressed"]
|
[connection signal="pressed" from="DownloadButton" to="." method="_on_download_button_pressed"]
|
||||||
[connection signal="pressed" from="CancelButton" to="." method="_on_cancel_button_pressed"]
|
[connection signal="pressed" from="CancelButton" to="." method="_on_cancel_button_pressed"]
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ func load_resource():
|
|||||||
func get_sources():
|
func get_sources():
|
||||||
var dir = DirAccess.open("user://download/")
|
var dir = DirAccess.open("user://download/")
|
||||||
var subdirs: PackedStringArray = dir.get_directories()
|
var subdirs: PackedStringArray = dir.get_directories()
|
||||||
print(subdirs)
|
|
||||||
for subdir in subdirs:
|
for subdir in subdirs:
|
||||||
if subdir == "temp":
|
if subdir == "temp":
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ func init_text() -> void:
|
|||||||
|
|
||||||
func init_sources() -> void:
|
func init_sources() -> void:
|
||||||
DownloadManager.get_sources()
|
DownloadManager.get_sources()
|
||||||
var options = $LoadSource/ChooseSource
|
|
||||||
for source_name in GameManager.sources:
|
for source_name in GameManager.sources:
|
||||||
options.add_item(source_name)
|
$LoadSource/ChooseSource.add_item(source_name)
|
||||||
|
|
||||||
func _on_save_button_pressed() -> void:
|
func _on_save_button_pressed() -> void:
|
||||||
GameManager.data_origin = $DataSetting/LineEdit.text
|
GameManager.data_origin = $DataSetting/LineEdit.text
|
||||||
|
|||||||
Reference in New Issue
Block a user