Files
whale-town-front/scripts/data/ErrorCode.gd
lzdFeiFei d623c705b6 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>
2025-12-23 01:15:33 +08:00

46 lines
1.4 KiB
GDScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
class_name ErrorCode
## 错误码定义
## 用于统一管理登录系统中的所有错误码和错误消息
# 成功
const SUCCESS: int = 0
# 网络相关错误 (1000-1999)
const NETWORK_ERROR: int = 1001
const TIMEOUT: int = 1002
const SERVER_ERROR: int = 1003
# 输入验证错误 (2000-2999)
const INVALID_INPUT: int = 2001
const INVALID_USERNAME: int = 2002
const INVALID_PASSWORD: int = 2003
const PASSWORDS_NOT_MATCH: int = 2004
# 认证相关错误 (3000-3999)
const WRONG_CREDENTIALS: int = 3001
const USER_NOT_FOUND: int = 3002
const ACCOUNT_DISABLED: int = 3003
const TOKEN_EXPIRED: int = 3004
const TOKEN_INVALID: int = 3005
# 错误消息映射
const MESSAGES: Dictionary = {
NETWORK_ERROR: "网络连接失败,请检查网络设置",
TIMEOUT: "请求超时,请稍后重试",
SERVER_ERROR: "服务器错误,请稍后重试",
INVALID_INPUT: "用户名或密码不能为空",
INVALID_USERNAME: "用户名格式不正确3-16个字符",
INVALID_PASSWORD: "密码格式不正确6-20个字符",
PASSWORDS_NOT_MATCH: "两次输入的密码不一致",
WRONG_CREDENTIALS: "用户名或密码错误",
USER_NOT_FOUND: "用户不存在",
ACCOUNT_DISABLED: "账号已被禁用",
TOKEN_EXPIRED: "登录已过期,请重新登录",
TOKEN_INVALID: "登录状态无效,请重新登录"
}
## 获取错误消息
static func getMessage(errorCode: int) -> String:
return MESSAGES.get(errorCode, "未知错误 (代码: %d)" % errorCode)