feat:实现登录系统和用户认证功能

- 添加登录场景(login_scene.tscn)和主菜单场景(main_menu_scene.tscn)
- 实现认证管理器(AuthManager)用于用户登录和会话管理
- 添加核心服务:加密服务、存储服务、网络服务
- 配置项目主场景为登录场景
- 添加自动加载服务到项目配置
- 添加开发环境配置(VSCode、Claude)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-23 01:15:33 +08:00
parent 8ed260b413
commit d623c705b6
28 changed files with 1455 additions and 0 deletions

196
scenes/login_scene.tscn Normal file
View File

@@ -0,0 +1,196 @@
[gd_scene load_steps=5 format=3 uid="uid://bqj1ykrxo0x8s"]
[ext_resource type="Script" uid="uid://c6f1awwaw1nim" path="res://scripts/ui/UI_Login.gd" id="1_p2w8r"]
[ext_resource type="Texture2D" uid="uid://byw73r2dt6xb8" path="res://assets/login/login-bg.png" id="2_login_bg"]
[ext_resource type="Texture2D" uid="uid://cswuqnhiiypb2" path="res://assets/login/enter.png" id="3_enter_btn"]
[ext_resource type="Texture2D" uid="uid://bqvel7n6dfo1d" path="res://assets/login/whaletown.png" id="4_whaletown"]
[node name="loginScene" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_p2w8r")
[node name="Background" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.85098, 0.929412, 0.964706, 1)
[node name="LoginPanel" type="TextureRect" parent="."]
layout_mode = 0
offset_left = 250.0
offset_top = 8.0
offset_right = 1274.0
offset_bottom = 1032.0
scale = Vector2(0.6, 0.6)
texture = ExtResource("2_login_bg")
stretch_mode = 1
[node name="MainTitle" type="TextureRect" parent="LoginPanel"]
layout_mode = 0
offset_left = 325.00003
offset_top = 243.33331
offset_right = 713.3334
offset_bottom = 393.3333
texture = ExtResource("4_whaletown")
expand_mode = 1
stretch_mode = 5
[node name="SubTitle" type="Label" parent="LoginPanel"]
layout_mode = 0
offset_left = 351.66666
offset_top = 408.3333
offset_right = 651.6666
offset_bottom = 431.3333
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "开始你的小镇之旅!"
horizontal_alignment = 1
vertical_alignment = 1
[node name="PasswordLoginTab" type="Button" parent="LoginPanel"]
layout_mode = 0
offset_left = 355.0
offset_top = 468.3333
offset_right = 500.0
offset_bottom = 503.3333
toggle_mode = true
button_pressed = true
text = "密码登录"
[node name="CodeLoginTab" type="Button" parent="LoginPanel"]
layout_mode = 0
offset_left = 510.0
offset_top = 468.3333
offset_right = 655.0
offset_bottom = 503.3333
toggle_mode = true
text = "验证码登录"
[node name="UsernameInput" type="LineEdit" parent="LoginPanel"]
layout_mode = 0
offset_left = 355.0
offset_top = 523.3333
offset_right = 655.0
offset_bottom = 563.3333
placeholder_text = "用户名/手机/邮箱"
caret_blink = true
[node name="PasswordInput" type="LineEdit" parent="LoginPanel"]
layout_mode = 0
offset_left = 355.0
offset_top = 578.3333
offset_right = 615.0
offset_bottom = 618.3333
placeholder_text = "输入密码"
caret_blink = true
secret = true
[node name="TogglePasswordButton" type="Button" parent="LoginPanel"]
layout_mode = 0
offset_left = 615.0
offset_top = 578.3333
offset_right = 655.0
offset_bottom = 618.3333
text = "👁"
[node name="RememberPasswordCheckBox" type="CheckBox" parent="LoginPanel"]
layout_mode = 0
offset_left = 325.0
offset_top = 703.3333
offset_right = 425.0
offset_bottom = 734.3333
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "记住密码"
[node name="AutoLoginCheckBox" type="CheckBox" parent="LoginPanel"]
layout_mode = 0
offset_left = 575.0
offset_top = 688.3333
offset_right = 675.0
offset_bottom = 719.3333
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "自动登录"
[node name="EnterButton" type="TextureButton" parent="LoginPanel"]
layout_mode = 0
offset_left = 286.66666
offset_top = 774.99994
offset_right = 1243.6666
offset_bottom = 958.99994
scale = Vector2(0.5, 0.5)
texture_normal = ExtResource("3_enter_btn")
stretch_mode = 0
[node name="EnterButtonLabel" type="Label" parent="LoginPanel/EnterButton"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 64
text = "进入小镇"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ForgotPasswordButton" type="LinkButton" parent="LoginPanel"]
layout_mode = 0
offset_left = 328.3333
offset_top = 893.3333
offset_right = 428.3333
offset_bottom = 918.3333
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "忘记密码?"
[node name="RegisterButton" type="LinkButton" parent="LoginPanel"]
layout_mode = 0
offset_left = 595.0
offset_top = 890.0
offset_right = 695.0
offset_bottom = 915.0
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "注册居民身份"
[node name="StatusLabel" type="Label" parent="LoginPanel"]
layout_mode = 0
offset_left = 50.0
offset_top = 480.0
offset_right = 350.0
offset_bottom = 510.0
text = " "
horizontal_alignment = 1
vertical_alignment = 1
[node name="LoadingOverlay" type="ColorRect" parent="."]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 0.5)
[node name="LoadingLabel" type="Label" parent="LoadingOverlay"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -50.0
offset_top = -11.5
offset_right = 50.0
offset_bottom = 11.5
grow_horizontal = 2
grow_vertical = 2
text = "登录中..."
horizontal_alignment = 1
vertical_alignment = 1

View File

@@ -0,0 +1,40 @@
[gd_scene load_steps=2 format=3 uid="uid://c3mxv7d1qw7ba"]
[ext_resource type="Script" path="res://scripts/ui/UI_MainMenu.gd" id="1_main_menu"]
[node name="mainMenuScene" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_main_menu")
[node name="centerContainer" type="CenterContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="vboxContainer" type="VBoxContainer" parent="centerContainer"]
layout_mode = 2
theme_override_constants/separation = 20
[node name="welcomeLabel" type="Label" parent="centerContainer/vboxContainer"]
layout_mode = 2
text = "欢迎来到鲸鱼小镇!"
horizontal_alignment = 1
[node name="userInfoLabel" type="Label" parent="centerContainer/vboxContainer"]
layout_mode = 2
text = "用户名:--
等级:--"
horizontal_alignment = 1
[node name="logoutButton" type="Button" parent="centerContainer/vboxContainer"]
custom_minimum_size = Vector2(200, 40)
layout_mode = 2
text = "退出登录"