feat: 进入关卡时 toast 提示体力消耗,修复 StorageManager 接口位置和 WxSDK 访问级别
- 进入关卡成功后显示 toast 提示消耗体力及剩余体力 - 将 StorageManager 中 UserInfo 接口移至模块顶层,修复嵌套接口语法问题 - WxSDK.getWx() 改为 static 公开方法,便于外部调用
This commit is contained in:
@@ -7,6 +7,17 @@ export interface ApiEnvelope<T> {
|
||||
success: boolean;
|
||||
data: T | null;
|
||||
message: string | null;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
/** 体力值信息 */
|
||||
export interface StaminaInfo {
|
||||
/** 当前体力值(已计算恢复) */
|
||||
current: number;
|
||||
/** 体力上限,固定为 5 */
|
||||
max: number;
|
||||
/** 下一点体力恢复的时间(ISO 8601),满体力时为 null */
|
||||
nextRecoverAt: string | null;
|
||||
}
|
||||
|
||||
/** 登录响应数据 */
|
||||
@@ -15,21 +26,64 @@ export interface WxLoginData {
|
||||
user: {
|
||||
id: string;
|
||||
nickname: string | null;
|
||||
points: number;
|
||||
stamina: number;
|
||||
};
|
||||
}
|
||||
|
||||
/** 积分响应数据 */
|
||||
export interface UserAssetsData {
|
||||
points: number;
|
||||
/** 用户资料响应数据 */
|
||||
export interface UserProfileData {
|
||||
id: string;
|
||||
nickname: string | null;
|
||||
stamina: StaminaInfo;
|
||||
}
|
||||
|
||||
/** 游戏数据响应(Loading 页面) */
|
||||
export interface GameData {
|
||||
user: { id: string; points: number };
|
||||
user: {
|
||||
id: string;
|
||||
stamina: StaminaInfo;
|
||||
};
|
||||
completedLevelIds: string[];
|
||||
}
|
||||
|
||||
/** 关卡列表项 */
|
||||
export interface LevelListItem {
|
||||
id: string;
|
||||
level: number;
|
||||
imageUrl: string;
|
||||
answer: string | null;
|
||||
hint1: string | null;
|
||||
hint2: string | null;
|
||||
hint3: string | null;
|
||||
completed: boolean;
|
||||
timeSpent: number | null;
|
||||
}
|
||||
|
||||
/** 关卡列表响应 */
|
||||
export interface LevelListData {
|
||||
levels: LevelListItem[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
/** 进入关卡响应 */
|
||||
export interface EnterLevelData {
|
||||
id: string;
|
||||
level: number;
|
||||
imageUrl: string;
|
||||
answer: string;
|
||||
hint1: string | null;
|
||||
hint2: string | null;
|
||||
hint3: string | null;
|
||||
stamina: StaminaInfo;
|
||||
}
|
||||
|
||||
/** 通关上报响应 */
|
||||
export interface CompleteLevelData {
|
||||
firstClear: boolean;
|
||||
levelId: string;
|
||||
timeSpent: number;
|
||||
}
|
||||
|
||||
/** 创建分享响应 */
|
||||
export interface CreateShareData {
|
||||
shareCode: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { SpriteFrame } from 'cc';
|
||||
|
||||
/**
|
||||
* API 返回的单个关卡数据结构
|
||||
* API 返回的单个关卡数据结构(关卡列表)
|
||||
*/
|
||||
export interface ApiLevelData {
|
||||
/** 关卡 ID (UUID) */
|
||||
@@ -10,20 +10,22 @@ export interface ApiLevelData {
|
||||
level: number;
|
||||
/** 主图 URL */
|
||||
imageUrl: string;
|
||||
/** 线索1 */
|
||||
hint1: string;
|
||||
/** 线索2 */
|
||||
hint2: string;
|
||||
/** 线索3 */
|
||||
hint3: string;
|
||||
/** 答案 */
|
||||
answer: string;
|
||||
/** 排序 */
|
||||
sortOrder: number;
|
||||
/** 线索1(未通关时为 null) */
|
||||
hint1: string | null;
|
||||
/** 线索2(未通关时为 null) */
|
||||
hint2: string | null;
|
||||
/** 线索3(未通关时为 null) */
|
||||
hint3: string | null;
|
||||
/** 答案(未通关时为 null) */
|
||||
answer: string | null;
|
||||
/** 是否已通关 */
|
||||
completed: boolean;
|
||||
/** 通关时长(秒),未通关时为 null */
|
||||
timeSpent: number | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* API 响应结构
|
||||
* API 响应结构(关卡列表)
|
||||
*/
|
||||
export interface ApiResponse {
|
||||
/** 是否成功 */
|
||||
@@ -47,12 +49,14 @@ export interface RuntimeLevelConfig {
|
||||
name: string;
|
||||
/** 主图 SpriteFrame(可能为 null 如果加载失败) */
|
||||
spriteFrame: SpriteFrame | null;
|
||||
/** 线索1 */
|
||||
clue1: string;
|
||||
/** 线索2 */
|
||||
clue2: string;
|
||||
/** 线索3 */
|
||||
clue3: string;
|
||||
/** 答案 */
|
||||
answer: string;
|
||||
/** 线索1(未通关时为 null,进入关卡后由 enter 接口获取) */
|
||||
clue1: string | null;
|
||||
/** 线索2(未通关时为 null) */
|
||||
clue2: string | null;
|
||||
/** 线索3(未通关时为 null) */
|
||||
clue3: string | null;
|
||||
/** 答案(未通关时为 null,进入关卡后由 enter 接口获取) */
|
||||
answer: string | null;
|
||||
/** 是否已通关 */
|
||||
completed: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user