feat: 基本完成了主界面的制作
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,36 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="font_data_dynamic"
|
||||||
|
type="FontFile"
|
||||||
|
uid="uid://c2bipf4tpdjj8"
|
||||||
|
path="res://.godot/imported/AlibabaPuHuiTi-3-65-Medium.ttf-9a6e0f84d96a7d41f689a2173ac531c4.fontdata"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/fonts/AlibabaPuHuiTi-3-65-Medium.ttf"
|
||||||
|
dest_files=["res://.godot/imported/AlibabaPuHuiTi-3-65-Medium.ttf-9a6e0f84d96a7d41f689a2173ac531c4.fontdata"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
Rendering=null
|
||||||
|
antialiasing=1
|
||||||
|
generate_mipmaps=false
|
||||||
|
disable_embedded_bitmaps=true
|
||||||
|
multichannel_signed_distance_field=false
|
||||||
|
msdf_pixel_range=8
|
||||||
|
msdf_size=48
|
||||||
|
allow_system_fallback=true
|
||||||
|
force_autohinter=false
|
||||||
|
modulate_color_glyphs=false
|
||||||
|
hinting=1
|
||||||
|
subpixel_positioning=4
|
||||||
|
keep_rounding_remainders=true
|
||||||
|
oversampling=0.0
|
||||||
|
Fallbacks=null
|
||||||
|
fallbacks=[]
|
||||||
|
Compress=null
|
||||||
|
compress=true
|
||||||
|
preload=[]
|
||||||
|
language_support={}
|
||||||
|
script_support={}
|
||||||
|
opentype_features={}
|
||||||
@@ -11,9 +11,14 @@ config_version=5
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="PaperChemisGame"
|
config/name="PaperChemisGame"
|
||||||
|
run/main_scene="uid://b2rokrdsjgx62"
|
||||||
config/features=PackedStringArray("4.5", "GL Compatibility")
|
config/features=PackedStringArray("4.5", "GL Compatibility")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
MultiGame="*res://scripts/autoload/MultiGame.gd"
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
renderer/rendering_method="gl_compatibility"
|
renderer/rendering_method="gl_compatibility"
|
||||||
|
|||||||
+143
-1
@@ -1,3 +1,145 @@
|
|||||||
[gd_scene format=3 uid="uid://b2rokrdsjgx62"]
|
[gd_scene load_steps=5 format=3 uid="uid://b2rokrdsjgx62"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bnieej0tc51ei" path="res://scripts/main_menu/main_menu.gd" id="1_ekxnf"]
|
||||||
|
[ext_resource type="FontFile" uid="uid://c2bipf4tpdjj8" path="res://assets/fonts/AlibabaPuHuiTi-3-65-Medium.ttf" id="1_l6cm7"]
|
||||||
|
[ext_resource type="Script" uid="uid://dxekqwgtgqkg" path="res://scripts/main_menu/create_game_ui.gd" id="3_bqqt6"]
|
||||||
|
[ext_resource type="Script" uid="uid://cosrsj5i8s26q" path="res://scripts/main_menu/join_game_ui.gd" id="4_wu84c"]
|
||||||
|
|
||||||
[node name="MainMenu" type="Node2D"]
|
[node name="MainMenu" type="Node2D"]
|
||||||
|
script = ExtResource("1_ekxnf")
|
||||||
|
|
||||||
|
[node name="Background" type="ColorRect" parent="."]
|
||||||
|
offset_left = -21.0
|
||||||
|
offset_top = -15.0
|
||||||
|
offset_right = 1186.0
|
||||||
|
offset_bottom = 654.0
|
||||||
|
color = Color(0.7058824, 0.6862745, 0, 1)
|
||||||
|
|
||||||
|
[node name="Title" type="Label" parent="."]
|
||||||
|
offset_left = 304.0
|
||||||
|
offset_top = 58.0
|
||||||
|
offset_right = 883.0
|
||||||
|
offset_bottom = 177.0
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
theme_override_fonts/font = ExtResource("1_l6cm7")
|
||||||
|
theme_override_font_sizes/font_size = 84
|
||||||
|
text = "纸片化学社区版"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="StartGame" type="Button" parent="."]
|
||||||
|
offset_left = 397.0
|
||||||
|
offset_top = 227.0
|
||||||
|
offset_right = 713.03845
|
||||||
|
offset_bottom = 326.0
|
||||||
|
theme_override_fonts/font = ExtResource("1_l6cm7")
|
||||||
|
theme_override_font_sizes/font_size = 36
|
||||||
|
text = "创建局域网游戏"
|
||||||
|
|
||||||
|
[node name="JoinGame" type="Button" parent="."]
|
||||||
|
offset_left = 396.0
|
||||||
|
offset_top = 373.0
|
||||||
|
offset_right = 712.03845
|
||||||
|
offset_bottom = 472.0
|
||||||
|
theme_override_fonts/font = ExtResource("1_l6cm7")
|
||||||
|
theme_override_font_sizes/font_size = 36
|
||||||
|
text = "加入局域网游戏"
|
||||||
|
|
||||||
|
[node name="CreateGameUI" type="Node2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(316, 203)
|
||||||
|
script = ExtResource("3_bqqt6")
|
||||||
|
|
||||||
|
[node name="Background" type="ColorRect" parent="CreateGameUI"]
|
||||||
|
offset_right = 475.0
|
||||||
|
offset_bottom = 257.0
|
||||||
|
color = Color(0, 0.7372549, 0, 1)
|
||||||
|
|
||||||
|
[node name="CreateGameEdit" type="LineEdit" parent="CreateGameUI"]
|
||||||
|
offset_left = 65.0
|
||||||
|
offset_top = 26.0
|
||||||
|
offset_right = 392.0
|
||||||
|
offset_bottom = 87.0
|
||||||
|
|
||||||
|
[node name="CreateGameButton" type="Button" parent="CreateGameUI"]
|
||||||
|
offset_left = 128.0
|
||||||
|
offset_top = 127.0
|
||||||
|
offset_right = 330.81818
|
||||||
|
offset_bottom = 224.0
|
||||||
|
theme_override_fonts/font = ExtResource("1_l6cm7")
|
||||||
|
theme_override_font_sizes/font_size = 36
|
||||||
|
text = "创建房间"
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CreateGameUI"]
|
||||||
|
offset_left = 131.0
|
||||||
|
offset_top = 88.0
|
||||||
|
offset_right = 326.0
|
||||||
|
offset_bottom = 126.0
|
||||||
|
theme_override_fonts/font = ExtResource("1_l6cm7")
|
||||||
|
text = "请输入最大玩家数(2~4)"
|
||||||
|
|
||||||
|
[node name="Warn" type="Node2D" parent="CreateGameUI"]
|
||||||
|
visible = false
|
||||||
|
|
||||||
|
[node name="WarnBackground" type="ColorRect" parent="CreateGameUI/Warn"]
|
||||||
|
offset_left = 86.0
|
||||||
|
offset_top = 41.0
|
||||||
|
offset_right = 366.0
|
||||||
|
offset_bottom = 202.0
|
||||||
|
color = Color(1, 0.3137255, 1, 1)
|
||||||
|
|
||||||
|
[node name="WarnButton" type="Button" parent="CreateGameUI/Warn"]
|
||||||
|
offset_left = 167.0
|
||||||
|
offset_top = 125.0
|
||||||
|
offset_right = 279.0
|
||||||
|
offset_bottom = 188.0
|
||||||
|
text = "确定"
|
||||||
|
|
||||||
|
[node name="WarnLabel" type="Label" parent="CreateGameUI/Warn"]
|
||||||
|
offset_left = 126.0
|
||||||
|
offset_top = 64.0
|
||||||
|
offset_right = 316.0
|
||||||
|
offset_bottom = 107.0
|
||||||
|
theme_override_fonts/font = ExtResource("1_l6cm7")
|
||||||
|
text = "输入数据错误!
|
||||||
|
请输入2~4之间的整数!"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="JoinGameUI" type="Node2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
position = Vector2(328, 216)
|
||||||
|
script = ExtResource("4_wu84c")
|
||||||
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
|
[node name="Background" type="ColorRect" parent="JoinGameUI"]
|
||||||
|
offset_right = 475.0
|
||||||
|
offset_bottom = 257.0
|
||||||
|
color = Color(0, 0.7372549, 0, 1)
|
||||||
|
|
||||||
|
[node name="JoinGameEdit" type="LineEdit" parent="JoinGameUI"]
|
||||||
|
offset_left = 65.0
|
||||||
|
offset_top = 26.0
|
||||||
|
offset_right = 392.0
|
||||||
|
offset_bottom = 87.0
|
||||||
|
|
||||||
|
[node name="JoinGameButton" type="Button" parent="JoinGameUI"]
|
||||||
|
offset_left = 128.0
|
||||||
|
offset_top = 127.0
|
||||||
|
offset_right = 330.81818
|
||||||
|
offset_bottom = 224.0
|
||||||
|
theme_override_fonts/font = ExtResource("1_l6cm7")
|
||||||
|
theme_override_font_sizes/font_size = 36
|
||||||
|
text = "加入房间"
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="JoinGameUI"]
|
||||||
|
offset_left = 131.0
|
||||||
|
offset_top = 88.0
|
||||||
|
offset_right = 326.0
|
||||||
|
offset_bottom = 126.0
|
||||||
|
theme_override_fonts/font = ExtResource("1_l6cm7")
|
||||||
|
text = "请输入服务器IP(无需加端口)"
|
||||||
|
|
||||||
|
[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="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="JoinGameUI/JoinGameButton" to="JoinGameUI" method="_on_join_game_button_pressed"]
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
extends Node
|
||||||
|
|
||||||
|
func create_server(player_num: int) -> void:
|
||||||
|
var peer = ENetMultiplayerPeer.new()
|
||||||
|
peer.create_server(8989, player_num)
|
||||||
|
multiplayer.multiplayer_peer = peer
|
||||||
|
|
||||||
|
func create_client(ip: String) -> void:
|
||||||
|
var peer = ENetMultiplayerPeer.new()
|
||||||
|
peer.create_client(ip, 8989)
|
||||||
|
multiplayer.multiplayer_peer = peer
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dwbuaieufg51g
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
func _on_create_game_button_pressed() -> void:
|
||||||
|
var player_num = int($CreateGameEdit.text)
|
||||||
|
if 2 <= player_num and player_num <= 4:
|
||||||
|
MultiGame.create_server(int(player_num))
|
||||||
|
$".".hide()
|
||||||
|
else:
|
||||||
|
$Warn.show()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_warn_button_pressed() -> void:
|
||||||
|
$Warn.hide()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dxekqwgtgqkg
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
func _on_join_game_button_pressed() -> void:
|
||||||
|
var ip: String = $JoinGameEdit.text
|
||||||
|
MultiGame.create_client(ip)
|
||||||
|
$".".hide()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cosrsj5i8s26q
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
func _on_join_game_pressed() -> void:
|
||||||
|
$JoinGameUI.show()
|
||||||
|
|
||||||
|
func _on_start_game_pressed() -> void:
|
||||||
|
$CreateGameUI.show()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bnieej0tc51ei
|
||||||
Reference in New Issue
Block a user