fix: 修复聊天系统编译错误
- 修复 WebSocketManager/SocketIOClient 函数缩进错误 - 重命名 is_connected() 避免与 Object 基类冲突 - 修复 tscn 文件多余前导空格 - 修复测试文件 GUT 断言函数调用 - 添加 GUT 测试框架
This commit is contained in:
@@ -14,6 +14,7 @@ extends Control
|
||||
# 场景节点引用
|
||||
@onready var auth_scene: Control = $AuthScene
|
||||
@onready var main_game_ui: Control = $MainGameUI
|
||||
@onready var chat_ui: Control = %ChatUI
|
||||
@onready var user_label: Label = $MainGameUI/TopBar/HBoxContainer/UserLabel
|
||||
@onready var logout_button: Button = $MainGameUI/TopBar/HBoxContainer/LogoutButton
|
||||
|
||||
@@ -87,11 +88,21 @@ func _on_login_success(username: String):
|
||||
# 登录成功后的处理
|
||||
current_user = username
|
||||
print("用户 ", username, " 登录成功!")
|
||||
|
||||
# 连接到聊天服务器(在进入游戏界面之前)
|
||||
print("🔌 开始连接聊天服务器...")
|
||||
ChatManager.connect_to_chat_server()
|
||||
|
||||
show_main_game()
|
||||
|
||||
func _on_logout_pressed():
|
||||
# 登出处理
|
||||
current_user = ""
|
||||
|
||||
# 断开聊天服务器连接
|
||||
print("🔌 断开聊天服务器...")
|
||||
ChatManager.disconnect_from_chat_server()
|
||||
|
||||
show_auth_scene()
|
||||
|
||||
# 游戏功能按钮处理
|
||||
|
||||
Reference in New Issue
Block a user